Example #1
0
        public void BindUserToUpdate()
        {
            SecureUsersModel model = _client.EditUserbyID(SecureUserId, Request.QueryString["CompanyParlourID"] != null ? CompanyParlourId : ParlourId);

            if ((model == null) || (model.parlourid != ParlourId || model.parlourid != CompanyParlourId))
            {
                Response.Write("<script>alert('Sorry!you are not authorized to perform edit on this User.');</script>");
            }
            else
            {
                CompanyParlourId     = model.parlourid;
                SecureUserId         = model.PkiUserID;
                txtUserNameUser.Text = model.UserName;
                txtPasswordpass.Attributes.Add("value", model.Password);
                //ParlourId = model.parlourid;
                txtSurname.Text   = model.EmployeeSurname;
                txtFullName.Text  = model.EmployeeFullname;
                txtIDNumber.Text  = model.EmployeeIDNumber;
                txtCellPhone.Text = model.EmployeeContactNumber;
                txtline1.Text     = model.EmployeeAddress1;
                txtline2.Text     = model.EmployeeAddress2;
                txtline3.Text     = model.EmployeeAddress3;
                txtline4.Text     = model.EmployeeAddress4;
                //System.DateTime.Now = model.LastModified;
                //UserName = model.ModifiedUser;
                txtUserNameUser.Text = model.Email;
                txtpostalcode.Text   = model.Code;
                // txtAgentName.Text = model.AgentName;
                //txtAgentSurname.Text = model.AgentSurname;
                /* changes for custom field implemented on 10th April 2017*/
                ddlCustom1.SelectedValue = model.CustomId1.ToString();
                ddlCustom2.SelectedValue = model.CustomId2.ToString();
                ddlCustom3.SelectedValue = model.CustomId3.ToString();
                /* changes for custom field implemented on 10th April 2017  completed*/
                ddlBankBranch.SelectedValue = model.BranchId.ToString();

                SecureUserGroupsModel[] modelS = _client.EditSecurUserbyID(SecureUserId);
                foreach (ListItem lst in chkSecurityGroup.Items)
                {
                    lst.Selected = false;
                }
                foreach (SecureUserGroupsModel lstModel in modelS)
                {
                    foreach (ListItem lst in chkSecurityGroup.Items)
                    {
                        if (Convert.ToInt32(lst.Value) == lstModel.fkiSecureGroupID)
                        {
                            lst.Selected = true;
                        }
                    }
                }
                btnSubmite.Text = @"Update";
            }
        }
Example #2
0
 public static int SaveUserDetails(SecureUsersModel model)
 {
     return(ToolsSetingDAL.SaveUserDetails(model));
 }
Example #3
0
        protected void btnSubmite_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                SecureUsersModel model;
                model = _client.GetUserByID(txtUserNameUser.Text, Request.QueryString["CompanyParlourID"] != null ? CompanyParlourId : ParlourId);
                if (model != null && SecureUserId == 0)
                {
                    ShowMessage(ref lblMessage, MessageType.Danger, "User Already Exists.");
                }
                else
                {
                    model           = new SecureUsersModel();
                    model.PkiUserID = SecureUserId;
                    model.UserName  = txtFullName.Text;
                    model.Password  = txtPasswordpass.Text;
                    if (CompanyParlourId != new Guid("00000000-0000-0000-0000-000000000000"))
                    {
                        model.parlourid = CompanyParlourId;
                    }
                    else
                    {
                        model.parlourid = ParlourId;
                    }
                    model.EmployeeSurname       = txtSurname.Text;
                    model.EmployeeFullname      = txtFullName.Text;
                    model.EmployeeIDNumber      = txtIDNumber.Text;
                    model.EmployeeContactNumber = txtCellPhone.Text;
                    model.EmployeeAddress1      = txtline1.Text;
                    model.EmployeeAddress2      = txtline2.Text;
                    model.EmployeeAddress3      = txtline3.Text;
                    model.EmployeeAddress4      = txtline4.Text;
                    model.LastModified          = System.DateTime.Now;
                    model.ModifiedUser          = UserName;
                    model.Email     = txtUserNameUser.Text;
                    model.Code      = txtpostalcode.Text;
                    model.CustomId1 = Convert.ToInt32(ddlCustom1.SelectedValue);
                    model.CustomId2 = Convert.ToInt32(ddlCustom2.SelectedValue);

                    model.CustomId3 = Convert.ToInt32(ddlCustom3.SelectedValue);

                    if (ddlBankBranch.SelectedIndex != -1)
                    {
                        model.BranchId = new Guid(ddlBankBranch.SelectedValue);
                    }
                    else
                    {
                        model.BranchId = default(Guid);
                    }
                    //model.AgentName = txtAgentName.Text;
                    // model.AgentSurname = txtAgentSurname.Text;

                    //================================================================
                    int retID = _client.SaveUserDetails(model);
                    SecureUserId = retID;

                    // ==================[  User Security Group Insert Delete ]=============================

                    int sguserID = 0;
                    foreach (ListItem lst in chkSecurityGroup.Items)
                    {
                        if (lst.Selected)
                        {
                            SecureUserGroupsModel modelS = new SecureUserGroupsModel();
                            modelS.pkiSecureUserGroups  = sguserID;
                            modelS.fkiSecureUserID      = SecureUserId;
                            modelS.fkiSecureGroupID     = Convert.ToInt32(lst.Value);
                            modelS.sSecureUserGroupDesc = lst.Text;
                            modelS.LastModified         = System.DateTime.Now;
                            modelS.ModifiedUser         = UserName;
                            if (sguserID == 0)
                            {
                                sguserID = _client.SaveUserGroupDetails(modelS);
                                modelS.pkiSecureUserGroups = sguserID;
                            }
                            sguserID = _client.SaveUserGroupDetails(modelS);
                        }
                    }
                    //bindEasyPayNumber();
                    ShowMessage(ref lblMessage, MessageType.Success, "User Details successfully saved");
                    BindUserList();
                    if (CompanyParlourId != new Guid("00000000-0000-0000-0000-000000000000"))
                    {
                        Response.Redirect("~/Tools/UserSetup.aspx");
                    }
                    ClearControl();
                }
                lblMessage.Visible = true;
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "goToTab512", "goToTab(5)", true);
            }
        }