private void ComboDocNo_TextChanged(object sender, EventArgs e) { FormatBtnUpdate(); FormatBtnDelete(); // Loading data into the form: try { using (DBAuditDataContext dc = new DBAuditDataContext()) { if (ComboDocNo.Text != "") { string StrDocNo = null; DateTime?VarDatePay = null; int? IntLocationID = null; int? IntEmployeeID = null; string StrLocation = null; string StrEmployee = null; string StrPerson = null; decimal? decimalAmount = null; string StrDesc = null; string StrNotes = null; var c = dc.ProSelectCure(ComboDocNo.Text, ref StrDocNo, ref IntEmployeeID, ref IntLocationID, ref StrPerson, ref decimalAmount, ref VarDatePay, ref StrDesc, ref StrNotes); TxtDocNo.Text = StrDocNo; if (VarDatePay != null) { DatePayDate.Value = VarDatePay.Value; } var d = dc.ProGetLocationByID(IntLocationID, ref StrLocation); ComboLocation.Text = StrLocation; var x = dc.ProGetEmployeeByID(IntEmployeeID, ref StrEmployee); ComboName.Text = StrEmployee; TxtPerson.Text = StrPerson; TxtAmount.Text = decimalAmount.ToString(); TxtDesc.Text = StrDesc; TxtNotes.Text = StrNotes; } else { TxtDocNo.Text = ""; TxtPerson.Text = ""; ComboLocation.Text = ""; TxtAmount.Text = ""; TxtDesc.Text = ""; TxtNotes.Text = ""; } } } catch (NullReferenceException) { BtnDelete.Enabled = false; } catch (InvalidOperationException) { BtnDelete.Enabled = false; } catch (Exception EX) { MessageBox.Show(EX.Message); } }
private void ImportData() { //Retreive document details from database try { using (var dc = new DBAuditDataContext()) { if (ComboDocNo.SelectedIndex != -1 && ComboName.SelectedIndex != -1) { DateTime?varDatePay = null; int? intLocationId = null; string strLocation = null; string strDestination = null; string strPeriod = null; decimal? doubleTrans = null; decimal? doubleTravel = null; string strNotes = null; dc.ProSelectTransFee(ComboDocNo.SelectedValue.ToString(), ref varDatePay, ref intLocationId, int.Parse(ComboName.SelectedValue.ToString()), ref strDestination, ref strPeriod, ref doubleTrans, ref doubleTravel, ref strNotes); if (varDatePay != null) { DatePay.Value = varDatePay.Value; } dc.ProGetLocationByID(intLocationId, ref strLocation); ComboLocation.Text = strLocation; TxtDestination.Text = strDestination; TxtPeriod.Text = strPeriod; TxtTrans.Text = doubleTrans.ToString(); TxtTravel.Text = doubleTravel.ToString(); TxtNotes.Text = strNotes; } else { DatePay.Text = null; ComboLocation.SelectedIndex = -1; TxtDestination.Clear(); TxtPeriod.Clear(); TxtTrans.Clear(); TxtTravel.Clear(); TxtNotes.Clear(); } } } catch (InvalidOperationException) { DatePay.Value = DateTime.Now; ComboLocation.Text = ""; TxtDestination.Text = ""; TxtPeriod.Text = ""; TxtTrans.Text = ""; TxtTravel.Text = ""; TxtNotes.Text = ""; BtnDelete.Enabled = false; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ComboSetNo_TextChanged(object sender, EventArgs e) { FormatBtnUpdate(ComboSetNo, TxtSettlementNo, ComboLocation, TxtTotalAmount, TxtReason); FormatBtnDelete(ComboSetNo); // // Loading data into form try { using (DBAuditDataContext dc = new DBAuditDataContext()) { if (ComboSetNo.Text != "") { string StrSetNo = null; int? IntLocID = null; string StrLocation = null; DateTime?VarSetDate = null; decimal? DecimalAmount = null; string StrDetails = null; string StrNotes = null; var c = dc.ProSelectSettlement(ComboSetNo.Text, ref StrSetNo, ref IntLocID, ref VarSetDate, ref DecimalAmount, ref StrDetails, ref StrNotes); TxtSettlementNo.Text = StrSetNo; var d = dc.ProGetLocationByID(IntLocID, ref StrLocation); ComboLocation.Text = StrLocation; if (VarSetDate != null) { DateSettlement.Value = VarSetDate.Value; } else { DateSettlement.Value = DateTime.Now; } TxtTotalAmount.Text = DecimalAmount.ToString(); TxtReason.Text = StrDetails; TxtNotes.Text = StrNotes; } else { TxtSettlementNo.Text = null; ComboLocation.Text = null; DateSettlement.Value = DateTime.Now; TxtTotalAmount.Text = null; TxtReason.Text = null; TxtNotes.Text = null; } } } catch (NullReferenceException) { } catch (InvalidOperationException) { DateSettlement.Value = DateTime.Now; BtnDelete.Enabled = false; } catch (Exception EX) { MessageBox.Show(EX.Message.ToString()); } }
private void ImportData() { try { // Loading data into the form: using (DBAuditDataContext dc = new DBAuditDataContext()) { if (ComboName.Text == "") { return; } string strName = null; int? intLocationId = null; string strLocation = null; string strDegree = null; string strPosition = null; string strAdress = null; string strTelephone = null; string strNotes = null; dc.ProSelectEmployee(int.Parse(ComboName.SelectedValue.ToString()), ref strName, ref intLocationId, ref strDegree, ref strPosition, ref strAdress, ref strTelephone, ref strNotes); dc.ProGetLocationByID(intLocationId, ref strLocation); TxtName.Text = strName; ComboLocation.Text = strLocation; ComboDegree.Text = strDegree; ComboPosition.Text = strPosition; TxtAddress.Text = strAdress; TxtTelephone.Text = strTelephone; TxtNotes.Text = strNotes; } } catch (NullReferenceException) { } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void ComboDocNo_TextChanged(object sender, EventArgs e) { // Formatting the form: if (ComboDocNo.Text == "") { BtnDelete.Enabled = false; } else { BtnDelete.Enabled = true; } if (ComboStatus.Text == "لم يتم تسويتها") { if (ComboDocNo.Text == "" || ComboLocation.Text == "" || ComboEmployee.Text == "" || TxtTotalAmount.Text == "" || TxtPeriod.Text == "" || TxtReason.Text == "") { BtnUpdate.Enabled = false; } else { BtnUpdate.Enabled = true; } } else { if (ComboDocNo.Text == "" || ComboLocation.Text == "" || ComboEmployee.Text == "" || TxtTotalAmount.Text == "" || TxtPeriod.Text == "" || TxtReason.Text == "" || TxtChequeNo.Text == "" || TxtSettlementAmount.Text == "0") { BtnUpdate.Enabled = false; } else { BtnUpdate.Enabled = true; } } // Loading data into the form: try { using (DBAuditDataContext dc = new DBAuditDataContext()) { if (ComboDocNo.Text != "") { DateTime?VarPayDate = null; int? IntLocationID = null; string StrLocation = null; int? IntEmployeeID = null; string StrEmployee = null; decimal? decimalTotalAmount = null; int? IntPeriod = null; string StrResason = null; string StrStatues = null; DateTime?varSettlementDate = null; string StrChequeNo = null; DateTime?VarChequeDate = null; DateTime?VarExpenseDate = null; DateTime?VarEndDate = null; decimal? decimalSettlementAmount = null; int? IntSettlementPEriod = null; decimal? decimalTax = null; decimal? decimalPenalty = null; decimal? decimalFees = null; decimal? decimalRevenues = null; decimal? decimalNetAmount = null; decimal? decimalTotalDiscount = null; decimal? decimalAmountToPay = null; decimal? decimalPaidAmount = null; string StrBillNo = null; string StrSettlementNo = null; string StrNotes = null; var c = dc.ProSelectTempLoan(ComboDocNo.Text, ref VarPayDate, ref IntLocationID, ref IntEmployeeID, ref decimalTotalAmount, ref IntPeriod, ref StrResason, ref StrStatues, ref varSettlementDate, ref StrChequeNo, ref VarChequeDate, ref VarExpenseDate, ref VarEndDate, ref decimalSettlementAmount, ref IntSettlementPEriod, ref decimalTax, ref decimalPenalty, ref decimalFees, ref decimalRevenues, ref decimalNetAmount, ref decimalTotalDiscount, ref decimalAmountToPay, ref decimalPaidAmount, ref StrBillNo, ref StrSettlementNo, ref StrNotes); DatePayDate.Value = VarPayDate.Value; var d = dc.ProGetLocationByID(IntLocationID, ref StrLocation); ComboLocation.Text = StrLocation; var x = dc.ProGetEmployeeByID(IntEmployeeID, ref StrEmployee); ComboEmployee.Text = StrEmployee; TxtTotalAmount.Text = decimalTotalAmount.ToString(); TxtPeriod.Text = IntPeriod.ToString(); TxtReason.Text = StrResason; ComboStatus.Text = StrStatues; if (varSettlementDate != null) { DateSettlement.Value = varSettlementDate.Value; } TxtChequeNo.Text = StrChequeNo; if (VarChequeDate != null) { DateChequeDate.Value = VarChequeDate.Value; } if (VarExpenseDate != null) { DateChequeExpense.Value = VarExpenseDate.Value; } if (VarExpenseDate != null) { DateChequeExpense.Value = VarExpenseDate.Value; } if (VarEndDate != null) { DateEndDate.Value = VarEndDate.Value; } TxtSettlementAmount.Text = decimalSettlementAmount.ToString(); TxtSettlementPeriod.Text = IntSettlementPEriod.ToString(); TxtTax.Text = decimalTax.ToString(); TxtPenalty.Text = decimalPenalty.ToString(); TxtFees.Text = decimalFees.ToString(); TxtRevenues.Text = decimalRevenues.ToString(); TxtNetAmount.Text = decimalNetAmount.ToString(); TxtTotalDiscount.Text = decimalTotalDiscount.ToString(); TxtAmountToPay.Text = decimalAmountToPay.ToString(); TxtPaidAmount.Text = decimalPaidAmount.ToString(); TxtBill.Text = StrBillNo; TxtSettlementNo.Text = StrSettlementNo; TxtNotes.Text = StrNotes; } else { DatePayDate.Value = DateTime.Now; ComboLocation.Text = ""; ComboEmployee.Text = ""; TxtTotalAmount.Text = ""; TxtPeriod.Text = ""; TxtReason.Text = ""; ComboStatus.Text = ""; DateSettlement.Value = DateTime.Now; TxtChequeNo.Text = ""; DateChequeDate.Value = DateTime.Now; DateChequeExpense.Value = DateTime.Now; DateEndDate.Value = DateTime.Now; TxtSettlementAmount.Text = ""; TxtSettlementPeriod.Text = ""; TxtTax.Text = ""; TxtPenalty.Text = ""; TxtFees.Text = ""; TxtRevenues.Text = ""; TxtNetAmount.Text = ""; TxtTotalDiscount.Text = ""; TxtAmountToPay.Text = ""; TxtPaidAmount.Text = ""; TxtBill.Text = ""; TxtSettlementNo.Text = ""; TxtNotes.Text = ""; } } } catch (NullReferenceException) { } catch (InvalidOperationException) { DatePayDate.Value = DateTime.Now; ComboLocation.Text = ""; ComboEmployee.Text = ""; TxtTotalAmount.Text = ""; TxtPeriod.Text = ""; TxtReason.Text = ""; ComboStatus.Text = ""; DateSettlement.Value = DateTime.Now; TxtChequeNo.Text = ""; DateChequeDate.Value = DateTime.Now; DateChequeExpense.Value = DateTime.Now; DateEndDate.Value = DateTime.Now; TxtSettlementAmount.Text = ""; TxtSettlementPeriod.Text = ""; TxtTax.Text = ""; TxtPenalty.Text = ""; TxtFees.Text = ""; TxtRevenues.Text = ""; TxtNetAmount.Text = ""; TxtTotalDiscount.Text = ""; TxtAmountToPay.Text = ""; TxtPaidAmount.Text = ""; TxtBill.Text = ""; TxtSettlementNo.Text = ""; TxtNotes.Text = ""; BtnDelete.Enabled = false; } catch (Exception EX) { MessageBox.Show(EX.Message.ToString()); } }
private void ComboDocNo_TextChanged(object sender, EventArgs e) { //Formatting Form: if (ComboDocNo.Text == "") { BtnDelete.Enabled = false; } else { BtnDelete.Enabled = true; } if (TxtPredicationOrder.Text == "" || ComboLocation.Text == "" || ComboContractor.Text == "" || TxtExcuteOrder.Text == "" || TxtPeriod.Text == "0" || ComboDocNo.Text == "" || TxtOperation.Text == "" || TxtAmount.Text == "0" || ComboReservedRefund.Text == "" || ComboInsuranceRefund.Text == "" || TxtJustAmount.Text == "") { BtnUpdate.Enabled = false; } else { BtnUpdate.Enabled = true; } // // Loading data to form: // try { using (DBAuditDataContext dc = new DBAuditDataContext()) { if (ComboDocNo.Text != "") { int? IntLocationID = null; int? IntContractorID = null; string StrExcuteOrder = null; DateTime?VarExcuteDate = null; string StrPredicationOder = null; DateTime?VarPredicationDate = null; int? IntPeriod = null; DateTime?VarStartDate = null; DateTime?VarEndDate = null; int? IntActualPeriod = null; string StrName = null; decimal? DecimalValue = null; DateTime?VarDatePay = null; decimal? DecimalTaxRate = null; decimal? DecimalTaxValue = null; decimal? DecimalTransFeesRate = null; decimal? DecimalTransFeesValue = null; decimal? DecimalInsuranceRate = null; decimal? DecimalInsuranceValue = null; string StrInsuranceRefund = null; decimal? DecimalReservedRate = null; decimal? DecimalReservedValue = null; string StrReservedRefund = null; decimal? DecimalBusinessFees = null; decimal? DecimalTotalDiscount = null; decimal? DecimalNetAmount = null; string StrJustAmount = null; string StrReservedDocNo = null; DateTime?VarReservedPayDate = null; decimal? DecimalResDiscPercent = null; decimal? DecimalResDiscount = null; decimal? DecimalResPaid = null; string StrInsDocNo = null; DateTime?varInsurancePayDate = null; decimal? DecimalInsDiscPercent = null; decimal? DecimalInsDiscount = null; decimal? DecimalInsurancePaid = null; string StrNotes = null; string StrLocation = null; string StrContractor = null; dc.ProSelectProject(ref IntLocationID, ref IntContractorID, ref StrExcuteOrder, ref VarExcuteDate, ref StrPredicationOder, ref VarPredicationDate, ref IntPeriod, ComboDocNo.SelectedValue.ToString(), ref VarStartDate, ref VarEndDate, ref IntActualPeriod, ref StrName, ref DecimalValue, ref VarDatePay, ref DecimalTaxRate, ref DecimalTaxValue, ref DecimalTransFeesRate, ref DecimalTransFeesValue, ref DecimalInsuranceRate, ref DecimalInsuranceValue, ref StrInsuranceRefund, ref DecimalReservedRate, ref DecimalReservedValue, ref StrReservedRefund, ref DecimalBusinessFees, ref DecimalTotalDiscount, ref DecimalNetAmount, ref StrJustAmount, ref StrReservedDocNo, ref VarReservedPayDate, ref DecimalResDiscPercent, ref DecimalResDiscount, ref DecimalResPaid, ref StrInsDocNo, ref varInsurancePayDate, ref DecimalInsDiscPercent, ref DecimalInsDiscount, ref DecimalInsurancePaid, ref StrNotes); TxtExcuteOrder.Text = StrExcuteOrder; DateExcuteOrder.Value = VarExcuteDate.Value; TxtPredicationOrder.Text = StrPredicationOder; DatePredicationOreder.Value = VarPredicationDate.Value; TxtPeriod.Text = IntPeriod.ToString(); DateStart.Value = VarStartDate.Value; DateEnd.Value = VarEndDate.Value; TxtActualPeriod.Text = IntActualPeriod.ToString(); TxtOperation.Text = StrName; TxtAmount.Text = DecimalValue.ToString(); DatePay.Value = VarDatePay.Value; TxtTaxRate.Text = DecimalTaxRate.ToString(); TxtTaxAmount.Text = DecimalTaxValue.ToString(); TxtTransRate.Text = DecimalTransFeesRate.ToString(); TxtTransAmount.Text = DecimalTransFeesValue.ToString(); TxtInsurRate.Text = DecimalInsuranceRate.ToString(); TxtInsurAmount.Text = DecimalInsuranceValue.ToString(); ComboReservedRefund.Text = StrInsuranceRefund; TxtReservedRate.Text = DecimalReservedRate.ToString(); TxtReservedAmount.Text = DecimalReservedValue.ToString(); ComboInsuranceRefund.Text = StrReservedRefund; TxtBusinessFees.Text = DecimalBusinessFees.ToString(); TxtTotalDiscount.Text = DecimalTotalDiscount.ToString(); TxtNetAmount.Text = DecimalNetAmount.ToString(); TxtJustAmount.Text = StrJustAmount; TxtReservedDocNo.Text = StrReservedDocNo; if (VarReservedPayDate != null) { DateResevedPay.Value = VarReservedPayDate.Value; } else { DateResevedPay.Value = DateTime.Now; } TxtResDiscountPercentage.Text = DecimalResDiscPercent.ToString(); TxtResDiscountAmount.Text = DecimalResDiscount.ToString(); TxtReservedPaid.Text = DecimalResPaid.ToString(); TxtInsuranceDocNo.Text = StrInsDocNo; if (varInsurancePayDate != null) { DateInsurancePay.Value = varInsurancePayDate.Value; } else { DateInsurancePay.Value = DateTime.Now; } TxtInsurDiscountPercentage.Text = DecimalInsDiscPercent.ToString(); TxtInsuranceDiscountAmount.Text = DecimalInsDiscount.ToString(); TxtInsurancePaid.Text = DecimalInsurancePaid.ToString(); TxtNotes.Text = StrNotes; DatePay.Value = VarDatePay.Value; var d = dc.ProGetLocationByID(IntLocationID, ref StrLocation); ComboLocation.Text = StrLocation; var x = dc.ProGetContractorByID(IntContractorID, ref StrContractor); ComboContractor.Text = StrContractor; TxtNotes.Text = StrNotes; } else { ComboLocation.Text = ""; ComboContractor.Text = ""; TxtExcuteOrder.Text = ""; DateExcuteOrder.Value = DatePredicationOreder.Value = DateStart.Value = DateEnd.Value = DatePay.Value = DateTime.Now; TxtPredicationOrder.Text = ""; TxtPeriod.Text = "0"; TxtActualPeriod.Text = ""; TxtOperation.Text = ""; TxtAmount.Text = "0.00"; TxtTaxAmount.Text = "0.00"; TxtTransAmount.Text = "0.00"; TxtInsurAmount.Text = "0.00"; ComboReservedRefund.Text = ""; TxtReservedAmount.Text = "0.00"; ComboInsuranceRefund.Text = ""; TxtBusinessFees.Text = "0.00"; TxtTotalDiscount.Text = "0.00"; TxtNetAmount.Text = "0.00"; TxtJustAmount.Text = ""; TxtReservedDocNo.Text = null; DateResevedPay.Value = DateTime.Now; ; TxtResDiscountPercentage.Text = null; TxtResDiscountAmount.Text = null; TxtReservedPaid.Text = null; TxtInsuranceDocNo.Text = null; DateInsurancePay.Value = DateTime.Now; TxtInsurDiscountPercentage.Text = null; TxtInsuranceDiscountAmount.Text = null; TxtInsurancePaid.Text = null; TxtNotes.Text = null; } } } catch (NullReferenceException) { } catch (InvalidOperationException IEX) { MessageBox.Show(IEX.Message); ComboLocation.Text = ""; ComboContractor.Text = ""; TxtExcuteOrder.Text = ""; DateExcuteOrder.Value = DatePredicationOreder.Value = DateStart.Value = DateEnd.Value = DatePay.Value = DateTime.Now; TxtPredicationOrder.Text = ""; TxtPeriod.Text = "0"; TxtActualPeriod.Text = ""; TxtOperation.Text = ""; TxtAmount.Text = "0.00"; TxtTaxAmount.Text = "0.00"; TxtTransAmount.Text = "0.00"; TxtInsurAmount.Text = "0.00"; ComboReservedRefund.Text = ""; TxtReservedAmount.Text = "0.00"; ComboInsuranceRefund.Text = ""; TxtBusinessFees.Text = "0.00"; TxtTotalDiscount.Text = "0.00"; TxtNetAmount.Text = "0.00"; TxtJustAmount.Text = ""; TxtReservedDocNo.Text = null; DateResevedPay.Value = DateTime.Now; ; TxtResDiscountPercentage.Text = null; TxtResDiscountAmount.Text = null; TxtReservedPaid.Text = null; TxtInsuranceDocNo.Text = null; DateInsurancePay.Value = DateTime.Now; TxtInsurDiscountPercentage.Text = null; TxtInsuranceDiscountAmount.Text = null; TxtInsurancePaid.Text = null; TxtNotes.Text = ""; BtnDelete.Enabled = false; } catch (Exception EX) { MessageBox.Show(EX.Message); ComboLocation.Text = ""; ComboContractor.Text = ""; TxtExcuteOrder.Text = ""; DateExcuteOrder.Value = DatePredicationOreder.Value = DateStart.Value = DateEnd.Value = DatePay.Value = DateTime.Now; TxtPredicationOrder.Text = ""; TxtPeriod.Text = "0"; TxtActualPeriod.Text = ""; TxtOperation.Text = ""; TxtAmount.Text = "0.00"; TxtTaxAmount.Text = "0.00"; TxtTransAmount.Text = "0.00"; TxtInsurAmount.Text = "0.00"; ComboReservedRefund.Text = ""; TxtReservedAmount.Text = "0.00"; ComboInsuranceRefund.Text = ""; TxtBusinessFees.Text = "0.00"; TxtTotalDiscount.Text = "0.00"; TxtNetAmount.Text = "0.00"; TxtJustAmount.Text = ""; TxtReservedDocNo.Text = null; DateResevedPay.Value = DateTime.Now; ; TxtResDiscountPercentage.Text = null; TxtResDiscountAmount.Text = null; TxtReservedPaid.Text = null; TxtInsuranceDocNo.Text = null; DateInsurancePay.Value = DateTime.Now; TxtInsurDiscountPercentage.Text = null; TxtInsuranceDiscountAmount.Text = null; TxtInsurancePaid.Text = null; TxtNotes.Text = ""; BtnDelete.Enabled = false; } }