Exemplo n.º 1
0
    protected bool IsUserValid()
    {
        ATTUsers objUsers = new ATTUsers(
            this.txtUserName_RQD.Text,
            this.txtPassword_RQD.Text,
            this.txtRePassword_RQD.Text,
            ((ATTUserLogin)Session["Login_User_Detail"]).UserName,
            DateTime.Now,
            (this.txtValidUpto_REDT.Text == "") ? DateTime.Parse("01/01/0001") : DateTime.Parse(this.txtValidUpto_REDT.Text),
            (this.chkActive.Checked == true) ? "Y" : "N",
            "",
            (this.txtPersonID.Text == "") ? 0 : double.Parse(this.txtPersonID.Text)
            );

        ObjectValidation OV = BLLUsers.Validate(objUsers);

        if (OV.IsValid == false)
        {
            this.lblStatusMessage.Text = OV.ErrorMessage;
            this.programmaticModalPopup.Show();
            return(false);
        }


        ATTOrganizationUsers objOrgUser = new ATTOrganizationUsers
                                              (int.Parse(this.DDLOgranization.SelectedValue.ToString()),
                                              txtUserName_RQD.Text,
                                              ((ATTUserLogin)Session["Login_User_Detail"]).UserName,
                                              DateTime.Now.AddYears(1).ToString(),
                                              ""
                                              );


        OV = BLLOrganizationUsers.Validate(objOrgUser);
        if (OV.IsValid == false)
        {
            this.lblStatusMessage.Text = OV.ErrorMessage;
            this.programmaticModalPopup.Show();
            return(false);
        }

        if (BLLUsers.ValidateDate(txtValidUpto_REDT.Text) == false)
        {
            this.lblStatusMessage.Text = "Invalid Date Format:  Date should be in DD/MM/YYYY Format";
            this.programmaticModalPopup.Show();
            return(false);
        }

        return(true);
    }