示例#1
0
        /// <summary>
        /// Function To find the List of Customer Type.
        /// </summary>
        /// <param name="objVehicleProp"></param>
        /// <returns>List</returns>
        /// <createdBy></createdBy>
        /// <createdOn>May-10,2016</createdOn>
        public List <string> CutomerType()
        {
            CustomerDAL objCustomerDAL = new CustomerDAL();

            CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                //Calling the Customer Type List.
                return(objCustomerDAL.CustomerType());
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
示例#2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string operation = "Points Added";


            if (txtBillAmount.Text == string.Empty || txtCustomerID.Text == string.Empty || txtReceiptNo.Text == string.Empty)
            {
                MessageBox.Show("ERROR!! One or more Fields is empty");
            }
            else
            {
                if (rd.DuplicateBill(txtReceiptNo.Text.Trim()) == true)
                {
                    MessageBox.Show("SORRY!! This Bill has already been used!");
                }
                else
                {
                    rb.ReceiptNo     = txtReceiptNo.Text.Trim();
                    rb.BillAmount    = double.Parse(txtBillAmount.Text.Trim());
                    cb.Customer_Type = cd.CustomerType(txtCustomerID.Text.Trim(), cb.Customer_Type).ToString();
                    switch (cb.Customer_Type)
                    {
                    case "Retailer":
                        rb.PointsAdded = (double.Parse(txtBillAmount.Text.Trim()) * 0.05);
                        break;

                    case "Wholesaler":
                        rb.PointsAdded = (double.Parse(txtBillAmount.Text.Trim()) * 0.01);
                        break;

                    default:
                        rb.PointsAdded = (double.Parse(txtBillAmount.Text.Trim()) * 0.05);
                        break;
                    }
                    rb.Operation      = operation;
                    rb.PointsRedeemed = 0.00;
                    rb.CustomerID     = txtCustomerID.Text.Trim();
                    rb.date           = DateTime.Now.ToString();

                    if (cd.DuplicateCustomer(cb.CustomerID) == true)
                    {
                        MessageBox.Show("This card has NOT been registered to any Customer. Kindly register it");
                    }

                    else
                    {
                        bool success = rd.Insert(rb);

                        if (success == true)
                        {
                            MessageBox.Show("Points Successfully Added");

                            Clear();
                        }
                        else
                        {
                            MessageBox.Show("Failed adding points");
                            Clear();
                        }
                    }
                }
            }
        }