예제 #1
0
        private void ManageCashMenuPanel_VisibleChanged(object sender, EventArgs e)
        {
            if (this.Visible && !DesignMode)
            {
                var currUser = GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile;
                //check if user has access to shop cash button
                const string btnName = "SAFEMANAGEMENT";
                if (!(SecurityProfileProcedures.CanUserModifyResource(btnName, currUser, GlobalDataAccessor.Instance.DesktopSession)))
                {
                    this.SafeOperationsButton.Enabled = false;
                }
                else
                {
                    this.SafeOperationsButton.Enabled = true;
                }


                //Check if user has access to buttons on this panel

                /* SecurityProfileProcedures.ModifyButtonAccessBasedOnSecurityProfile(this.Controls, currUser,
                 *   ImageButtonControllerGroup.BUTTON_SUFFIX,
                 *   ImageButtonControllerGroup.BUTTON_TAGSEP,
                 *   ImageButtonControllerGroup.BUTTON_LEAF);*/
            }
        }
예제 #2
0
 private void dataGridViewCustomerID_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1)
     {
         if ((SecurityProfileProcedures.CanUserModifyResource("EDITGOVTIDTYPEAGENCY", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, GlobalDataAccessor.Instance.DesktopSession)) ||
             (SecurityProfileProcedures.CanUserModifyResource("EDITGOVTIDNUMBER", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, GlobalDataAccessor.Instance.DesktopSession)))
         {
             addRowToEnter(e);
         }
     }
 }
        private void UtilitiesMenuPanel_VisibleChanged(object sender, EventArgs e)
        {
            if (this.Visible && !DesignMode)
            {
                int    idx;
                string btnName;
                var    dSession = GlobalDataAccessor.Instance.DesktopSession;
                var    currUser = dSession.LoggedInUserSecurityProfile;
                //Check if user has access to Customer Holds
                if (CustomerHoldsButton != null && CustomerHoldsButton.Enabled && !string.IsNullOrEmpty(CustomerHoldsButton.Name))
                {
                    idx     = this.CustomerHoldsButton.Name.IndexOf("Button", StringComparison.Ordinal);
                    btnName = CustomerHoldsButton.Name.Substring(0, idx).ToUpper();
                    this.CustomerHoldsButton.Enabled = (SecurityProfileProcedures.CanUserViewResource(btnName, currUser, dSession));
                }

                //Check if user has access to Police activities
                if (Police_ActivitiesButton != null && Police_ActivitiesButton.Enabled && !string.IsNullOrEmpty(Police_ActivitiesButton.Name))
                {
                    idx     = this.Police_ActivitiesButton.Name.IndexOf("Button", StringComparison.Ordinal);
                    btnName = Police_ActivitiesButton.Name.Substring(0, idx).ToUpper();
                    this.Police_ActivitiesButton.Enabled = SecurityProfileProcedures.CanUserViewResource(btnName, currUser, dSession);
                }

                /* // removed per CQ - 14915
                 * //Check if user has access to VOID
                 * if (voidTransactionButton != null && voidTransactionButton.Enabled && !string.IsNullOrEmpty(voidTransactionButton.Name))
                 * {
                 *  idx = this.voidTransactionButton.Name.IndexOf("Button", StringComparison.Ordinal);
                 *  btnName = voidTransactionButton.Name.Substring(0, idx).ToUpper();
                 *  this.voidTransactionButton.Enabled = SecurityProfileProcedures.CanUserViewResource(btnName, currUser, dSession);
                 * }
                 */

                this.ManageInventoryButton.Enabled = true;
                this.ManageCashButton.Enabled      = true;

                //if (TransferButton.Enabled)
                //{
                //    this.TransferButton.Enabled = (CashlinxDesktop.Desktop.CashlinxDesktopSession.Instance.LoggedInUserSafeAccess);
                //}
                //Check if user has permissions to modify security profile
                btnName = "UPDATE USER PROFILE RESOURCES CURRENT LOCATION ONLY";
                const string multipleLocationResource = "UPDATE USER PROFILE RESOURCES MULTIPLE LOCATIONS";
                if (Update_Security_ProfileButton != null && Update_Security_ProfileButton.Enabled)
                {
                    this.Update_Security_ProfileButton.Enabled =
                        ((SecurityProfileProcedures.CanUserModifyResource(btnName, currUser, dSession)) ||
                         SecurityProfileProcedures.CanUserModifyResource(multipleLocationResource, currUser, dSession));
                }
            }
        }
        private void UpdateCustomerDetails_Load(object sender, EventArgs e)
        {
            LoadDataInForm();
            //SR 2/16/2010 Roles and resources check added
            //check the privileges of the logged in user to determine
            //if the user can edit any information
            if (!(SecurityProfileProcedures.CanUserModifyResource("UPDATESSN", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, GlobalDataAccessor.Instance.DesktopSession)))
            {
                this.labelSSN.Visible = false;
                this.custSSN.Visible  = false;
            }

            this.custDateOfBirth.ErrorMessage = Commons.GetMessageString("InvalidDateOfBirth");
        }
예제 #5
0
        /*__________________________________________________________________________________________*/
        private void UpdateCommentsandNotes_Load(object sender, EventArgs e)
        {
            ownerFrm            = this.Owner;
            NavControlBox.Owner = this;

            CustToEdit = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;

            if (_viewCommentsandNotes)
            {
                this.customButtonCancel.Visible = false;
                //this.customButtonClose.Visible = true;
                //this.customButtonReset.Visible = false;
                //this.customButtonSubmit.Visible = false;
                this.customDataGridViewComments.ReadOnly = true;
            }
            else
            {
                this.customButtonCancel.Visible = true;
                //this.customButtonClose.Visible = false;
                //this.customButtonReset.Visible = true;
                //this.customButtonSubmit.Visible = true;
                this.customDataGridViewComments.ReadOnly = false;
            }
            _strUser        = GlobalDataAccessor.Instance.DesktopSession.UserName;
            _strStoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
            _strDate        = ShopDateTime.Instance.ShopDate.ToString();
            //Load the comments data
            LoadCommentsData();
            //check the privileges of the logged in user to determine
            //if the user can edit comments or only add comments
            if (!(SecurityProfileProcedures.CanUserModifyResource("EDITCOMMENTS", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, GlobalDataAccessor.Instance.DesktopSession)))
            {
                userCanEdit = false;
                foreach (DataGridViewRow dgvr in customDataGridViewComments.Rows)
                {
                    dgvr.ReadOnly = true;
                }
            }
            else
            {
                userCanEdit = true;
            }
        }
예제 #6
0
 private void dataGridViewCustomerID_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex > -1)
     {
         if (dataGridViewCustomerID.Rows[e.RowIndex].IsNewRow)
         {
             if ((SecurityProfileProcedures.CanUserModifyResource("EDITGOVTIDTYPEAGENCY", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, GlobalDataAccessor.Instance.DesktopSession)) ||
                 (SecurityProfileProcedures.CanUserModifyResource("EDITGOVTIDNUMBER", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, GlobalDataAccessor.Instance.DesktopSession)))
             {
                 changeCellDataToEdit(e);
             }
         }
         else
         {
             changeCellDataToEdit(e);
         }
     }
     if (dataValid)
     {
         dataGridViewCustomerID.RowHeadersVisible = false;
     }
 }
예제 #7
0
        /// <summary>
        /// Function to to check if the user is authorized to override
        /// </summary>
        /// <param name="userName"></param>
        /// <returns></returns>
        private bool checkRole(string userName)
        {
            string errorCode;
            string errorMesg;

            //Get the security profile of the user whose credentials were entered in the override form
            if (SecurityProfileProcedures.GetUserSecurityProfile(userName, GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, null, "N", GlobalDataAccessor.Instance.DesktopSession, out managerUserProfile, out errorCode, out errorMesg))
            {
                //check if the manager whose credentials were entered
                //has modify access on the override resource
                //return true if yes and false if not
                if (SecurityProfileProcedures.CanUserModifyResource("OVERRIDE", managerUserProfile, GlobalDataAccessor.Instance.DesktopSession))
                {
                    //If the override type is for new pawn loan override
                    //check that the overriding user's limits allow override
                    var managerLimit = 0.0m;
                    if (ManagerOverrideTypes[0] == ManagerOverrideType.NLO)
                    {
                        if (!(SecurityProfileProcedures.CanUserOverridePawnLoanLimit(managerUserProfile, _OverrideAmount[0], GlobalDataAccessor.Instance.DesktopSession, new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession), out managerLimit)))
                        {
                            MessageBox.Show(@"The amount to override exceeds the amount you can override. Your override limit is " + managerLimit);
                            return(false);
                        }
                    }
                    if (ManagerOverrideTypes[0] == ManagerOverrideType.PURO)
                    {
                        if (!(SecurityProfileProcedures.CanUserOverrideBuyLimit(managerUserProfile, _OverrideAmount[0], out managerLimit)))
                        {
                            MessageBox.Show(@"The amount to override exceeds the amount you can override. Your override limit is " + managerLimit);
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }
 private void EditGunBookRecord_Load(object sender, EventArgs e)
 {
     this.NavControlBox.Owner = this;
     gunBookData = GlobalDataAccessor.Instance.DesktopSession.GunData;
     gunItemData = GlobalDataAccessor.Instance.DesktopSession.GunItemData;
     if (gunBookData != null && gunBookData.Rows.Count > 0)
     {
         gunCACCCode        = Utilities.GetStringValue(gunBookData.Rows[0]["cat_code"]);
         currentGunNo.Text  = Utilities.GetStringValue(gunBookData.Rows[0]["gun_number"]);
         originalGunNo.Text = Utilities.GetStringValue(gunBookData.Rows[0]["original_gun_number"]);
         newGunNo.Text      = Utilities.GetStringValue(gunBookData.Rows[0]["new_gun_number"]);
         status.Text        = Utilities.GetStringValue(gunBookData.Rows[0]["status_cd"]);
         statusDate.Text    = Utilities.GetDateTimeValue(gunBookData.Rows[0]["status_date"]).ToString("d", DateTimeFormatInfo.InvariantInfo);
         gunBound.Text      = Utilities.GetStringValue(gunBookData.Rows[0]["gun_bound"]);
         pageRecord.Text    = Utilities.GetStringValue(gunBookData.Rows[0]["gun_page"]) + "/" + Utilities.GetStringValue(gunBookData.Rows[0]["record_number"]);
         manufacturer.Text  = Utilities.GetStringValue(gunBookData.Rows[0]["manufacturer"]);
         model.Text         = Utilities.GetStringValue(gunBookData.Rows[0]["model"]);
         serialNumber.Text  = Utilities.GetStringValue(gunBookData.Rows[0]["serial_number"]);
         caliber.Text       = Utilities.GetStringValue(gunBookData.Rows[0]["caliber"]);
         type.Text          = Utilities.GetStringValue(gunBookData.Rows[0]["gun_type"]);
         importer.Text      = Utilities.GetStringValue(gunBookData.Rows[0]["importer"]);
         icnDocType         = Utilities.GetStringValue(gunBookData.Rows[0]["icn_doc_type"]);
         icn.Text           = Utilities.IcnGenerator(Utilities.GetIntegerValue(gunBookData.Rows[0]["icn_store"]),
                                                     Utilities.GetIntegerValue(gunBookData.Rows[0]["icn_year"]),
                                                     Utilities.GetIntegerValue(gunBookData.Rows[0]["icn_doc"]),
                                                     Utilities.GetStringValue(gunBookData.Rows[0]["icn_doc_type"]),
                                                     Utilities.GetIntegerValue(gunBookData.Rows[0]["icn_item"]),
                                                     Utilities.GetIntegerValue(gunBookData.Rows[0]["icn_sub_item"]));
         //acquisition data
         acquireCustNumber          = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_customer_number"]);
         acquisitionCustomerNo.Text = acquireCustNumber;
         acquireTransactionType     = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_transaction_type"]);
         acquisitionType.Text       = acquireTransactionType;
         acquireCustFirstName       = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_first_name"]);
         acquireCustLastName        = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_last_name"]);
         acquireCustMiddleName      = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_middle_initial"]);
         acquisitionName.Text       = acquireCustFirstName + " " + acquireCustMiddleName + " " + acquireCustLastName;
         acquisitionTicket.Text     = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_document_number"]);
         acquireCustomerAddress1    = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_address"]);
         acquisitionAddress1.Text   = acquireCustomerAddress1;
         acquireCustomerCity        = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_city"]);
         acquireCustomerState       = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_state"]);
         acquireCustomerZipcode     = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_postal_code"]);
         acquisitionAddress2.Text   = acquireCustomerCity + "," + acquireCustomerState + " " + acquireCustomerZipcode;
         acquisitionDate.Text       = Utilities.GetDateTimeValue(gunBookData.Rows[0]["acquire_date"]).ToShortDateString();
         acquireCustIDType          = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_type"]);
         acquireCustIDNumber        = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_number"]);
         acquireCustIDAgency        = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_agency"]);
         acquisitionID.Text         = acquireCustIDType + " " + acquireCustIDAgency + " " + acquireCustIDNumber;
         //disposition data
         dispositionCustNumber       = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_customer_number"]);
         dispositionCustomerNo.Text  = dispositionCustNumber;
         dispTransactionType         = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_transaction_type"]);
         dispositionType.Text        = dispTransactionType;
         dispositionCustLastName     = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_last_name"]);
         dispositionCustFirstName    = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_first_name"]);
         dispositionCustMiddleName   = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_middle_initial"]);
         dispositionName.Text        = dispositionCustFirstName + " " + dispositionCustMiddleName + " " + dispositionCustLastName;
         dispositionTicket.Text      = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_document_number"]);
         dispositionCustomerAddress1 = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_address"]);
         dispositionAddress1.Text    = dispositionCustomerAddress1;
         dispositionCustomerCity     = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_city"]);
         dispositionCustomerState    = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_state"]);
         dispositionCustomerZipcode  = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_postal_code"]);
         dispositionAddress2.Text    = dispositionCustomerCity + "," + dispositionCustomerState + " " + dispositionCustomerZipcode;
         dispositionDate.Text        = Utilities.GetDateTimeValue(gunBookData.Rows[0]["disposition_date"]).ToShortDateString();
         dispositionCustIDType       = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_type"]);
         dispositionCustIDAgency     = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_agency"]);
         dispositionCustIDNumber     = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_number"]);
         dispositionID.Text          = dispositionCustIDType + " " + dispositionCustIDAgency + " " + dispositionCustIDNumber;
         string gunStatus = Utilities.GetStringValue((gunBookData.Rows[0]["status_cd"]));
         if (gunStatus == "VO" || gunStatus == "PS")
         {
             labelErrMessage.Text = Commons.GetMessageString("GunEditError");
             DisableActions();
         }
         if (string.IsNullOrEmpty(dispositionCustNumber))
         {
             DispositionReplace.Enabled = false;
             DispositionEdit.Enabled    = false;
         }
         if (!SecurityProfileProcedures.CanUserModifyResource("EDIT GUN BOOK", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, CashlinxPawnSupportSession.Instance) &&
             !SecurityProfileProcedures.CanUserModifyResource("EDIT RESTRICTED GUN BOOK FIELDS", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, CashlinxPawnSupportSession.Instance))
         {
             firearmDescEdit.Enabled    = false;
             AcquisitionEdit.Enabled    = false;
             AcquisitionReplace.Enabled = false;
             DispositionEdit.Enabled    = false;
             DispositionReplace.Enabled = false;
         }
         if (string.IsNullOrEmpty(acquireCustNumber))
         {
             AcquisitionEdit.Enabled    = false;
             AcquisitionReplace.Enabled = false;
         }
         if (acquireTransactionType == "T" || acquireTransactionType == "C")
         {
             AcquisitionEdit.Enabled    = false;
             AcquisitionReplace.Enabled = false;
         }
         if (dispTransactionType == "T" || dispTransactionType == "C")
         {
             DispositionReplace.Enabled = false;
             DispositionEdit.Enabled    = false;
         }
     }
     else
     {
         labelErrMessage.Text = "Gun Book data not found";
         DisableActions();
     }
 }
예제 #9
0
        public void populateCustomerIdentification(List <IdentificationVO> custIds)
        {
            dataGridViewCustomerID.Rows.Clear();
            string idTypeDesc;
            string idIssuer;
            string idNumber;
            string idExpiryDate;
            string identId;

            if (custIds.Count > 0)
            {
                foreach (var custid in custIds)
                {
                    idTypeDesc = custid.DatedIdentDesc;
                    if (Commons.IsStateIdDescription(idTypeDesc))
                    {
                        idIssuer = custid.IdIssuerCode;
                    }
                    else
                    {
                        idIssuer = custid.IdIssuer;
                    }

                    idNumber = custid.IdValue;
                    if (custid.IdExpiryData == DateTime.MaxValue)
                    {
                        idExpiryDate = string.Empty;
                    }
                    else
                    {
                        idExpiryDate = (custid.IdExpiryData).FormatDate();
                    }
                    identId = custid.IdentId;

                    var idtypecell     = new DataGridViewTextBoxCell();
                    var issuercell     = new DataGridViewTextBoxCell();
                    var numbercell     = new DataGridViewTextBoxCell();
                    var expirationcell = new DataGridViewTextBoxCell();
                    var identidcell    = new DataGridViewTextBoxCell();
                    numbercell.MaxInputLength     = 20;
                    expirationcell.MaxInputLength = 10;
                    idtypecell.Value     = idTypeDesc;
                    issuercell.Value     = idIssuer;
                    numbercell.Value     = idNumber;
                    expirationcell.Value = idExpiryDate;
                    identidcell.Value    = identId;

                    var dgRow = new DataGridViewRow();
                    dgRow.Cells.Insert(0, idtypecell);
                    dgRow.Cells.Insert(1, issuercell);
                    dgRow.Cells.Insert(2, numbercell);
                    dgRow.Cells.Insert(3, expirationcell);
                    dgRow.Cells.Insert(4, identidcell);
                    dataGridViewCustomerID.Rows.Add(dgRow);
                }
                //SR 2/16/2010 Roles and resources check added
                //check the privileges of the logged in user to determine
                //if the user can edit id type and agency
                if (!(SecurityProfileProcedures.CanUserModifyResource("EDITGOVTIDTYPEAGENCY", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, GlobalDataAccessor.Instance.DesktopSession)))
                {
                    dataGridViewCustomerID.Columns[0].ReadOnly = true;
                    dataGridViewCustomerID.Columns[1].ReadOnly = true;
                }
                //check the privileges of the logged in user to determine
                //if the user can edit id number
                if (!(SecurityProfileProcedures.CanUserModifyResource("EDITGOVTIDNUMBER", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, GlobalDataAccessor.Instance.DesktopSession)))
                {
                    dataGridViewCustomerID.Columns[2].ReadOnly = true;
                }
            }
        }
예제 #10
0
        private void CustomerReplace_Load(object sender, EventArgs e)
        {
            gunBookData = GlobalDataAccessor.Instance.DesktopSession.GunData;
            if (gunBookData != null && gunBookData.Rows.Count > 0)
            {
                if (GlobalDataAccessor.Instance.DesktopSession.GunAcquireCustomer)
                {
                    string acquireCustNumber = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_customer_number"]);
                    customerNumber.Text = acquireCustNumber;
                    string acquireCustFirstName  = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_first_name"]);
                    string acquireCustLastName   = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_last_name"]);
                    string acquireCustMiddleName = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_middle_initial"]);
                    currentName.Text = string.Format("{0} {1} {2}", acquireCustFirstName, acquireCustMiddleName, acquireCustLastName);
                    string acquireCustomerAddress1 = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_address"]);
                    address1.Text = acquireCustomerAddress1;
                    string acquireCustomerCity    = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_city"]);
                    string acquireCustomerState   = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_state"]);
                    string acquireCustomerZipcode = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_postal_code"]);
                    address2.Text = string.Format("{0},{1} {2}", acquireCustomerCity, acquireCustomerState, acquireCustomerZipcode);
                    string acquireCustIDType   = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_type"]);
                    string acquireCustIDNumber = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_number"]);
                    string acquireCustIDAgency = Utilities.GetStringValue(gunBookData.Rows[0]["acquire_id_agency"]);
                    id.Text = string.Format("{0} {1} {2}", acquireCustIDType, acquireCustIDAgency, acquireCustIDNumber);
                }
                else
                {
                    string dispositionCustNumber = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_customer_number"]);
                    customerNumber.Text = dispositionCustNumber;

                    string dispositionCustLastName   = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_last_name"]);
                    string dispositionCustFirstName  = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_first_name"]);
                    string dispositionCustMiddleName = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_middle_initial"]);
                    currentName.Text = string.Format("{0} {1} {2}", dispositionCustFirstName, dispositionCustMiddleName, dispositionCustLastName);

                    string dispositionCustomerAddress1 = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_address"]);
                    address1.Text = dispositionCustomerAddress1;
                    string dispositionCustomerCity    = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_city"]);
                    string dispositionCustomerState   = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_state"]);
                    string dispositionCustomerZipcode = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_postal_code"]);
                    address2.Text = string.Format("{0},{1} {2}", dispositionCustomerCity, dispositionCustomerState, dispositionCustomerZipcode);

                    string dispositionCustIDType   = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_type"]);
                    string dispositionCustIDAgency = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_agency"]);
                    string dispositionCustIDNumber = Utilities.GetStringValue(gunBookData.Rows[0]["disposition_id_number"]);
                    id.Text = string.Format("{0} {1} {2}", dispositionCustIDType, dispositionCustIDAgency, dispositionCustIDNumber);
                }
            }
            if (!SecurityProfileProcedures.CanUserModifyResource("EDIT RESTRICTED GUN BOOK FIELDS", GlobalDataAccessor.Instance.DesktopSession.LoggedInUserSecurityProfile, GlobalDataAccessor.Instance.DesktopSession))
            {
                tableLayoutPanel2.Visible = false;
            }
            else
            {
                idEditResource = true;
            }

            if (GlobalDataAccessor.Instance.DesktopSession.CustomerEditType == CustomerType.RECEIPT)
            {
                label1.Text = "Edit Receipt Customer Information";
            }
            else if (GlobalDataAccessor.Instance.DesktopSession.CustomerEditType == CustomerType.DISPOSITION)
            {
                label1.Text = "Edit Disposition Customer Information";
            }
            else
            {
                this.label1.Text = GlobalDataAccessor.Instance.DesktopSession.GunAcquireCustomer ? "Replace Receipt Customer Information" : "Replace Disposition Customer Information";
            }


            if (GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer != null &&
                !string.IsNullOrEmpty(GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber))
            {
                newCustomer = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;
                if (newCustomer.DateOfBirth != DateTime.MaxValue && newCustomer.Age <= 18)
                {
                    DialogResult dgr = MessageBox.Show("This customer does not meet the age criteria for firearm transactions. An audit event will be generated. Do you want to continue?", "Firearm Eligibility", MessageBoxButtons.YesNo);
                    if (dgr == DialogResult.No)
                    {
                        NavControlBox.Action = NavBox.NavAction.CANCEL;
                    }
                }

                labelCustNumber.Text        = newCustomer.CustomerNumber;
                customTextBoxFirstName.Text = newCustomer.FirstName;
                customTextBoxLastName.Text  = newCustomer.LastName;
                customTextBoxInitial.Text   = newCustomer.MiddleInitial;
                ComboBox  custstate = (ComboBox)state1.Controls[0];
                AddressVO custAddr  = newCustomer.getHomeAddress();
                if (custAddr != null)
                {
                    customTextBoxAddr1.Text = custAddr.Address1;
                    customTextBoxAddr2.Text = custAddr.Address2;



                    foreach (USState currstate in custstate.Items)
                    {
                        if (currstate.ShortName == custAddr.State_Code)
                        {
                            custstate.SelectedIndex = custstate.Items.IndexOf(currstate);
                            break;
                        }
                    }
                    customTextBoxCity.Text = custAddr.City;
                    zipcode1.Text          = custAddr.ZipCode;
                }
                IdentificationVO firstIdentity = newCustomer.getFirstIdentity();
                //Populate the id details if the first identity cursor is not empty
                if (firstIdentity != null)
                {
                    strIdentIssuerName = firstIdentity.IdIssuer;
                    strIdentNumber     = firstIdentity.IdValue;
                    ComboBox custId = (ComboBox)this.pwnapp_identificationtype.Controls[0];

                    foreach (ComboBoxData idtype in custId.Items)
                    {
                        if (idtype.Code == firstIdentity.IdType)
                        {
                            custId.SelectedIndex = custId.Items.IndexOf(idtype);
                            break;
                        }
                    }
                }
                else
                {
                    pwnapp_identificationexpirationdate.Enabled = false;
                    pwnapp_identificationnumber.Enabled         = false;
                }
            }
        }
예제 #11
0
        /// <summary>
        /// Function to call LDAP to validate the user
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns></returns>
        private bool callLdap(string userName, string password)
        {
            if (GlobalDataAccessor.Instance.DesktopSession.IsSkipLDAP)
            {
                return(true);
            }

            //See if ldap is enabled
            var ldapObj = PawnLDAPAccessor.Instance;

            if (ldapObj.State == PawnLDAPAccessor.LDAPState.CONNECTED)
            {
                var  refCount = 0;
                bool lockedOut;

                DateTime lastModified;
                string[] pwdHistory;
                if (ldapObj.AuthorizeUser(
                        userName,
                        password,
                        ref refCount,
                        out lastModified,
                        out pwdHistory,
                        out userDisplayName,
                        out lockedOut))
                {
                    if (lockedOut)
                    {
                        MessageBox.Show(
                            "You are now locked out of the system.  Please call Shop System Support",
                            "Application Security");
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
                if (TransferToSafe)
                {
                    string errorCode;
                    string errorMesg;
                    UserVO transferUser;
                    if (!SecurityProfileProcedures.GetUserSecurityProfile(userName, GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, "", "N", GlobalDataAccessor.Instance.DesktopSession,
                                                                          out transferUser, out errorCode, out errorMesg))
                    {
                        BasicExceptionHandler.Instance.AddException(
                            "Security Profile could not be loaded for the logged in user. Cannot Authorize",
                            new ApplicationException());
                        MessageBox.Show(
                            "User's security profile could not be loaded. Exiting the application");
                        return(false);
                    }

                    //Check if the user who logged in for destination has safe access if
                    //the transfer is done to safe from cash drawer
                    if (SecurityProfileProcedures.CanUserModifyResource(
                            "SAFEMANAGEMENT", transferUser, GlobalDataAccessor.Instance.DesktopSession))
                    {
                        transferUserSafeAccess = true;
                    }
                }
            }
            else
            {
                FileLogger.Instance.logMessage(LogLevel.ERROR, this, "Cannot validate destination cash drawer user. The LDAP connection is not active");
                BasicExceptionHandler.Instance.AddException("Cannot authorize transfer.  The LDAP connection is not active", new ApplicationException());
            }
            return(true);
        }