Exemplo n.º 1
0
        //When the user clicks cancel, take them to the desktop
        private void buttonCancel_Click(object sender, EventArgs e)
        {
            DialogResult dR = MessageBox.Show("Do you want to continue processing this customer?", "Existing Customer", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (dR == DialogResult.No)
            {
                GlobalDataAccessor.Instance.DesktopSession.ClearCustomerList();
                GlobalDataAccessor.Instance.DesktopSession.ClearPawnLoan();
                _newCustomer = null;
                clearCustomerSessionValues();
                this.NavControlBox.Action = NavBox.NavAction.CANCEL;
            }
            else
            {
                this.Show();
                this.Focus();
            }
        }
Exemplo n.º 2
0
        private CustomerAndCard GetCusAndCardModel(ClubCardVO recard, CustomerVO recust)
        {
            if (recard != null && recust != null)
            {
                CustomerAndCard cuandcard = new CustomerAndCard()
                {
                    CustID        = recust.CustomerID,
                    CustName      = recust.Name,
                    ICNo          = recust.ICNo,
                    MobileNo      = recust.MobileNO,
                    Birthday      = recust.Birthday,
                    CardID        = recard.ClubCardID,
                    CardNo        = recard.ClubCardNo,
                    CardType      = recard.ClubCardTypeID,
                    CardStatu     = recard.CardStatus,
                    OpenCardStore = recard.OpenCardStore,
                    SaleMan       = recard.SalesMan,
                    SaleTime      = recard.SalesTime,
                    ExpireDate    = recard.ExpireDate
                };
                cuandcard.CardTypeName = recard.ClubCardTypeName;
                switch (recard.CardStatus)
                {
                case (int)ClubCardStatus.OpenCard: cuandcard.CardStatuName = "开卡";
                    break;

                case (int)ClubCardStatus.Expire: cuandcard.CardStatuName = "过期";
                    break;

                case (int)ClubCardStatus.Froze: cuandcard.CardStatuName = "冻结";
                    break;

                case (int)ClubCardStatus.LogOff: cuandcard.CardStatuName = "注销";
                    break;

                case (int)ClubCardStatus.ReportLoss: cuandcard.CardStatuName = "挂失";
                    break;
                }
                return(cuandcard);
            }
            return(new CustomerAndCard());
        }
Exemplo n.º 3
0
        //=====================================================================
        // Form Custom Functionality
        //=====================================================================
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            if (preValidateTextboxes())
            {
                List <LoginVO> matchingLoginInfo = databaseService.GetMatchingLogin(textBoxUsername.Text, textBoxPassword.Text);

                if (matchingLoginInfo.Count > 1)
                {
                    formError(this, new FormErrorArg("Credentials correct, but system error occured.  Please contact your local Hog Bank branch manager for more info.", null));
                }
                if (matchingLoginInfo.Count < 1)
                {
                    formError(this, new FormErrorArg("Invalid Credentials.  Be sure to enter your correct username and password.", null));
                }
                if (matchingLoginInfo.Count == 1)
                {
                    LoginVO    currentLogin = matchingLoginInfo[0];
                    CustomerVO customerInfo = databaseService.GetCustomerInformationFromRegistrationId(currentLogin.Id);
                    if (customerInfo == null)
                    {
                        EmployeeVO employeeInfo = databaseService.GetEmployeeInformationFromRegistrationId(currentLogin.Id);

                        if (employeeInfo == null)
                        {
                            formInfo(this, new FormInfoArg("Credentials are currently inactive.  Please contact your local Hog Bank branch manager for more info"));
                        }
                        else
                        {
                            // Before exiting, unsubscribe.
                            this.databaseService.OnFormError -= this.formError;
                            WindowManager.navigateToFormStartTag(this, this.GetType(), typeof(Homescreen), employeeInfo);
                        }
                    }
                    else
                    {
                        // Before exiting, unsubscribe.
                        this.databaseService.OnFormError -= this.formError;
                        WindowManager.navigateToFormStartTag(this, this.GetType(), typeof(Homescreen), customerInfo);
                    }
                }
            }
        }
Exemplo n.º 4
0
        //
        // GET: /ClubcardConsume/
        public ActionResult Index()
        {
            ViewData["ConItem"] = GetddlList(DDLlist.PkgItem, false, null, null, null);
            //ViewData["CardPkgItem"]=GetddlList(DDLlist.CardPkg,null,null,null,)
            int id = NullHelper.Convert <int>(Request["id"], 0);

            ViewBag.StoreName = Emp.StroeName;
            ViewBag.Recivor   = Emp.UserName;
            CustomerAndCard cuscard = new CustomerAndCard();

            if (id > 0)
            {
                IClubCardMgm cardMgm = new ClubCardMgm();
                ClubCardVO   card    = cardMgm.GetClubCardByID(id);
                ICustomerMgm custMgm = new CustomerMgm();
                CustomerVO   cust    = custMgm.GetCustomerByID(card.CustomerID);
                cuscard = GetCusAndCardModel(card, cust);
            }
            return(View(cuscard));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 客户详细信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult CustomerDetails(int id)
        {
            var result = new CustomerAndCar();

            if (id != -1)
            {
                ICustomerMgm couMgm   = new CustomerMgm();
                ICarMgm      carMgm   = new CarMgm();
                CustomerVO   customer = couMgm.GetCustomerByID(id);
                List <CarVO> car      = new List <CarVO>();
                if (customer != null)
                {
                    car    = carMgm.GetCarsByCustID(customer.CustomerID);
                    result = GetcusAndcarObj(customer, car.FirstOrDefault());
                }
            }


            return(View(result));
        }
        private void showCustomer()
        {
            var dgr = DialogResult.Retry;

            do
            {
                try
                {
                    LoadSelectedCustomer();


                    if (_customerObject != null)
                    {
                        //Set the selected customer in the desktop session as the ActiveCustomer
                        GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = _customerObject;
                        NavControlBox.IsCustom     = true;
                        NavControlBox.CustomDetail = "Complete";
                        NavControlBox.Action       = NavBox.NavAction.BACKANDSUBMIT;


                        break;
                    }
                    GlobalDataAccessor.Instance.DesktopSession.ClearPawnLoan();
                    this.NavControlBox.Action = NavBox.NavAction.CANCEL;
                }
                catch (Exception ex)
                {
                    BasicExceptionHandler.Instance.AddException(Commons.GetMessageString("SelectedCustomerLoadError"), ex);
                    dgr = MessageBox.Show(Commons.GetMessageString("ProcessingError"), "Error", MessageBoxButtons.RetryCancel);
                    if (dgr == DialogResult.Retry)
                    {
                        continue;
                    }
                    else
                    {
                        _customerObject = null;
                        break;
                    }
                }
            } while (dgr == DialogResult.Retry);
        }
Exemplo n.º 7
0
        private object isCustomerLookedUp(object data)
        {
            DesktopSession cds = GlobalDataAccessor.Instance.DesktopSession;

            if (cds == null)
            {
                return(null);
            }

            CustomerVO cust = cds.ActiveCustomer;

            if (cust != null)
            {
                if (!string.IsNullOrEmpty(cust.CustomerNumber))
                {
                    return(true);
                }
            }

            return(null);
        }
Exemplo n.º 8
0
        void workerLoadRetail_DoWork(object sender, DoWorkEventArgs e)
        {
            string     errorCode;
            string     errorText;
            CustomerVO customerObj  = null;
            SaleVO     saleObj      = null;
            int        ticketNumber = (int)e.Argument;

            RetailProcedures.GetSaleData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(CDS.CurrentSiteId.StoreNumber, 0),
                                         ticketNumber, "3", StateStatus.BLNK, "SALE", true, out saleObj, out customerObj, out errorCode, out errorText);

            Action <string>  actionShowMessageBox = s => MessageBox.Show(s);
            Action <Control> setFocus             = c => c.Focus();

            if (saleObj == null || saleObj.RetailItems.Count == 0)
            {
                this.Invoke(actionShowMessageBox, new object[] { "No records found or not the originating shop of the number entered." });
                this.Invoke(setFocus, new object[] { txtReceiptNumber });
                e.Result = false;
                return;
            }
            else
            {
                int maxDaysForRefundEligibility = new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).GetMaxDaysForRefundEligibility(CDS.CurrentSiteId);
                if (ShopDateTime.Instance.FullShopDateTime.Date > saleObj.DateMade.AddDays(maxDaysForRefundEligibility))
                {
                    this.Invoke(actionShowMessageBox, new object[] { "The number of days eligible for refund has expired for the MSR number entered." });
                    this.Invoke(setFocus, new object[] { txtReceiptNumber });
                    e.Result = false;
                    return;
                }

                this.Invoke(new Action(() =>
                {
                    GlobalDataAccessor.Instance.DesktopSession.Sales = new List <SaleVO>();
                    GlobalDataAccessor.Instance.DesktopSession.Sales.Add(saleObj);
                    GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;
                }));
            }
        }
Exemplo n.º 9
0
 private void GunBookCustomer_Load(object sender, EventArgs e)
 {
     gunBookCustomerData = GlobalDataAccessor.Instance.DesktopSession.GunBookCustomerData;
     gunNumber           = GlobalDataAccessor.Instance.DesktopSession.GunNumber;
     customerEditType    = GlobalDataAccessor.Instance.DesktopSession.CustomerEditType;
     if (gunBookCustomerData != null)
     {
         currentName.Text  = string.Format("{0} {1}", gunBookCustomerData.FirstName, gunBookCustomerData.LastName);
         customerName.Text = currentName.Text;
         AddressVO custAddr = gunBookCustomerData.getAddress(0);
         if (custAddr != null)
         {
             address1.Text           = custAddr.Address1;
             address2.Text           = string.Format("{0},{1} {2}", custAddr.City, custAddr.State_Code, custAddr.ZipCode);
             customTextBoxaddr1.Text = custAddr.Address1;
             customTextBoxAddr2.Text = custAddr.Address2;
             customTextBoxCity.Text  = custAddr.City;
             ComboBox custstate = (ComboBox)state1.Controls[0];
             foreach (USState currstate in custstate.Items)
             {
                 if (currstate.ShortName == custAddr.State_Code)
                 {
                     custstate.SelectedIndex = custstate.Items.IndexOf(currstate);
                     break;
                 }
             }
             zipcode1.Text = custAddr.ZipCode;
         }
         customerNumber.Text  = gunBookCustomerData.CustomerNumber;
         labelCustNumber.Text = gunBookCustomerData.CustomerNumber;
         IdentificationVO custId = gunBookCustomerData.getFirstIdentity();
         if (custId != null)
         {
             currentID.Text = custId.IdType + " " + custId.IdIssuerCode + " " + custId.IdValue;
             id.Text        = currentID.Text;
         }
         newCustomer = Utilities.CloneObject(gunBookCustomerData);
         GlobalDataAccessor.Instance.DesktopSession.GunAcquireCustomer = this.customerEditType == CustomerType.RECEIPT;
     }
 }
Exemplo n.º 10
0
        /// <summary>
        /// 模型转换
        /// </summary>
        /// <param name="customer"></param>
        /// <param name="car"></param>
        /// <returns></returns>
        private CustomerAndCar GetcusAndcarObj(CustomerVO customer, CarVO car)
        {
            CustomerAndCar cusandcar = new CustomerAndCar();

            cusandcar.Customerid = customer.CustomerID;
            cusandcar.Name       = customer.Name;
            cusandcar.Sex        = customer.Sex;
            cusandcar.ICNo       = customer.ICNo;
            cusandcar.Birthday   = customer.Birthday;
            cusandcar.Carno      = car.CarNo;
            cusandcar.Brand      = car.Brand;
            cusandcar.Carmodel   = car.CarModel;
            cusandcar.Capacity   = car.Capacity;
            cusandcar.Color      = car.Color;
            cusandcar.FrameNo    = car.FrameNo;
            cusandcar.EngineNo   = car.EngineNo;
            cusandcar.Maintainkm = car.MaintainKM;
            cusandcar.Insuredate = car.InsureDate;
            cusandcar.Asdate     = car.ASDate;
            cusandcar.MobileNo   = customer.MobileNO;
            cusandcar.Carid      = car.CarID;
            return(cusandcar);
        }
Exemplo n.º 11
0
 /*__________________________________________________________________________________________*/
 private void LoadUpdatedNotesInCustomerObject()
 {
     //Set the Notes data for the customer
     _updatedCustomer = new CustomerVO();
     if (_notesTable != null)
     {
         foreach (DataRow note in _notesTable.Rows)
         {
             var    commentDate       = Utilities.GetDateTimeValue(note.ItemArray[(int)customernotesrecord.CREATIONDATE], DateTime.MaxValue);
             var    contactDate       = Utilities.GetDateTimeValue(note.ItemArray[(int)customernotesrecord.CONTACTDATE], DateTime.MaxValue);
             var    commentUpdateDate = Utilities.GetDateTimeValue(note.ItemArray[(int)customernotesrecord.UPDATEDATE], DateTime.MaxValue);
             string storeNumber       = Utilities.GetStringValue(note.ItemArray[(int)customernotesrecord.STORENUMBER], "");
             string contactResult     = Utilities.GetStringValue(note.ItemArray[(int)customernotesrecord.CONTACTRESULT], "");
             string contactStatus     = Utilities.GetStringValue(note.ItemArray[(int)customernotesrecord.CONTACTSTATUS], "");
             string comments          = Utilities.GetStringValue(note.ItemArray[(int)customernotesrecord.CONTACTNOTE], "");
             string commentsby        = Utilities.GetStringValue(note.ItemArray[(int)customernotesrecord.CREATEDBY], "");
             string custProdNoteId    = Utilities.GetStringValue(note.ItemArray[(int)customernotesrecord.CUSTOMERPRODUCTNOTEID], "");
             string commentCode       = Utilities.GetStringValue(note.ItemArray[(int)customernotesrecord.CUSTOMERNOTESCODE], "");
             var    custnote          = new CustomerNotesVO(contactResult, contactStatus, comments, contactDate, commentDate, commentUpdateDate, commentsby, commentCode, custProdNoteId, storeNumber);
             _updatedCustomer.addNotes(custnote);
         }
     }
 }
Exemplo n.º 12
0
        private void LoadIDDataInObject()
        {
            _updatedCustomer = new CustomerVO();

            if (_custIdentities != null)
            {
                foreach (DataRow cust in _custIdentities.Rows)
                {
                    IdentificationVO custid = new IdentificationVO
                    {
                        IdType =
                            Utilities.GetStringValue(
                                cust.ItemArray[(int)customeridrecord.IDENTTYPECODE], ""),
                        IdValue =
                            Utilities.GetStringValue(
                                cust.ItemArray[(int)customeridrecord.ISSUEDNUMBER], ""),
                        IdIssuer =
                            Utilities.GetStringValue(
                                cust.ItemArray[(int)customeridrecord.STATE_NAME], ""),
                        IdIssuerCode =
                            Utilities.GetStringValue(
                                cust.ItemArray[(int)customeridrecord.ISSUERNAME], ""),
                        DatedIdentDesc =
                            Utilities.GetStringValue(
                                cust.ItemArray[(int)customeridrecord.DATEDIDENTTYPEDESC], ""),
                        IdExpiryData =
                            Utilities.GetDateTimeValue(
                                cust.ItemArray[(int)customeridrecord.EXPIRYDATE],
                                DateTime.MaxValue),
                        IdentId =
                            Utilities.GetStringValue(
                                cust.ItemArray[(int)customeridrecord.IDENTID], "")
                    };
                    _updatedCustomer.addIdentity(custid);
                }
            }
        }
Exemplo n.º 13
0
        public int AddNew(CustomerVO vo)
        {
            Customers customers = customerRepository.Find(c => c.CustomerID == vo.CustomerID)
                                  .FirstOrDefault();

            if (customers == null) // add new
            {
                Customers add = AutoMapper.Mapper.Map <Customers>(vo);
                customerRepository.Add(add);
                uok.Commit();

                return(1);
            }
            else //edit
            {
                AutoMapper.Mapper.Map(vo, customers);

                customerRepository.Update(customers);

                uok.Commit();

                return(2);
            }
        }
Exemplo n.º 14
0
 private CustomerAndCard GetCusAndCardModel(ClubCardVO recard, CustomerVO recust)
 {
     if (recard != null && recust != null)
     {
         CustomerAndCard cuandcard = new CustomerAndCard()
         {
             CustID        = recust.CustomerID,
             CustName      = recust.Name,
             ICNo          = recust.ICNo,
             MobileNo      = recust.MobileNO,
             Birthday      = recust.Birthday,
             CardID        = recard.ClubCardID,
             CardNo        = recard.ClubCardNo,
             CardType      = recard.ClubCardTypeID,
             CardStatu     = recard.CardStatus,
             OpenCardStore = recard.OpenCardStore,
             SaleMan       = recard.SalesMan,
             SaleTime      = recard.SalesTime,
             ExpireDate    = recard.ExpireDate
         };
         return(cuandcard);
     }
     return(new CustomerAndCard());
 }
Exemplo n.º 15
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;
                }
            }
        }
Exemplo n.º 16
0
        private void PoliceHoldform_Load(object sender, EventArgs e)
        {
            decimal tranAmt = 0.0m;

            //Populate store data
            STORE_NAME    = GlobalDataAccessor.Instance.CurrentSiteId.StoreName;
            STORE_ADDRESS = GlobalDataAccessor.Instance.CurrentSiteId.StoreAddress1;
            STORE_CITY    = GlobalDataAccessor.Instance.CurrentSiteId.StoreCityName;
            STORE_STATE   = GlobalDataAccessor.Instance.CurrentSiteId.State;
            STORE_ZIP     = GlobalDataAccessor.Instance.CurrentSiteId.StoreZipCode;

            CustomerVO currentCust = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;

            empNo = GlobalDataAccessor.Instance.DesktopSession.UserName.ToLowerInvariant();
            //Set all the data for printing

            //Madhu 12/02/2010 fix for bug 9
            transactionDate = ShopDateTime.Instance.ShopDate.ToShortDateString();

            foreach (HoldData phdata in PoliceHoldLoans)
            {
                if (currentCust != null)
                {
                    label1CustName.Text   = currentCust.CustomerName;
                    label1CustDOB.Text    = currentCust.DateOfBirth.FormatDate();
                    labelCustAddress.Text = currentCust.CustHomeAddress;
                }
                //Madhu fix for bug 9
                //transactionDate = phdata.TransactionDate.ToShortDateString();

                labelTranDate.Text   = @"Date : " + transactionDate;
                labelStoreName.Text  = STORE_NAME;
                labelStoreAddr1.Text = STORE_ADDRESS;
                labelStoreAddr2.Text = STORE_CITY + " " + STORE_STATE + " " + STORE_ZIP;
                labelEmpNo.Text      = empNo;
                foreach (Item pItem in phdata.Items)
                {
                    tranAmt += pItem.ItemAmount;
                }
                labelTranCost.Text    = string.Format("{0:C}", tranAmt);
                labelTranNo.Text      = phdata.TicketNumber.ToString();
                labelHoldComment.Text = phdata.HoldComment;
                labelOfficerName.Text = phdata.PoliceInformation.OfficerFirstName + " " +
                                        phdata.PoliceInformation.OfficerLastName;
                labelHoldExpire.Text = phdata.ReleaseDate.ToShortDateString();
                labelReqType.Text    = phdata.PoliceInformation.RequestType;

                labelOfficerPhone.Text = Utilities.GetPhoneNumber(
                    Utilities.GetStringValue(
                        phdata.PoliceInformation.PhoneAreaCode, "")
                    + "-"
                    + Utilities.GetStringValue(phdata.PoliceInformation.PhoneNumber, ""));

                labelOfficerBadge.Text = phdata.PoliceInformation.BadgeNumber;
                labelCaseNo.Text       = phdata.PoliceInformation.CaseNumber;
                labelAgency.Text       = phdata.PoliceInformation.Agency;

                int n = 0;
                int j = 0;
                foreach (Item pawnItemData in phdata.Items)
                {
                    n++;
                    j++;
                    itemDescription.Text += j + " " + pawnItemData.TicketDescription
                                            + Environment.NewLine;
                    if (n == 3)
                    {
                        Print();
                        itemDescription.Text = "";
                        n = 0;
                    }
                }
                Print();
                PrintPDFReport(currentCust, PoliceHoldLoans);
                itemDescription.Text = "";
            }
            Application.DoEvents();
            this.Close();
        }
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            DialogResult dgr;

            checkDateOfBirth();
            if (custDateOfBirth.isValid)
            {
                checkReqFields();
                if (_isFormValid)
                {
                    bool retValue = false;
                    getFormData();
                    if (custInfoChanged())
                    {
                        /* *****
                        * ***** Skip duplicate check. Refer to Bugzilla #117
                        * ***** (http://192.168.106.16/bugzilla/show_bug.cgi?id=117)
                        * *****
                        *  //If name and dob is changed check to see if there are
                        *  //any other customers in the system with the same information
                        *  if (_nameChanged || _dobChanged)
                        *  {
                        *   if (doNameCheck())
                        *   {
                        *       //if there are duplicate customers, show the error message and let the user
                        *       //decide whether they would like to continue with the change or not
                        *           dgr = MessageBox.Show(Commons.GetMessageString("DuplicateNameMessage"), "Warning", MessageBoxButtons.YesNo);
                        *           if (dgr == DialogResult.No)
                        *               return;
                        *   }
                        *  }
                        ***** */
                        try
                        {
                            do
                            {
                                retValue = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).UpdatePersonalInfoDetails(_strTitle, _strFirstName, _strMiddleName, _strLastName, _strTitleSuffix, _strLanguage, _strDob, _strSsn, _strUserId, _partyId, out _errorCode, out _errorMsg);
                                if (retValue)
                                {
                                    MessageBox.Show("Customer information updated");
                                    CustomerVO updatedCustomer = new CustomerVO
                                    {
                                        FirstName            = _strFirstName,
                                        MiddleInitial        = _strMiddleName,
                                        LastName             = _strLastName,
                                        DateOfBirth          = _dateOfBirth,
                                        CustTitle            = _strTitle,
                                        CustTitleSuffix      = _strTitleSuffix,
                                        NegotiationLanguage  = _strLanguage,
                                        SocialSecurityNumber = _strSsn
                                    };
                                    updatedCustomer.Age = _age != 0 ? _age : _custToEdit.Age;
                                    Form ownerForm = this.Owner;
                                    if (ownerForm.GetType() == typeof(ViewCustomerInformation))
                                    {
                                        ((ViewCustomerInformation)ownerForm).UpdatedCustomerToView = updatedCustomer;
                                        ((ViewCustomerInformation)ownerForm).ShowUpdates           = true;
                                    }
                                    updatedCustomer = null;

                                    break;
                                }
                                else
                                {
                                    dgr = _errorCode.Equals("1") ? MessageBox.Show(Commons.GetMessageString("DuplicateSSNMessage"), "Warning", MessageBoxButtons.OK) : MessageBox.Show(Commons.GetMessageString("CustPersInfoUpdateFailure"), "Error", MessageBoxButtons.RetryCancel);
                                }
                            } while (dgr == DialogResult.Retry);
                            if (_errorCode.Equals("1"))
                            {
                                return;
                            }
                        }
                        catch (ApplicationException aEx)
                        {
                            //exception already handled at the oracledataaccessor level
                            MessageBox.Show(aEx.Message);
                        }
                    }
                    else
                    {
                        MessageBox.Show(Commons.GetMessageString("NoChangesInForm"));
                    }
                    this.Close();
                    this.Dispose(true);
                }
                else
                {
                    MessageBox.Show(Commons.GetMessageString("FormRequiredFieldsFilledError"));
                }
            }
            else
            {
                MessageBox.Show(Commons.GetMessageString("FormRequiredFieldsFilledError"));
            }
        }
Exemplo n.º 18
0
        private void RTCform_Load(object sender, EventArgs e)
        {
            //Populate store data
            STORE_NAME    = CashlinxDesktopSession.Instance.CurrentSiteId.StoreName;
            STORE_ADDRESS = CashlinxDesktopSession.Instance.CurrentSiteId.StoreAddress1;
            STORE_CITY    = CashlinxDesktopSession.Instance.CurrentSiteId.StoreCityName;
            STORE_STATE   = CashlinxDesktopSession.Instance.CurrentSiteId.State;
            STORE_ZIP     = CashlinxDesktopSession.Instance.CurrentSiteId.StoreZipCode;

            CustomerVO currentCust = CashlinxDesktopSession.Instance.ActiveCustomer;

            numofRTCLoans = RTCLoans.Count;
            empNo         = CashlinxDesktopSession.Instance.UserName.ToLowerInvariant();
            //Set all the data for printing
            transactionDate = ShopDateTime.Instance.ShopDate.FormatDate();

            foreach (HoldData rtcdata in RTCLoans)
            {
                if (currentCust != null)
                {
                    label1CustName.Text   = currentCust.CustomerName;
                    label1CustDOB.Text    = currentCust.DateOfBirth.FormatDate();
                    labelCustAddress.Text = currentCust.CustHomeAddress;
                }
                labelTranDate.Text       = "Date:  " + transactionDate;
                labelStoreName.Text      = STORE_NAME;
                labelStoreAddr1.Text     = STORE_ADDRESS;
                labelStoreAddr2.Text     = STORE_CITY + ", " + STORE_STATE + " " + STORE_ZIP;
                labelTktNo.Text          = rtcdata.TicketNumber.ToString();
                labelEmpNo.Text          = empNo;
                labelReleaseComment.Text = rtcdata.HoldComment;
                labelOfficerName.Text    = rtcdata.PoliceInformation.OfficerFirstName + " " +
                                           rtcdata.PoliceInformation.OfficerLastName;
                labelOfficerBadge.Text = rtcdata.PoliceInformation.BadgeNumber;
                labelOfficerPhone.Text = Utilities.GetPhoneNumber(
                    Utilities.GetStringValue(
                        rtcdata.PoliceInformation.PhoneAreaCode, "")
                    + "-"
                    + Utilities.GetStringValue(rtcdata.PoliceInformation.PhoneNumber, ""));
                // Only show dash and extension if value exists.  -DDW, 6/30/2010
                if (Utilities.GetStringValue(rtcdata.PoliceInformation.PhoneExtension, "") != "")
                {
                    labelOfficerPhone.Text += "-" + rtcdata.PoliceInformation.PhoneExtension;
                }

                //To DO: Change the following 2 fields to denote actual values when restitution is added
                labelRestitutionCollected.Text = "No";
                labelRestitutionAmt.Text       = "$0.00";

                int i = 0;
                foreach (Item pawnItemData in rtcdata.Items)
                {
                    i++;
                    itemDescription.Text += i.ToString() + " " + pawnItemData.TicketDescription
                                            + System.Environment.NewLine;
                }
                Print();
            }
            Application.DoEvents();
            this.Close();
        }
Exemplo n.º 19
0
        public void Print()
        {
            //Check if multiple loans should be printed in one memo or not
            bool printMultipleInOneMemo = GlobalDataAccessor.Instance.DesktopSession.PrintSingleMemoOfExtension;
            //Get all the data to print from the desktop session
            CustomerVO currentCust = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;

            printDocument1.PrintPage +=
                printDocument1_PrintPage;
            printDocument1.QueryPageSettings +=
                printDocument1_QueryPageSettings;
            printPreviewDialog1.Document = printDocument1;
            numofExtendLoans             = ExtensionLoans.Count;
            empNo = GlobalDataAccessor.Instance.DesktopSession.UserName.ToLowerInvariant();
            //Set all the data for printing
            transactionDate = ShopDateTime.Instance.ShopDate.FormatDate();
            transactionTime = ShopDateTime.Instance.ShopTime.Hours + ":" +
                              ShopDateTime.Instance.ShopTime.Minutes;

            foreach (PawnLoan pawnLoan in ExtensionLoans)
            {
                StringBuilder loanData = new StringBuilder();
                if (currentCust != null)
                {
                    if (pawnLoan.CustomerNumber != currentCust.CustomerNumber)
                    {
                        currentCust = CustomerProcedures.getCustomerDataByCustomerNumber(GlobalDataAccessor.Instance.DesktopSession, pawnLoan.CustomerNumber);
                    }


                    customerName = !string.IsNullOrEmpty(currentCust.MiddleInitial)
                                           ? currentCust.LastName + "," + currentCust.FirstName + "," +
                                   currentCust.MiddleInitial
                                           : currentCust.LastName + "," + currentCust.FirstName;
                    tktNo            = pawnLoan.TicketNumber.ToString().PadRight(10);
                    principalAmount  = pawnLoan.Amount.ToString().PadRight(10);
                    dailyAmount      = pawnLoan.DailyAmount;
                    dailyAmt         = string.Format("{0:C}", dailyAmount).PadRight(10);
                    prevMaturityDate = pawnLoan.DueDate.FormatDate().PadRight(20);
                    newMaturityDate  = pawnLoan.NewDueDate.FormatDate().PadRight(15);

                    lastRedeemDate      = pawnLoan.NewPfiEligible.FormatDate().PadRight(15);;
                    pawnChargePaidToday = pawnLoan.ExtensionAmount;

                    pawnChargeMaturity = pawnLoan.InterestAmount;
                    totalAtMaturity    = (amtFinanced + pawnChargeMaturity);
                    totalAmtAtMaturity = string.Format("{0:C}", totalAtMaturity).PadRight(8);
                    pawnChargeRedeem   = (Utilities.GetDecimalValue((pawnLoan.NewPfiEligible - pawnLoan.DueDate).TotalDays / 30)) * pawnLoan.InterestAmount;
                    totalAtRedeem      = amtFinanced + pawnChargeRedeem;
                    totalAmtAtRedeem   = string.Format("{0:C}", totalAtRedeem).PadRight(10);
                    loanData.Append(tktNo);
                    loanData.Append(principalAmount);
                    loanData.Append(prevMaturityDate);
                    loanData.Append(dailyAmt);
                    loanData.Append(newMaturityDate);
                    loanData.Append(totalAmtAtMaturity);
                    loanData.Append(lastRedeemDate);
                    loanData.Append(totalAmtAtRedeem);
                    loanData.Append(string.Format("{0:C}", pawnChargePaidToday));
                    if (printMultipleInOneMemo)
                    {
                        sumOfAllAmountsPaidToday += pawnChargePaidToday;
                        sumOfAllDailyAmounts     += dailyAmount;
                        sumOfAllmaturityAmounts  += totalAtMaturity;
                    }
                    else
                    {
                        sumOfAllAmountsPaidToday = pawnChargePaidToday;
                        sumOfAllDailyAmounts     = dailyAmount;
                        sumOfAllmaturityAmounts  = totalAtMaturity;
                        numofExtendLoans         = 1;
                    }


                    itemLines.Enqueue(loanData.ToString());
                    if (printMultipleInOneMemo)
                    {
                        continue;
                    }


                    printDocument1.Print();
                }
            }
            if (printMultipleInOneMemo)
            {
                printDocument1.Print();
            }
        }
        private void PoliceSeizeform_Load(object sender, EventArgs e)
        {
            //Populate store data
            STORE_NAME    = GlobalDataAccessor.Instance.CurrentSiteId.StoreName;
            STORE_ADDRESS = GlobalDataAccessor.Instance.CurrentSiteId.StoreAddress1;
            STORE_CITY    = GlobalDataAccessor.Instance.CurrentSiteId.StoreCityName;
            STORE_STATE   = GlobalDataAccessor.Instance.CurrentSiteId.State;
            STORE_ZIP     = GlobalDataAccessor.Instance.CurrentSiteId.StoreZipCode;
            CustomerVO currentCust = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;

            numofSeizeLoans = PoliceSeizeLoans.Count;
            empNo           = GlobalDataAccessor.Instance.DesktopSession.UserName.ToLowerInvariant();
            //Set all the data for printing
            transactionDate = ShopDateTime.Instance.ShopDate.FormatDate();


            foreach (HoldData seizedata in PoliceSeizeLoans)
            {
                if (currentCust != null)
                {
                    labelCustName.Text = currentCust.CustomerName;
                    var custHomeAddr = currentCust.getHomeAddress();
                    if (custHomeAddr != null)
                    {
                        labelCustAddressLine1.Text = custHomeAddr.Address1;
                        labelCustAddressLine2.Text = custHomeAddr.City + "," + custHomeAddr.State_Code + "," + custHomeAddr.ZipCode;
                    }
                    else
                    {
                        labelCustAddressLine1.Text = string.Empty;
                        labelCustAddressLine2.Text = string.Empty;
                    }
                }
                labelTranDate.Text   = "Date : " + transactionDate;
                labelStoreName.Text  = STORE_NAME;
                labelStoreAddr1.Text = STORE_ADDRESS;
                labelStoreAddr2.Text = STORE_CITY + " " + STORE_STATE + " " + STORE_ZIP;
                labelEmpNo.Text      = empNo;
                labelCaseNo.Text     = seizedata.PoliceInformation.CaseNumber;
                if (seizedata.RefType == "2")
                {
                    labelLoanNoHeading.Text = "Purchase Number:";
                }

                labelLoanNo.Text = seizedata.TicketNumber.ToString();
                labelAmt.Text    = string.Format("{0:C}", seizedata.Amount);

                if (new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).IsPartialPaymentAllowed(GlobalDataAccessor.Instance.CurrentSiteId))
                {
                    labelCurrentPrincipal.Text = String.Format("{0:C}", seizedata.CurrentPrincipalAmount);
                }
                else
                {
                    labelCurrentPrincipalHeading.Visible = false;
                    labelCurrentPrincipal.Visible        = false;
                }

                labelCurrentPrincipal.Text = string.Format("{0:C}", seizedata.CurrentPrincipalAmount);
                labelAgency.Text           = seizedata.PoliceInformation.Agency;
                labelSeizeNumber.Text      = seizedata.PoliceInformation.SeizeNumber.ToString();

                int i = 0;
                foreach (Item pawnItemData in seizedata.Items)
                {
                    i++;
                    itemDescription.Text += string.Format("{0} {1}{2}", i, pawnItemData.TicketDescription, System.Environment.NewLine);
                }
                Print();
            }
            Application.DoEvents();
            this.Close();
        }
Exemplo n.º 21
0
        private void PopulateUnboundData()
        {
            try
            {
                var loc_aisle = string.Empty;
                var loc_shelf = string.Empty;

                if (!(_thisItem[_rowNum].Row["LOC_AISLE"] is System.DBNull))
                {
                    loc_aisle = string.Format("aisle:{0} ", _thisItem[_rowNum].Row["LOC_AISLE"]);
                }

                if (!(_thisItem[_rowNum].Row["LOC_SHELF"] is System.DBNull))
                {
                    loc_shelf = string.Format("shelf:{0} ", _thisItem[_rowNum].Row["LOC_SHELF"]);
                }

                loctn.Text = string.Format("{0} {1}  {2}", loc_aisle, loc_shelf, _thisItem[_rowNum].Row["LOCATION"]);

                if (useDefaultBinding)
                {
                    return;
                }

                //-----------------------------------------------------------------------------------------------
                String icn       = _thisItem[this._rowNum]["ICN"].ToString();
                Icn    icnObject = new Icn(icn.Replace(" ", ""));

                if (icnObject.DocumentType == DocumentType.MerchandisePurchaseReceipt &&
                    _thisItem[this._rowNum]["PURCH_TYPE"].ToString() == "V")
                {
                    showingCustomerMdse = false;
                }
                else
                {
                    showingCustomerMdse = true;
                }

                if (missingCustomerVendorData && showingCustomerMdse)
                {
                    Object o = _thisItem[this._rowNum]["CUSTOMERNUMBER"];
                    if (o != System.DBNull.Value)
                    {
                        String custNumber = (String)_thisItem[this._rowNum]["CUSTOMERNUMBER"];

                        if (custNumber.Length != 0)
                        {
                            CustomerVO custObject = CustomerProcedures.getCustomerDataByCustomerNumber(GlobalDataAccessor.Instance.DesktopSession, custNumber);

                            cust_vendor_no.Text = custNumber;
                            if (custObject != null)
                            {
                                cust_name.Text = custObject.CustomerName;

                                if (custObject.CustomerIDs.Count != 0)
                                {
                                    cust_id.Text = custObject.CustomerIDs[0].IdValue;
                                }
                                else
                                {
                                    cust_id.Text = "";
                                }

                                cust_vendor_since.Text = custObject.CustomerSince.ToShortDateString();
                                cust_vendor_dob.Text   = custObject.DateOfBirth.ToShortDateString();
                            }
                        }
                    }
                    else
                    {
                        cust_vendor_no.Text    = "Unknown";
                        cust_id.Text           = "Unknown";
                        cust_name.Text         = "Unknown";
                        cust_vendor_since.Text = "Unknown";
                        cust_vendor_dob.Text   = "Unknown";

                        //CommonUI.DesktopProcedures.ProcedureUtilities..RetailProcedures.
                    }
                }
                else if (missingCustomerVendorData && !showingCustomerMdse)
                {
                    cust_vendor_no.Text    = "Unknown";
                    cust_id.Text           = "Unknown";
                    cust_name.Text         = "Unknown";
                    cust_vendor_since.Text = "Unknown";
                    cust_vendor_dob.Text   = "Unknown";

                    DataSet ds = InventoryInquiries.getVendorDataForIcn(icnObject);

                    if (!ds.IsNullOrEmpty() && ds.Tables.Contains("REVISIONS"))
                    {
                        // Get output number
                        DataTable outputDt = ds.Tables["REVISIONS"];

                        if (outputDt != null && outputDt.IsInitialized &&
                            outputDt.Rows != null && outputDt.Rows.Count > 0)
                        {
                            cust_name.Text = outputDt.Rows[0]["VENDOR_NAME"].ToString();
                            cust_id.Text   = outputDt.Rows[0]["VENDOR_ID"].ToString();
                            DateTime dt = DateTime.Parse(outputDt.Rows[0]["EFFECTIVE_DATE"].ToString());
                            cust_vendor_since.Text = dt.ToShortDateString();
                            cust_vendor_no.Text    = outputDt.Rows[0]["TAX_ID"].ToString();
                        }
                    }
                }

                if (missingMdseData)
                {
                    System.Diagnostics.Debug.Assert(false, "Missing MDSE data. Need to load from Oracle.");
                }

                if (missingPawnData)
                {
                    org_date_time.Text        = "Unknown";
                    loan_purchase_amount.Text = "Unknown";
                    status_cd.Text            = "Unknown";

                    cur_loan_nr.Text = _thisItem[this._rowNum]["TICKET_NUMBER"].ToString();

                    DataSet ds = InventoryInquiries.getMinPawnData(new Icn(icn.Replace(" ", "")));

                    if (!ds.IsNullOrEmpty() && ds.Tables.Contains("OUTPUT"))
                    {
                        //Get output number
                        DataTable outputDt = ds.Tables["OUTPUT"];

                        if (outputDt != null && outputDt.IsInitialized &&
                            outputDt.Rows != null && outputDt.Rows.Count > 0)
                        {
                            DataRow dr = outputDt.Rows[0];
                            if (dr != null && dr.ItemArray.Length > 0)
                            {
                                object o_date_made = dr.ItemArray.GetValue(1);
                                if ((String)o_date_made != "null")
                                {
                                    String   day   = o_date_made.ToString().Substring(0, 2);
                                    String   year  = o_date_made.ToString().Substring(7, 2);
                                    String   month = o_date_made.ToString().Substring(3, 3);
                                    DateTime dt    = DateTime.Parse(month + " " + day + " " + year);
                                    this.org_date_time.Text = dt.ToShortDateString();
                                }
                            }

                            dr = outputDt.Rows[1];
                            if (dr != null && dr.ItemArray.Length > 0)
                            {
                                object o_loan_amount = dr.ItemArray.GetValue(1);
                                if (o_loan_amount != null)
                                {
                                    Decimal loan = Decimal.Parse((string)o_loan_amount);
                                    this.loan_purchase_amount.Text = "$" + loan.ToString();
                                }
                            }

                            dr = outputDt.Rows[2];
                            if (dr != null && dr.ItemArray.Length > 0)
                            {
                                object o_loan_status = dr.ItemArray.GetValue(1);
                                if ((String)o_loan_status != "null")
                                {
                                    String status = (string)o_loan_status;
                                    this.status_cd.Text = status;
                                }
                            }
                        }
                    }
                    else
                    {
                        // no Pawn data, assume if it is a purchase
                        showingLoan = false;

                        //cur_loan_nr.Text = _thisItem[this._rowNum]["TICKET_NUMBER"].ToString();

                        ds = InventoryInquiries.getMinPurchaseData(new Icn(icn.Replace(" ", "")));

                        if (!ds.IsNullOrEmpty())
                        {
                            //Get output number
                            DataTable outputDt = ds.Tables["OUTPUT"];

                            if (outputDt != null && outputDt.IsInitialized &&
                                outputDt.Rows != null && outputDt.Rows.Count > 0)
                            {
                                DataRow dr = outputDt.Rows[0];
                                if (dr != null && dr.ItemArray.Length > 0)
                                {
                                    object o_date_made = dr.ItemArray.GetValue(1);
                                    if ((String)o_date_made != "null")
                                    {
                                        String   day   = o_date_made.ToString().Substring(0, 2);
                                        String   year  = o_date_made.ToString().Substring(7, 2);
                                        String   month = o_date_made.ToString().Substring(3, 3);
                                        DateTime dt    = DateTime.Parse(month + " " + day + " " + year);
                                        this.org_date_time.Text = dt.ToShortDateString();
                                    }
                                }

                                dr = outputDt.Rows[1];
                                if (dr != null && dr.ItemArray.Length > 0)
                                {
                                    object o_loan_amount = dr.ItemArray.GetValue(1);
                                    if (o_loan_amount != null)
                                    {
                                        Decimal loan = Decimal.Parse((string)o_loan_amount);
                                        this.loan_purchase_amount.Text = "$" + loan.ToString();
                                    }
                                }

                                dr = outputDt.Rows[2];
                                if (dr != null && dr.ItemArray.Length > 0)
                                {
                                    object o_loan_status = dr.ItemArray.GetValue(1);
                                    if ((String)o_loan_status != "null")
                                    {
                                        String status = (string)o_loan_status;
                                        this.status_cd.Text = status;
                                    }
                                }
                            }
                        }
                    }
                }

                if (showingCustomerMdse)
                {
                    labelCustomerVendorNumber.Text = "Customer #:";

                    labelCustomerVendorDOB.Text    = "DOB:";
                    labelCustomerVendorDOB.Visible = true;
                    cust_vendor_dob.Visible        = true;

                    labelCustomerVendorSince.Text = "Customer Since:";
                }
                else
                {
                    labelCustomerVendorNumber.Text = "Vendor #";

                    labelCustomerVendorDOB.Visible = false;
                    cust_vendor_dob.Visible        = false;

                    labelCustomerVendorSince.Text = "Vendor Since:";
                }

                if (showingLoan)
                {
                    labelLoanPurchaseAmount.Text = "Loan Amount:";
                }
                else
                {
                    labelLoanPurchaseAmount.Text = "Purchase Amount:";
                }
            }
            catch (Exception ex)
            {
                int i = 0;
            }
        }
        private void addCustomerButton_Click(object sender, EventArgs e)
        {
            string trigger = GlobalDataAccessor.Instance.DesktopSession.HistorySession.Trigger;
            //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.ADDCUSTOMER;
            //CustomerController.NavigateUser(ownerFrm);
            var newCustomer = new CustomerVO
            {
                NewCustomer = true
            };
            //get the Search criteria entered by the user
            var searchCriteria = GlobalDataAccessor.Instance.DesktopSession.ActiveLookupCriteria;

            //Get store state from desktop session
            var strStoreState = string.Empty;

            strStoreState = GlobalDataAccessor.Instance.CurrentSiteId.State;
            var newAddr = new AddressVO
            {
                State_Code         = strStoreState,
                ContactTypeCode    = CustomerAddressTypes.HOME_ADDRESS,
                ContMethodTypeCode = "POSTALADDR"
            };

            newCustomer.addAddress(newAddr);
            newCustomer.FirstName = searchCriteria.FirstName;
            newCustomer.LastName  = searchCriteria.LastName;
            if (!string.IsNullOrEmpty(searchCriteria.DOB) && searchCriteria.DOB != "mm/dd/yyyy")
            {
                newCustomer.DateOfBirth = Utilities.GetDateTimeValue(searchCriteria.DOB);
            }
            if (!string.IsNullOrEmpty(searchCriteria.IDIssuer))
            {
                var idData = new IdentificationVO
                {
                    IdIssuer     = searchCriteria.IDIssuer,
                    IdValue      = searchCriteria.IDNumber,
                    IdIssuerCode = searchCriteria.IdIssuerCode,
                    IdType       = searchCriteria.IdTypeCode
                };
                newCustomer.addIdentity(idData);
                if (!string.IsNullOrEmpty(searchCriteria.PhoneNumber))
                {
                    var phoneData = new ContactVO
                    {
                        ContactPhoneNumber = searchCriteria.PhoneNumber,
                        ContactAreaCode    = searchCriteria.PhoneAreaCode
                    };
                    newCustomer.addContact(phoneData);
                }

                newCustomer.SocialSecurityNumber = searchCriteria.SSN;
            }
            GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = newCustomer;
            if (trigger.Equals("newpawnloan", StringComparison.OrdinalIgnoreCase))
            {
                this.NavControlBox.IsCustom     = true;
                this.NavControlBox.CustomDetail = "ManagePawnApplication";
                this.NavControlBox.Action       = NavBox.NavAction.BACKANDSUBMIT;
            }
            else
            {
                this.NavControlBox.IsCustom     = true;
                this.NavControlBox.CustomDetail = "CreateCustomer";
                this.NavControlBox.Action       = NavBox.NavAction.BACKANDSUBMIT;
            }
        }
Exemplo n.º 23
0
        private void ExistingCustomer_Load(object sender, EventArgs e)
        {
            try
            {
                //set the owner form
                ownerFrm = this.Owner;
                this.NavControlBox.Owner = this;

                //Pull data out of cashlinx desktop session
                var gSess    = GlobalDataAccessor.Instance;
                var dSession = gSess.DesktopSession;
                _currentCustomer   = dSession.EXCurrentCustomer;
                _existingCustomers = dSession.EXExistingCustomers;
                if (!string.IsNullOrEmpty(dSession.EXErrorMessage))
                {
                    _strMessageToShow = dSession.EXErrorMessage;
                }
                else
                {
                    _strMessageToShow = dSession.EXMessageToShow;
                }
                _nameCheck   = dSession.EXNameCheck;
                _newCustomer = dSession.EXNewCustomer;

                //Set the message to show on top
                this.labelRedHeader.Text = Commons.GetMessageString("ExistingCustomerHeader");
                this.labelMessage.Text   = _strMessageToShow;
                //Binding new customer data
                _newCustBindingSouce = new BindingSource();
                var dataTableNewCustomer = new DataTable();
                dataTableNewCustomer.Columns.Add("LastName");
                dataTableNewCustomer.Columns.Add("FirstName");
                dataTableNewCustomer.Columns.Add("CustAddress");
                dataTableNewCustomer.Columns.Add("DateOfBirth");
                dataTableNewCustomer.Columns.Add("IDData");
                dataTableNewCustomer.Columns.Add("IssuerName");
                var newCustRow = dataTableNewCustomer.NewRow();
                newCustRow["LastName"]  = _newCustomer.LastName;
                newCustRow["FirstName"] = _newCustomer.FirstName;
                if (_newCustomer.getHomeAddress() != null)
                {
                    newCustRow["CustAddress"] = _newCustomer.getHomeAddress().CustAddress;
                }
                else
                {
                    newCustRow["CustAddress"] = string.Empty;
                }
                newCustRow["DateOfBirth"] = (_newCustomer.DateOfBirth).FormatDate();
                var custId = _newCustomer.getFirstIdentity();
                if (custId != null)
                {
                    newCustRow["IDData"]     = custId.IDData;
                    newCustRow["IssuerName"] = custId.IdIssuerCode;
                }
                else
                {
                    newCustRow["IDData"]     = string.Empty;
                    newCustRow["IssuerName"] = string.Empty;
                }

                dataTableNewCustomer.Rows.Add(newCustRow);

                _newCustBindingSouce.DataSource = dataTableNewCustomer;
                this.customDataGridViewNewCustomer.AutoGenerateColumns = false;
                int newColIndex     = 0;
                var selectNewColumn = new DataGridViewCheckBoxColumn
                {
                    HeaderText = "Select",
                    ReadOnly   = false,
                    ThreeState = false,
                    FalseValue = false
                };

                newColIndex = this.customDataGridViewNewCustomer.Columns.Add(selectNewColumn);

                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("LastName", "Last Name");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "LastName";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;


                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("FirstName", "First Name");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "FirstName";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;


                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("CustAddress", "Address");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "CustAddress";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;



                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("birthdate", "Date of Birth");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "DateOfBirth";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;


                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("IdTypeNumber", "ID Type & Number");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "IDData";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;



                newColIndex = this.customDataGridViewNewCustomer.Columns.Add("Issuer_Name", "Issuer");
                this.customDataGridViewNewCustomer.Columns[newColIndex].DataPropertyName = "IssuerName";
                this.customDataGridViewNewCustomer.Columns[newColIndex].ReadOnly         = true;


                if (_nameCheck)
                {
                    customDataGridViewNewCustomer.Columns["LastName"].DefaultCellStyle.ForeColor  = Color.Red;
                    customDataGridViewNewCustomer.Columns["FirstName"].DefaultCellStyle.ForeColor = Color.Red;
                    customDataGridViewNewCustomer.Columns["birthdate"].DefaultCellStyle.ForeColor = Color.Red;
                }
                else
                {
                    customDataGridViewNewCustomer.Columns["IdTypeNumber"].DefaultCellStyle.ForeColor = Color.Red;
                    customDataGridViewNewCustomer.Columns["Issuer_Name"].DefaultCellStyle.ForeColor  = Color.Red;
                }
                customDataGridViewNewCustomer.DataSource = _newCustBindingSouce;
                customDataGridViewNewCustomer.AutoResizeColumns();

                //Binding existing customer data
                _existingCustomers.Columns.Add("IDData");
                _existingCustomers.Columns.Add("Address");

                string idData;
                string address;
                //Concatenate the ID type and number in the ID Data field
                //Concatenate the address fields in one
                foreach (DataRow dr in _existingCustomers.Rows)
                {
                    idData = string.Format("{0}-{1}", dr["Ident_type_code"], dr["Issued_number"]);
                    dr.SetField("idData", idData);
                    string addr2 = dr["address2_text"].ToString();
                    if (addr2.Trim().Length > 0)
                    {
                        address = string.Format("{0},{1},{2},{3},{4}", dr["address1_text"], dr["address2_text"], dr["city_name"], dr["state_province_name"], dr["postal_code_text"]);
                    }
                    else
                    {
                        address = string.Format("{0},{1},{2},{3}", dr["address1_text"], dr["city_name"], dr["state_province_name"], dr["postal_code_text"]);
                    }
                    dr.SetField("Address", address);
                }
                _existingCustBindingSource = new BindingSource();
                //Add primary key to the existing customers table
                var key = new DataColumn[1];
                key[0] = _existingCustomers.Columns["customer_number"];
                _existingCustomers.PrimaryKey = key;

                _existingCustBindingSource.DataSource = _existingCustomers;
                this.customDataGridViewExistingCustomer.AutoGenerateColumns = false;
                newColIndex = 0;

                var selectColumn = new DataGridViewCheckBoxColumn
                {
                    HeaderText = "Select",
                    ReadOnly   = false,
                    ThreeState = false,
                    FalseValue = false
                };
                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add(selectColumn);
                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("family_name", "Last Name");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "family_name";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("first_name", "First Name");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "first_name";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("Address", "Address");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "Address";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("birthdate", "Date of Birth");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "birthdate";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("IdcodeNumber", "ID Type & Number");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "IDData";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                newColIndex = this.customDataGridViewExistingCustomer.Columns.Add("Issuer_Name", "Issuer");
                this.customDataGridViewExistingCustomer.Columns[newColIndex].DataPropertyName = "Issuer_Name";
                this.customDataGridViewExistingCustomer.Columns[newColIndex].ReadOnly         = true;

                if (_nameCheck)
                {
                    this.customDataGridViewExistingCustomer.Columns["family_name"].DefaultCellStyle.ForeColor = Color.Red;
                    this.customDataGridViewExistingCustomer.Columns["first_name"].DefaultCellStyle.ForeColor  = Color.Red;
                    this.customDataGridViewExistingCustomer.Columns["birthdate"].DefaultCellStyle.ForeColor   = Color.Red;
                }
                else
                {
                    this.customDataGridViewExistingCustomer.Columns["IdcodeNumber"].DefaultCellStyle.ForeColor = Color.Red;
                    this.customDataGridViewExistingCustomer.Columns["Issuer_Name"].DefaultCellStyle.ForeColor  = Color.Red;
                }

                this.customButtonContinue.Enabled = false;
                this.customDataGridViewExistingCustomer.DataSource = _existingCustBindingSource;
                this.customDataGridViewNewCustomer.ClearSelection();
                this.customDataGridViewExistingCustomer.ClearSelection();
                this.customDataGridViewExistingCustomer.AutoResizeColumns();
                this.ActiveControl = labelRedHeader;
            }
            catch (SystemException ex)
            {
                BasicExceptionHandler.Instance.AddException("Error loading the existing customer screen ", ex);
                clearCustomerSessionValues();
                this.NavControlBox.Action = NavBox.NavAction.CANCEL;
            }
        }
        private void customButtonOK_Click(object sender, EventArgs e)
        {
            labelErrorMessage.Visible = false;
            noDataFound = false;
            PurchaseVO     purchaseObj         = null;
            CustomerVO     customerObj         = null;
            SaleVO         saleObj             = null;
            LayawayVO      layawayObj          = null;
            CashTransferVO bankTransferObj     = null;
            CashTransferVO shopCashTransferObj = null;
            DataSet        mdseInfo            = null;
            string         errorCode;
            string         errorText;

            getCustomerInfo = true;
            string tenderType;

            GlobalDataAccessor.Instance.DesktopSession.Purchases = new List <PurchaseVO>();
            GlobalDataAccessor.Instance.DesktopSession.Sales     = new List <SaleVO>();
            GlobalDataAccessor.Instance.DesktopSession.Layaways  = new List <LayawayVO>();
            ReleaseFingerprintsInfo releaseFingerprintsequest = null;
            bool retValue = false;

            if (voidBuyReturn)
            {
                retValue = PurchaseProcedures.GetPurchaseData(Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                              Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "2", StateStatus.BLNK, "RET", true, out purchaseObj, out customerObj, out tenderType, out errorCode, out errorText);
            }
            else if (voidBuy)
            {
                retValue = PurchaseProcedures.GetPurchaseData(Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                              Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "2", StateStatus.BLNK, "", true, out purchaseObj, out customerObj, out tenderType, out errorCode, out errorText);
            }
            else if (voidSale)
            {
                retValue = RetailProcedures.GetSaleData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                        Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "3", StateStatus.BLNK, "SALE", false, out saleObj, out customerObj, out errorCode, out errorText);
            }
            else if (voidLayaway)
            {
                retValue = RetailProcedures.GetLayawayData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                           Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "4", StateStatus.BLNK, "ALL", false, out layawayObj, out customerObj, out errorCode, out errorText);
            }
            else if (voidSaleRefund)
            {
                retValue = RetailProcedures.GetSaleData(GlobalDataAccessor.Instance.DesktopSession, GlobalDataAccessor.Instance.OracleDA, Utilities.GetIntegerValue(GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, 0),
                                                        Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0), "3", StateStatus.BLNK, "REFUND", false, out saleObj, out customerObj, out errorCode, out errorText);
            } //BZ # 419
            else if (voidBanktoShopCashTransfer)
            {
                retValue = ShopCashProcedures.GetBankTransferDetails(customTextBoxTranNo.Text, "BANKTOSHOP", GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession,
                                                                     out bankTransferObj, out errorCode, out errorText);
            }
            else if (voidShopToBankCashTransfer)
            {
                retValue = ShopCashProcedures.GetBankTransferDetails(customTextBoxTranNo.Text, "SHOPTOBANK", GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber, GlobalDataAccessor.Instance.DesktopSession,
                                                                     out bankTransferObj, out errorCode, out errorText);
            }//BZ # 419 end

            else if (voidStoreCashTransfer)
            {
                string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                retValue = ShopCashProcedures.GetShopCashTransferData(customTextBoxTranNo.Text, "", storeNumber, GlobalDataAccessor.Instance.DesktopSession, out shopCashTransferObj, out errorCode, out errorText);
            }
            else if (voidMerchandiseTransfer)
            {
                string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                string tranNo      = customTextBoxTranNo.Text;

                if (customTextBoxTranNo.Text.Length > 6)
                {
                    tranNo = tranNo.Substring(5);
                }

                retValue = VoidProcedures.getTransferToVoid(Utilities.GetIntegerValue(tranNo, 0),
                                                            storeNumber, out mdseInfo, out errorCode, out errorText);
                //                retValue = VoidProcedures.GetEligibleToScrapItems(Utilities.GetIntegerValue(customTextBoxTranNo.Text, 0),
                //                    storeNumber, out mdse , out errorCode, out errorText);
            }
            else if (voidReleaseFingerprints)
            {
                string storeNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                string tranNo      = customTextBoxTranNo.Text;

                if (tranNo.Length > 6)
                {
                    tranNo = tranNo.Substring(5);
                }

                // Add procedure to VoidsProcedurees to Locate the Release Fingerprint Authorization
                GlobalDataAccessor.Instance.FingerPrintRelaseAuthorizationInfo =
                    HoldsProcedures.GetReleaseFingerprintAuthorization(tranNo,
                                                                       storeNumber, out errorCode, out errorText);
            }

            if (voidBuy || voidBuyReturn)
            {
                if (retValue && purchaseObj != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.Purchases.Add(purchaseObj);
                    if (purchaseObj.EntityType != "V" && customerObj != null)
                    {
                        GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;
                    }

                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    noDataFound = true;
                }
            }
            else if (voidSale || voidSaleRefund)
            {
                if (retValue && saleObj != null)
                {
                    if (saleObj.RefType == "4")
                    {
                        MessageBox.Show("This sale originated from a layaway. You have to void the last layaway payment and not the sale");
                        return;
                    }
                    GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;
                    GlobalDataAccessor.Instance.DesktopSession.Sales.Add(saleObj);
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    noDataFound = true;
                }
            }
            else if (voidLayaway)
            {
                if (retValue && layawayObj != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;
                    GlobalDataAccessor.Instance.DesktopSession.Layaways.Add(layawayObj);
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    noDataFound = true;
                }
            }
            //BZ # 419
            //else if (voidCashTransfer)
            else if (voidBanktoShopCashTransfer || voidShopToBankCashTransfer)
            {
                //BZ # 419 end
                if (retValue && bankTransferObj != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.CashTransferData = bankTransferObj;
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    noDataFound = true;
                }
            }
            else if (voidStoreCashTransfer)
            {
                if (retValue && shopCashTransferObj != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.CashTransferData = shopCashTransferObj;
                    GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                }
                else
                {
                    noDataFound = true;
                }
            }
            else if (voidMerchandiseTransfer)
            {
                if (retValue && mdseInfo != null && mdseInfo.Tables.Count > 0)
                {
                    if (isFaultyTransferINOUT(mdseInfo))
                    {
                        noDataFound = true;
                    }
                    else
                    {
                        GlobalDataAccessor.Instance.DesktopSession.MdseTransferData       = mdseInfo;
                        GlobalDataAccessor.Instance.DesktopSession.SelectedTransferNumber = customTextBoxTranNo.Text;
                        GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
                    }
                }
                else
                {
                    noDataFound = true;
                }
            }
            else if (voidReleaseFingerprints && GlobalDataAccessor.Instance.FingerPrintRelaseAuthorizationInfo != null)
            {
                this.DialogResult = DialogResult.OK;
                //GlobalDataAccessor.Instance.DesktopSession.HistorySession.Back();
            }

            if (noDataFound)
            {
                labelErrorMessage.Text    = "The number entered is not valid. Please enter another number";
                labelErrorMessage.Visible = true;
                return;
            }
        }
Exemplo n.º 25
0
        private void PickSlipPrint_Load(object sender, EventArgs e)
        {
            //Get all the data to print from the desktop session
            CustomerVO      currentCust   = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;
            List <HoldData> custHoldsData = GlobalDataAccessor.Instance.DesktopSession.HoldsData;

            userName = GlobalDataAccessor.Instance.DesktopSession.UserName.ToLowerInvariant();
            labelTransactionType.Text = PickSlipType + @" Picking Slip";
            labelEmployeeNo.Text      = userName;
            //set up the data
            if (currentCust != null && custHoldsData.Count > 0)
            {
                foreach (HoldData holdTransaction in custHoldsData)
                {
                    pageNo           = 1;
                    itemCount        = 0;
                    transactionDate  = DateTime.Now.ToString("g");//holdTransaction.TransactionDate.ToShortDateString();
                    labelPageNo.Text = "Page " + pageNo.ToString();
                    labelDate.Text   = transactionDate;
                    if (!string.IsNullOrEmpty(currentCust.MiddleInitial))
                    {
                        labelCustName.Text = currentCust.LastName + "," + currentCust.FirstName + "," + currentCust.MiddleInitial;
                    }
                    else
                    {
                        labelCustName.Text = currentCust.LastName + "," + currentCust.FirstName;
                    }

                    labelCurrentLoanNo.Text = holdTransaction.TicketNumber.ToString();
                    labelLoanAmt.Text       = String.Format("{0:C}", holdTransaction.Amount);

                    if (new BusinessRulesProcedures(GlobalDataAccessor.Instance.DesktopSession).IsPartialPaymentAllowed(GlobalDataAccessor.Instance.CurrentSiteId))
                    {
                        labelCurrentPrincipal.Text = String.Format("{0:C}", holdTransaction.CurrentPrincipalAmount);
                    }
                    else
                    {
                        labelCurrentPrincipalHeading.Visible = false;
                        labelCurrentPrincipal.Visible        = false;
                    }

                    labelorigLoanNo.Text     = holdTransaction.OrigTicketNumber.ToString();
                    labelPreviousLoanNo.Text = holdTransaction.PrevTicketNumber.ToString();

                    //item description of all items for this ticket
                    int      rowNum      = 0;
                    HoldData transaction = holdTransaction;
                    var      items       =
                        holdTransaction.Items.Where(
                            itemdata => itemdata.mDocNumber == transaction.OrigTicketNumber);
                    int pageNumberCount = 0;
                    if (items.Count() > 0)
                    {
                        tableLayoutPanelItemData.Controls.Clear();
                        tableLayoutPanelItemData.Height = 0;

                        foreach (Item transactionItem in items)
                        {
                            PickSlipPrintControl slipControl = new PickSlipPrintControl();
                            itemCount = itemCount + 1;
                            slipControl.ItemNumber      = itemCount;
                            slipControl.ItemDescription = transactionItem.TicketDescription.ToString();
                            if (transactionItem.GunNumber > 0)
                            {
                                slipControl.GunNumber = transactionItem.GunNumber.ToString();
                            }
                            if (transactionItem.Location_Aisle != string.Empty)
                            {
                                slipControl.ItemLocationAisle = transactionItem.Location_Aisle.ToString();
                            }
                            if (transactionItem.Location_Shelf != string.Empty)
                            {
                                slipControl.ItemLocationShelf = transactionItem.Location_Shelf.ToString();
                            }
                            if (transactionItem.Location != string.Empty)
                            {
                                slipControl.ItemLocationOther = transactionItem.Location.ToString();
                            }

                            //tableLayoutPanelItemData.Controls.Add(slipControl, 0, rowNum);
                            int gapDifference = pageFooterMarkerLabel.Top - tableLayoutPanelItemData.Bottom;
                            if (gapDifference < slipControl.Height)
                            {
                                //tableLayoutPanelItemData.Controls.Remove(slipControl);
                                rowNum = 0;
                                pageNumberCount++;
                                labelPageNo.Text = "Page " + pageNumberCount;
                                Print();
                                tableLayoutPanelItemData.Controls.Clear();
                                tableLayoutPanelItemData.Controls.Add(slipControl, 0, rowNum);
                                rowNum++;
                            }
                            else
                            {
                                tableLayoutPanelItemData.Controls.Add(slipControl, 0, rowNum);
                                rowNum++;
                            }
                        }
                    }
                    if (rowNum > 0)
                    {
                        pageNumberCount++;
                        labelPageNo.Text = "Page " + pageNumberCount;
                        Print();
                        tableLayoutPanelItemData.Controls.Clear();
                    }
                }
                Application.DoEvents();
            }
            this.Close();
        }
        private void submitForm()
        {
            validateForm();

            if (isFormValid)
            {
                bool         returnValue = false;
                DialogResult dgr         = DialogResult.Retry;

                CustomerVO currentCustomer = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;

                string currDate     = ShopDateTime.Instance.ShopDate.FormatDate();
                string currDateTime = currDate + " " + ShopDateTime.Instance.ShopTime.ToString();

                ReleaseFingerprintsInfo releaseFingerprintsInfo = new ReleaseFingerprintsInfo()
                {
                    RefType =
                        GlobalDataAccessor.Instance.DesktopSession
                        .TicketTypeLookedUp == ProductType.BUY
                                                                                  ? "2"
                                                                                  : "1",
                    RefNumber =
                        GlobalDataAccessor.Instance.DesktopSession
                        .TicketLookedUp,
                    Comment     = CommentText.Text,
                    StoreNumber =
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreNumber,
                    SubpoenaNumber   = SubpoenaNumberText.Text,
                    OfficerFirstName = OfficerFirstNameText.Text,
                    OfficerLastName  = OfficerLastNameText.Text,
                    BadgeNumber      = BadgeNumberText.Text,
                    CaseNumber       = CaseNumberText.Text,
                    Agency           = AgencyText.Text,
                    TransactionDate  = currDateTime,
                    SeizeStatus      = "FPRNT"
                };

                do
                {
                    int seizeNumber = 0;

                    returnValue = HoldsProcedures.AddReleaseFingerprints(releaseFingerprintsInfo,
                                                                         out seizeNumber);

                    if (returnValue && seizeNumber > 0)
                    {
                        MessageBox.Show("Transaction completed successfully");
                        //Print release fingerprints document

                        //Print authorization to release fingerprints form
                        printAuthorizationToReleaseFingerprints(releaseFingerprintsInfo, currentCustomer, seizeNumber);

                        break;
                    }
                    dgr = MessageBox.Show(Commons.GetMessageString("ProcessingError"), "Error",
                                          MessageBoxButtons.RetryCancel);
                } while (dgr == DialogResult.Retry);

                this.NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT;
            }
            else
            {
                //Set background color to yellow for any required controls that are empty.
                this.Controls.OfType <CustomTextBox>()
                .Where(r => r.Required)
                .Where(t => !t.isValid).ToList()
                .ForEach(control => control.BackColor = Color.Yellow);
            }
        }
        private void LookupTicketResults_Load(object sender, EventArgs e)
        {
            _ownerfrm           = Owner;
            NavControlBox.Owner = this;
            //Show customer data using the customer object stored in session
            CustomerVO custdata = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer;

            if (custdata != null)
            {
                customDataGridViewTicketResults.Rows.Add(1);
                customDataGridViewTicketResults.Rows[0].Cells["custlastname"].Value  = custdata.LastName;
                customDataGridViewTicketResults.Rows[0].Cells["custfirstname"].Value = custdata.FirstName;
                customDataGridViewTicketResults.Rows[0].Cells["dob"].Value           = custdata.DateOfBirth.FormatDate();
                AddressVO custAddr = custdata.getHomeAddress();
                if (custAddr != null)
                {
                    customDataGridViewTicketResults.Rows[0].Cells["address"].Value = custAddr.Address1 + " " +
                                                                                     custAddr.UnitNum + " " + custAddr.City + "," + custAddr.State_Code + " " +
                                                                                     custAddr.ZipCode;
                }
                IdentificationVO currentId = custdata.getIdentity(0);
                if (GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp == ProductType.LAYAWAY)
                {
                    customDataGridViewTicketResults.Rows[0].Cells["IDData"].Value = currentId.IdType + "-" +
                                                                                    currentId.IdIssuer + "-" + currentId.IdValue;

                    //Get the layaway from session to get the ticket number
                    List <LayawayVO> layaway = GlobalDataAccessor.Instance.DesktopSession.Layaways;
                    var tktNumber            = string.Empty;
                    if (layaway != null)
                    {
                        LayawayVO layawayObj = layaway.First();
                        if (layawayObj != null)
                        {
                            tktNumber = layawayObj.TicketNumber.ToString();
                        }
                    }
                    tktNumberLabel.Text = tktNumber;
                }
                else
                {
                    //Get ID data from the pawn app object
                    List <PawnAppVO> pawnApplications = GlobalDataAccessor.Instance.DesktopSession.PawnApplications;
                    long             pawnAppId;
                    try
                    {
                        pawnAppId = Convert.ToInt64(GlobalDataAccessor.Instance.DesktopSession.CurPawnAppId);
                    }
                    catch (Exception)
                    {
                        pawnAppId = 0;
                    }
                    if (pawnAppId != 0 && pawnApplications != null)
                    {
                        PawnAppVO pawnApplication = pawnApplications.First
                                                        (papp => papp.PawnAppID == pawnAppId);
                        if (pawnApplication != null)
                        {
                            customDataGridViewTicketResults.Rows[0].Cells["IDData"].Value = pawnApplication.PawnAppCustIDType + "-" +
                                                                                            pawnApplication.PawnAppCustIDIssuer + "-" + pawnApplication.PawnAppCustIDNumber;
                        }

                        //Get the pawn loan from session to get the ticket number
                        //Only 1 pawn loan for this application id
                        List <PawnLoan> pawnLoans = GlobalDataAccessor.Instance.DesktopSession.PawnLoans;
                        var             tktNumber = string.Empty;
                        if (pawnLoans != null)
                        {
                            PawnLoan pawnLoanObj = pawnLoans.First
                                                       (ploan => ploan.PawnAppId == pawnAppId.ToString());
                            if (pawnLoanObj != null)
                            {
                                tktNumber = pawnLoanObj.TicketNumber.ToString();
                            }
                        }
                        tktNumberLabel.Text = tktNumber;
                    }
                    else
                    {
                        BasicExceptionHandler.Instance.AddException("Pawn Application Data is not found in Lookup Ticket Results ", new ApplicationException());
                        NavControlBox.Action = NavBox.NavAction.CANCEL;
                    }
                }
            }
            else
            {
                BasicExceptionHandler.Instance.AddException("Customer object is missing in session ", new ApplicationException());
                //NavControlBox.Action = NavBox.NavAction.CANCEL;
            }
        }
        private void printAuthorizationToReleaseFingerprints(ReleaseFingerprintsInfo releaseFingerprintsInfo, CustomerVO currentCustomer, int seizeNumber)
        {
            //Call print Police seize form if print is enabled
            if (SecurityAccessor.Instance.EncryptConfig.ClientConfig.ClientConfiguration.PrintEnabled)
            {
                var address = currentCustomer.getHomeAddress();

                var releaseFingerprintsContext = new Reports.AuthorizationToReleaseFingerprints.
                                                 ReleaseFingerprintsContext()
                {
                    EmployeeNumber =
                        GlobalDataAccessor.Instance.DesktopSession.
                        UserName,
                    ShopName =
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreName,
                    ShopAddress =
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreAddress1 + " " +
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreAddress2,
                    ShopCity =
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreCityName,
                    ShopState =
                        GlobalDataAccessor.Instance.CurrentSiteId.State,
                    ShopZipCode =
                        GlobalDataAccessor.Instance.CurrentSiteId.
                        StoreZipCode,
                    CustomerName        = currentCustomer.CustomerName,
                    CustomerAddress1    = address.Address1,
                    CustomerAddress2    = address.Address2,
                    CustomerCity        = address.City,
                    CustomerState       = address.State_Code,
                    CustomerAddressUnit = address.UnitNum,
                    CustomerZipCode     = address.ZipCode,
                    TicketNumber        = releaseFingerprintsInfo.RefNumber,
                    Agency         = releaseFingerprintsInfo.Agency,
                    CaseNumber     = releaseFingerprintsInfo.CaseNumber,
                    SubpoenaNumber =
                        releaseFingerprintsInfo.SubpoenaNumber,
                    OfficerName =
                        releaseFingerprintsInfo.OfficerFirstName + " " +
                        releaseFingerprintsInfo.OfficerLastName,
                    BadgeNumber     = releaseFingerprintsInfo.BadgeNumber,
                    TransactionDate = releaseFingerprintsInfo.TransactionDate,
                    OutputPath      =
                        SecurityAccessor.Instance.EncryptConfig.
                        ClientConfig.GlobalConfiguration.
                        BaseLogPath +
                        "\\AuthorizationToReleaseFingerprints_" +
                        DateTime.Now.ToString("MMddyyyyhhmmssFFFFFFF") +
                        ".pdf"
                };

                var authorizationToReleaseFingerprints = new AuthorizationToReleaseFingerprints(
                    seizeNumber, GlobalDataAccessor.Instance.DesktopSession.TicketTypeLookedUp,
                    releaseFingerprintsContext, null);

                authorizationToReleaseFingerprints.Print();

                string strReturnMessage =
                    PrintingUtilities.printDocument(
                        releaseFingerprintsContext.OutputPath,
                        GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.IPAddress,
                        GlobalDataAccessor.Instance.DesktopSession.LaserPrinter.Port, 2);
                if (!strReturnMessage.Contains("SUCCESS"))
                {
                    FileLogger.Instance.logMessage(LogLevel.ERROR, this,
                                                   "Authorization to release fingerprints : " +
                                                   strReturnMessage);
                }

                //---------------------------------------------------
                // Place document into couch
                var filePath = releaseFingerprintsContext.OutputPath;
                //authorizationToReleaseFingerprints.Save(policeCardFilePath);

                var pDoc = new CouchDbUtils.PawnDocInfo();
                var dA   = GlobalDataAccessor.Instance.OracleDA;
                var cC   = GlobalDataAccessor.Instance.CouchDBConnector;
                //Set document add calls
                pDoc.UseCurrentShopDateTime = true;
                pDoc.SetDocumentSearchType(CouchDbUtils.DocSearchType.POLICE_CARD);
                pDoc.StoreNumber    = GlobalDataAccessor.Instance.DesktopSession.CurrentSiteId.StoreNumber;
                pDoc.CustomerNumber = GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer.CustomerNumber;
                pDoc.TicketNumber   = seizeNumber;
                pDoc.DocumentType   = Common.Libraries.Objects.Doc.Document.DocTypeNames.PDF;
                pDoc.DocFileName    = filePath;
                //Add this document to the pawn document registry and document storage
                string errText;
                if (!CouchDbUtils.AddPawnDocument(dA, cC, GlobalDataAccessor.Instance.DesktopSession.UserName, ref pDoc, out errText))
                {
                    if (FileLogger.Instance.IsLogError)
                    {
                        FileLogger.Instance.logMessage(LogLevel.ERROR, this,
                                                       "Could not store release authorization to release fingerprints document in document storage: {0} - FileName: {1}", errText, filePath);
                    }

                    BasicExceptionHandler.Instance.AddException(
                        "Could not store police card document in document storage",
                        new ApplicationException("Could not store authorization to release fingerprints document in document storage: " + errText));
                }
            }
        }
        public void BuildDocument(string ticketNumber /*PawnLoan pawnLoan*/, List <Common.Libraries.Objects.Business.Item> listItems, CustomerVO customerInfo, string storeName, AddressVO selectedCustomerAddress, KeyValuePair <string, string> lastIdUsed, DateTime statusDateTime, Boolean isLoan)
        {
            var pageNumber = 1;

            // Emulation specific control codes to force the police card to fit on 3x5.
            Document.AddPrinterCode(PrinterCode.LineDensity8Dpi);
            Document.AddPrinterCode(PrinterCode.HorizontalSpacing171Cpi);

            foreach (var item in listItems)
            {
                var mdls     = new MerchandiseDescriptionLineSeparator(8, RightColumnWidth);
                var descRows = mdls.SplitIntoRows(item.TicketDescription);

                // -------------------------------------------------------------
                var row = Document.CreateNewRow();
                row.WriteText("NAME OF CUSTOMER", LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("SERIAL NUMBER", RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();

                row.WriteText(customerInfo.LastName + ", " + customerInfo.FirstName + " " + customerInfo.MiddleInitial,
                              LeftColumnWidth, RawTextFlags.ForceUpper);

                row.WriteText(HorizontalSeparatorValue);
                var serialNumber = string.Empty;
                if (item.QuickInformation.SerialNumber != null)
                {
                    serialNumber = item.QuickInformation.SerialNumber;
                }
                row.WriteText(serialNumber, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteRepeatingText(VerticalSeparatorValue, 45);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 28);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("CUSTOMER SIGNATURE", LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("ITEM", RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText(string.Empty, LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(item.CategoryDescription, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteRepeatingText(VerticalSeparatorValue, 45);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 28);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("ADDRESS", LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("DESIGN / MODEL / MAKE / CAL /", RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText(selectedCustomerAddress.Address1 + " " + selectedCustomerAddress.Address2 + " " + selectedCustomerAddress.UnitNum, LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("         SIZE / DESC.", RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteRepeatingText(VerticalSeparatorValue, 27);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 10);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 6);
                row.WriteText(IntersectingSeparatorValue);

                row = Document.CreateNewRow();
                row.WriteText("CITY - STATE - ZIP", 27);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("DOB", 9);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("EYES", 5);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(descRows.Length >= 1 ? descRows[0].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                var city = selectedCustomerAddress.City;
                if (city.Length > 17)
                {
                    city = city.Substring(0, 17);
                }
                row.WriteText(city + ", " + selectedCustomerAddress.State_Code + selectedCustomerAddress.ZipCode, 27);

                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.DateOfBirth.ToString("MM/dd/yy"), 9);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.EyeColor, 5);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(descRows.Length >= 2 ? descRows[1].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteRepeatingText(VerticalSeparatorValue, 6);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 7);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 12);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 7);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 2);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteRepeatingText(VerticalSeparatorValue, 6);
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText(" ");
                //MDSE Desc Line 3
                row.WriteText(descRows.Length >= 3 ? descRows[2].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("SEX", 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("HEIGHT", 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("WEIGHT", 11);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("HAIR", 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("ORIGIN", 8);
                row.WriteText(HorizontalSeparatorValue);
                //MDSE Desc Line 4
                row.WriteText(descRows.Length >= 4 ? descRows[3].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText(customerInfo.Gender, 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.Height, 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.Weight.ToString(), 11, RawTextFlags.Right);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.HairColor, 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(customerInfo.Race, 8);
                row.WriteText(HorizontalSeparatorValue);
                //MDSE Desc Line 5
                row.WriteText(descRows.Length >= 5 ? descRows[4].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("---------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText(" ");
                //MDSE Desc Line 6
                row.WriteText(descRows.Length >= 6 ? descRows[5].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("IDENTIFICATION TYPE DR LIC OR VALID PHOTO ID", LeftColumnWidth);
                row.WriteText(HorizontalSeparatorValue);
                //MDSE Desc Line 7
                row.WriteText(descRows.Length >= 7 ? descRows[6].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                //row.WriteText("DL-NV-2000407563", LeftColumnWidth);

                var id     = customerInfo.getIdByTypeandIssuer(lastIdUsed.Key, lastIdUsed.Value);
                var idLine = string.Empty;
                if (id != null)
                {
                    idLine = id.IdType + "-" + id.IdIssuerCode + "-" + id.IdValue;
                    if (idLine.Length > LeftColumnWidth)
                    {
                        idLine.Substring(0, LeftColumnWidth - 1);
                    }
                }
                row.WriteText(idLine, LeftColumnWidth);

                row.WriteText(HorizontalSeparatorValue);
                //MDSE Desc Line 8
                row.WriteText(descRows.Length >= 8 ? descRows[7].Trim() : string.Empty, RightColumnWidth);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("--");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("--------------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("--------------");

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("CONS", 7);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("TRADE", 6);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("PURC", 5);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("PAWN", 5);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("TICKET NO.", 11);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("DATE & TIME", 16);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText("LOAN AMOUNT", 11);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText(string.Empty, 7);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(string.Empty, 6);
                row.WriteText(HorizontalSeparatorValue);
                if (!isLoan)
                {
                    row.WriteText("X", 5);
                }
                else
                {
                    row.WriteText(string.Empty, 5);
                }
                row.WriteText(HorizontalSeparatorValue);
                if (isLoan)
                {
                    row.WriteText("X", 5);
                }
                else
                {
                    row.WriteText(string.Empty, 5);
                }

                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(ticketNumber, 11);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(statusDateTime.ToString("MM/dd/yy HH:mm"), 16);
                row.WriteText(HorizontalSeparatorValue);
                row.WriteText(String.Format("{0:0.00}", item.ItemAmount), 11);

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("-------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("------------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("-----------------");
                row.WriteText(IntersectingSeparatorValue);
                row.WriteText("--------------");

                // -------------------------------------------------------------
                row = Document.CreateNewRow();
                row.WriteText(storeName, 45);
                row.WriteText("PAGE " + pageNumber + " OF " + listItems.Count, 30, RawTextFlags.Right);

                // -------------------------------------------------------------
                for (var blankRowCount = 0; blankRowCount < 2; blankRowCount++) //25
                {
                    row = Document.CreateNewRow();
                    row.WriteText(string.Empty);
                }

                /*
                 * for (var blankRowCount = 0; blankRowCount < 5; blankRowCount++)
                 * {
                 *  row = Document.CreateNewRow();
                 *  row.WriteText(PrinterCode.FormFeed.ToString() + " ");
                 * }
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED1");
                 * row = Document.CreateNewRow();
                 * row.WriteText("123456789012345678901234567890123456789012345678901234567890123456789012345678\f");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED2");
                 * row = Document.CreateNewRow();
                 * row.WriteText("                                                                              \f");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED3");
                 * row = Document.CreateNewRow();
                 * row.WriteText("/f");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED4");
                 * row = Document.CreateNewRow();
                 * row.WriteText("<FF>");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED5");
                 * row = Document.CreateNewRow();
                 * row.WriteText('\xC'.ToString());
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED6");
                 * row = Document.CreateNewRow();
                 * row.WriteText('\f'.ToString());
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED7");
                 * row = Document.CreateNewRow();
                 * var pc = new PrinterCode("<CSI>");
                 * row.WriteText(pc.NonMtplSequence+"\f");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED8");
                 * row = Document.CreateNewRow();
                 * row.WriteText(pc.MtplSequence + "\f");
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED9");
                 *
                 * row.WriteText(pc.NonMtplSequence + '\xC'.ToString());
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED10");
                 * row = Document.CreateNewRow();
                 * row.WriteText(pc.MtplSequence + '\xC'.ToString());
                 * row = Document.CreateNewRow();
                 * row.WriteText("ED11");
                 */
                // -------------------------------------------------------------
                pageNumber++;
            }
        }
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            bool newCustCreated = false;
            var  partyId        = string.Empty;
            var  custNumber     = string.Empty;
            bool updatePhysData = false;

            if (isFormValid())
            {
                getFormData();
                if (string.IsNullOrEmpty(CustToView.PartyId) || physDescDataChanged())
                {
                    _strUserId      = GlobalDataAccessor.Instance.DesktopSession.UserName;
                    _strStoreNumber = GlobalDataAccessor.Instance.CurrentSiteId.StoreNumber;
                    _strCustNumber  = CustToView.CustomerNumber;

                    DateTime     noteDate  = ShopDateTime.Instance.ShopDate;
                    DialogResult dgr       = DialogResult.Retry;
                    bool         retVal    = false;
                    var          errorDesc = string.Empty;
                    //The following is true when this form is called in the Manage customer use case
                    if (CustToView.PartyId == string.Empty)
                    {
                        do
                        {
                            retVal = CustomerProcedures.AddCustomer(GlobalDataAccessor.Instance.DesktopSession, CustToView, _strUserId, _strStoreNumber, out custNumber, out partyId, out errorDesc);
                            if (retVal)
                            {
                                break;
                            }
                            else
                            {
                                dgr = MessageBox.Show(Commons.GetMessageString("CustDataAddFailure"), "Error", MessageBoxButtons.RetryCancel);
                            }
                        }while (dgr == DialogResult.Retry);

                        if (retVal)
                        {
                            newCustCreated            = true;
                            _strCustNumber            = custNumber;
                            CustToView.CustomerNumber = _strCustNumber;
                            CustToView.PartyId        = partyId;
                            do
                            {
                                retVal = CustomerProcedures.AddCustomerAddress(GlobalDataAccessor.Instance.DesktopSession, CustToView, _strUserId, _strStoreNumber);
                                if (retVal)
                                {
                                    break;
                                }
                                else
                                {
                                    dgr = MessageBox.Show(Commons.GetMessageString("CustDataAddFailure"), "Error", MessageBoxButtons.RetryCancel);
                                }
                            }while (dgr == DialogResult.Retry);
                        }
                        else
                        {
                            //the call to add customer failed and the user pressed cancel when asked
                            //if they would like to keep trying so go to desktop
                            //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.CANCEL;
                            //CustomerController.NavigateUser(ownerFrm);
                            NavControlBox.Action = NavBox.NavAction.CANCEL;
                        }
                    }
                    else
                    {
                        retVal = true;
                    }

                    if (retVal)
                    {
                        do
                        {
                            updatePhysData = new CustomerDBProcedures(GlobalDataAccessor.Instance.DesktopSession).UpdateCustPhysicalDescription(_strRace, _strGender, _strHairColor, _strEyeColor, _strHeight,
                                                                                                                                                _strWeight, _strUserId, CustToView.PartyId, _strCustNumber, _strOthers, _strContactProductNoteId,
                                                                                                                                                _strStoreNumber, out _strNewContactProductNoteId, out _errorCode, out _errorMsg);
                            if (updatePhysData)
                            {
                                Form ownerForm = this.Owner;
                                if (ownerForm.GetType() == typeof(ViewCustomerInformation))
                                {
                                    CustomerVO updatedCustomer = new CustomerVO();
                                    updatedCustomer.addNotes(CustToView.getPhysicalDescNote());
                                    updatedCustomer.Race      = _strRace;
                                    updatedCustomer.Gender    = _strGender;
                                    updatedCustomer.HairColor = _strHairColor;
                                    updatedCustomer.EyeColor  = _strEyeColor;
                                    updatedCustomer.Height    = _strHeight;
                                    if (_strNewContactProductNoteId.Equals(string.Empty))
                                    {
                                        _strNewContactProductNoteId = _strContactProductNoteId;
                                    }
                                    try
                                    {
                                        updatedCustomer.Weight = Convert.ToInt32(_strWeight);
                                    }
                                    catch (Exception)
                                    {
                                        updatedCustomer.Weight = 0;
                                    }
                                    updatedCustomer.updatePhysicalDescNote(_strOthers, _strStoreNumber, noteDate, _strUserId, _strNewContactProductNoteId);

                                    ((ViewCustomerInformation)ownerForm).UpdatedCustomerToView = updatedCustomer;
                                    ((ViewCustomerInformation)ownerForm).ShowUpdates           = true;
                                }
                                break;
                            }
                            else
                            {
                                dgr = MessageBox.Show(Commons.GetMessageString("CustPhysicalDescUpdateFailure"), "Error", MessageBoxButtons.RetryCancel);
                            }
                        }while (dgr == DialogResult.Retry);
                    }
                    else
                    {
                        //Adding customer address was a failure and the user pressed cancel when asked
                        //if they would like to retry so take them to desktop
                        //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.CANCEL;
                        //CustomerController.NavigateUser(ownerFrm);
                        NavControlBox.Action = NavBox.NavAction.CANCEL;
                    }
                }
                else if (CustToView.PartyId != string.Empty)
                {
                    MessageBox.Show(Commons.GetMessageString("NoChangesInForm"));
                }
            }
            else
            {
                MessageBox.Show(Commons.GetMessageString("FormRequiredFieldsFilledError"));
                return;
            }
            if (newCustCreated)
            {
                MessageBox.Show(Commons.GetMessageString("CustCreationSuccess") + " " + custNumber);
                CustomerVO customerObj = CustomerProcedures.getCustomerDataByCustomerNumber(GlobalDataAccessor.Instance.DesktopSession, custNumber);
                if (customerObj != null)
                {
                    GlobalDataAccessor.Instance.DesktopSession.ActiveCustomer = customerObj;
                }
                //CashlinxDesktopSession.Instance.FormState = CashlinxDesktopSession.CustomerFormStates.ADDCUSTOMERCOMPLETE;
                //CustomerController.NavigateUser(ownerFrm);
                NavControlBox.Action = NavBox.NavAction.BACKANDSUBMIT;
            }
            else
            {
                if (updatePhysData)
                {
                    MessageBox.Show("Physical details updated");
                }
                this.Close();
                this.Dispose(true);
            }
        }