protected void GVFloat_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            FloatAmountDAL floatDAL = new FloatAmountDAL {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            Float TheFloat = new Float()
            {
                OrderNo               = (GVFloat.Rows[e.RowIndex].FindControl("LblFloatOrderNo") as Label).Text,
                OrderDate             = DateTime.Parse((GVFloat.Rows[e.RowIndex].FindControl("LblFloatOrderDate") as Label).Text),
                MemberName            = (GVFloat.Rows[e.RowIndex].FindControl("LblFloatMemberName") as Label).Text,
                Totalcost             = Double.Parse((GVFloat.Rows[e.RowIndex].FindControl("LblFloatCost") as Label).Text),
                Deliveryfees          = Double.Parse((GVFloat.Rows[e.RowIndex].FindControl("LblFloatFees") as Label).Text),
                Status                = (GVFloat.Rows[e.RowIndex].FindControl("DLLStatusList") as DropDownList).Text,
                TotalCostwithDelivery = Double.Parse((GVFloat.Rows[e.RowIndex].FindControl("LblFloatTotal") as Label).Text),
                CardTypeandAmount     = (GVFloat.Rows[e.RowIndex].FindControl("LblFloatProduct") as Label).Text,
                Quantity              = Int32.Parse((GVFloat.Rows[e.RowIndex].FindControl("LblFloatQuantity") as Label).Text),
                DeliveryDate          = ((GVFloat.Rows[e.RowIndex].FindControl("TxtFloatDeliveryDate") as TextBox).Text == string.Empty) ? (DateTime?)null : DateTime.Parse((GVFloat.Rows[e.RowIndex].FindControl("TxtFloatDeliveryDate") as TextBox).Text)
            };

            floatDAL.InsertFloat(TheFloat);
            GVFloat.EditIndex = -1;

            FetchFloat();
        }
        protected void FetchFloat()
        {
            FloatAmountDAL theFloat = new FloatAmountDAL {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            GVFloat.DataSource = theFloat.GetFloat(null);
            GVFloat.DataBind();
        }
        protected void FetchAmount()
        {
            FloatAmountDAL theAmount = new FloatAmountDAL {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };
            Double TotalAmount = Convert.ToDouble(theAmount.GetTotalAmount());

            LblTotalAmount.Text = "Total remaining amount: " + TotalAmount;
            GVAmount.DataSource = theAmount.GetAmount();
            GVAmount.DataBind();
        }
        protected void GVFloat_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            FloatAmountDAL floatDAL = new FloatAmountDAL {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            string OrderNo = GVFloat.DataKeys[e.RowIndex].Values["OrderNo"].ToString();

            floatDAL.DeleteFloat(OrderNo);

            FetchFloat();
        }
        protected void GVAmount_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            FloatAmountDAL amountDAL = new FloatAmountDAL {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            string ID = GVAmount.DataKeys[e.RowIndex].Values["ID"].ToString();

            amountDAL.DeleteAmount(ID);

            FetchAmount();
        }
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            FloatAmountDAL amountDAL = new FloatAmountDAL {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            Amount TheAmount = new Amount();


            TheAmount.PaymentstoOman = Convert.ToDouble(TxtAddPaymentAmount.Text);
            TheAmount.Dateofpayment  = (TxtAddPaymentDate.Text == string.Empty) ? (DateTime?)null : DateTime.Parse(TxtAddPaymentDate.Text);


            amountDAL.InsertAmount(TheAmount);

            FetchAmount();
        }
        protected void GVAmount_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            FloatAmountDAL amountDAL = new FloatAmountDAL {
                ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString()
            };

            Amount TheAmount = new Amount();

            TheAmount.ID             = Convert.ToInt32(GVAmount.DataKeys[e.RowIndex].Values["ID"].ToString());
            TheAmount.PaymentstoOman = Convert.ToDouble((GVAmount.Rows[e.RowIndex].FindControl("TxtAmountPayment") as TextBox).Text);
            TheAmount.Dateofpayment  = ((GVAmount.Rows[e.RowIndex].FindControl("TxtAmountPaymentDate") as TextBox).Text == string.Empty) ? (DateTime?)null : DateTime.Parse((GVAmount.Rows[e.RowIndex].FindControl("TxtAmountPaymentDate") as TextBox).Text);


            amountDAL.InsertAmount(TheAmount);
            GVAmount.EditIndex = -1;

            FetchAmount();
        }