Exemplo n.º 1
0
        protected void btnChangePW_Click(object sender, EventArgs e)
        {
            if (captcha.IsValid && ASPxEdit.ValidateEditorsInContainer(this))
            {
                //PopupChangePW.HeaderText = "Confirm";
                //PopupChangePW.ShowOnPageLoad = true;

                string     qry = "", _sPassword = "";
                SqlCommand cmd = null;
                _sPassword = EncryptionClass.Encrypt(newPasswordCH.Text.ToString().Trim());

                SqlConnection con = new SqlConnection(GlobalClass.SQLConnString());
                con.Open();
                qry = "UPDATE tbl_Users " +
                      " SET Password = '******' " +
                      " WHERE (PK = " + Session["CreatorKey"] + ")";
                cmd            = new SqlCommand(qry);
                cmd.Connection = con;
                cmd.ExecuteNonQuery();
                con.Close();

                ModalPopupExtenderLoading.Hide();

                Response.Redirect("home.aspx");
            }
        }
Exemplo n.º 2
0
        public bool CustomFieldEditing_PreTransitionCRUD(string transition)
        {
            switch (transition.ToUpper())
            {
            case "SAVE":
                if (ASPxEdit.ValidateEditorsInContainer(formlayoutGeneralInfo))
                {
                    using (UnitOfWork uow = XpoHelper.GetNewUnitOfWork())
                    {
                        Guid selectedCustomFieldTypeId =
                            Guid.Parse(cbbCustomFieldType.SelectedItem.Value.ToString());
                        CustomFieldType customFieldType =
                            uow.GetObjectByKey <CustomFieldType>(selectedCustomFieldTypeId);
                        //Get eidting CustomField
                        NAS.DAL.CMS.ObjectDocument.CustomField customField =
                            uow.GetObjectByKey <NAS.DAL.CMS.ObjectDocument.CustomField>(CustomFieldId);
                        customField.Name = txtCustomFieldName.Text;
                        customField.CustomFieldTypeId = customFieldType;
                        //Set new Id to session variable
                        CustomFieldId = customField.CustomFieldId;
                        uow.CommitChanges();
                    }
                }
                else
                {
                    return(false);
                }
                break;

            default:
                break;
            }
            return(true);
        }
 protected void CallbackPanel_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e)
 {
     if (ASPxEdit.ValidateEditorsInContainer(sender as ASPxCallbackPanel))
     {
         ASPxWebControl.RedirectOnCallback(VirtualPathUtility.ToAbsolute(loginUrl));
     }
 }
Exemplo n.º 4
0
        protected void btnRestore_Click(object sender, EventArgs e)
        {
            if (!IsPostBack && !IsCallback)
            {
                ASPxEdit.ValidateEditorsInContainer(this);
            }
            string lang = System.Globalization.CultureInfo.CurrentUICulture.ToString();

            if (_sysDbManager.RestoreDataBase(tree0.GetVirtualNodeObject(tree0.FocusedNode).ToString()))
            {
                if (lang == "vi-VN")
                {
                    lblStatus.Text = "Phục hồi thành công!";
                }
                else
                {
                    lblStatus.Text = "Restore Successfully!";
                }
                //btnOk.Visible = true;
            }
            else
            {
                if (lang == "vi-VN")
                {
                    lblStatus.Text = "Lỗi!";
                }
                else
                {
                    lblStatus.Text = "Error !";
                }
                //btnOk.Visible = true;
            }
            //WriteLog("Restore DataBase " + tree0.GetVirtualNodeObject(tree0.FocusedNode).ToString(), Action.Update);
        }
Exemplo n.º 5
0
        protected void signUp_Click(object sender, EventArgs e)
        {
            if (eMailTextBox.IsValid && Captcha.IsValid)
            {
                using (OleDbConnection connection = GetConnection()) {
                    OleDbCommand command = new OleDbCommand(string.Empty, connection);
                    command.CommandText = "INSERT INTO [Users] (FirstName, LastName, Gender, BirthDate, Country, City, Email, UserPassword) VALUES (@firstName, @lastName, @gender, @birthDate, @country, @city, @email, @password)";

                    command.Parameters.AddWithValue("firstName", firstNameTextBox.Text);
                    command.Parameters.AddWithValue("lastName", lastNameTextBox.Text);
                    command.Parameters.AddWithValue("gender", genderRadioButtonList.Value);
                    command.Parameters.AddWithValue("birthDate", birthDateEdit.Date.ToShortDateString());
                    command.Parameters.AddWithValue("country", countryComboBox.Text);
                    command.Parameters.AddWithValue("city", cityComboBox.Text);
                    command.Parameters.AddWithValue("email", eMailTextBox.Text);
                    command.Parameters.AddWithValue("password", passwordTextBox.Text);
                    connection.Open();
                    command.ExecuteNonQuery();
                }
                if (ASPxEdit.ValidateEditorsInContainer(registrationFormLayout))
                {
                    Response.Redirect("RegisteredPage.aspx");
                }
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string   link         = HttpContext.Current.Request.Url.AbsoluteUri; //lay url
                string[] list         = link.Split('?');                             // tach chuoi de lay ma md5
                string   prameterInfo = Utility.Security.DecryptString(list[1], "123");
                list   = prameterInfo.Split('&');
                userId = list[0].Split('=')[1];
                DateTime timeCreateLink = Convert.ToDateTime(list[1].Split('=')[1]);
                timeCreateLink = timeCreateLink.AddDays(1);
                if (timeCreateLink.Ticks < DateTime.Now.Ticks)
                {
                    Response.Redirect("~/");//direct page link expire
                }
                if (IsPostBack && captcha.IsValid && ASPxEdit.ValidateEditorsInContainer(this))
                {
                    //UserBLO userBLO = new UserBLO();
                    //if (userBLO.ResetPassword(Guid.Parse(userId),
                    //    FormsAuthentication.HashPasswordForStoringInConfigFile(passwordtb.Text, "MD5")))
                    //{

                    //    //Direct page reset successful
                    //}
                    //else
                    //{
                    //    //Direct page reset not successful
                    //}
                }
            }
            catch
            {
            }
        }
Exemplo n.º 7
0
        protected void SignInButton_Click(object sender, EventArgs e)
        {
            FormLayout.FindItemOrGroupByName("GeneralError").Visible = false;
            if (ASPxEdit.ValidateEditorsInContainer(this))
            {
                // Your Authentication logic

                string user = UserNameTextBox.Value.ToString().Trim();
                string pass = PasswordButtonEdit.Value.ToString().Trim();

                string val1 = ConfigurationManager.AppSettings["Debug:User.Login"].ToString();
                string val2 = ConfigurationManager.AppSettings["Debug:User.Login"].ToString();

                if (user.Equals(val1) && pass.Equals(val2))
                {
                    //TODO: rol system
                    Global.Sessions.SetDeveloperUserSessionVariables();
                    Response.Redirect("~/Views/Main.aspx");
                }
                else
                {
                    GeneralErrorDiv.InnerText = "Invalid login attempt.";
                    FormLayout.FindItemOrGroupByName("GeneralError").Visible = true;
                }
            }
        }
Exemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (IsPostBack && ASPxEdit.ValidateEditorsInContainer(ASPxFormLayout1))
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "alert",
                                                 @"<script type=""text/javascript"">setTimeout(function() { alert('You have successfully registered'); }, 0);</script>");
     }
 }
Exemplo n.º 9
0
        public bool CustomFieldCreatingHasNoInitData_PreTransitionCRUD(string transition)
        {
            switch (transition.ToUpper())
            {
            case "ACCEPT":
                if (ASPxEdit.ValidateEditorsInContainer(formlayoutGeneralInfo))
                {
                    using (UnitOfWork uow = XpoHelper.GetNewUnitOfWork())
                    {
                        Guid selectedCustomFieldTypeId =
                            Guid.Parse(cbbCustomFieldType.SelectedItem.Value.ToString());
                        CustomFieldType customFieldType =
                            uow.GetObjectByKey <CustomFieldType>(selectedCustomFieldTypeId);
                        //Create new CustomField
                        NAS.DAL.CMS.ObjectDocument.CustomField customField =
                            new NAS.DAL.CMS.ObjectDocument.CustomField(uow)
                        {
                            CustomFieldId     = Guid.NewGuid(),
                            Name              = txtCustomFieldName.Text,
                            CustomFieldTypeId = customFieldType
                        };
                        //Attach CustomField to ObjectTypeId
                        if (ObjectTypeId != null && !ObjectTypeId.Equals(Guid.Empty))
                        {
                            /*2013-12-12 Khoa.Truong DEL START
                             * Decoupling with the client using this form
                             * //Guid objectTypeId = ((ObjectTypeCustomFieldListing)Parent).ObjectTypeId;
                             * 2013-12-12 Khoa.Truong DEL END*/
                            ObjectType            objectType            = uow.GetObjectByKey <ObjectType>(ObjectTypeId);
                            ObjectTypeCustomField objectTypeCustomField = new ObjectTypeCustomField(uow)
                            {
                                ObjectTypeCustomFieldId = Guid.NewGuid(),
                                CustomFieldId           = customField,
                                ObjectTypeId            = objectType
                            };
                        }
                        //Attach new custom fields for all object of the object type

                        /*These code is replace with lazy updating for custom fields of each object
                         * //ObjectBO objectBO = new ObjectBO();
                         * //objectBO.UpdateCMSObjects(uow, objectTypeId);
                         */

                        uow.CommitChanges();
                    }
                }
                else
                {
                    return(false);
                }
                break;

            default:
                break;
            }
            return(true);
        }
Exemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //ApplyValidationSummarySettings();
        //ApplyEditorsSettings();
        bool isCallback = IsCallback;
        bool isPostback = IsPostBack;

        if (Request.QueryString["subjid"] != null)
        {
            SQL_utils sql   = new SQL_utils("backend");
            string    theID = sql.StringScalar_from_SQLstring("select id from tblsubject where subjID=" + Request.QueryString["subjid"]);
            Session["ID"] = theID;
            //cboID.Value = theID;
            ID = theID;

            lblID.Text = theID;

            int newstudyID = sql.IntScalar_from_SQLstring("select studyID from vwMasterStatus_S where subjID=" + Request.QueryString["subjid"]);

            if (newstudyID != Master.Master_studyID)
            {
                sql.NonQuery_from_SQLstring("exec spSEC_Update_Default_StudyID_for_User " + newstudyID);
            }

            Master.Master_studyID = newstudyID;

            sql.Close();
        }
        else if (Request.QueryString["ID"] != null)
        {
            ID            = Request.QueryString["ID"];
            Session["ID"] = ID;
            lblID.Text    = ID;

            //cboID.Value = ID;
        }
        else
        {
            Session["ID"] = "";
        }



        if (!IsCallback && !IsPostBack)
        {
            //sliderValue.Value = color.GetColorLevel().ToString();


            if (!String.IsNullOrEmpty(Session["ID"].ToString()))
            {
                GetSubjectInfo(Session["ID"].ToString());
                //GetMeasureInfo(ID);
                ASPxEdit.ValidateEditorsInContainer(this);
            }
        }
    }
        protected void StandardButton_Click(object sender, EventArgs e)
        {
            ASPxEdit.ValidateEditorsInContainer(Page); // Required only for a standard button

            if (ASPxEdit.AreEditorsValid(Page))
            {
                UpdateStatusLabel.Text = string.Format("Submitted value: {0}", spinEdit.Value);
            }
            else
            {
                UpdateStatusLabel.Text = "Editors are not valid!";
            }
        }
 protected void ASPxGridView1_CustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
 {
     if (e.Parameters == "Cancel")
     {
         ASPxEdit.ClearEditorsInContainer(ASPxGridView1, "DateGroup");
         ASPxGridView1.DataBind();
     }
     else
     {
         if (ASPxEdit.ValidateEditorsInContainer(ASPxGridView1))
         {
             //Your update operations here
         }
     }
 }
Exemplo n.º 13
0
 protected void SignInButton_Click(object sender, EventArgs e)
 {
     FormLayout.FindItemOrGroupByName("GeneralError").Visible = false;
     if (ASPxEdit.ValidateEditorsInContainer(this, "login"))
     {
         // DXCOMMENT: You Authentication logic
         if (AuthHelper.SignIn(UserNameTextBox.Text, PasswordButtonEdit.Text) == null)
         {
             GeneralErrorDiv.InnerText = "Đăng nhập không thành công: Sai tên đăng nhập hoặc mật khẩu.";
             FormLayout.FindItemOrGroupByName("GeneralError").Visible = true;
         }
         else
         {
             Response.Redirect("~/Map.aspx");
         }
     }
 }
Exemplo n.º 14
0
 protected void SignInButton_Click(object sender, EventArgs e)
 {
     FormLayout.FindItemOrGroupByName("GeneralError").Visible = false;
     if (ASPxEdit.ValidateEditorsInContainer(this))
     {
         // DXCOMMENT: You Authentication logic
         if (!AuthHelper.SignIn(UserNameTextBox.Text, PasswordButtonEdit.Text, RememberMeCheckBox.Checked))
         {
             GeneralErrorDiv.InnerText = "Tên đăng nhập hoặc mật khẩu không đúng.";
             FormLayout.FindItemOrGroupByName("GeneralError").Visible = true;
         }
         else
         {
             loadLicense();
         }
     }
 }
Exemplo n.º 15
0
 protected void SignInButton_Click(object sender, EventArgs e)
 {
     FormLayout.FindItemOrGroupByName("GeneralError").Visible = false;
     if (ASPxEdit.ValidateEditorsInContainer(this))
     {
         // DXCOMMENT: You Authentication logic
         if (!AuthHelper.SignIn(UserNameTextBox.Text, PasswordButtonEdit.Text))
         {
             GeneralErrorDiv.InnerText = "Invalid login attempt.";
             FormLayout.FindItemOrGroupByName("GeneralError").Visible = true;
         }
         else
         {
             Response.Redirect("~/");
         }
     }
 }
Exemplo n.º 16
0
        public bool ReceiptVoucherCreating_PreTransitionCRUD(string transition)
        {
            //Save data before transit by 'Save' transition
            if (transition.ToUpper().Equals(VoucherStateTransition.SaveTransition.TransitionName.ToUpper()))
            {
                gridviewReceiptVoucherAllocation.GridView.UpdateEdit();
                //Validate input data
                if (!ASPxEdit.ValidateEditorsInContainer(cpnReceiptVoucherEditingForm, "ReceiptVoucherEditingForm", false))
                {
                    return(false);
                }
                //Collects input data
                string   code        = txtCode.Text;
                DateTime issueDate   = txtIssueDate.Date;
                string   description = txtDescription.Text;
                string   address     = txtAddress.Text;
                string   payer       = txtPayer.Text;
                Guid     sourceOrgId = cboSourceOrganization.Value != null ? (Guid)cboSourceOrganization.Value : Guid.Empty;
                Guid     targetOrgId = Utility.CurrentSession.Instance.AccessingOrganizationId;
                double   debit       = (double)spinAmount.Number;
                //Guid currencyId = (Guid)cboCurrency.Value;
                Guid   currencyId   = (Guid)gridlookupCurrency.GetSelectedCurrencyKey();
                double exchangeRate = (double)spinExchangeRate.Number;

                //Insert data to database
                ReceiptVouchesBO receiptVoucherBO = new ReceiptVouchesBO();
                receiptVoucherBO.Insert(VoucherId,
                                        code,
                                        issueDate,
                                        description,
                                        address,
                                        payer,
                                        sourceOrgId,
                                        targetOrgId,
                                        debit,
                                        currencyId,
                                        exchangeRate);
            }
            else if (transition.ToUpper().Equals(VoucherStateTransition.CancelTransition.TransitionName.ToUpper()))
            {
                voucherBO.DeleteTempObject(VoucherId);
            }
            return(true);
        }
Exemplo n.º 17
0
        protected void SignInButton_Click(object sender, EventArgs e)
        {
            FormLayout.FindItemOrGroupByName("GeneralError").Visible = false;
            if (ASPxEdit.ValidateEditorsInContainer(this))
            {
                // DXCOMMENT: You Authentication logic
                if (AuthHelper.SignIn(UserNameTextBox.Text, PasswordButtonEdit.Text) == 0)
                {
                    ApplicationUser user = HttpContext.Current.Session["User"] as ApplicationUser;
                    Session["GlobalConnectionString"] = cmbSite.Value;
                    int site_id = 0;
                    if (!string.IsNullOrEmpty(user.SiteID))
                    {
                        site_id = Convert.ToInt32(user.SiteID);
                    }
                    // "1" = site_id.ToString();
                    //"1" = user.Exercice;

                    GestionConnexion(user.Rolename, 1, site_id);
                    Response.Redirect("~/");
                }
                else if (AuthHelper.SignIn(UserNameTextBox.Text, PasswordButtonEdit.Text) == 2)
                {
                    GeneralErrorDiv.InnerText = "Merci de vous rapprocher vous de votre administrateur pour acceder à la plateforme.";
                    FormLayout.FindItemOrGroupByName("GeneralError").Visible = true;

                    GestionConnexion("", 0, 0);
                }
                else
                {
                    GeneralErrorDiv.InnerText = "Erreur d'authentification";
                    FormLayout.FindItemOrGroupByName("GeneralError").Visible = true;

                    GestionConnexion("", 0, 0);
                }
            }
        }
Exemplo n.º 18
0
        protected void btnBackup_Click(object sender, EventArgs e)
        {
            if (!IsPostBack && !IsCallback)
            {
                ASPxEdit.ValidateEditorsInContainer(this);
            }
            string lang     = System.Globalization.CultureInfo.CurrentUICulture.ToString();
            string fileName = String.Format("{0}\\{1}.bak", tree.GetVirtualNodeObject(tree.FocusedNode), txtFileName.Text);

            if (_sysDbManager.BackupDataBase(fileName))
            {
                if (lang == "vi-VN")
                {
                    lblStatus.Text = "Sao lưu thành công. ?";
                }
                else
                {
                    lblStatus.Text = "Backup Successfuly. ?";
                }
                //btnOk.Visible = true;
                btnCancel.Visible = true;
            }
            else
            {
                if (lang == "vi-VN")
                {
                    lblStatus.Text = "Lỗi!Bạn hãy kiểm tra lai tên. Ko chưa các kí tự đặc biệt";
                }
                else
                {
                    lblStatus.Text = "Error !";
                }
                //btnOk.Visible = true;
            }
            //WriteLog("Backup DataBase " + fileName, Action.Create);
        }
Exemplo n.º 19
0
        public bool AllocationEditing_PreTransitionCRUD(string transition)
        {
            switch (transition.ToUpper())
            {
            case "SAVE":
                if (ASPxEdit.ValidateEditorsInContainer(formlayoutAllocationEditingForm))
                {
                    using (UnitOfWork uow = XpoHelper.GetNewUnitOfWork())
                    {
                        Guid             selectedAllocationTypeId;
                        Guid             selectedAccountActorTypeId;
                        AllocationType   selectedAllocationType   = null;
                        AccountActorType selectedAccountActorType = null;
                        Allocation       allocation = null;
                        bool             isParseSuccess;

                        //Get selected allocation type
                        isParseSuccess = Guid.TryParse(cboAllocationType.Value.ToString(), out selectedAllocationTypeId);
                        if (!isParseSuccess)
                        {
                            throw new Exception("The string is invalid for parsing to GUID");
                        }
                        selectedAllocationType = uow.GetObjectByKey <AllocationType>(selectedAllocationTypeId);

                        //Update allocation
                        allocation                  = uow.GetObjectByKey <Allocation>(AllocationId);
                        allocation.Code             = txtCode.Text;
                        allocation.Name             = txtName.Text;
                        allocation.Description      = txtDescription.Text;
                        allocation.AllocationTypeId = selectedAllocationType;

                        //Get selected IsMaster AccountActorType
                        isParseSuccess =
                            Guid.TryParse(cbIsMasterAccountActorType.Value.ToString()
                                          , out selectedAccountActorTypeId);
                        if (!isParseSuccess)
                        {
                            throw new Exception("The string is invalid for parsing to GUID");
                        }
                        selectedAccountActorType = uow.GetObjectByKey <AccountActorType>(selectedAccountActorTypeId);

                        //Update isMaster AllocationAccountActorType
                        AllocationAccountActorType isMasterAllocationAccountActorType =
                            allocation.AllocationAccountActorTypes.FirstOrDefault(r => r.IsMaster);
                        if (isMasterAllocationAccountActorType != null)
                        {
                            isMasterAllocationAccountActorType.AccountActorTypeId = selectedAccountActorType;
                        }
                        else
                        {
                            //Create new IsMaster AllocationAccountActorType
                            AllocationAccountActorType allocationAccountActorType
                                = new AllocationAccountActorType(uow)
                                {
                                AccountActorTypeId = selectedAccountActorType,
                                AllocationId       = allocation,
                                IsMaster           = true
                                };
                        }

                        //Get selected ids in gridlookupAccountActorType
                        var relatedAccountActorTypeIds = gridlookupAccountActorType.GridView
                                                         .GetSelectedFieldValues("AccountActorTypeId")
                                                         .Select(r => Guid.Parse(r.ToString()));
                        List <AllocationAccountActorType> relatedAccountActorTypes =
                            allocation.AllocationAccountActorTypes.Where(r => !r.IsMaster).ToList();
                        uow.Delete(relatedAccountActorTypes);

                        //Create new related AllocationAccountActorTypes
                        foreach (var relatedAccountActorTypeId in relatedAccountActorTypeIds)
                        {
                            AllocationAccountActorType relatedAllocationAccountActorType
                                = new AllocationAccountActorType(uow)
                                {
                                AccountActorTypeId = uow.GetObjectByKey <AccountActorType>(relatedAccountActorTypeId),
                                AllocationId       = allocation,
                                IsMaster           = false
                                };
                            relatedAllocationAccountActorType.Save();
                        }

                        //Set new Id to session variable
                        AllocationId = allocation.AllocationId;
                        uow.CommitChanges();
                    }
                }
                else
                {
                    return(false);
                }
                break;

            default:
                break;
            }
            return(true);
        }
Exemplo n.º 20
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     if (IsPostBack && ASPxEdit.ValidateEditorsInContainer(this))
     {
     }
 }
 protected void ASPxCallbackPanelDemo_Callback(object sender, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
 {
     ASPxCallbackPanel callbackPanel = (ASPxCallbackPanel)sender;
     bool isValid = ASPxEdit.ValidateEditorsInContainer(callbackPanel);
 }
Exemplo n.º 22
0
        public bool AllocationCreating_PreTransitionCRUD(string transition)
        {
            switch (transition.ToUpper())
            {
            case "SAVE":
                if (ASPxEdit.ValidateEditorsInContainer(formlayoutAllocationEditingForm))
                {
                    using (UnitOfWork uow = XpoHelper.GetNewUnitOfWork())
                    {
                        Guid             selectedAllocationTypeId;
                        Guid             selectedAccountActorTypeId;
                        AllocationType   selectedAllocationType   = null;
                        AccountActorType selectedAccountActorType = null;
                        Allocation       allocation = null;
                        bool             isParseSuccess;

                        //Get selected allocation type
                        isParseSuccess = Guid.TryParse(cboAllocationType.Value.ToString(), out selectedAllocationTypeId);
                        if (!isParseSuccess)
                        {
                            throw new Exception("The string is invalid for parsing to GUID");
                        }
                        selectedAllocationType = uow.GetObjectByKey <AllocationType>(selectedAllocationTypeId);

                        //Create new allocation
                        allocation = new Allocation(uow)
                        {
                            AllocationId     = Guid.NewGuid(),
                            AllocationTypeId = selectedAllocationType,
                            Code             = txtCode.Text,
                            Description      = txtDescription.Text,
                            Name             = txtName.Text,
                            RowStatus        = Utility.Constant.ROWSTATUS_ACTIVE
                                               //OwnerOrgId
                        };

                        //Get selected IsMaster AccountActorType
                        isParseSuccess =
                            Guid.TryParse(cbIsMasterAccountActorType.Value.ToString()
                                          , out selectedAccountActorTypeId);
                        if (!isParseSuccess)
                        {
                            throw new Exception("The string is invalid for parsing to GUID");
                        }
                        selectedAccountActorType = uow.GetObjectByKey <AccountActorType>(selectedAccountActorTypeId);

                        //Create new IsMaster AllocationAccountActorType
                        AllocationAccountActorType allocationAccountActorType
                            = new AllocationAccountActorType(uow)
                            {
                            AccountActorTypeId = selectedAccountActorType,
                            AllocationId       = allocation,
                            IsMaster           = true
                            };

                        //Get selected ids in gridlookupAccountActorType
                        var relatedAccountActorTypeIds = gridlookupAccountActorType.GridView
                                                         .GetSelectedFieldValues("AccountActorTypeId")
                                                         .Select(r => Guid.Parse(r.ToString()));
                        //Create new related AllocationAccountActorTypes
                        foreach (var relatedAccountActorTypeId in relatedAccountActorTypeIds)
                        {
                            AllocationAccountActorType relatedAllocationAccountActorType
                                = new AllocationAccountActorType(uow)
                                {
                                AccountActorTypeId = uow.GetObjectByKey <AccountActorType>(relatedAccountActorTypeId),
                                AllocationId       = allocation,
                                IsMaster           = false
                                };
                            relatedAllocationAccountActorType.Save();
                        }

                        //Set new Id to session variable
                        AllocationId = allocation.AllocationId;
                        uow.CommitChanges();
                    }
                }
                else
                {
                    return(false);
                }
                break;

            default:
                break;
            }
            return(true);
        }
 protected void ASPxButton1_Click(object sender, EventArgs e)
 {
     ASPxEdit.ValidateEditorsInContainer(Form, "submit");
 }
        protected void signUp_Click(object sender, EventArgs e)
        {
            int iEmployeeKey = 0;

            //MRPClass.PrintString("pass clicked signup");
            if (captcha.IsValid && ASPxEdit.ValidateEditorsInContainer(this))
            {
                ModalPopupExtenderLoading.Show();

                //MRPClass.PrintString("pass inside validation");
                DataTable      dt  = new DataTable();
                SqlCommand     cmd = null;
                SqlDataAdapter adp;

                string qry = "";
                using (SqlConnection conHRIS = new SqlConnection(GlobalClass.SQLConnStringHRIS()))
                {
                    //MRPClass.PrintString("pass inside hris");
                    qry            = "SELECT PK, IDNumber FROM dbo.tbl_EmployeeIDNumber WHERE(IDNumber = '" + IDNumTextBox.Text.ToString() + "')";
                    cmd            = new SqlCommand(qry);
                    cmd.Connection = conHRIS;
                    adp            = new SqlDataAdapter(cmd);
                    adp.Fill(dt);
                    if (dt.Rows.Count > 0)
                    {
                        //MRPClass.PrintString("pass inside hris with id");
                        foreach (DataRow row in dt.Rows)
                        {
                            iEmployeeKey = Convert.ToInt32(row["PK"]);
                        }
                    }
                    else
                    {
                        //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert",
                        //    @"<script type=""text/javascript"">setTimeout(()=>{alert('ID Number not found in Employee MasterList!')},0);</script>");
                        ModalPopupExtenderLoading.Hide();
                        CreateAccntNotify.HeaderText     = "Error...";
                        CreateAccntNotifyLbl.Text        = "ID Number not found in Employee MasterList!";
                        CreateAccntNotifyLbl.ForeColor   = System.Drawing.Color.Red;
                        CreateAccntNotify.ShowOnPageLoad = true;
                        return;
                    }
                    dt.Clear();
                    conHRIS.Close();
                }

                DataTable dtUser = AccountClass.UserList();

                //dtUser.CaseSensitive = true;
                string    expressionID = "EmployeeKey = '" + iEmployeeKey.ToString().Trim() + "'";
                string    sortOrderID  = "PK ASC";
                DataRow[] foundRowsID;
                foundRowsID = dtUser.Select(expressionID, sortOrderID);
                if (foundRowsID.Length > 0)
                {
                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert",
                    //        @"<script type=""text/javascript"">setTimeout(()=>{alert('Found Duplicate ID Number!')},0);</script>");
                    ModalPopupExtenderLoading.Hide();
                    CreateAccntNotify.HeaderText     = "Error...";
                    CreateAccntNotifyLbl.Text        = "Found Duplicate ID Number!";
                    CreateAccntNotifyLbl.ForeColor   = System.Drawing.Color.Red;
                    CreateAccntNotify.ShowOnPageLoad = true;
                    return;
                }

                dtUser.CaseSensitive = true;
                string    expressionName = "Lastname = '" + lastNameTextBox.Text.ToString().Trim() + "' AND Firstname = '" + firstNameTextBox.Text.ToString().Trim() + "'";
                string    sortOrderName  = "PK ASC";
                DataRow[] foundRowsName;
                foundRowsName = dtUser.Select(expressionName, sortOrderName);
                if (foundRowsName.Length > 0)
                {
                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert",
                    //        @"<script type=""text/javascript"">setTimeout(()=>{alert('Found Duplicate Lastname and Firstname!')},0);</script>");
                    ModalPopupExtenderLoading.Hide();
                    CreateAccntNotify.HeaderText     = "Error...";
                    CreateAccntNotifyLbl.Text        = "Found Duplicate Lastname and Firstname!";
                    CreateAccntNotifyLbl.ForeColor   = System.Drawing.Color.Red;
                    CreateAccntNotify.ShowOnPageLoad = true;
                    return;
                }

                string    expressionEmail = "Email = '" + eMailTextBox.Text.ToString().Trim() + "'";
                string    sortOrderEmail  = "PK ASC";
                DataRow[] foundRowsEmail;
                foundRowsEmail = dtUser.Select(expressionEmail, sortOrderEmail);
                if (foundRowsEmail.Length > 0)
                {
                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert",
                    //        @"<script type=""text/javascript"">setTimeout(()=>{alert('Found Duplicate Email!')},0);</script>");
                    ModalPopupExtenderLoading.Hide();
                    CreateAccntNotify.HeaderText     = "Error...";
                    CreateAccntNotifyLbl.Text        = "Found Duplicate Email!";
                    CreateAccntNotifyLbl.ForeColor   = System.Drawing.Color.Red;
                    CreateAccntNotify.ShowOnPageLoad = true;
                    return;
                }

                string    expressionUName = "Username = '******'";
                string    sortOrderUName  = "PK ASC";
                DataRow[] foundRowsUName;
                foundRowsUName = dtUser.Select(expressionUName, sortOrderUName);
                if (foundRowsUName.Length > 0)
                {
                    //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert",
                    //        @"<script type=""text/javascript"">setTimeout(()=>{alert('Found Duplicate Username!')},0);</script>");
                    ModalPopupExtenderLoading.Hide();
                    CreateAccntNotify.HeaderText     = "Error...";
                    CreateAccntNotifyLbl.Text        = "Found Duplicate Username!";
                    CreateAccntNotifyLbl.ForeColor   = System.Drawing.Color.Red;
                    CreateAccntNotify.ShowOnPageLoad = true;
                    return;
                }

                using (SqlConnection con = new SqlConnection(GlobalClass.SQLConnString()))
                {
                    string _sLastName, _sFirstName, _sEmail, _sUserName, _sPassword, _sIDNum;
                    int    _Gender = 0;
                    _sLastName  = EncryptionClass.Encrypt(GlobalClass.UpperCaseFirstLetter(lastNameTextBox.Text.ToString().Trim()));
                    _sFirstName = EncryptionClass.Encrypt(GlobalClass.UpperCaseFirstLetter(firstNameTextBox.Text.ToString().Trim()));
                    _Gender     = gender_int;
                    _sEmail     = EncryptionClass.Encrypt(eMailTextBox.Text.ToString().Trim());
                    _sUserName  = EncryptionClass.Encrypt(userNameTextBox.Text.ToString().Trim());
                    _sPassword  = EncryptionClass.Encrypt(passwordTextBox.Text.ToString().Trim());
                    _sIDNum     = EncryptionClass.Encrypt(IDNumTextBox.Text.ToString().Trim());

                    con.Open();

                    qry = "INSERT INTO tbl_Users " +
                          " (Lastname, Firstname, Username, Password, Email, EmployeeKey, Gender) " +
                          " VALUES ('" + _sLastName + "', '" + _sFirstName + "', '" + _sUserName + "', " +
                          " '" + _sPassword + "', '" + _sEmail + "', " + iEmployeeKey + ", " + _Gender + ")";;
                    try
                    {
                        cmd            = new SqlCommand(qry);
                        cmd.Connection = con;
                        cmd.ExecuteNonQuery();
                        con.Close();
                        //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert",
                        //        @"<script type=""text/javascript"">setTimeout(()=>{alert('You have successfully registered')},0);</script>");

                        //MRPClass.PrintString("pass saved");

                        ModalPopupExtenderLoading.Hide();
                        CreateAccntNotify.HeaderText     = "Info";
                        CreateAccntNotifyLbl.Text        = "You is successfully registered.";
                        CreateAccntNotifyLbl.ForeColor   = System.Drawing.Color.Black;
                        CreateAccntNotify.ShowOnPageLoad = true;

                        Response.Redirect("default.aspx");
                    }
                    catch (SqlException ex)
                    {
                        //MRPClass.PrintString(ex.ToString());
                        con.Close();
                        //Page.ClientScript.RegisterStartupScript(this.GetType(), "alert",
                        //        @"<script type=""text/javascript"">setTimeout(()=>{alert('" + ex.ToString() + "')},0);</script>");

                        CreateAccntNotify.HeaderText     = "Error...";
                        CreateAccntNotifyLbl.Text        = ex.ToString();
                        CreateAccntNotifyLbl.ForeColor   = System.Drawing.Color.Red;
                        CreateAccntNotify.ShowOnPageLoad = true;
                    }
                }
            }
        }