Beispiel #1
0
  protected void  btConfirm0_Click(object sender, EventArgs e)
  {
      Session["previous"] = "~/Paycard.aspx";

      String user                = Session["user"].ToString();
      int    count               = dba.CountNoOfItems(user);
      Int32  nextmainorderno     = dba.CountNoOfAllOrders() + 1;                                             //next main orderno
      Int32  nextCustomerorderno = dba.CountNoOfOrdersOfaCustomer(Session["user"].ToString().ToLower()) + 1; //next customer order no
      double sum = 0;

      for (int i = 0; i < count; i++)
      {
          string priceOfaProduct  = GridView1.Rows[i].Cells[2].Text;
          double ApriceOfaProduct = System.Convert.ToDouble(priceOfaProduct);
          string quantity         = GridView1.Rows[i].Cells[3].Text;

          string pname     = GridView1.Rows[i].Cells[1].Text;
          Int32  Aquantity = System.Convert.ToInt32(quantity);
          double Aprice    = ApriceOfaProduct * Aquantity;


          dba.AddOrders(Session["user"].ToString().ToLower(), nextmainorderno, nextCustomerorderno, pname, Aquantity, Aprice, "Not Deleivered");

          sum = sum + Aprice;
      }
      Int32 nextmainreceiptno     = dba.CountNoOfAllReceipt() + 1;
      Int32 nextCustomerreceiptno = dba.CountNoReceiptsOfaCustomer(Session["user"].ToString().ToLower()) + 1;

      dba.AddReceipt(Session["user"].ToString().ToLower(), nextmainreceiptno, nextCustomerreceiptno, sum, "Card");



      dba.ClearCart(Session["user"].ToString());
      double percentage = dba.getBonusGivingpercentage("admin");

      string total  = Session["totalprice"].ToString();
      double atotal = System.Convert.ToDouble(total);

      double givingbonus = atotal * (percentage / 100.0);
      string bonus       = givingbonus.ToString();

      lbllabel.Visible      = true;
      lbllabel.Text         = "Your Transaction complete." + "You have been awarded with " + bonus + " bonus Points.";
      btnHome.Visible       = true;
      btConfirm0.Visible    = false;
      txtCreditCno.Visible  = false;
      txtCreditCno0.Visible = false;
      TextBox1.Visible      = false;
      TextBox2.Visible      = false;


      dba.updateAddBonusPointsOfAuser(Session["user"].ToString(), givingbonus);
  }
Beispiel #2
0
    protected void btnLastOrder_Click(object sender, EventArgs e)
    {
        int lastCOrderNo = dba.CountNoOfOrdersOfaCustomer(Session["user"].ToString().ToLower());

        if (lastCOrderNo == -1)
        {
            lblError.Visible = true;
            lblError.Text    = "You dont have any Orders !";
        }
        else
        {
            lblError.Visible = false;
            DataSet ds = dba.getDetailsofANOrdertOfaCustomer(Session["user"].ToString().ToLower(), lastCOrderNo);
            GridView1.DataSource = ds.Tables["Corders"].DefaultView;
            GridView1.DataBind();
        }
    }
Beispiel #3
0
    protected void btnpoints_Click(object sender, EventArgs e)
    {
        Session["previous"] = "~/Payment.aspx";


        String user = Session["user"].ToString();

        int count = dba.CountNoOfItems(user);

        Int32  nextmainorderno     = dba.CountNoOfAllOrders() + 1;                                             //next main orderno
        Int32  nextCustomerorderno = dba.CountNoOfOrdersOfaCustomer(Session["user"].ToString().ToLower()) + 1; //next customer order no
        double sum = 0;

        for (int i = 0; i < count; i++)
        {
            string priceOfaProduct  = GridView1.Rows[i].Cells[2].Text;
            double ApriceOfaProduct = System.Convert.ToDouble(priceOfaProduct);
            string quantity         = GridView1.Rows[i].Cells[3].Text;

            string pname     = GridView1.Rows[i].Cells[1].Text;
            Int32  Aquantity = System.Convert.ToInt32(quantity);
            double Aprice    = ApriceOfaProduct * Aquantity;


            dba.AddOrders(Session["user"].ToString().ToLower(), nextmainorderno, nextCustomerorderno, pname, Aquantity, Aprice, "Not Deleivered");

            sum = sum + Aprice;
        }
        Int32 nextmainreceiptno     = dba.CountNoOfAllReceipt() + 1;
        Int32 nextCustomerreceiptno = dba.CountNoReceiptsOfaCustomer(Session["user"].ToString().ToLower()) + 1;

        dba.AddReceipt(Session["user"].ToString().ToLower(), nextmainreceiptno, nextCustomerreceiptno, sum, "Bonus Points");


        dba.ClearCart(Session["user"].ToString().ToLower());
        dba.updateSubstractBonusPointsOfAuser(Session["user"].ToString().ToLower(), atotal);
        Label2.Visible     = true;
        Label2.Text        = "Your Transaction complete. " + Session["totalprice"].ToString() + " bonus Points reducted from your account.";
        btnHome.Visible    = true;
        btCard.Enabled     = false;
        btnpoints.Enabled  = false;
        lblBpoints.Visible = false;
        Label1.Visible     = false;
    }