示例#1
0
 private void addtype_Click(object sender, EventArgs e)
 {
     if (combotypes.SelectedIndex != -1 || combocompany.SelectedIndex != -1)
     {
         int       typeid = 0, manid = 0;
         double    price = 0; int amnt = 1;
         BLL.Types tppp = null;
         try
         {
             try { amnt = int.Parse(numbertextbox1.Text); }
             catch { amnt = 1; }
             tppp = (BLL.Types)combotypes.SelectedItem;
             if (!BLL.SalePoint.ISinStore(tppp.ID, amnt))
             {
                 DefaultState(true); return;
             }
             typeid = int.Parse(combotypes.SelectedValue.ToString());
             manid  = int.Parse(combocompany.SelectedValue.ToString());
             price  = ((SaledProcrdere == "M") ? tppp.ClientPrice : tppp.BusinessClientPrice);
             tppp   = (BLL.Types)combotypes.SelectedItem;
             TheUnito TheUnito = TheUnito.Kilo;
             TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString());
             BLL.ClientDeal cl = new WeightsOrganizer.BLL.ClientDeal(0, typeid, manid, amnt, price, price, "", new  MyDateTime(dateTimePicker1.Value), TheUnito, tppp.BusinessPrice, combocompany.Text, combotypes.Text);
             dataGridView1.DataSource = new object();
             dataGridView1.DataSource = BLL.SalePoint.Add(cl);
             DefaultState(true);
             BLL.SalePoint.WriteSerolizeMe();
         }
         catch { }
     }
     else
     {
         MessageBox.Show("معلومات مطلوبة", "الحساب و المادة", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        private void InsertToStoreFromClient(WeightsOrganizer.BLL.ClientDeal cl)
        {
            if (cl.TheUnit == TheUnito.Gram)
            {
                cl.Amount = cl.Amount / 1000;
            }
            StoreDetails StoreDetails = new StoreDetails(0, cl.TypeId, cl.Amount, DateTime.Now, DateTime.Now, cl.TypeName);

            InsertStoreFromClient(StoreDetails);
        }
示例#3
0
        private void btnaction_Click(object sender, EventArgs e)
        {
            if (combotypes.SelectedIndex == -1 || combocompany.SelectedIndex == -1)
            {
                MessageBox.Show("الرجاء تحديد الزبون و الصنف", "خطأ ادخال بيانات", MessageBoxButtons.OK); return;
            }
            if (txtamount.Text == "0" || (string.IsNullOrEmpty(txtamount.Text)))
            {
                MessageBox.Show("الرجاء تحديد الكمية ", "خطأ ادخال بيانات", MessageBoxButtons.OK); return;
            }
            TheUnito TheUnito = TheUnito.Kilo;

            TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString());
            BLL.Types tp = (BLL.Types)combotypes.SelectedItem;
            //
            double stramnt = 0;

            stramnt = double.Parse(txtamount.Text);
            if (tp.TheUnit == TheUnito.Gram)
            {
                stramnt = double.Parse(txtamount.Text) / 1000;
            }
            BLL.Store teststore = BLL.Store.GetStoreByTypeID(tp.ID);
            if (teststore != null)
            {
                ///MessageBox.Show(teststore.Amount.ToString() + " " + stramnt.ToString());
                if ((teststore.Amount < stramnt))
                {
                    MessageBox.Show(" لا تتوفر هذه الكمية من الصنف  " + tp.Name, "الكميات المتوفرة-المخزن", MessageBoxButtons.OK, MessageBoxIcon.Information); return;
                }
            }
            else
            {
                MessageBox.Show(" صنف غير موجود بالمخزن" + tp.Name, "الكميات المتوفرة-المخزن", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            //

            TheUnito = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString());
            BLL.ClientDeal cl = new WeightsOrganizer.BLL.ClientDeal(0, (int)combotypes.SelectedValue, (int)combocompany.SelectedValue,
                                                                    double.Parse(txtamount.Text), (radioButton2.Checked ? tp.ClientPrice : tp.BusinessClientPrice), 0, "مجموعة", MyDateTime.Now, TheUnito, tp.BusinessPrice, combocompany.Text, combotypes.Text);

            List <BLL.ClientDeal> allz = new List <WeightsOrganizer.BLL.ClientDeal>();

            allz = alloo;
            bool s = false;

            if (allz.Count > 0)
            {
                foreach (BLL.ClientDeal bd in allz)
                {
                    if ((bd.TypeId == cl.TypeId) && (bd.TheUnit == cl.TheUnit))
                    {
                        bd.Amount += cl.Amount; s = false;
                        break;
                    }
                    else
                    {
                        s = true;
                    }
                }
                if (s)
                {
                    alloo.Add(cl);
                }
            }
            else
            {
                alloo.Add(cl);
            }
            ALlPrice                += cl.ToTalPrice;
            numbertextbox1.Text      = ALlPrice.ToString();
            numbertextbox2.Text      = ALlPrice.ToString();
            txtamount.Text           = "";
            combotypes.SelectedIndex = -1;
            combotypes.Text          = "اختر صنف.. ";
            combotypes.SelectAll();
            txtamount.Text           = "1";
            dataGridView1.DataSource = new object();
            dataGridView1.DataSource = alloo;
            combocompany.Enabled     = false;
            checkBox1.Enabled        = false;
            groupBox3.Enabled        = false;
            label2.Text = "السعر";
        }
 public void InsertClientDeal(WeightsOrganizer.BLL.ClientDeal cl)
 {
     InsertClientDeal(new ClientDealDetails(0, cl.TypeId, cl.ClientId, cl.Amount, cl.Price, cl.ToTalPrice, cl.Details, cl.AddedDate, cl.TheUnit, cl.BusinessPrice, cl.ClientName, cl.TypeName));
 }