Exemplo n.º 1
0
        protected void BtnFinish_Click(object sender, EventArgs e)
        {
            Bill_Payments payment = new Bill_Payments();

            payment.Pay_Date    = new DateTime(Convert.ToInt32(txtYear.Text), Convert.ToInt32(txtMonth.Text), Convert.ToInt32(txtDay.Text), DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
            payment.Paid_amount = Convert.ToDouble(txtPaid_amount.Text);
            payment.Notes       = TxtNotes.Text;
            if (txtDiscount.Text == "")
            {
                payment.Add_Bill_Payment(Convert.ToInt64(lblBill_ID.Text));
            }
            else
            {
                payment.Add_Bill_Payment(Convert.ToInt64(lblBill_ID.Text), Convert.ToDouble(txtDiscount.Text));
            }
            lblFinishMsg.Text = "تم بنجاح";
        }
Exemplo n.º 2
0
        protected void BtnAddToBill_Click(object sender, EventArgs e)
        {
            bool allExists = true;

            foreach (Product p in (List <Product>)ViewState["ProductsList"])
            {
                int Current;
                if (!p.Check_amounts(out Current)) // amount not enough for the order
                {
                    lblConfirmMsg.Text += " لا توجد كل الكميه المطلوبه من المنتج" + " ( " + p.P_name + " ) " + " الكميه الموجوده = " + Current + "<br />";
                    allExists           = false;
                }
            }
            if (allExists)//add ps to bill list
            {
                Bill_Content content = new Bill_Content();
                bool         AllDone = true;
                string       m;
                System.Text.StringBuilder ConcatenatedNotes = new System.Text.StringBuilder("قام العميل باضافة منتجات جديدة للفاتورة : ");
                foreach (Product p in (List <Product>)ViewState["ProductsList"])
                {
                    if (!content.Add_Bill_Contents(out m, Convert.ToInt64(lblBill_ID.Text), p))
                    {
                        Response.Write("<script>alert('" + m + "')</script>");
                        AllDone = false;
                        break;
                    }
                    else
                    {
                        ConcatenatedNotes.AppendLine();
                        ConcatenatedNotes.Append(p.Amount.ToString() + " " + p.P_name + " " + (p.Mark != "Not found" ? ("ماركة  " + p.Mark + " " +
                                                                                                                        p.Inch.ToString() + " بوصه " + (p.Style != "Not found" ? "طراز " + p.Style + " " : "")) : "")
                                                 + " سعر الواحده يساوى" + p.Regulare_Price.ToString());
                    }
                }
                if (AllDone)
                {
                    lblConfirmMsg.ForeColor = System.Drawing.Color.Green;
                    Bill_Payments payment = new Bill_Payments();
                    payment.Pay_Date = new DateTime(Convert.ToInt32(txtYear.Text), Convert.ToInt32(txtMonth.Text), Convert.ToInt32(txtDay.Text),
                                                    DateTime.Now.Hour, DateTime.Now.Minute + 1, DateTime.Now.Second);
                    payment.Paid_amount = 0;
                    payment.Notes       = ConcatenatedNotes.ToString();
                    payment.Add_Bill_Payment(Convert.ToInt64(lblBill_ID.Text));
                    lblConfirmMsg.Text = "تم بنجاح";
                }
            }
        }