コード例 #1
0
ファイル: Stores_form.cs プロジェクト: elnomrosy66/Mti-Stores
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (DGV_stores.Rows.Count > 0)
            {
                if (DGV_stores.SelectedRows != null)
                {
                    int id = Convert.ToInt32(DGV_stores.CurrentRow.Cells[0].Value.ToString());

                    store = db.stores.Where(u => u.id == id).FirstOrDefault();
                    if (store.items.Count > 0)
                    {
                        MessageBox.Show("لا يمكن حذف المخزن حيث تم استخدامه في ععمليات من قبل ومسحه سيؤدي لتلف بعض البيانات");
                        return;
                    }
                    db.stores.DeleteOnSubmit(store);
                    db.SubmitChanges();
                    New();
                    btnDelete.Enabled = false;
                    MessageBox.Show("تم حذف المخزن بنجاح");
                    db = new DAL.dbDataContext();
                    DGV_stores.DataSource                 = db.stores;
                    DGV_stores.Columns["id"].Visible      = false;
                    DGV_stores.Columns["name"].HeaderText = "الاسم";
                    return;
                }
            }
        }
コード例 #2
0
ファイル: Stores_form.cs プロジェクト: elnomrosy66/Mti-Stores
        private void DGV_stores_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int id = 0;

            if (DGV_stores.CurrentRow.Cells[0].Value != null)
            {
                id    = Convert.ToInt32(DGV_stores.CurrentRow.Cells[0].Value.ToString());
                store = db.stores.Where(s => s.id == id).FirstOrDefault();
                GetData();
                btnDelete.Enabled = true;
            }
        }
コード例 #3
0
ファイル: store.cs プロジェクト: WayLeeLi/Tea
 public store()
 {
     dal = new DAL.store(siteConfig.sysdatabaseprefix);
 }
コード例 #4
0
ファイル: Stores_form.cs プロジェクト: elnomrosy66/Mti-Stores
 void New()
 {
     store = new DAL.store();
     GetData();
 }