| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Data;
- using HySoft.Common;
- namespace HySoft.BaseCallCenter.Web.sysmanage
- {
- public partial class usermodify : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- if (Request.QueryString["actionFlag"].ToString() == "edit")
- {
- getOrderInformerEdit(Request.QueryString["singleFlage"].ToString());
- }
- }
- }
- /// <summary>
- /// 初始化信息
- /// </summary>
- private void getOrderInformerEdit(string Flage)
- {
- DataTable dt = new DataTable();
- DataTable dtItems = new DataTable();
- string sql = "select * from T_Sys_UserAccount where F_UserId=" + Flage + "";
- dt = DBUtility.DbHelperSQL.Query(sql).Tables[0];
- if (dt.Rows.Count > 0)
- {
- F_UserName.Text = dt.Rows[0]["F_UserName"].ToString();
- hfbirthday.Value = dt.Rows[0]["F_Password"].ToString();
- F_UserCode.Text = dt.Rows[0]["F_UserCode"].ToString();
- hfRoleText.Value = dt.Rows[0]["F_RoleId"].ToString();
- hfDeptText.Value = dt.Rows[0]["F_DeptId"].ToString();
- if (dt.Rows[0]["F_SeatFlag"].ToString() == "True")
- {
- hdradiolist.Value = "1";
- }
- else
- {
- hdradiolist.Value = "0";
- }
- hfzuoxiquanxian.Value = dt.Rows[0]["F_SeatRight"].ToString();
- hfzuoxileixing.Value = dt.Rows[0]["F_HJType"].ToString();
- if (dt.Rows[0]["F_SexFlag"].ToString() == "男")
- {
- hfxinbie.Value = "1";
- }
- else
- {
- hfxinbie.Value = "0";
- }
- hfF_GroupId.Value = dt.Rows[0]["F_GroupId"].ToString();
- txtExtNo.Text = dt.Rows[0]["F_ExtensionNumber"].ToString();
- txtWorkNumber.Text = dt.Rows[0]["F_WorkNumber"].ToString();
- txtBirthday.Text = dt.Rows[0]["F_Birthday"].ToString();
- txtTelphone.Text = dt.Rows[0]["F_Telephone"].ToString();
- txtMobel.Text = dt.Rows[0]["F_Mobile"].ToString();
- txtRemark.Text = dt.Rows[0]["F_Remark"].ToString();
- }
- }
- /// <summary>
- /// 保存用户方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- try
- {
- string struserId = Request.QueryString["singleFlage"].ToString();
- int userId = 0;
- HySoft.BaseCallCenter.Model.T_Sys_UserAccount userAccountModel = new Model.T_Sys_UserAccount();
- if (int.TryParse(struserId, out userId))
- userAccountModel = new BLL.T_Sys_UserAccount().GetModel(userId);
- HySoft.BaseCallCenter.BLL.T_Sys_UserAccount sysUserAccountBll = new BLL.T_Sys_UserAccount();
- userAccountModel.F_UserCode = F_UserCode.Text.Trim();
- userAccountModel.F_UserName = F_UserName.Text.Trim();
- userAccountModel.F_Password = hfbirthday.Value;
- userAccountModel.F_ExtensionNumber = txtExtNo.Text.Trim();
- userAccountModel.F_WorkNumber = txtWorkNumber.Text.Trim();
- userAccountModel.F_DeptId = Convert.ToInt32(hfDeptText.Value);
- userAccountModel.F_RoleId = Convert.ToInt32(hfRoleText.Value);
- if (hfF_GroupId.Value != "")
- {
- userAccountModel.F_GroupId = Convert.ToInt32(hfF_GroupId.Value);
- }
- if (hdradiolist.Value == "0")
- {
- userAccountModel.F_SeatFlag = false;
- }
- if (hdradiolist.Value == "1")
- {
- userAccountModel.F_SeatFlag = true;
- }
- userAccountModel.F_SeatRight = hfzuoxiquanxian.Value;
- if (hfxinbie.Value == "1")
- {
- userAccountModel.F_SexFlag = "男";
- }
- else
- {
- userAccountModel.F_SexFlag = "女";
- }
- userAccountModel.F_Remark = txtRemark.Text;
- userAccountModel.F_Mobile = txtMobel.Text;
- userAccountModel.F_Telephone = txtTelphone.Text;
- DateTime dttime = new DateTime();
- bool b = DateTime.TryParse(txtBirthday.Text, out dttime);
- if (b)
- userAccountModel.F_Birthday = Convert.ToDateTime(txtBirthday.Text);
- userAccountModel.F_CreateOn = DateTime.Now;
- userAccountModel.F_DeleteFlag = 0;
- userAccountModel.F_HJType = Convert.ToInt32(hfzuoxileixing.Value);
- if (Request.QueryString["actionFlag"].Trim() == "edit")
- {
- DataTable dt = sysUserAccountBll.GetList("F_UserCode='" + F_UserCode.Text.Trim() + "' and F_UserId!=" + Request.QueryString["singleFlage"] + "").Tables[0];
- if (dt.Rows.Count > 0)
- {
- MessageBoxToWindow("当前员工工号存在,请更换!", "提示", "error");
- }
- else
- {
- userAccountModel.F_UserId = Convert.ToInt32(Request.QueryString["singleFlage"]);
- if (sysUserAccountBll.Update(userAccountModel))
- {
- MessageBoxToWindow("修改成功", "修改提示!", "success");
- }
- else
- {
- MessageBoxToWindow("修改失败", "修改提示!", "error");
- }
- }
- }
- }
- catch (Exception ex)
- {
- SysLog.WriteLog(ex);
- MessageBoxToWindow("异常提示!" + ex.Message, "提示", "catch");
- }
- }
- #region 弹出对话框
- /// <summary>
- /// 弹出对话框
- /// </summary>
- /// <param name="title"></param>
- /// <param name="content"></param>
- /// <param name="type"></param>
- public void MessageBoxToWindow(string title, string content, string type)
- {
- string script = "";
- switch (type)
- {
- case "error"://失败
- type = "error";
- script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
- break;
- case "success"://成功
- type = "info";
- script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "',CloseThis);</script>";
- break;
- case "catch"://异常
- type = "warning";
- script = "<script type='text/javascript'> $.ligerDialog.alert('" + title + "','" + content + "','" + type + "');</script>";
- break;
- default:
- type = "question";
- break;
- }
- ClientScript.RegisterClientScriptBlock(this.GetType(), "", script);
- }
- #endregion
- }
- }
|