Пример #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     try
     {
         if (new QuickItemAdd().ShowDialog() == DialogResult.OK)
         {
             LoadQuickItems();
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (db.SaveChanges() > 0)
         {
             MessageBox.Show("تم حفظ البيانات");
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #3
0
 private void PurchaseInvoiceUC_Load(object sender, EventArgs e)
 {
     try
     {
         branchBindingSource.DataSource = db.Branches.ToList();
         cmbBranch.EditValue            = 0;
         cmbFrom.DateTime = DateTime.Now;
         cmbTo.DateTime   = DateTime.Now;
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #4
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (db.SaveChanges() > 0)
         {
             ShowMessageInStatusBar("تم حفظ اليانات", 9000);
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #5
0
 private void gridView1_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
 {
     try
     {
         if (db.SaveChanges() > 0)
         {
             gridView1.ExpandAllGroups();
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #6
0
 private void btnShowHidden_Click(object sender, EventArgs e)
 {
     try
     {
         db = new DataAccess.RedaV1Entities(ModuleClass.Connect());
         db.Items.Where(s => s.Hidden == true).Load();
         var list = db.Items.Local.ToBindingList();
         bindingSource1.DataSource = list;
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #7
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);
            }
        }
Пример #8
0
        void FillData()
        {
            try
            {
                DateTime from = new DateTime(cmbPaymentDate.DateTime.Year, cmbPaymentDate.DateTime.Month, 1, 0, 0, 0);
                DateTime to   = new DateTime(cmbPaymentDate.DateTime.Year, cmbPaymentDate.DateTime.Month, DateTime.DaysInMonth(cmbPaymentDate.DateTime.Year, cmbPaymentDate.DateTime.Month), 23, 59, 59);

                bindingSourceIn.DataSource  = db.vw_Payment.Where(s => s.Date >= from && s.Date <= to && s.Amount > 0).ToList();
                bindingSourceOut.DataSource = db.vw_Payment.Where(s => s.Date >= from && s.Date <= to && s.Amount < 0).ToList();
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
Пример #9
0
        private void btnGetAll_Click(object sender, EventArgs e)
        {
            try
            {
                // var list = new ObservableCollection(db.ItemCategories.ToList());

                db.ItemCategories.Load();
                var list = db.ItemCategories.Local.ToBindingList();
                bindingSource1.DataSource = list;
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
Пример #10
0
 private void repositoryItemButtonEditOperation_ButtonClick(object sender, ButtonPressedEventArgs e)
 {
     try
     {
         ////if (e.Button.Kind == ButtonPredefines.Ellipsis && gridView2.GetFocusedRow() is DataAccess.Item)
         ////{
         ////    var currentRow = gridView2.GetFocusedRow() as DataAccess.Item;
         ////    cmbItem.EditValue = currentRow.ID;
         ////}
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #11
0
 private void txtSearch_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         string query = txtSearch.Text;
         if (e.KeyCode == Keys.Enter && txtSearch.Text.Length > 2)
         {
             bindingSourceItem.DataSource = (from s in db.Items where s.Name.Contains(query) select s).ToList();// db.vw_Inventory.ToList();
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #12
0
 private void btnDailyInventoryStatu_Click(object sender, EventArgs e)
 {
     try
     {
         int BranchID = Convert.ToInt32(cmbBranches.EditValue);
         if (PushMessage.SendDailyInventoryStatus(BranchID, cmbFrom.DateTime, cmbTo.DateTime))
         {
             MessageBox.Show("تم إرسال التقرير الي نظام الموبايل");
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #13
0
        private void btnShowExpire_Click(object sender, EventArgs e)
        {
            try
            {
                int ReorderPoint = Convert.ToInt32(txtReorderPoint.EditValue);
                vwInventoryBindingSource.DataSource = null;

                var list = from s in db.vw_Inventory where s.CurrentQuanity < ReorderPoint select s;
                vwInventoryBindingSource.DataSource = list.ToList();
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
Пример #14
0
 void AddToListbox(IEnumerable <DataAccess.Item> list)
 {
     try
     {
         list = list.ToList();
         foreach (var item in list)
         {
             listBoxControl1.Items.Add(new ItemObject(item.Name, item.ID));
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #15
0
 private void cmbTheme_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (cmbTheme.EditValue != null && cmbTheme.EditValue.ToString() != string.Empty)
         {
             string selectedSkin = cmbTheme.EditValue.ToString();
             defaultLookAndFeel1.LookAndFeel.SkinName = selectedSkin;
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #16
0
 private void btnNewExpense_Click(object sender, EventArgs e)
 {
     try
     {
         ExpensesForm frm = new ExpensesForm();
         frm.ShowDialog();
         getExpenses();
         shiftBindingSource.ResetBindings(true);
         CalculateNetAmounts();
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #17
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            try
            {
                if (e.Button.Kind == DevExpress.XtraEditors.Controls.ButtonPredefines.SpinRight)
                {
                    var row    = gridView1.GetFocusedRow() as DataAccess.Inventory;
                    int itemID = Convert.ToInt32(row.ItemID);
                    var item   = db.Items.Where(s => s.ID == itemID).SingleOrDefault();
                    new ItemForm(item).ShowDialog();
                }
                else
                if (e.Button.Kind == DevExpress.XtraEditors.Controls.ButtonPredefines.Ellipsis)
                {
                    //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, "ItemID").ToString();

                    row.SystemQTY     = row.CurrentQuanity;
                    row.ActualQTY     = row.CurrentQuanity;
                    row.InventoryDate = DateTime.Now;
                    if (db.SaveChanges() > 0)
                    {
                        txtBarcode.Text = "";
                        txtSearch.Text  = "";
                        txtSearch.Focus();
                        inventoryBindingSource.DataSource = null;
                        gridControl1.DataSource           = null;
                        this.Text = ItemName + "  " + NewQTY;
                    }
                    else
                    {
                        MessageBox.Show("لم يتم حفظ البيانات، الرجاء المحاولة مرة أخري");
                    }
                }
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
Пример #18
0
        private void CalculateCash()
        {
            try
            {
                decimal discount         = Convert.ToDecimal(txtDiscount.EditValue);
                decimal cashFromCustomer = Convert.ToDecimal(txtCashFromCustomer.EditValue);

                txtCashReturn.EditValue = cashFromCustomer - invoiceTotal + discount;

                txtAfterDiscount.EditValue = invoiceTotal - discount;
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
Пример #19
0
        private void gridView1_ShowingEditor(object sender, CancelEventArgs e)
        {
            try
            {
                GridView view = sender as GridView;

                if (!view.IsNewItemRow(view.FocusedRowHandle))
                {
                    e.Cancel = true;
                }
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
Пример #20
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);
     }
 }
Пример #21
0
 private void btnItemCategory_Click(object sender, EventArgs e)
 {
     try
     {
         XtraForm frm = new XtraForm();
         frm.StartPosition = FormStartPosition.CenterScreen;
         frm.WindowState   = FormWindowState.Maximized;
         frm.Controls.Add(new GategoryUC());
         frm.Controls[0].Dock = DockStyle.Fill;
         frm.Show();
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #22
0
 private void gridView1_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
 {
     try
     {
         if (db.SaveChanges() > 0)
         {
             DataAccess.StockingDetail row = e.Row as DataAccess.StockingDetail;
             row.Status = 1;
             ShowMessageInStatusBar("تم حفظ اليانات", 9000);
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #23
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         errorProvider1.Clear();
         int userID = Convert.ToInt32(UserData.Default.UserID);
         //var User = db.Users.Where(s => s.ID == userID).SingleOrDefault();
         if (txtOldPassword.EditValue.ToString() != User.Password)
         {
             errorProvider1.SetError(txtOldPassword, "كلمة السر القديمة غير صحيحة");
             return;
         }
         if (txtNewPassword.EditValue == null || txtConfirmPassword.EditValue == null)
         {
             errorProvider1.SetError(txtConfirmPassword, "كلمة السر غير صحيحه");
             return;
         }
         if (txtNewPassword.EditValue.ToString() != txtConfirmPassword.EditValue.ToString())
         {
             errorProvider1.SetError(txtConfirmPassword, "كلمة السر غير مطابقة");
             return;
         }
         //User.Password = "";
         User.Password = txtNewPassword.EditValue.ToString();
         //User.Email = txtEmail.EditValue.ToString();
         //User.MobileNo = txtMobileNo.EditValue.ToString();
         //User.
         if (!db.ChangeTracker.HasChanges())
         {
             MessageBox.Show("لم تقم بتغيير أي شي ");
             return;
         }
         if (db.SaveChanges() > 0)
         {
             MessageBox.Show("تم حفظ التغييرات");
             this.Close();
         }
         else
         {
             MessageBox.Show("لم يتم حفظ التغييرات");
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #24
0
        private void btnAddUser_Click(object sender, EventArgs e)
        {
            try
            {
                if (!dxErrorProvider1.HasErrors)
                {
                    DataAccess.Request request = db.Requests.Create();
                    itemID = 0;

                    userID = Convert.ToInt32(UserData.Default.UserID);
                    string UserName = Convert.ToString(UserData.Default.UserName);
                    branchID = Convert.ToInt32(UserData.Default.BranchID);
                    quantity = Convert.ToInt32(txtQuantity.EditValue);
                    string desciption = txtDescription.Text;


                    request.UserID      = userID;
                    request.BranchID    = branchID;
                    request.RequestDate = DateTime.Now;
                    request.Quantity    = quantity;
                    request.Description = desciption;
                    var itemObj = (ItemObject)listBoxControl1.SelectedItem;
                    request.ItemID = Convert.ToInt32(itemObj.Data);
                    db.Requests.Add(request);

                    if (db.SaveChanges() > 0)
                    {
#if !DEBUG
                        var message = "" + UserData.Default.BranchName + " فرع " + UserName + " من المستخدم   " + lblItem.Text + " تمت طلب الصنف ";
                        PushMessage.SendDirectMessage(message);
#endif
                        MessageBox.Show("تم حفظ الطلب و إرساله للإدارة", "شكرا لاهتمامك");
                        //  Thread.Sleep(1500);
                        // this.Close();
                    }
                    else
                    {
                        MessageBox.Show("توجد مشكلة في حفظ البيانات، الرجاء المحاولة مرة أخري");
                    }
                }
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
                db = ModuleClass.GetConnection();
            }
        }
Пример #25
0
 private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         var row = gridView1.GetFocusedRow();
         if (row != null && row is DataAccess.ItemBarcode)
         {
             DataAccess.ItemBarcode itemBarcode = row as DataAccess.ItemBarcode;
             barCodeControlReda.Text = itemBarcode.BarcodeText;
         }
         //  e.FocusedRowHandle
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #26
0
 private void btnCommitInvoice_Click(object sender, EventArgs e)
 {
     try
     {
         this.invoice.Flag = 1;
         if (db.SaveChanges() > 0)
         {
             MessageBox.Show("تم قفل الفاتورة");
             // ShowMessageInStatusBar("تم حفظ اليانات", 9000);
             this.Close();
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #27
0
        private void TestForm_Load(object sender, EventArgs e)
        {
            try
            {
                //UserData.Default.BranchID = "1";
                //UserData.Default.Save();

                //SaleInvoiceForm_Tab saleTab = new SaleInvoiceForm_Tab(db, items, new DataAccess.SaleInvoice(), true, SaleInvoiceType.Sale);

                //xtraTabPage1.Controls.Add(saleTab);
                //xtraTabPage1.Text = "فاتورة " + pageIndex++;
                //xtraTabPage1.Controls[0].Dock = DockStyle.Fill;
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }
Пример #28
0
 private void txtSearch_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         string query = txtSearch.Text;
         if (e.KeyCode == Keys.Enter)
         {
             db = new DataAccess.RedaV1Entities(ModuleClass.Connect());
             db.PurchaseInvoices.Where(s => s.Number.Contains(query)).Load();
             var list = db.PurchaseInvoices.Local.ToBindingList();
             bindingSource1.DataSource = list;
         }
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #29
0
 private void ChangePassword_Load(object sender, EventArgs e)
 {
     try
     {
         int userID = Convert.ToInt32(UserData.Default.UserID);
         User = db.Users.Where(s => s.ID == userID).SingleOrDefault();
         userBindingSource.DataSource = User;
         txtOldPassword.EditValue     = "";
         //txtUserName.EditValue = User.UserName;
         //txtEmail.EditValue = User.Email;
         //txtMobileNo.EditValue = User.MobileNo;
         //txtOldPassword.Focus();
     }
     catch (Exception ex)
     {
         ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
     }
 }
Пример #30
0
        private void btnSaleInvoiceSearch_Click(object sender, EventArgs e)
        {
            try
            {
                //vwSaleReportBindingSource.DataSource = null;
                lblIncomeInvoice.Text    = "0";
                lblNoOfSaleInvoices.Text = "0";

                int ID   = Convert.ToInt32(txtSaleInvoiceID.EditValue);
                var list = from s in db.vw_SaleReport where s.ID == ID && s.BranchID == BranchID select s;
                vwSaleReportBindingSource.DataSource = list.ToList();
                gridViewSaleInvoice.ExpandAllGroups();
            }
            catch (Exception ex)
            {
                ModuleClass.ShowExceptionMessage(this, ex, "خطأ", null);
            }
        }