Beispiel #1
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(Request.QueryString["mode"]) || Request.QueryString["mode"] == "1")
        {
            if (!Cktxt())
            {
                return;
            }
            if (ckRoleDuplicate(ddlUserRole.SelectedValue))
            {
                lblRoleDuplicate.Visible = true;
                return;
            }
            lblRoleDuplicate.Visible = false;
            string ckPwd = "password";
            if (!string.IsNullOrEmpty(txtPwd.Text))
            {
                ckPwd = txtPwd.Text;
            }

            Int32 i = Conn.AddNew("Employee", "EmpID, UserName, Pwd, EmpName, Email, Tel, SchoolID, DeptCode, UserRoleID, HideFlag, DelFlag, CreateUser, CreateDate, UpdateUser, UpdateDate, ApprovePositionID",
                                  hdfEmpID.Value, txtUserName.Text, Text.Encrypt(ckPwd), txtName.Text, txtEmail.Text, txtTel.Text, ddlSchool.SelectedValue, ddlDept.SelectedValue, ddlUserRole.SelectedValue, 0, 0, CurrentUser.ID, DateTime.Now, CurrentUser.ID, DateTime.Now, ddlPosition.SelectedValue);
            UploadImg();
            for (int j = 0; j <= cblDept.Items.Count - 1; j++)
            {
                if (cblDept.Items[j].Selected)
                {
                    Conn.AddNew("EmpDept", "EmpID, DeptCode", hdfEmpID.Value, cblDept.Items[j].Value);
                }
            }
            Response.Redirect("EmployeeView.aspx?ckmode=1&Cr=" + i);
        }
        if (Request.QueryString["mode"] == "2")
        {
            if (ckRoleDuplicate(ddlUserRole.SelectedValue))
            {
                lblRoleDuplicate.Visible = true;
                return;
            }
            lblRoleDuplicate.Visible = false;

            Int32 i = Conn.Update("Employee", "WHERE EmpID = '" + Request.QueryString["id"] + "' ", "EmpName, Email, Tel, SchoolID, DeptCode, UserRoleID, UpdateUser, UpdateDate, ApprovePositionID",
                                  txtName.Text, txtEmail.Text, txtTel.Text, ddlSchool.SelectedValue, ddlDept.SelectedValue, ddlUserRole.SelectedValue, CurrentUser.ID, DateTime.Now, ddlPosition.SelectedValue);
            UploadImg();

            ServiceReference2.ProfileServiceSoapClient PmsServices = new ServiceReference2.ProfileServiceSoapClient();
            PmsServices.setProfile(Request.QueryString["id"], txtName.Text, txtEmail.Text, txtTel.Text, CurrentUser.ID);

            Conn.Delete("EmpDept", "Where EmpID = '" + Request.QueryString["id"] + "' ");
            for (int j = 0; j <= cblDept.Items.Count - 1; j++)
            {
                if (cblDept.Items[j].Selected)
                {
                    Conn.AddNew("EmpDept", "EmpID, DeptCode", Request.QueryString["id"], cblDept.Items[j].Value);
                }
            }
            Response.Redirect("EmployeeView.aspx?ckmode=2&Cr=" + i);
        }
    }
Beispiel #2
0
    protected void btSave_Click(object sender, EventArgs e)
    {
        if (!CkOldPassword())
        {
            return;
        }

        Int32 i = Conn.Update("Employee", "WHERE EmpID = '" + CurrentUser.ID + "' ", "Pwd", Text.Encrypt(txtNewPassword.Text));

        ServiceReference2.ProfileServiceSoapClient PmsServices = new ServiceReference2.ProfileServiceSoapClient();
        PmsServices.setPassword(CurrentUser.ID, Text.Encrypt(txtNewPassword.Text));

        ClearAll();
        btc.Msg_Head(Img1, MsgHead, true, "2", i);
    }