本文整理汇总了C#中Security.SaveLog方法的典型用法代码示例。如果您正苦于以下问题:C# Security.SaveLog方法的具体用法?C# Security.SaveLog怎么用?C# Security.SaveLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Security
的用法示例。
在下文中一共展示了Security.SaveLog方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cmd_Save_Click
protected void cmd_Save_Click(object sender, EventArgs e)
{
if (!CheckExistText(txt_UserName))
{
ShowPageMsg("請輸入使用者姓名");
return;
}
if (!CheckExistText(txt_User_ID))
{
ShowPageMsg("請輸入使用者代號");
return;
}
if (_operator == null)
{
_operator = new UserRole();
}
Security sec = new Security();
Users user = new Users();
bool suc = true;
try
{
user.User_ID = this.txt_User_ID.Text.Trim();
user.User_Name = this.txt_UserName.Text;
if (txt_Password.Text.Length > 0)
user.User_Password = user.GetEncryptPassword(this.txt_Password.Text.Trim());
user.Create_Time = DateTime.Now;
//if (ddl_department.SelectedValue != "-1")
//{
// user.DepartmentID = Convert.ToInt32(ddl_department.SelectedValue);
//}
user.Phone = txt_tel.Text;
user.Email = txt_email.Text;
user.Status = chk_Status.Checked;
user.Expire_Time = DateTime.Now;
user.Update_Time = DateTime.Now;
if (this.hidden_Action.Value.Equals("add"))
{
//新增User
if (user.Add())
{
sec.SaveLog(this.txt_User_ID.Text.Trim(), "add user", "AuthManage", "success", Session["LoginStaffID"].ToString());
}
else
{
suc = false;
sec.SaveLog(this.txt_User_ID.Text.Trim(), "add user", "AuthManage", "fault", Session["LoginStaffID"].ToString());
}
//新增User Role
string role = "";
for (int i = 0; i < this.gv.Rows.Count; i++)
{
CheckBox chk = (CheckBox)this.gv.Rows[i].Cells[0].Controls[1];
if (chk.Checked)
{
_operator.User_ID = this.txt_User_ID.Text.Trim();
_operator.Role_ID = this.gv.Rows[i].Cells[1].Text.Trim();
suc &= _operator.AddUserRole();
role += _operator.Role_ID + ",";
}
}
sec.SaveLog(this.txt_User_ID.Text.Trim(), "add userrole", "AuthManage", "role[" + role.TrimEnd(',') + "]", Session["LoginStaffID"].ToString());
}
else
{
//儲存User Role
_operator.DeleteUserRole(this.hidden_ID.Value);
string role = "";
for (int i = 0; i < this.gv.Rows.Count; i++)
{
CheckBox chk = (CheckBox)this.gv.Rows[i].Cells[0].Controls[1];
if (chk.Checked)
{
_operator.User_ID = this.hidden_ID.Value;
_operator.Role_ID = this.gv.Rows[i].Cells[1].Text.Trim();
suc &= _operator.AddUserRole();
role += _operator.Role_ID + ",";
}
}
sec.SaveLog(this.hidden_ID.Value, "save userrole", "AuthManage", "role[" + role.TrimEnd(',') + "]", Session["LoginStaffID"].ToString());
//儲存狀態
switch (this.chk_Status.Checked)
{
case true:
user.SaveStatus(this.hidden_ID.Value, "1");
break;
case false:
user.SaveStatus(this.hidden_ID.Value, "0");
break;
default:
break;
}
suc = user.EditUser(user);
sec.SaveLog(this.hidden_ID.Value, "save status", "AuthManage", "status[" + this.chk_Status.Checked + "]", Session["LoginStaffID"].ToString());
}
//.........这里部分代码省略.........