Ejemplo n.º 1
0
        protected void btn_applyRebates_Click(object sender, EventArgs e)
        {
            string vehicle = txt_vehicleNo.Text;

            //get the receipt lists from the session variable
            myreceipt = (Receipt)Session["receipt"];


            //converting to the List<Receipt> to ArrayList because the given applyRebates(string vehicle, ArrayList receipts) Method
            //is only can access the Arrayist parameter
            ArrayList receiptlist = new ArrayList();

            foreach (var item in myreceipt.ReceiptList)
            {
                receiptlist.Add(item);
            }

            try
            {
                Rebates rebates = new Rebates();
                rebates.applyRebates(vehicle, receiptlist);

                //Save the Rebate List to session variable
                Session["rebate"] = rebates;
                BindGrid2();
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        //Methods

        public void applyRebates(string vehicle, ArrayList receiptlist)
        {
            try
            {
                if (vehicle != null)
                {
                    bool IsExists = false;

                    if (!IsExists)
                    {
                        Rebates rebates = new Rebates();
                        foreach (Receipt item in receiptlist)
                        {
                            rebates.vehicle    = vehicle;
                            rebates.receipt_sn = item.Receipt_Sn;
                            rebates.shop       = item.Shop;
                            rebates.amount     = item.Amount;
                            RebatesList.Add(rebates);
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
Ejemplo n.º 3
0
        protected void Session_Start(object sender, EventArgs e)
        {
            //Declear Session Variables
            Session["receipt"] = new Receipt(); //this is calling the Receipt Class

            Session["rebate"] = new Rebates();  //this is calling the Rebates Class
        }
Ejemplo n.º 4
0
        public void BindGrid2()
        {
            //getting the session variables
            myrebate = (Rebates)Session["rebate"];

            //Binding Rebates List to the GridView
            GridView2.DataSource = myrebate.GetRebates();
            GridView2.DataBind();
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //getting the session variables
                myreceipt = (Receipt)Session["receipt"];
                myrebate  = (Rebates)Session["rebate"];

                //Binding data to the grid view
                BindGrid();
                BindGrid2();
            }
        }