Exemple #1
0
        private void btnaction_Click(object sender, EventArgs e)
        {
            string baracode = "0";
            double bupric = 0, clpric = 0, businessclientPrice = 0;
            string nme = "";

            try
            {
                TheUnito            = (TheUnito)Enum.Parse(typeof(TheUnito), Globals.Globals.gram.ToString());
                bupric              = double.Parse(txtBusinessPrice.Text);
                clpric              = double.Parse(txtClientPrice.Text);
                businessclientPrice = double.Parse(txtprcln.Text);
                nme      = txtname.Text;
                baracode = (string.IsNullOrEmpty(baraCode128vewier1.Text) ? "0" : baraCode128vewier1.Text);
                int          baraisher  = 0;
                List <Types> allbracodr = new List <Types>();
                allbracodr = BLL.Types.GetTypeByBaraCode(baracode, false);
                baraisher  = allbracodr.Count;
                if (id > 0)
                {
                    if ((baraisher > 0))
                    {
                        if (allbracodr[0].BaraCode != BLL.Types.GetTypeByID(id).BaraCode)
                        {
                            MessageBox.Show("هذا الباركود خاص بصنف اخر "); return;
                        }
                    }


                    if ((nme != BLL.Types.GetTypeByID(id).Name))
                    {
                        Store.UpdateTypNamesinstore(id, nme);
                    }
                    BLL.Types.UpdateType(id, nme, bupric, clpric, businessclientPrice, TheUnito, baracode);
                }
                else
                {
                    if (BLL.Types.GetTypeByName(nme) != null)
                    {
                        MessageBox.Show(" الاسم موجود مسبقا الرجاء ادخال اسم اخر", "خطأ مدخلات"); return;
                    }

                    if (baraisher > 0)
                    {
                        MessageBox.Show("هذا الباركود متوفر مسبقا"); return;
                    }
                    BLL.Types.InsertType(0, nme, bupric, clpric, businessclientPrice, TheUnito, baracode);
                }
                alltyps = BLL.Types.GetAllTypes();
                dataGridView1_DataSourceChanged(sender, e);
                btnnew_Click(sender, e);
                txtname.Focus();
                BllGlobal.UpdateAllType();
                WeightsOrganizer.Controls.Righto.GetDataAgainToTypes();
                BllGlobal.UpdateAllStore();
            }
            catch {;
                   MessageBox.Show(" الرجاء التأكد من المدخلات", "خطأ مدخلات");
                   SelectTheEmptyText(groupBox1); }
        }
Exemple #2
0
 private void btndel_Click(object sender, EventArgs e)
 {
     try
     {
         if (id > 0)
         {
             BLL.Types.DeleteType(id);
             alltyps = BLL.Types.GetAllTypes();
             WeightsOrganizer.Controls.Righto.GetDataAgainToTypes();
             BllGlobal.UpdateAllStore();
             dataGridView1_DataSourceChanged(sender, e);
             btnnew_Click(sender, e);
             txtname.Focus();
         }
     }
     catch { }
 }