public virtual VoucherDataTable GetData(int?invoiceCode) { this.Adapter.SelectCommand = this.CommandCollection[0]; if (&invoiceCode.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = &invoiceCode.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } VoucherDataTable voucherDataTable = new VoucherDataTable(); this.Adapter.Fill(voucherDataTable); return(voucherDataTable); }
public virtual VoucherDataTable GetVoucherByDate(DateTime?date) { this.Adapter.SelectCommand = this.CommandCollection[2]; if (&date.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = &date.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } VoucherDataTable voucherDataTable = new VoucherDataTable(); this.Adapter.Fill(voucherDataTable); return(voucherDataTable); }
public VoucherDataTable getVoucherBydate(DateTime date) { VoucherDataTable voucherDataTable; using (VoucherTableAdapter voucherTableAdapter = new VoucherTableAdapter()) { try { VoucherDataTable voucherByDate = voucherTableAdapter.GetVoucherByDate(new DateTime?(date)); voucherDataTable = voucherByDate; } catch (Exception exception) { throw new Exception(string.Concat("unable to get vouchers", exception.Message)); } } return(voucherDataTable); }
public virtual int FillBy(VoucherDataTable dataTable, DateTime?date) { this.Adapter.SelectCommand = this.CommandCollection[2]; if (&date.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = &date.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } if (this.ClearBeforeFill) { dataTable.Clear(); } int num = this.Adapter.Fill(dataTable); return(num); }
public virtual int Fill(VoucherDataTable dataTable, int?invoiceCode) { this.Adapter.SelectCommand = this.CommandCollection[0]; if (&invoiceCode.HasValue) { this.Adapter.SelectCommand.Parameters[1].Value = &invoiceCode.Value; } else { this.Adapter.SelectCommand.Parameters[1].Value = DBNull.Value; } if (this.ClearBeforeFill) { dataTable.Clear(); } int num = this.Adapter.Fill(dataTable); return(num); }
public VoucherDataTable getVoucher(int VID) { VoucherDataTable voucherDataTable1; bool flag; VoucherTableAdapter voucherTableAdapter = new VoucherTableAdapter(); try { try { VoucherDataTable voucherDataTable2 = new VoucherDataTable(); voucherTableAdapter.Fill(voucherDataTable2, new int?(VID)); try { voucherDataTable2[0].chkNumber; flag = 0 == 0; } catch { voucherDataTable2[0].chkNumber = 0; } voucherDataTable1 = voucherDataTable2; } catch { throw new Exception("Error getting the invoice information"); } } finally { flag = voucherTableAdapter == null; if (!flag) { voucherTableAdapter.Dispose(); } } return(voucherDataTable1); }
internal void tsPrint_Click(object sender, EventArgs e) { if (WithdrawalForm._print != 0) { if (this.printDialog1.ShowDialog() == 1) { VoucherDataTable voucher = this._voucher.getVoucher(WithdrawalForm._voucherID); ReportDocument reportDocument = new ReportDocument(); reportDocument.Load(string.Concat(Path.GetDirectoryName(Application.ExecutablePath), "\\VoucherCR.rpt")); ParameterValues parameterValue1 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue1 = new ParameterDiscreteValue(); parameterDiscreteValue1.set_Value("سند صرف"); parameterValue1.Add(parameterDiscreteValue1); reportDocument.DataDefinition.ParameterFields["title"].ApplyCurrentValues(parameterValue1); ParameterValues parameterValue2 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue2 = new ParameterDiscreteValue(); parameterDiscreteValue2.set_Value(this.lblName.Text); parameterValue2.Add(parameterDiscreteValue2); reportDocument.DataDefinition.ParameterFields["lblAccName"].ApplyCurrentValues(parameterValue2); ParameterValues parameterValue3 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue3 = new ParameterDiscreteValue(); parameterDiscreteValue3.set_Value(voucher[0].CName); parameterValue3.Add(parameterDiscreteValue3); reportDocument.DataDefinition.ParameterFields["AccName"].ApplyCurrentValues(parameterValue3); ParameterValues parameterValue4 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue4 = new ParameterDiscreteValue(); parameterDiscreteValue4.set_Value(voucher[0].CAcc); parameterValue4.Add(parameterDiscreteValue4); reportDocument.DataDefinition.ParameterFields["AccNumber"].ApplyCurrentValues(parameterValue4); ParameterValues parameterValue5 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue5 = new ParameterDiscreteValue(); parameterDiscreteValue5.set_Value(voucher[0].Amount_NU); parameterValue5.Add(parameterDiscreteValue5); reportDocument.DataDefinition.ParameterFields["Amount"].ApplyCurrentValues(parameterValue5); ParameterValues parameterValue6 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue6 = new ParameterDiscreteValue(); parameterDiscreteValue6.set_Value(voucher[0].Descrip_VC); parameterValue6.Add(parameterDiscreteValue6); reportDocument.DataDefinition.ParameterFields["Desc"].ApplyCurrentValues(parameterValue6); ParameterValues parameterValue7 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue7 = new ParameterDiscreteValue(); try { int item = voucher[0].chkNumber.set_Value((!voucher[0].chkNumber ? "" : item.ToString())); } catch { parameterDiscreteValue7.set_Value(""); } parameterValue7.Add(parameterDiscreteValue7); reportDocument.DataDefinition.ParameterFields["chkNumber"].ApplyCurrentValues(parameterValue7); ParameterValues parameterValue8 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue8 = new ParameterDiscreteValue(); parameterDiscreteValue8.set_Value((!voucher[0].BankName ? "" : voucher[0].BankName)); parameterValue8.Add(parameterDiscreteValue8); reportDocument.DataDefinition.ParameterFields["Bank"].ApplyCurrentValues(parameterValue8); ParameterValues parameterValue9 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue9 = new ParameterDiscreteValue(); DateTime dateDT = voucher[0].Date_DT.set_Value(dateDT.ToShortDateString()); parameterValue9.Add(parameterDiscreteValue9); reportDocument.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(parameterValue9); ParameterValues parameterValue10 = new ParameterValues(); ParameterDiscreteValue parameterDiscreteValue10 = new ParameterDiscreteValue(); parameterDiscreteValue10.set_Value(WithdrawalForm._voucherID); parameterValue10.Add(parameterDiscreteValue10); reportDocument.DataDefinition.ParameterFields["VNumber"].ApplyCurrentValues(parameterValue10); reportDocument.PrintOptions.set_PrinterName(this.printDialog1.PrinterSettings.PrinterName); reportDocument.PrintToPrinter(this.printDialog1.PrinterSettings.Copies, this.printDialog1.PrinterSettings.Collate, 1, 1); MessageBox.Show(string.Concat("Report Error", exception.Message)); } try { } catch (Exception exception) { } } else { MessageBox.Show("الرجاء حفظ السند"); } }
private void tsAdd_Click(object sender, EventArgs e) { int num1; int? nullable1; int? nullable2; int num2; DateTime dateTime; if (!this.checkValidity()) { this.tbName.Focus(); } else { int num3 = Convert.ToInt32(this.tbCode.Text); decimal num4 = Convert.ToDecimal(this.tbAmount.Text); string text = this.tbNote.Text; if (!string.IsNullOrEmpty(this.tbCode.Text) && !string.IsNullOrEmpty(this.tbName.Text) && !string.IsNullOrEmpty(this.tbAmount.Text)) { BankBll bankBll = new BankBll(); new int?(Convert.ToInt32(this.tbCheck.Text)); new int?(num1 = Convert.ToInt32(this.ddlBank.SelectedValue)); } else { nullable1 = null; nullable2 = null; num1 = 21; } if (this.cbType.Checked) { MessageBox.Show("أحد الحسابات هو حساب رئيسي .. لايمكن اختياره"); } else { switch (WithdrawalForm._mode) { case Mode.New: { num2 = this._cash.getNewVoucher(); num2.insertVoucher(num3, num1, num4, 1.ToString(), nullable2, nullable1, 2, text, dateTime = DateTime.Now, dateTime.Date); MessageBox.Show("تم حفظ السند"); WithdrawalForm._mode = 1; WithdrawalForm._print = 1; WithdrawalForm._voucherID = num2; this.canPrint(true); MessageBox.Show(exception.Message); break; } } try { VoucherDataTable voucher = this._voucher.getVoucher(Convert.ToInt32(this.tbVNumber.Text)); this._voucher.updateVoucher(int.Parse(this.tbVNumber.Text), num3, voucher[0].DAcc, num1, voucher[0].CAcc, voucher[0].Amount_NU, num4, text, nullable1, nullable2); MessageBox.Show("تم التعديل"); WithdrawalForm._print = 1; WithdrawalForm._voucherID = int.Parse(this.tbVNumber.Text); this.canPrint(true); } catch (Exception exception) { MessageBox.Show(exception.Message); } goto L_0276; L_0276: break; MessageBox.Show("الرجاء اضافة المعلومات"); } } }
private void tbVNumber_Leave(object sender, EventArgs e) { bool str = string.IsNullOrEmpty(this.tbVNumber.Text) || WithdrawalForm._mode != Mode.Edit || this._closed; try { int num1 = Convert.ToInt32(this.tbVNumber.Text); string voucherType = this._voucher.getVoucherType(num1); str = !(voucherType == 1.ToString()); if (!str) { VoucherDataTable voucher = this._voucher.getVoucher(num1); DateTime dateDT = voucher[0].Date_DT.Text = dateDT.ToShortDateString(); int dAcc = voucher[0].DAcc.Text = dAcc.ToString(); this.tbName.Text = voucher[0].DName; decimal amountNU = voucher[0].Amount_NU.Text = amountNU.ToString(); this.tbNote.Text = voucher[0].Descrip_VC; this.cbType.Checked = (!voucher[0].chkNumber ? 0 : 1); str = !this.cbType.Checked; if (!str) { dAcc = voucher[0].chkNumber.Text = dAcc.ToString(); this.ddlBank.SelectedValue = voucher[0].CAcc; } WithdrawalForm._print = 1; WithdrawalForm._voucherID = Convert.ToInt32(this.tbVNumber.Text); this.tbVNumber.Enabled = false; this.dtpDate.Enabled = false; } else { str = !(voucherType == 0.ToString()); if (!str) { str = MessageBox.Show("نوع السند - سند قبض - هل تريد تحريره؟", "سند قبض", MessageBoxButtons.YesNo) != 6; if (!str) { DepositForm depositForm = new DepositForm(); Form mdiParent = base.MdiParent; this._closed = true; Form[] mdiChildren = mdiParent.MdiChildren; int num2 = 0; while (str) { Form form = mdiChildren[num2]; form.Close(); form.Dispose(); num2++; str = num2 < (int)mdiChildren.Length; } depositForm.MdiParent = mdiParent; depositForm._directed = true; depositForm._vNum = num1; depositForm.Anchor = AnchorStyles.Top | AnchorStyles.Right; depositForm.Dock = DockStyle.Fill; depositForm.Show(); } } else { str = !(voucherType == 2.ToString()); if (!str) { MessageBox.Show("قيد يومي. لا يمكن التعديل", "قيد يومي"); this.tbVNumber.Text = ""; this.tbVNumber.Focus(); } } } } catch { MessageBox.Show("خطأ في رقم السند - غير موجود "); } }