Esempio n. 1
0
 /// <summary>
 /// Constructor to initialize save type and the user data object to edit
 /// </summary>
 public AddUser(SaveType eSaveType, ObjectUser.UserInstance objUser)
 {
     this.Visible = false;
     InitializeComponent();
     m_objUser = objUser;
     m_eSaveType = eSaveType;
     this.Visible = true;
     this.layoutControlItemSIP.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
 }
Esempio n. 2
0
        /// <summary>
        /// Constructor to initialize save type and the user data object to edit
        /// </summary>
        public AddUser(SaveType eSaveType, ObjectUser.UserInstance objUser, bool EditCredentialsOnly)
        {
            this.Visible = false;
            InitializeComponent();
            m_objUser = objUser;
            m_eSaveType = eSaveType;

            if (EditCredentialsOnly)
            {
                txtFullname.Enabled = false;
                txtTitle.Enabled = false;
                cboManager.Enabled = false;
                txtSite.Enabled = false;
                txtPhone.Enabled = false;
                txtMobile.Enabled = false;
                txtEmail.Enabled = false;
                chkActive.Enabled = false;
            }

            this.Visible = true;
        }
Esempio n. 3
0
        /// <summary>
        /// Logic to save user record
        /// </summary>
        private void SaveUser(bool IsNew)
        {
            if (!ValidateEntries())
                return;

            WaitDialog.Show(ParentForm, "Saving user data...");
            ObjectUser.UserInstance objParams = new ObjectUser.UserInstance() {
                id = UserId,
                full_name = txtFullname.Text,
                title = txtTitle.Text,
                reports_to = (int) cboManager.EditValue,
                site = txtSite.Text,
                active = chkActive.Checked,
                phone = txtPhone.Text,
                mobile = txtMobile.Text,
                email = txtEmail.Text,
                username = txtUsername.Text
            };

            if (IsNew) {
                if (txtPassword.Text.Length < 1)
                    objParams.password = HashUtility.GetHashPassword("1234");
                else
                    objParams.password = HashUtility.GetHashPassword(txtPassword.Text);
            }
            else {
                if (m_hasChangedPassword)
                    objParams.password = HashUtility.GetHashPassword(txtPassword.Text);
            }

            if (Convert.ToInt32(cboSIP.EditValue) > 0)
                objParams.sip_id = (int)(cboSIP.EditValue);

            if (UserType == eUserType.InternalUser)
                objParams.internal_user = true;
            else
                objParams.internal_user = false;

            UserId = ObjectUser.SaveUser(IsNew, objParams, m_hasChangedPassword);
            if (UserType == eUserType.InternalUser)
                objInternalUserControl.PopulateUserGrid();
            else {
                ObjectUser.SaveUserCustomer(UserId, (int)cboCustomer.EditValue);
                objCustomerUserControl.PopulateUserGrid(objParams.full_name);
            }
            WaitDialog.Close();
            this.ParentForm.Close();
        }
Esempio n. 4
0
        private void SetFocusedViewInstance()
        {
            this.InitObjects();
            m_objUser = gridViewUsers.GetFocusedRow() as ObjectUser.UserInstance;

            if (gridViewRoles.DataRowCount > 0)
                m_objUserRole = gridViewRoles.GetFocusedRow() as ObjectUser.UserRoleInstance;

            if (gridViewCustomers.DataRowCount > 0)
                m_objUserCustomer = gridViewCustomers.GetFocusedRow() as ObjectUser.UserCustomerInstance;
        }
Esempio n. 5
0
 private void InitObjects()
 {
     m_objUser = null;
     m_objUserRole = null;
     m_objUserCustomer = null;
 }
Esempio n. 6
0
        /// <summary>
        /// Sets the focused view instance of the grid. Instantiates the objects that can be used for data manipulation.
        /// Where m_objUser, is the current selected object in the grid view
        /// </summary>
        private void SetFocusedViewInstance()
        {
            this.InitObjects();

            m_objGridView = (DevExpress.XtraGrid.Views.Grid.GridView)DXGridUser.FocusedView;
            m_objUser = (ObjectUser.UserInstance)m_objGridView.GetFocusedRow();

            if (gridViewRoles.DataRowCount > 0)
            {
                m_objGridView = (DevExpress.XtraGrid.Views.Grid.GridView)DXGridRole.FocusedView;
                m_objUserRole = (ObjectUser.UserRoleInstance)m_objGridView.GetFocusedRow();
            }
        }