Пример #1
0
        private void navBarRole_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            ListRole form = ListRole.GetForm();

            form.MdiParent = this;
            form.Show();
            form.Activate();
        }
Пример #2
0
        private void barButtonItem4_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            ListRole form = ListRole.GetForm();

            form.MdiParent = this;
            form.Show();
            form.Activate();
        }
Пример #3
0
 /// <summary>
 /// For clearing user information from controls
 /// </summary>
 public void ClearUserInfo()
 {
     try
     {
         CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
         UserID       = null;
         UserName     = null;
         Password     = null;
         Email        = null;
         IsActive     = null;
         FirstName    = null;
         LastName     = null;
         LastLogin    = null;
         Phone        = null;
         ListCustomer = ListCustomer.Select(x => new UserCustomerList {
             CustomerName = x.CustomerName, CustomerID = x.CustomerID, IsSelected = false
         }).ToList();
         ListModule = ListModule.Select(x => new ModuleList {
             ModuleID = x.ModuleID, ModuleName = x.ModuleName, IsSelected = false, ModuleCode = x.ModuleCode
         }).ToList();
         ListRole = ListRole.Select(x => new RoleList {
             RoleID = x.RoleID, RoleName = x.RoleName, Description = x.Description, IsSelected = false
         }).ToList();
         ListGroup = ListGroup.Select(x => new GroupList {
             GroupID = x.GroupID, GroupName = x.GroupName, Description = x.Description, IsSelected = false
         }).ToList();
     }
     catch (Exception ex)
     {
         CommonSettings.logger.LogError(this.GetType(), ex);
     }
     finally
     {
         CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
     }
 }
Пример #4
0
        /// <summary>
        /// Function to Save/Update a particular user.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns>NA</returns>
        /// <createdBy></createdBy>
        /// <createdOn>May-27,2016</createdOn>
        public void Save_Click(object obj)
        {
            try
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));

                WebPortalUserList objUserProp = new WebPortalUserList();

                if (UserID != null && UserID > 0)
                {
                    objUserProp.userID = (int)UserID;
                }

                objUserProp.username    = UserName;
                objUserProp.password    = Password;
                objUserProp.firstname   = FirstName;
                objUserProp.lastname    = LastName;
                objUserProp.email       = Email;
                objUserProp.phone       = Phone;
                objUserProp.isActive    = IsActive;
                objUserProp.isSuperUser = 0;
                objUserProp.lastLogin   = DateTime.Now;
                if (IsAction == Resources.ActionSave)
                {
                    objUserProp.whoCreated  = Application.Current.Properties["LoggedInUserName"].ToString();
                    objUserProp.dateCreated = DateTime.Now;
                }
                else if (IsAction == Resources.ActionUpdate)
                {
                    objUserProp.whoModified  = Application.Current.Properties["LoggedInUserName"].ToString();
                    objUserProp.dateModified = DateTime.Now;
                }

                if (!string.IsNullOrEmpty(UserName))
                {
                    if (!string.IsNullOrEmpty(Password))
                    {
                        if (!string.IsNullOrEmpty(Email))
                        {
                            ValidateEmail emailValidation = new ValidateEmail();
                            bool          isValid         = emailValidation.IsValidEmail(Email);
                            if (isValid)
                            {
                                bool checkDuplicateUserName = _serviceInstance.CheckDuplicateEmail(Email);
                                bool checkDuplicateEmailID  = _serviceInstance.CheckDuplicatePortalUserName(UserName);
                                bool isSuccessfull          = false;
                                if (IsAction == Resources.ActionSave)
                                {
                                    if (!checkDuplicateUserName)
                                    {
                                        if (!checkDuplicateEmailID)
                                        {
                                            isSuccessfull = _serviceInstance.InsertUpdateUser(objUserProp, ListCustomer.ToArray(), ListModule.ToArray(), ListRole.ToArray(), ListGroup.ToArray());
                                        }
                                        else
                                        {
                                            MessageBox.Show(Resources.MsgDuplicateUserName);
                                        }
                                    }
                                    else
                                    {
                                        MessageBox.Show(Resources.MsgDuplicateEmailID);
                                    }
                                }
                                else if (IsAction == Resources.ActionUpdate)
                                {
                                    isSuccessfull = _serviceInstance.InsertUpdateUser(objUserProp, ListCustomer.ToArray(), ListModule.ToArray(), ListRole.ToArray(), ListGroup.ToArray());
                                }

                                if (isSuccessfull)
                                {
                                    if (IsAction == Resources.ActionUpdate)
                                    {
                                        MessageBox.Show(Resources.msgUpdatedSuccessfully);
                                    }
                                    else if (IsAction == Resources.ActionSave)
                                    {
                                        MessageBox.Show(Resources.msgInsertedSuccessfully);
                                    }
                                    ClearUserInfo();
                                    CurrentView   = new WebPortalUsersView();
                                    IsVisibleInfo = Resources.MsgHidden;
                                    IsModify      = true;
                                    IsButtonPanel = Resources.MsgHidden;
                                    IsAction      = Resources.ActionSave;
                                    LoadUsers(null);
                                    View_Click(null);
                                    AcceptChanges();
                                }
                            }
                            else
                            {
                                MessageBox.Show(Resources.ErrorEmail);
                            }
                        }
                        else
                        {
                            MessageBox.Show(Resources.ReqEmail);
                        }
                    }
                    else
                    {
                        MessageBox.Show(Resources.ReqPassword);
                    }
                }
                else
                {
                    MessageBox.Show(Resources.ReqrUserName);
                }
            }
            catch (Exception ex)
            {
                CommonSettings.logger.LogError(this.GetType(), ex);
            }
            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }