public CustomerMatchInfoDetails GetCustomerMatchDetails(int customerId, SuppressionOptions suppressionOptions)
        {
            CustomerMatchInfoDetails      customerMatchInfoDetails = new CustomerMatchInfoDetails();
            KeyValuePair <string, string> keyValuePair             = new KeyValuePair <string, string>("PKEY", customerId.ToString());

            CustomerInfoDetails customerInfo = _customerDetailsDataAccess.GetCustomerDetails(keyValuePair, AddressType.Correspondence, suppressionOptions);

            var keys = _customerDetailsDataAccess.GetCustomerAllIndexKeys("PKEY", customerId.ToString(), "All");

            customerMatchInfoDetails.Title        = customerInfo.Title;
            customerMatchInfoDetails.FirstName    = customerInfo.FirstName;
            customerMatchInfoDetails.Surname      = customerInfo.Surname;
            customerMatchInfoDetails.Dob          = customerInfo.Dob;
            customerMatchInfoDetails.EmailAddress = customerInfo.Email;
            customerMatchInfoDetails.Homephone    = customerInfo.HomePhone;
            customerMatchInfoDetails.MobilePhone  = customerInfo.MobilePhone;
            customerMatchInfoDetails.SmsPhone     = customerInfo.SmsPhone;
            customerMatchInfoDetails.Address      = customerInfo.FullAddress;
            customerMatchInfoDetails.Postcode     = ((CorrespondenceAddress)customerInfo.Address).Postcode;
            var firstOrDefault = keys.FirstOrDefault(x => x.SourceKey == "NUME");

            if (firstOrDefault != null)
            {
                customerMatchInfoDetails.NumeroId = firstOrDefault.Keys;
            }
            var customerIndexResult = keys.FirstOrDefault(x => x.SourceKey == "TARS");

            if (customerIndexResult != null)
            {
                customerMatchInfoDetails.TaurusId = customerIndexResult.Keys;
            }
            return(customerMatchInfoDetails);
        }
Esempio n. 2
0
        public void SellerEntry(string billNo, decimal sumTotal, CustomerInfoDetails custInfo)
        {
            var database       = new InventoryEntities();
            var billTypeIDList = (from c in database.BillTypes
                                  where c.BillTypeName == "Cash"
                                  select new
            {
                c.BillTypeID
            }).FirstOrDefault();

            var custInfoTable = new CustomerInfo();
            var billInfoTable = new BillInfo();

            custInfoTable.CustomerName    = custInfo.custName;
            custInfoTable.CustomerAddress = custInfo.custAddress;
            custInfoTable.Mobile          = custInfo.custMobile;
            custInfoTable.Email           = custInfo.custEmail;
            database.CustomerInfoes.Add(custInfoTable);


            billInfoTable.BillNumber   = billNo;
            billInfoTable.BillTypeID   = billTypeIDList.BillTypeID;//Cash or Credit Bill
            billInfoTable.TotalAmount  = sumTotal;
            billInfoTable.Discount     = custInfo.custDiscount;
            billInfoTable.BillDate     = custInfo.billDate;
            billInfoTable.UpdatedOn    = DateTime.Now;
            billInfoTable.CustomerInfo = custInfoTable;
            //database.CustomerInfoes.Add(custInfoTable);
            database.BillInfoes.Add(billInfoTable);
            database.SaveChanges();
        }
Esempio n. 3
0
 public void CallBackFromReport(string billno, CustomerBillData cusBill, CustomerInfoDetails custInfo, ProductSale prodSale)
 {
     //MessageBox.Show("Please enter First Name!" + billno);
     customerBillData    = cusBill;
     customerInfoDetails = custInfo;
     ProductFinalSale(billno);
     prodSale.dataGridViewSale.Rows.Clear();
 }
Esempio n. 4
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            decimal discount;

            if (txtDiscount.Text.Trim() == "")
            {
                discount = 0;
            }
            else
            {
                discount = Convert.ToDecimal(txtDiscount.Text.Trim());
            }
            if (txtCustomerName.Text.Trim() == "" || ControlValidation.IsReserveWord(txtCustomerName.Text.Trim().ToLower()))
            {
                lblError.Text      = "Please Enter Customer Name";
                lblError.ForeColor = Color.Red;
            }
            else
            {
                var custDetails = new CustomerInfoDetails();
                if (txtAddress.Text == "" || ControlValidation.IsReserveWord(txtAddress.Text.Trim().ToLower()))
                {
                    custDetails.custAddress = "XXXX";
                }
                else
                {
                    custDetails.custAddress = txtAddress.Text;
                }
                custDetails.custName     = txtCustomerName.Text;
                custDetails.custMobile   = "9999999999";
                custDetails.custEmail    = "*****@*****.**";
                custDetails.billDate     = dateTimeBillDate.Value.Date;
                custDetails.custDiscount = discount;
                this.Hide();
                if (sellerEntry == 1)
                {
                    this.Hide();
                    var stockEntry = new StockEntry();
                    stockEntry.CalllbackFromCustDetails(_glStockEntry, custDetails, _billnumber);
                    this.Close();
                }
                else
                {
                    CustomerBillForm cust = new CustomerBillForm(productSale);
                    cust.showBill(custBillInfoData, custDetails);
                    cust.ShowDialog(this);
                    this.Close();
                }
            }
        }
Esempio n. 5
0
        public object Process(KeyValueParameter keyValueParameter)
        {
            KeyValueParameter _parameter = keyValueParameter;

            NoAccessToCustomerDetails message = new NoAccessToCustomerDetails();

            if (_parameter.AccessControl.ModuleAccess.Find(x => x.HasAccess && x.Key == GroupCode.GCUST) == null)
            {
                message.Message = "You dont' have access for CustomerDetails data.";
                return(message);
            }

            CustomerInfoDetails customerInfoDetails =
                _customerDetailsService.GetCustomerDetail(
                    new KeyValuePair <string, string>(_parameter.KeyValue.Key, _parameter.KeyValue.Value),
                    _parameter.ReturnMe.CustomerDetails.AddressType.Value,
                    _parameter.SuppressionOptions
                    );

            return(customerInfoDetails);
        }
Esempio n. 6
0
        public void showBill(CustomerBillData cusBill, CustomerInfoDetails custInfo)
        {
            customerBillData    = cusBill;
            customerInfoDetails = custInfo;
            rs.Name             = "DataSetCustBillProd";
            rs.Value            = cusBill.billData;
            _billNo             = cusBill.billNo;

            this.reportViewerCustBill.LocalReport.DataSources.Clear();
            this.reportViewerCustBill.LocalReport.DataSources.Add(rs);
            this.reportViewerCustBill.LocalReport.ReportEmbeddedResource = "RawForms.Reports.CustomerBill.rdlc";

            rp.Add(new ReportParameter("gstNumber", cusBill.gstn));
            rp.Add(new ReportParameter("custName", custInfo.custName));
            rp.Add(new ReportParameter("custAddress", custInfo.custAddress));
            rp.Add(new ReportParameter("billDate", custInfo.billDate.ToString("dd-MM-yyyy")));
            rp.Add(new ReportParameter("billNumber", cusBill.billNo));
            rp.Add(new ReportParameter("shopName", cusBill.shopName));
            rp.Add(new ReportParameter("shopAddress", cusBill.shopAddress));
            rp.Add(new ReportParameter("discount", custInfo.custDiscount.ToString()));
            this.reportViewerCustBill.LocalReport.SetParameters(rp);
            this.reportViewerCustBill.RefreshReport();
        }
Esempio n. 7
0
 public void CalllbackFromCustDetails(StockEntry lcstockentry, CustomerInfoDetails custInfo, string billNo)
 {
     StockUpdate(lcstockentry);
     SellerEntry(billNo, lcstockentry._grandTotal, custInfo);
 }
        public void ReportBuilder(string lclbillNo)
        {
            List <CustomerBillProduct> billProdList = new List <CustomerBillProduct>();

            billProdList.Clear();
            var billedItems = (from c in database.TransactionDetails
                               join d in database.ProductInfoes on c.ProductID equals d.ProductID
                               where c.BillNumber == lclbillNo
                               select new
            {
                c.Quantity,
                c.UnitPrice,
                c.TotalPrice,
                d.Description
            });

            var billingInfo = (from c in database.BillInfoes
                               join d in database.CustomerInfoes on c.CustomerID equals d.CustomerID
                               where c.BillNumber == lclbillNo
                               select new
            {
                c.BillDate,
                c.Discount,
                c.TotalAmount,
                d.CustomerName,
                d.CustomerAddress,
                d.Mobile,
                d.Email,
            }).FirstOrDefault();

            var shopInfo = (from c in database.ShopInfoes
                            select c).FirstOrDefault();

            string shopAddress = shopInfo.ShopAddress + " " + shopInfo.City + " " + shopInfo.Dist + " " + shopInfo.State + " " + shopInfo.ZIP + " Tel :" + shopInfo.PhoneNo;

            foreach (var row in billedItems)
            {
                var custBillProduct = new CustomerBillProduct
                {
                    Productdesc  = Convert.ToString(row.Description),
                    Productprice = Convert.ToDecimal(row.UnitPrice),
                    Productunit  = Convert.ToDecimal(row.Quantity),
                    Totalprice   = Convert.ToDecimal(row.TotalPrice),
                };
                billProdList.Add(custBillProduct);
            }
            var customerBillData = new CustomerBillData();

            customerBillData.gstn        = shopInfo.Gstn;
            customerBillData.shopName    = shopInfo.ShopName;
            customerBillData.shopAddress = shopAddress;
            customerBillData.billNo      = lclbillNo;
            customerBillData.billData    = billProdList;


            var custDetails = new CustomerInfoDetails();

            custDetails.custAddress  = billingInfo.CustomerAddress;
            custDetails.custName     = billingInfo.CustomerName;
            custDetails.custMobile   = billingInfo.Mobile;
            custDetails.custEmail    = billingInfo.Email;
            custDetails.billDate     = (DateTime)billingInfo.BillDate;
            custDetails.custDiscount = Convert.ToDecimal(billingInfo.Discount);
            int printonlyBill = 1;
            var printBill     = new CustomerBillForm(printonlyBill);

            printBill.showBill(customerBillData, custDetails);
            printBill.ShowDialog(this);
        }
        public CustomerInfoDetails GetCustomerDetails(KeyValuePair <string, string> kvPair,
                                                      AddressType addressType,
                                                      SuppressionOptions suppressionOptions
                                                      )
        {
            CustomerInfoDetails infoDetails = new CustomerInfoDetails();

            using (var conn = new SqlConnection(MciCrDbConnectionString))
            {
                using (var cmd = new SqlCommand("[dbo].[GetCustomerDetails]", conn))
                {
                    try
                    {
                        cmd.Connection.Open();

                        cmd.Parameters.Add(
                            new SqlParameter("@key", SqlDbType.VarChar, 4).SetSqlValue(kvPair.Key)
                            );

                        var param1Value = "";
                        if (!string.IsNullOrWhiteSpace(kvPair.Key))
                        {
                            if (kvPair.Key.Equals(SourceKey.ACTI.ToString(), StringComparison.OrdinalIgnoreCase) ||
                                kvPair.Key.Equals(SourceKey.MEMB.ToString(), StringComparison.OrdinalIgnoreCase))
                            {
                                var value = kvPair.Value;
                                if (value.Contains(" "))
                                {
                                    value = value.Replace(" ", "+");
                                }

                                param1Value = HttpUtility.UrlEncode(value);
                            }
                            else
                            {
                                param1Value = kvPair.Value;
                            }
                        }
                        else
                        {
                            param1Value = kvPair.Value;
                        }
                        cmd.Parameters.Add(new SqlParameter("@value", SqlDbType.VarChar, 40).SetSqlValue(param1Value));
                        cmd.Parameters.Add(new SqlParameter("@addressFormat", SqlDbType.VarChar, 15).SetSqlValue(addressType));

                        // Suppression parameter
                        cmd.Parameters.Add(
                            new SqlParameter("@ignoreSuppression", SqlDbType.Bit).SetSqlValue(suppressionOptions.IgnoreSuppression.ToInt())
                            );

                        if (!IsCustomerExists(kvPair.Key, kvPair.Value, "PKEY"))
                        {
                            return(null);
                        }

                        cmd.CommandType = CommandType.StoredProcedure;
                        var table        = new DataTable();
                        var adapter      = new SqlDataAdapter(cmd);
                        var affectedRows = adapter.Fill(table);
                        if (affectedRows == 0)
                        {
                            return(null);
                        }

                        infoDetails = BuildCustomerDetails(table.Rows, addressType);
                    }
                    catch (SqlException ex)
                    {
                        _logger.Error("CustomerDetailsDataAccess: " + "ErrorTag: " + ErrorTagProvider.ErrorTagDatabase + " -- " + ex.Message, ex);
                        throw new Exception(string.Format(DatabaseMessage.DatabaseException, ErrorTagProvider.ErrorTagDatabase));
                    }
                    catch (Exception ex)
                    {
                        _logger.Error("CustomerDetailsDataAccess: " + "ErrorTag: " + ErrorTagProvider.ErrorTagDatabase + " -- " + ex.Message, ex);
                        throw new Exception(string.Format(DatabaseMessage.DatabaseException, ErrorTagProvider.ErrorTagDatabase));
                    }
                }
            }
            return(infoDetails);
        }
        private CustomerInfoDetails BuildCustomerDetails(DataRowCollection rows, AddressType addressType)
        {
            CustomerInfoDetails infoDetails = new CustomerInfoDetails();

            try
            {
                foreach (DataRow row in rows)
                {
                    infoDetails.Title     = row["title"]?.ToString();
                    infoDetails.FirstName = row["first_name"]?.ToString();
                    infoDetails.Surname   = row["surname"]?.ToString();
                    DateTime dateVal;
                    var      isValidDate = DateTime.TryParse(row["DOB"].ToString(), out dateVal);

                    if (!isValidDate)
                    {
                        infoDetails.Dob = null;
                    }
                    else
                    {
                        infoDetails.Dob = dateVal;
                    }

                    infoDetails.Gender    = row["gender"]?.ToString();
                    infoDetails.SupStatus = row["suppression_status"]?.ToString();
                    infoDetails.Suffix    = row["suffix"]?.ToString();
                    if (addressType == AddressType.Correspondence)
                    {
                        var correspondance = new CorrespondenceAddress
                        {
                            Address1 = row["address1"]?.ToString(),
                            Address2 = row["address2"]?.ToString(),
                            Address3 = row["address3"]?.ToString(),
                            Address4 = row["address4"]?.ToString(),
                            Address5 = row["address5"]?.ToString(),
                            Address6 = row["address6"]?.ToString(),
                            Address7 = row["address7"]?.ToString(),
                            Postcode = row["postcode"]?.ToString()
                        };
                        infoDetails.Address = correspondance;
                    }
                    else if (addressType == AddressType.Transactional)
                    {
                        var transactional = new TransactionalAddress
                        {
                            HouseNumber = row["housenumber"]?.ToString(),
                            HouseName   = row["housename"]?.ToString(),
                            Street      = row["street"]?.ToString(),
                            Street1     = row["street1"]?.ToString(),
                            City        = row["city"]?.ToString(),
                            County      = row["county"]?.ToString(),
                            Postcode    = row["postcode"]?.ToString(),
                        };
                        infoDetails.Address = transactional;
                    }
                    // GN-36 Fix null salutation fields on KeyValuePair calls
                    infoDetails.Salutation        = row["salutation"]?.ToString();
                    infoDetails.AddressSalutation = row["address_salutation"]?.ToString();
                    infoDetails.EmploymentStatus  = row["employment_status"]?.ToString();
                    infoDetails.Occupation        = row["occupation"]?.ToString();
                    infoDetails.MaritialStatus    = row["marital_status"]?.ToString();
                    infoDetails.Email             = row["email_address"]?.ToString();
                    infoDetails.MobilePhone       = row["mobile_phone"]?.ToString();
                    infoDetails.HomePhone         = row["home_phone"]?.ToString();
                    infoDetails.WorkPhone         = row["work_phone"]?.ToString();
                    infoDetails.SmsPhone          = row["sms_number"]?.ToString();
                    infoDetails.FullAddress       = row["full_address"]?.ToString();
                }
            }
            catch (Exception ex)
            {
                _logger.Error("CustomerDetailsDataAccess - GetCustomerDetails : " + "ErrorTag: " + ErrorTagProvider.ErrorTagDatabase + " -- " + ex.Message, ex);
                throw new Exception(ex.Message);
            }
            return(infoDetails);
        }