예제 #1
0
파일: SaleUC.cs 프로젝트: thachgiasoft/RPOS
        private void gridView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)// && e.Modifiers == Keys.Control)
            {
                if (MessageBox.Show("Delete invoice?", "Confirmation", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }

                DataAccess.SaleInvoice currentRow = (DataAccess.SaleInvoice)gridView1.GetFocusedRow();

                if (currentRow.Flag == 1)
                {
                    MessageBox.Show("You can not delete closed invoice", "Delete Invoice", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }

                db.SaleInvoices.Remove(currentRow);
                if (db.SaveChanges() > 0)
                {
                    MainScreen parent = (MainScreen)this.Parent.Parent.Parent.Parent;

                    parent.ShowMessageInStatusBar("Item Deleted", 9000);
                }
            }
        }
예제 #2
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                if (gridView1.IsDataRow(gridView1.FocusedRowHandle))
                {
                    DataAccess.ItemCategory currentRow = (DataAccess.ItemCategory)gridView1.GetFocusedRow();

                    //Delete Current Object
                    if (e.Button.Kind == DevExpress.XtraEditors.Controls.ButtonPredefines.Delete)
                    {
                        if (MessageBox.Show("Are you sure ?", "Delete  " + currentRow.Category, MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
                        {
                            db.ItemCategories.Remove(currentRow);
                            if (db.SaveChanges() > 0)
                            {
                                gridView1.DeleteRow(gridView1.FocusedRowHandle);
                                MainScreen parent = (MainScreen)this.Parent.Parent.Parent.Parent;
                                parent.ShowMessageInStatusBar("Item Deleted", 9000);
                            }
                        }
                    }
                    else
                    //Update
                    if (e.Button.Kind == DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis)
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
예제 #3
0
파일: SaleUC.cs 프로젝트: thachgiasoft/RPOS
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         MainScreen parent = (MainScreen)this.Parent.Parent.Parent.Parent;
         if (db.SaveChanges() > 0)
         {
             parent.ShowMessageInStatusBar("تم حفظ اليانات", 9000);
         }
         else
         {
             parent.ShowMessageInStatusBar("لا يوجد تغيير في البيانات يحتاج لحفظ", 9000);
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
예제 #4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (db.SaveChanges() > 0)
         {
             MainScreen parent = (MainScreen)this.Parent.Parent.Parent.Parent;
             parent.ShowMessageInStatusBar("تم حفظ اليانات", 9000);
             //  MessageBox.Show("Saved");
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
예제 #5
0
파일: ItemUC.cs 프로젝트: thachgiasoft/RPOS
        private void gridView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)// && e.Modifiers == Keys.Control)
            {
                if (MessageBox.Show("Delete row?", "Confirmation", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }

                DataAccess.Item currentRow = (DataAccess.Item)gridView1.GetFocusedRow();
                //GridView view = sender as GridView;
                db.Items.Remove(currentRow);
                if (db.SaveChanges() > 0)
                {
                    MainScreen parent = (MainScreen)this.Parent.Parent.Parent.Parent;
                    parent.ShowMessageInStatusBar("Item Deleted", 9000);
                }
            }
        }