コード例 #1
0
ファイル: SysUser.aspx.cs プロジェクト: 262734254/TopfoManage
    //邦定数据
    private void BindData()
    {
        AspNetPager1.PageSize = iPageSize;
        pageindex             = AspNetPager1.CurrentPageIndex;

        Tz888.Model.Sys.EmployeeInfoTab empMode = new Tz888.Model.Sys.EmployeeInfoTab();
        empMode.EmployeeName = tbLoginName.Value.Trim();  //账号
        empMode.DeptID       = ddlDept.SelectedValue;     //部门
        empMode.sRole        = ddlRole.SelectedValue;     //角色
        empMode.WorkType     = ddlWorkType.SelectedValue; //岗位
        empMode.sStatus      = ddlStatus.SelectedValue;   //状态

        dt = loginbll.GetEmployeeList("page", ViewState["sort"].ToString(), 1, 1, 1, empMode);
        if (dt != null && dt.Rows.Count > 0)
        {
            AspNetPager1.RecordCount = Tz888.Common.Text.FormatData(dt.Rows[0]["RecordCount"].ToString().Trim());
        }
        dt = null;
        dt = loginbll.GetEmployeeList("page", ViewState["sort"].ToString(), iPageSize, pageindex, 0, empMode);
        if (dt != null && dt.Rows.Count > 0)
        {
            rptEmployeeList.DataSource = dt;
            rptEmployeeList.DataBind();
        }
        dt.Dispose();
        dt = null;
    }
コード例 #2
0
    ////邦定角色
    //private void BindRole()
    //{
    //    Tz888.BLL.Conn bll = new Tz888.BLL.Conn();
    //    DataTable dt = bll.GetList("sysroletab", " * ", "sroleid", 50, 1, 0, 0, "");
    //    ddlRole.DataTextField = "srname";
    //    ddlRole.DataValueField = "sroleid";
    //    ddlRole.DataSource = dt;
    //    ddlRole.DataBind();
    //}

    //邦定数据
    private void BindData()
    {
        if (Request.QueryString["UserLoginName"] != null && Request.QueryString["UserLoginName"] != "")
        {
            string strName = Tz888.Common.DEncrypt.DESEncrypt.Decrypt(Request.QueryString["UserLoginName"].ToString());

            //获取employeeinfotab表数据
            Tz888.Model.Sys.EmployeeInfoTab empModel = new Tz888.Model.Sys.EmployeeInfoTab();
            empModel = empBll.GetModel(strName);

            //##暂不用
            ////获取logininfotab表数据
            //DataTable dt = loginBll.GetData(strName).Tables[0];

            txtLoginName.Text = empModel.LoginName;
            //txtPasswordQuestion.Text = dt.Rows[0]["passwordquestion"].ToString().Trim();
            //txtPasswordAnswer.Text = dt.Rows[0]["passwordanswer"].ToString().Trim();
            txtEmployeeName.Text = empModel.EmployeeName.Trim();

            txtNickName.Text = empModel.NickName.Trim();
            tbDate.Value     = empModel.Birthday.ToShortDateString();
            ddlCertificateID.SelectedValue = empModel.CertificateID;
            txtCertificateNumber.Text      = empModel.CertificateNumber.Trim();
            txtAddress.Text  = empModel.Address.Trim();
            txtPostCode.Text = empModel.PostCode.Trim();

            //解联络电话字符串
            string   strTel = empModel.Tel;
            string[] arr    = strTel.Split('-');
            for (int i = 0; i < arr.Length; i++)
            {
                if (arr.Length > 0)
                {
                    txtCountryCode.Text = arr[0].Trim();
                }
                if (arr.Length > 1)
                {
                    txtAreaCode.Text = arr[1].Trim();
                }
                if (arr.Length > 2)
                {
                    txtTelPhone.Text = arr[2].Trim();
                }
            }

            txtMobile.Text            = empModel.Mobile.Trim();
            txtFax.Text               = empModel.FAX.Trim();
            txtEmail.Text             = empModel.Email.Trim();
            ddlDept.SelectedValue     = empModel.DeptID;
            ddlWorkType.SelectedValue = empModel.WorkType;
            ddlDegree.SelectedValue   = empModel.DegreeID;
        }
    }
コード例 #3
0
    private void UpdateEmpTab()
    {
        //Employeeinfotab表
        Tz888.BLL.Sys.EmployeeInfoTab   empBll   = new Tz888.BLL.Sys.EmployeeInfoTab();
        Tz888.Model.Sys.EmployeeInfoTab empModel = new Tz888.Model.Sys.EmployeeInfoTab();

        empModel.LoginName    = txtLoginName.Text;
        empModel.EmployeeName = txtEmployeeName.Text.Trim();
        string strSex = rblSex.SelectedValue.Trim();

        empModel.Sex               = Convert.ToBoolean(strSex);
        empModel.NickName          = txtNickName.Text.Trim();
        empModel.Birthday          = Convert.ToDateTime(tbDate.Value.Trim());
        empModel.CertificateID     = ddlCertificateID.SelectedValue.ToString().Trim();
        empModel.CertificateNumber = txtCertificateNumber.Text.Trim();

        //*区域,这是修改内部会员资料,所以不更新它
        //*empModel.CountryCode = "CN";
        //*empModel.ProvinceID = "1098";
        //*empModel.CityID = "1099";
        //*empModel.CountyID = "1100";

        empModel.Address  = txtAddress.Text.Trim();
        empModel.PostCode = txtPostCode.Text.Trim();
        empModel.Tel      = txtCountryCode.Text.Trim() + "-" + txtAreaCode.Text.Trim() + "-" + txtTelPhone.Text.Trim();
        empModel.Mobile   = txtMobile.Text.Trim();
        empModel.FAX      = txtFax.Text.Trim();
        empModel.Email    = txtEmail.Text.Trim();
        empModel.DeptID   = ddlDept.SelectedValue.Trim();
        empModel.WorkType = ddlWorkType.SelectedValue.Trim();
        empModel.DegreeID = ddlDegree.SelectedValue.Trim();

        if (empBll.UpdateEmpTab(empModel) > 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", "alert('资料修改成功!'); location.href='SysUser.aspx'", true);
        }
        else
        {
            Tz888.Common.MessageBox.Show(this, "资料修改失败!");
        }
    }
コード例 #4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Tz888.Model.Sys.EmployeeInfoTab model)
 {
     dal.Update(model);
 }
コード例 #5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Tz888.Model.Sys.EmployeeInfoTab model)
 {
     return(dal.Add(model));
 }
コード例 #6
0
 /// <summary>
 /// 添加员工,改版后_2010-8-9
 /// </summary>
 /// <param name="empModel"></param>
 /// <param name="strTem"></param>
 /// <returns></returns>
 public int Insert_V1(Tz888.Model.Sys.EmployeeInfoTab empModel, string strTem)
 {
     return(dal.Insert_V1(empModel, strTem));
 }
コード例 #7
0
 /// <summary>
 /// 更新employeeinfotab表数据
 /// </summary>
 /// <param name="empModel"></param>
 /// <returns></returns>
 public int UpdateEmpTab(Tz888.Model.Sys.EmployeeInfoTab empModel)
 {
     return(dal.UpdateEmpTab(empModel));
 }
コード例 #8
0
 //同时更新两人个表
 public int Update(Tz888.Model.LoginInfo loginModel, Tz888.Model.Sys.EmployeeInfoTab empModel, string strTem)
 {
     return(dal.Update(loginModel, empModel, strTem));
 }
コード例 #9
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
 //{
 //return dal.GetList(PageSize,PageIndex,strWhere);
 //}
 /// <summary>
 /// 添加一条数据,同事向两人个表添加
 /// </summary>
 /// <param name="loginModel"></param>
 /// <param name="empModel"></param>
 /// <returns></returns>
 public int Add(Tz888.Model.LoginInfo loginModel, Tz888.Model.Sys.EmployeeInfoTab empModel, string sTem)
 {
     return(dal.Add(loginModel, empModel, sTem));
 }
コード例 #10
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Tz888.Model.Sys.EmployeeInfoTab> DataTableToList(DataTable dt)
        {
            List <Tz888.Model.Sys.EmployeeInfoTab> modelList = new List <Tz888.Model.Sys.EmployeeInfoTab>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Tz888.Model.Sys.EmployeeInfoTab model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Tz888.Model.Sys.EmployeeInfoTab();
                    if (dt.Rows[n]["EmployeeID"].ToString() != "")
                    {
                        model.EmployeeID = int.Parse(dt.Rows[n]["EmployeeID"].ToString());
                    }
                    model.LoginName    = dt.Rows[n]["LoginName"].ToString();
                    model.EmployeeName = dt.Rows[n]["EmployeeName"].ToString();
                    if (dt.Rows[n]["Sex"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Sex"].ToString() == "1") || (dt.Rows[n]["Sex"].ToString().ToLower() == "true"))
                        {
                            model.Sex = true;
                        }
                        else
                        {
                            model.Sex = false;
                        }
                    }
                    model.NickName = dt.Rows[n]["NickName"].ToString();
                    if (dt.Rows[n]["Birthday"].ToString() != "")
                    {
                        model.Birthday = DateTime.Parse(dt.Rows[n]["Birthday"].ToString());
                    }
                    model.CertificateID     = dt.Rows[n]["CertificateID"].ToString();
                    model.CertificateNumber = dt.Rows[n]["CertificateNumber"].ToString();
                    model.CountryCode       = dt.Rows[n]["CountryCode"].ToString();
                    model.ProvinceID        = dt.Rows[n]["ProvinceID"].ToString();
                    model.CityID            = dt.Rows[n]["CityID"].ToString();
                    model.CountyID          = dt.Rows[n]["CountyID"].ToString();
                    model.Address           = dt.Rows[n]["Address"].ToString();
                    model.PostCode          = dt.Rows[n]["PostCode"].ToString();
                    model.Tel      = dt.Rows[n]["Tel"].ToString();
                    model.Mobile   = dt.Rows[n]["Mobile"].ToString();
                    model.FAX      = dt.Rows[n]["FAX"].ToString();
                    model.Email    = dt.Rows[n]["Email"].ToString();
                    model.DeptID   = dt.Rows[n]["DeptID"].ToString();
                    model.WorkType = dt.Rows[n]["WorkType"].ToString();
                    model.DegreeID = dt.Rows[n]["DegreeID"].ToString();
                    if (dt.Rows[n]["Enable"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Enable"].ToString() == "1") || (dt.Rows[n]["Enable"].ToString().ToLower() == "true"))
                        {
                            model.Enable = true;
                        }
                        else
                        {
                            model.Enable = false;
                        }
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #11
0
    //更新数据
    private void UpdateUserDoc()
    {
        //Employeeinfotab表
        Tz888.BLL.Sys.EmployeeInfoTab   empBll   = new Tz888.BLL.Sys.EmployeeInfoTab();
        Tz888.Model.Sys.EmployeeInfoTab empModel = new Tz888.Model.Sys.EmployeeInfoTab();

        empModel.LoginName    = txtLoginName.Text;
        empModel.EmployeeName = txtEmployeeName.Text.Trim();
        string strSex = rblSex.SelectedValue.Trim();

        empModel.Sex               = Convert.ToBoolean(strSex);
        empModel.NickName          = txtNickName.Text.Trim();
        empModel.Birthday          = Convert.ToDateTime(tbDate.Value.Trim());
        empModel.CertificateID     = ddlCertificateID.SelectedValue.ToString().Trim();
        empModel.CertificateNumber = txtCertificateNumber.Text.Trim();

        //*区域,这是修改内部会员资料,所以不更新它
        //*empModel.CountryCode = "CN";
        //*empModel.ProvinceID = "1098";
        //*empModel.CityID = "1099";
        //*empModel.CountyID = "1100";

        empModel.Address  = txtAddress.Text.Trim();
        empModel.PostCode = txtPostCode.Text.Trim();
        empModel.Tel      = txtCountryCode.Text.Trim() + "-" + txtAreaCode.Text.Trim() + "-" + txtTelPhone.Text.Trim();
        empModel.Mobile   = txtMobile.Text.Trim();
        empModel.FAX      = txtFax.Text.Trim();
        empModel.Email    = txtEmail.Text.Trim();
        empModel.DeptID   = ddlDept.SelectedValue.Trim();
        empModel.WorkType = ddlWorkType.SelectedValue.Trim();
        empModel.DegreeID = ddlDegree.SelectedValue.Trim();


        //logininfotab表
        Tz888.BLL.Login.LoginInfoBLL loginBll   = new Tz888.BLL.Login.LoginInfoBLL();
        Tz888.Model.LoginInfo        loginModel = new Tz888.Model.LoginInfo();

        //######更新密码,暂不用
        //SHA1 sha1 = SHA1.Create();
        //byte[] bytePassword = sha1.ComputeHash(Encoding.Unicode.GetBytes(txtPassword.Text.Trim()));
        //loginModel.Password = bytePassword;
        //######

        loginModel.LoginName = txtLoginName.Text;
        //loginModel.PasswordQuestion = txtPasswordQuestion.Text.Trim();
        //loginModel.PasswordAnswer = txtPasswordAnswer.Text.Trim();
        loginModel.RoleName  = "2";
        loginModel.IsCheckUp = false;
        loginModel.NickName  = txtNickName.Text.Trim();
        loginModel.Tel       = txtCountryCode.Text.Trim() + "-" + txtAreaCode.Text.Trim() + "-" + txtTelPhone.Text.Trim();
        loginModel.Email     = txtEmail.Text.Trim();
        //*loginModel.RequirInfo = "";
        //*loginModel.RealName = "";
        //*loginModel.ManageTypeID = "1001";
        //*loginModel.MemberGradeID = "1001";//和以前的项目一样
        //*loginModel.Enable = true;  //有效

        string sTem = "";//不修改角色(有专门的修改页面)

        if (empBll.Update(loginModel, empModel, sTem) > 0)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", "alert('资料修改成功!'); location.href='SysUser.aspx'", true);
        }
        else
        {
            Tz888.Common.MessageBox.Show(this, "资料修改失败!");
        }
    }
コード例 #12
0
    private void InsertData()
    {
        //检查登录名是否重名
        if (CheckLoginUserName(txtLoginName.Text.Trim()))
        {
            Tz888.Common.MessageBox.Show(this, "该用户名已经存在,请使用其它用户名!");
            txtLoginName.Focus();
            //txtLoginName.Text = "";
            return;
        }

        //Employeeinfotab表
        Tz888.BLL.Sys.EmployeeInfoTab   empBll   = new Tz888.BLL.Sys.EmployeeInfoTab();
        Tz888.Model.Sys.EmployeeInfoTab empModel = new Tz888.Model.Sys.EmployeeInfoTab();

        //密码
        SHA1 sha1 = SHA1.Create();

        byte[] bytePassword = sha1.ComputeHash(Encoding.Unicode.GetBytes(txtPassword.Text.Trim()));

        empModel.LoginName    = txtLoginName.Text.Trim();
        empModel.Password     = bytePassword;
        empModel.EmployeeName = txtEmployeeName.Text.Trim();
        string strSex = rblSex.SelectedValue.Trim();

        empModel.Sex      = Convert.ToBoolean(strSex);
        empModel.NickName = txtNickName.Text.Trim();
        if (!string.IsNullOrEmpty(tbDate.Value.Trim()))
        {
            empModel.Birthday = Convert.ToDateTime(tbDate.Value.Trim());
        }
        else
        {
            //empModel.Birthday = DateTime.Now.ToShortTimeString();
            empModel.Birthday = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
            //Response.Write("<script>alert('" + empModel.Birthday + "')</script>");
        }
        empModel.CertificateID     = ddlCertificateID.SelectedValue.ToString().Trim();
        empModel.CertificateNumber = txtCertificateNumber.Text.Trim();
        empModel.CountryCode       = "CN";
        empModel.ProvinceID        = "1098";
        empModel.CityID            = "1099";
        empModel.CountyID          = "1100";
        empModel.Address           = txtAddress.Text.Trim();
        empModel.PostCode          = txtPostCode.Text.Trim();
        empModel.Tel      = txtCountryCode.Text.Trim() + "-" + txtAreaCode.Text.Trim() + "-" + txtTelPhone.Text.Trim();
        empModel.Mobile   = txtMobile.Text.Trim();
        empModel.FAX      = txtFax.Text.Trim();
        empModel.Email    = txtEmail.Text.Trim();
        empModel.DeptID   = ddlDept.SelectedValue.Trim();
        empModel.WorkType = ddlWorkType.SelectedValue.Trim();
        empModel.DegreeID = ddlDegree.SelectedValue.Trim();
        empModel.Enable   = true; //有效

        string sTem = ddlRole.SelectedValue.Trim();

        //if (empBll.Insert(empModel,sTem) > 0)
        if (empBll.Insert_V1(empModel, sTem) > 0) //2010-8-9改为存储过程
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", "alert('注册成功!'); location.href='SysUser.aspx'", true);
        }
        else
        {
            Tz888.Common.MessageBox.Show(this, "注册失败!");
        }
    }
コード例 #13
0
    //注册
    private void SaveUserDoc()
    {
        //检查登录名是否重名
        if (CheckLoginUserName(txtLoginName.Text.Trim()))
        {
            Tz888.Common.MessageBox.Show(this, "该用户名已经存在,请使用其它用户名!");
            txtLoginName.Focus();
            //txtLoginName.Text = "";
            return;
        }

        //Employeeinfotab表
        Tz888.BLL.Sys.EmployeeInfoTab   empBll   = new Tz888.BLL.Sys.EmployeeInfoTab();
        Tz888.Model.Sys.EmployeeInfoTab empModel = new Tz888.Model.Sys.EmployeeInfoTab();


        empModel.LoginName    = txtLoginName.Text.Trim();
        empModel.EmployeeName = txtEmployeeName.Text.Trim();
        string strSex = rblSex.SelectedValue.Trim();

        empModel.Sex      = Convert.ToBoolean(strSex);
        empModel.NickName = txtNickName.Text.Trim();
        if (string.IsNullOrEmpty(tbDate.Value.Trim()))
        {
            empModel.Birthday = Convert.ToDateTime(tbDate.Value.Trim());
        }
        else
        {
            empModel.Birthday = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd"));
        }
        empModel.CertificateID     = ddlCertificateID.SelectedValue.ToString().Trim();
        empModel.CertificateNumber = txtCertificateNumber.Text.Trim();
        empModel.CountryCode       = "CN";
        empModel.ProvinceID        = "1098";
        empModel.CityID            = "1099";
        empModel.CountyID          = "1100";
        empModel.Address           = txtAddress.Text.Trim();
        empModel.PostCode          = txtPostCode.Text.Trim();
        empModel.Tel      = txtCountryCode.Text.Trim() + "-" + txtAreaCode.Text.Trim() + "-" + txtTelPhone.Text.Trim();
        empModel.Mobile   = txtMobile.Text.Trim();
        empModel.FAX      = txtFax.Text.Trim();
        empModel.Email    = txtEmail.Text.Trim();
        empModel.DeptID   = ddlDept.SelectedValue.Trim();
        empModel.WorkType = ddlWorkType.SelectedValue.Trim();
        empModel.DegreeID = ddlDegree.SelectedValue.Trim();
        empModel.Enable   = true; //有效


        //logininfotab表
        Tz888.BLL.Login.LoginInfoBLL loginBll   = new Tz888.BLL.Login.LoginInfoBLL();
        Tz888.Model.LoginInfo        loginModel = new Tz888.Model.LoginInfo();
        SHA1 sha1 = SHA1.Create();

        byte[] bytePassword = sha1.ComputeHash(Encoding.Unicode.GetBytes(txtPassword.Text.Trim()));

        loginModel.LoginName = txtLoginName.Text.Trim();
        loginModel.Password  = bytePassword;
        //loginModel.PasswordQuestion = txtPasswordQuestion.Text.Trim();
        //loginModel.PasswordAnswer = txtPasswordAnswer.Text.Trim();
        loginModel.RoleName      = "2";
        loginModel.IsCheckUp     = false;
        loginModel.NickName      = txtNickName.Text.Trim();
        loginModel.Tel           = txtCountryCode.Text.Trim() + "-" + txtAreaCode.Text.Trim() + "-" + txtTelPhone.Text.Trim();
        loginModel.Email         = txtEmail.Text.Trim();
        loginModel.RequirInfo    = "";
        loginModel.RealName      = "";
        loginModel.ManageTypeID  = "1001";
        loginModel.MemberGradeID = "1001"; //和以前的项目一样
        loginModel.Enable        = true;   //有效

        string sTem = ddlRole.SelectedValue.Trim();

        if (empBll.Add(loginModel, empModel, sTem) > 0)
        {
            //Tz888.Common.MessageBox.Show(this, "注册成功!");
            Page.ClientScript.RegisterStartupScript(this.GetType(), "myKey", "alert('注册成功!'); location.href='SysUser.aspx'", true);
        }
        else
        {
            Tz888.Common.MessageBox.Show(this, "注册失败!");
        }
    }