Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            CResult oResult = ValidateForm();

            if (oResult.IsSuccess)
            {
                String sTempUser = txtUserName.Text.Trim();

                //String sTempPass =RMSGlobal.Decrypt(txtPassword.Text.Trim(),true);

                String sTempPass = txtPassword.Text.Trim();

                int iTempType = ((CComboBoxItem)cmbUserType.SelectedItem).Value;

                String sTempGender = cmbSex.SelectedItem.ToString();

                CUserInfo oUser = new CUserInfo();

                oUser.UserName = sTempUser;

                oUser.Password = sTempPass;

                oUser.Type = iTempType;

                oUser.Gender = sTempGender;

                if (rdoActive.Checked)
                {
                    oUser.Status = 1;
                }
                else if (rdoInActive.Checked)
                {
                    oUser.Status = 0;
                }

                CUserAccess oUserAccess = new CUserAccess();

                if (chkOpenDrawer.Checked)
                {
                    oUserAccess.OpenDrawer = 1;
                }

                if (chkReviewTrans.Checked)
                {
                    oUserAccess.ReviewTransaction = 1;
                }

                if (chkVoidTable.Checked)
                {
                    oUserAccess.VoidTable = 1;
                }

                if (chkViewReport.Checked)
                {
                    oUserAccess.ViewReport = 1;
                }

                if (chkTransferTable.Checked)
                {
                    oUserAccess.TransferTable = 1;
                }

                if (chkTillReport.Checked)
                {
                    oUserAccess.TillReporting = 1;
                }

                if (chkMergeTable.Checked)
                {
                    oUserAccess.MergeTable = 1;
                }

                if (chkExitRms.Checked)
                {
                    oUserAccess.ExitRms = 1;
                }

                if (chkUnlockTable.Checked)
                {
                    oUserAccess.UnlockTable = 1;
                }

                if (chkBooking.Checked)
                {
                    oUserAccess.Booking = 1;
                }

                if (chkUsers.Checked)
                {
                    oUserAccess.Users = 1;
                }

                if (chkDeposit.Checked)
                {
                    oUserAccess.Deposit = 1;
                }

                if (chkCustomer.Checked)
                {
                    oUserAccess.Customers = 1;
                }

                if (chkUpdateItems.Checked)
                {
                    oUserAccess.UpdateItems = 1;
                }

                if (chkRemoveItems.Checked)
                {
                    oUserAccess.RemoveItems = 1;
                }

                if (chkLogRegister.Checked)
                {
                    oUserAccess.LogRegister = 1;
                }

                if (chkSettings.Checked)
                {
                    oUserAccess.SystemSettings = 1;
                }

                if (chkRmsAdmin.Checked)
                {
                    oUserAccess.RmsAdminAccess = 1;
                }


                oUser.UserAccess = oUserAccess;

                oUser.UserID = m_userID;

                CUserManager oManager = new CUserManager();

                CResult oResult2 = oManager.UpdateUser(oUser);

                if (oResult2.IsSuccess)
                {
                    lblSaveStatus.Text = "User information has been modified successfully.";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    lblSaveStatus.Text = oResult2.Message;

                    lblSaveStatus.Visible = true;
                }
            }
            else
            {
                lblSaveStatus.Text    = oResult.Message;
                lblSaveStatus.Visible = true;
            }
        }