| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- 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 useredit : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- }
- /// <summary>
- /// 保存用户方法
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- try
- {
- HySoft.BaseCallCenter.Model.T_Sys_UserAccount userAccountModel = new Model.T_Sys_UserAccount();
- 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 = F_Password.Text.Trim();
- 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() == "add")
- {
- DataTable dt = sysUserAccountBll.GetList(" F_UserCode='" + F_UserCode.Text.Trim() + "'").Tables[0];
- if (dt.Rows.Count > 0)
- {
- MessageBoxToWindow("当前员工工号存在,请更换!", "提示", "error");
- }
- else
- {
- if (sysUserAccountBll.Add(userAccountModel) > 0)
- {
- MessageBoxToWindow("新增成功", "新增提示", "success");
- }
- else
- {
- MessageBoxToWindow("新增失败", "新增提示!", "error");
- }
- }
- dt.Clear();
- dt.Dispose();
- }
- }
- 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
- }
- }
|