コード例 #1
0
 private void Add_Prodoct()
 {
     if (txtNameProdoct.TextLength > 0)
     {
         if (txtNameProdoct.Text != "" && txtCodeProdoct.Text != "")
         {
             Service.StimulsoftEntities context = new Service.StimulsoftEntities();
             Service.AnbarProdoct       prodoct = new Service.AnbarProdoct();
             prodoct.Name = txtNameProdoct.Text;
             prodoct.Code = int.Parse(txtCodeProdoct.Text);
             if (comUnit.SelectedIndex != null)
             {
                 prodoct.IdUnit = comUnit.SelectedIndex;
             }
             if (txtDetails.Text != "")
             {
                 prodoct.Description = txtDetails.Text;
             }
             if (txtBarcode.Text != "")
             {
                 prodoct.Barcode = txtBarcode.Text;
             }
             if (txtRFID.Text != "")
             {
                 prodoct.RfID = txtRFID.Text;
             }
             context.AnbarProdoct.Add(prodoct);
             context.SaveChanges();
         }
         //Service.FormAnbar anbar = new Service.FormAnbar();
         // anbar.Refresh_dgProdoct();
     }
 } // ezafe kardane mahsoole jadid be jadval prodoct(mahsoolat)
コード例 #2
0
 private void btnDelUnit_Click(object sender, EventArgs e)
 {
     Service.StimulsoftEntities context = new Service.StimulsoftEntities();
     if (context.Unit.Count() > 0)
     {
         var selectUnit = context.Unit.Where(c => c.Name == comUnit.Text).FirstOrDefault();
         context.Unit.Remove(selectUnit);
         context.SaveChanges();
         Refresh_comUnit();
     }
 }
コード例 #3
0
        private void Add_Unit()
        {
            using (var context = new Service.StimulsoftEntities())
            {
                if (context.Unit.Count() > 0)
                {
                    bool existUnit = context.Unit.Where(c => c.Name == txtUnitName.Text).Any();
                    if (existUnit)
                    {
                        MessageBox.Show("واحدی با این نام وجود دارد", "واحد", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        Service.Unit newUnit = new Service.Unit();
                        newUnit.Name = txtUnitName.Text;
                        context.Unit.Add(newUnit);
                        context.SaveChanges();
                        //MessageBox.Show("واحد ثبت شد", "ثبت", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        txtUnitName.Text = "";
                        txtUnitName.Focus();
                    }
                }
                else
                {
                    Service.Unit newUnit = new Service.Unit();
                    newUnit.Name = txtUnitName.Text;
                    context.Unit.Add(newUnit);
                    context.SaveChanges();
                    //MessageBox.Show("واحد ثبت شد", "ثبت", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtUnitName.Text = "";
                    txtUnitName.Focus();
                }
            }
            ucAddProdoctStore ucadd = new ucAddProdoctStore();

            ucadd.Refresh_comUnit();
        }
コード例 #4
0
        } // ezafe kardane mahsoole jadid be jadval prodoct(mahsoolat)

        private void Add_Store() // ezafe kardane forooshgahe jadid be jadvale foroshgah(store)
        {
            Service.StimulsoftEntities context = new Service.StimulsoftEntities();

            if (txtStoreName.Text != "")
            {
                Service.Store newStore = new Service.Store();
                newStore.Name = txtStoreName.Text;
                if (txtPhoneStore.Text != "")
                {
                    newStore.Phone = txtPhoneStore.Text;
                }
                if (txtAddressStore.Text != "")
                {
                    newStore.Address = txtAddressStore.Text;
                }
                context.Store.Add(newStore);
            }
            context.SaveChanges();

            Service.FormAnbar frmAnbar = new Service.FormAnbar();
            frmAnbar.Refresh_dgStore();
        }