コード例 #1
0
        protected void btnUserUpdate_click(object sender, EventArgs e)
        {
            try
            {

                UserBLL userbll = new UserBLL();

                userbll.UserName = txtbxUserName.Text;
                userbll.Cell = "+88" + txtbxmobile.Text;
                userbll.Email = txtbxemail.Text;
                //userbll.DOB = txtbxDateOfBirth.Text;
                //userbll.Gender = drpdwnSex.Text;
                //if (hiddentfieldGroupId.Value == "")
                //{
                    userbll.UserGroupId = drpdownGroup.SelectedValue;
                //}
                //else
                //{
                //    userbll.UserGroupId = hiddentfieldGroupId.Value;
                //}
                //userbll.Certificate = "";
                //userbll.Occupation = drpdwnOccupation.SelectedValue;
                //userbll.Organization = txtbxNameofOrganization.Text;
                //userbll.Designation = txtbxDesignation.Text;
                //userbll.ExperienceICT = txtbxExperienceICT.Text;
                //userbll.LastDegree = drpdwnLastEducation.SelectedValue;
                //userbll.DegreeSubject = txtbxsubject.Text;
                //userbll.PassingYear = txtbxYear.Text;

                //userbll.FatherName = txtbxFatherName.Text;
                //userbll.MotherName = txtbxMotherName.Text;
                //userbll.ParmanentAdd = txtbxParmanentAddress.Text;
                //userbll.PresentAdd = txtbxPresentAddress.Text;
                userbll.UserId = userIdForUpdateHiddenField.Value;
                //userbll.Branch = BranchDropDownList.SelectedValue;
                string IsUpload = photoUploadfn(userbll.Email);

                if (IsUpload == "")
                {

                    msgTitleLabel.Text = "Error!!!!";
                    msgDetailLabel.Text = "  Pleace Check File Extention or File size.You can only upload Image and size less than 128Kb";
                    msgbox.Visible = true;
                    string message = " <span class='actionTopic'>" + " Pleace Check File Extention or File size.You can only upload Image and size less than 128Kb</span>.";
                    MyAlertBox("var callbackOk = function () { window.location = \"/setting/user/update.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);");

                }
                else
                {
                    userbll.PerPhoto = IsUpload;
                    bool status = userbll.UpdateUser();

                    if (status)
                    {
                        //if (hiddentfieldGroupId.Value == "")
                        //{
                            string message = " <span class='actionTopic'>" + "User Update Successfully.</span>.";
                            MyAlertBox("var callbackOk = function () { window.location = \"/setting/User/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);");
                        //}
                        //else
                        //{
                        //    string message = " <span class='actionTopic'>" + "User Update Successfully.</span>.";
                        //    MyAlertBox("var callbackOk = function () { window.location = \"/default.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);");
                        //}

                    }
                }

            }
            catch (Exception ex)
            {

                string message = ex.Message;
                if (ex.InnerException != null) { message += " --> " + ex.InnerException.Message; }
                MyAlertBox("ErrorAlert(\"" + ex.GetType() + "\", \"" + message + "\", \"\");");

            }
            //UserBLL user = new UserBLL();

            //try
            //{
            //    //if (userIdForUpdateHiddenField.Value.Trim() == "")
            //    {
            //        msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = "User not found to update.";
            //    }
            //    if (userIdTextBox.Text == "")
            //    {
            //        msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "User ID field is required.";
            //    }
            //    else if (userNameTextBox.Text == "")
            //    {
            //        msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "User Name field is required.";
            //    }
            //    else if (userGroupDropDownList.SelectedValue == "----------Select----------")
            //    {
            //        msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "User Group field is required.";
            //    }
            //    else if (contactNumberTextBox.Text == "")
            //    {
            //        msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Contact Number field is required.";
            //    }
            //    else if (emailTextBox.Text == "")
            //    {
            //        msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Email field is required.";
            //    }
            //    //else if (addressTextBox.Text == "")
            //    //{
            //    //    msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Address field is required.";
            //    //}
            //    else
            //    {
            //        user.Serial = hdnfldUserSerial.Value.ToString();
            //        user.UserId = idLabel.Text;
            //        user.UserName = userNameTextBox.Text.Trim();
            //        string[] emp = employeeIdTextBox.Text.Split('#');
            //        if (emp.Length > 1)
            //        {
            //            user.EmployeeId = emp[0];
            //        }
            //        else
            //        {
            //            user.EmployeeId = employeeIdTextBox.Text.Trim();
            //        }
            //        user.Department = departmentTextBox.Text.Trim();
            //        user.Designation = designationTextBox.Text.Trim();
            //        // user.Address = addressTextBox.Text.Trim();
            //        user.ContactNumber = contactNumberTextBox.Text.Trim();
            //        user.Email = emailTextBox.Text.Trim();
            //        // user.NationalId = nationalIdTextBox.Text.Trim();
            //        user.PassportNumber = passportNumberTextBox.Text.Trim();
            //        user.UserGroupId = userGroupDropDownList.SelectedValue.Trim();
            //        user.Branch = drpdwnBranch.SelectedValue.Trim();
            //        //user.Password = passwordTextBox.Text.Trim();

            //        user.UpdateUser();

            //        userIdForUpdateHiddenField.Value = "";
            //        string message = " <span class='actionTopic'>" + " User Updated Successfully</span>.";
            //        MyAlertBox("var callbackOk = function () { window.location = \"/HRUI/User/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);");

            //    }

            //    if (userGroupDropDownList.SelectedValue == "----------Select----------")
            //    {
            //        msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "User Group field is required.";
            //    }
            //    else if (drpdwnBranch.SelectedValue == "")
            //    {
            //        msgbox.Visible = true; msgTitleLabel.Text = "Validation!!!"; msgDetailLabel.Text = "Branch field is required.";

            //    }
            //    else
            //    {
            //        user.UserId = idLabel.Text;
            //        user.UserGroupId = userGroupDropDownList.SelectedValue.Trim();
            //        user.Branch = drpdwnBranch.SelectedValue.Trim();
            //        user.UpdateUser();

            //        string message = " <span class='actionTopic'>" + " User Updated Successfully</span>.";
            //        MyAlertBox("var callbackOk = function () { window.location = \"/HRUI/User/List.aspx\"; }; SuccessAlert(\"" + "Process Succeed" + "\", \"" + message + "\", callbackOk);");

            //    }
            //}
            //catch (Exception ex)
            //{
            //    msgbox.Visible = true; msgTitleLabel.Text = "Exception!!!"; msgDetailLabel.Text = ex.Message;
            //}
            //finally
            //{
            //    user = null;
            //}
        }