Exemplo n.º 1
0
        private void btnSaveProdoct_Click(object sender, EventArgs e)
        {
            if (majhool[0] == "editProdoct") // baraye edit kardane mahsool
            {
                using (var context = new StimulsoftEntities())
                {
                    Int32 id            = Int32.Parse(majhool[1]);
                    var   selectProdoct = context.AnbarProdoct.Where(c => c.Id == id).FirstOrDefault();
                    if (selectProdoct == null)
                    {
                        MessageBox.Show("این نام محصول تکراری است", "ثبت", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        selectProdoct.Name        = txtNameProdoct.Text;
                        selectProdoct.Code        = int.Parse(txtCodeProdoct.Text);
                        selectProdoct.IdUnit      = comUnit.SelectedIndex;
                        selectProdoct.Description = txtDetails.Text;
                        selectProdoct.Barcode     = txtBarcode.Text;
                        selectProdoct.RfID        = txtRFID.Text;
                        context.SaveChanges();
                        MessageBox.Show("ویرایش انجام شد", "ویرایش", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        this.Close();
                        FormAnbar frmAnbar = new FormAnbar();
                        frmAnbar.Refresh_dgProdoct();
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void dgSearch_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            FormAnbar frmAnbar = new FormAnbar();

            majhool1 = dgSearch.CurrentRow.Cells[3].Value.ToString();
            majhool2 = dgSearch.CurrentRow.Cells[2].Value.ToString();
            this.Close();
        }
Exemplo n.º 3
0
        private void btnSaveStore_Click(object sender, EventArgs e)
        {
            if (majhool[0] == "editStore")
            {
                Int32 id = Int32.Parse(majhool[1]);

                var selectStore = context.Store.Where(c => c.Id == id).FirstOrDefault();
                selectStore.Name    = txtStoreName.Text;
                selectStore.Phone   = txtTelStore.Text;
                selectStore.Address = txtAddressStore.Text;
                context.SaveChanges();
                MessageBox.Show("ویرایش انجام شد", "ویرایش", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
                FormAnbar frmAnbar = new FormAnbar();
                frmAnbar.Refresh_dgStore();
            }
        }