Esempio n. 1
0
        private void gridView1_CellValueChanged(object sender, CellValueChangedEventArgs e)
        {
            try
            {
                if (e.Column != colCurrentQuanity)
                {
                    return;
                }

                string cellValue = e.Value.ToString();// +" " + gridView1.GetRowCellValue(e.RowHandle, gridView1.Columns["CurrentQuanity"]).ToString();

                var row = gridView1.GetFocusedRow() as DataAccess.Inventory;


                GridView view   = (GridView)sender;
                var      editor = view.ActiveEditor;
                OldQTY   = Convert.ToInt32(view.ActiveEditor.OldEditValue);
                NewQTY   = Convert.ToInt32(view.ActiveEditor.EditValue);
                ItemName = gridView1.GetRowCellDisplayText(view.FocusedRowHandle, colItemID).ToString();

                row.SystemQTY     = OldQTY;
                row.ActualQTY     = NewQTY;
                row.InventoryDate = DateTime.Now;



                if (cbAutoSave.Checked)
                {
                    if (db.SaveChanges() > 0)
                    {
                        string message = "";
                        message += " تم تغير كمية الصنف: " + ItemName + " من   " + OldQTY + " الي " + NewQTY + Environment.NewLine;
                        message += "الموظف" + UserData.Default.UserName + Environment.NewLine;
                        message += "@ Reda" + UserData.Default.BranchID + Environment.NewLine;
                        gridControl1.DataSource = null;
                        this.inventoryBindingSource.DataSource = null;

                        txtSearch.Focus();
                        txtSearch.SelectAll();
                        this.Text = ItemName + "  " + NewQTY;
                        PushMessage.SendDirectInventory(message);
                    }
                }
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
Esempio n. 2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (db.SaveChanges() > 0)
         {
             string message = "";
             message += "تم تغير كمية الصنف:" + ItemName + "من" + OldQTY + "الي" + NewQTY + Environment.NewLine;
             message += "الموظف" + UserData.Default.UserName + Environment.NewLine;
             message += "@ Reda" + UserData.Default.BranchID + Environment.NewLine;
             gridControl1.DataSource = null;
             this.inventoryBindingSource.DataSource = null;
             txtSearch.Focus();
             PushMessage.SendDirectInventory(message);
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }