private void simpleButton2_Click(object sender, EventArgs e) { if (ControlFlag == InvoiceWorkflowState.Approvement) { Invoice inv = InvoiceUtils.Find <Invoice>(InvoiceID); inv.WorkflowState = InvoiceWorkflowState.Rejected; int result = InvoiceUtils.Update <Invoice>(inv); if (result == 0) { DevExpress.XtraEditors.XtraMessageBox.Show(LookAndFeel.ParentLookAndFeel, "تمت العملية بنجاج", "تصديق فاتورة", MessageBoxButtons.OK, MessageBoxIcon.Information); } } this.Hide(); }
private void simpleButton1_Click(object sender, EventArgs e) { if (ControlFlag == InvoiceWorkflowState.Request) { DateTime invoiceDatetime = dateTimePicker1.Value; int supID = int.Parse(comboBoxEdit1.SelectedValue.ToString()); Invoice inv = new Invoice { InvoiceDate = invoiceDatetime, SupplierId = supID, WorkflowState = InvoiceWorkflowState.Request, Total = InvoiceTotal }; InvoiceUtils.Add <Invoice>(inv); DataGridViewComboBoxCell cat; DataGridViewComboBoxCell pro; //Product product; //Category category; int catId; int proID; double unPrise; int Qty; for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { DataGridViewRow row = dataGridView1.Rows[i]; cat = row.Cells[0] as DataGridViewComboBoxCell; pro = row.Cells[1] as DataGridViewComboBoxCell; catId = int.Parse(cat.Value.ToString()); proID = int.Parse(pro.Value.ToString()); unPrise = double.Parse(row.Cells[2].Value.ToString()); Qty = int.Parse(row.Cells[3].Value.ToString()); //product = InvoiceUtils.Find<Product>(proID); //category = InvoiceUtils.Find<Category>(catId); InvoiceDetail inDet = new InvoiceDetail { InvoiceId = inv.InvoiceId, ProductId = proID, CategoryId = catId, UnitQuantity = Qty, UnitPrice = unPrise }; InvoiceUtils.Add <InvoiceDetail>(inDet); } XtraMessageBox.AllowCustomLookAndFeel = true; DevExpress.XtraEditors.XtraMessageBox.Show(LookAndFeel.ParentLookAndFeel, "تمت العملية بنجاج", "حفظ الفاتورة", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (ControlFlag == InvoiceWorkflowState.Approvement) { Invoice inv = InvoiceUtils.Find <Invoice>(InvoiceID); inv.WorkflowState = InvoiceWorkflowState.Approvement; int result = InvoiceUtils.Update <Invoice>(inv); if (result == 0) { DevExpress.XtraEditors.XtraMessageBox.Show(LookAndFeel.ParentLookAndFeel, "تمت العملية بنجاج", "تصديق فاتورة", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (ControlFlag == InvoiceWorkflowState.Payment) { //more payment stuff Invoice inv = InvoiceUtils.Find <Invoice>(InvoiceID); inv.WorkflowState = InvoiceWorkflowState.Completed; int result = InvoiceUtils.Update <Invoice>(inv); if (result == 0) { DevExpress.XtraEditors.XtraMessageBox.Show(LookAndFeel.ParentLookAndFeel, "تمت العملية بنجاج", "البيانات المالية لفاتورة", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (ControlFlag == InvoiceWorkflowState.Completed) { Invoice inv = InvoiceUtils.Find <Invoice>(InvoiceID); inv.WorkflowState = InvoiceWorkflowState.Completed; int result = InvoiceUtils.Update <Invoice>(inv); if (result == 0) { DevExpress.XtraEditors.XtraMessageBox.Show(LookAndFeel.ParentLookAndFeel, "تمت العملية بنجاج", "تأكيد إكمال فاتورة", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else if (ControlFlag == InvoiceWorkflowState.Return) { //more return stuff Invoice inv = InvoiceUtils.Find <Invoice>(InvoiceID); inv.WorkflowState = InvoiceWorkflowState.Return; int result = InvoiceUtils.Update <Invoice>(inv); if (result == 0) { DevExpress.XtraEditors.XtraMessageBox.Show(LookAndFeel.ParentLookAndFeel, "تمت العملية بنجاج", "إرجاع فاتورة", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }