private void btnSave_Click(object sender, EventArgs e) { PayDayCodeManager oManager = new PayDayCodeManager(); PayDayCodeUnit oUnit = new PayDayCodeUnit(); oManager.ConnectionString = this.ConnectionString; oManager.Open(); oUnit.Code = txtCode.Text; oUnit.Description = txtDescription.Text; oUnit.DateCreated = Convert.ToDateTime(dtCreated.EditValue); oUnit.CreatedBy = txtCreatedBy.Text; oUnit.DateModified = Convert.ToDateTime(dtModified.EditValue); oUnit.ModifiedBy = txtModifiedBy.Text; oUnit.LineItems = this.LineItems; oManager.Add(oUnit); oManager.Close(); this.MainMenu.RefreshMainMenu(); }
void BindPayDayCode() { PayDayCodeManager oManager = new PayDayCodeManager(); DataTable dtLines = new DataTable(); oManager.ConnectionString = this.ConnectionString; oManager.Open(); dtLines = oManager.GetPayDayCodeHeader(); cboPayDayCode.Properties.DataSource = dtLines; cboPayDayCode.Properties.DisplayMember = "Remarks"; cboPayDayCode.Properties.ValueMember = "PayDayCode"; DevExpress.XtraEditors.Controls.LookUpColumnInfo col; col = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("PayDayCode", "Code", 100); cboPayDayCode.Properties.Columns.Add(col); col = new DevExpress.XtraEditors.Controls.LookUpColumnInfo("Remarks", "Name", 100); cboPayDayCode.Properties.Columns.Add(col); cboPayDayCode.Refresh(); oManager.Close(); }
public void CreateRowInCustomFrequency(string sPayDayCode, string sPayment, int count, string sInterestPaid, string sPrincipalPaid, string sEndingBalance, int countRow) { DateTime dateStart = (DateTime)dtStartOfPayment.EditValue; string sPaymentTerm = cboFrequencyOfPayment.Text; PayDayCodeManager oManager = new PayDayCodeManager(); oManager.ConnectionString = this.ConnectionString; oManager.Open(); DataTable dtLines = oManager.GetPayDayCodeLineItems(sPayDayCode); oManager.Close(); int iRowCount = dtLines.Rows.Count; int iRowNo = 0; dateStart = dateStart.AddMonths(countRow - 1); foreach (DataRow lineRow in dtLines.Rows) { DataRow oRow = this.LineScheduleOfPayment.NewRow(); oRow["ScheduleNo"] = iRowCounter; string sMonth = dateStart.Month.ToString(); string sDay = lineRow["DayWeekNo"].ToString(); string sYear = dateStart.Year.ToString(); DateTime dtSchedule; repeat: string sConcatMonth = (sMonth + "/" + sDay + "/" + sYear); try { dtSchedule = Convert.ToDateTime(sConcatMonth); } catch { sDay = (Convert.ToInt16(sDay) - 1).ToString(); goto repeat; } //dtSchedule = Convert.ToDateTime(sConcatMonth); oRow["ScheduledDate"] = dtSchedule; oRow["PaymentAmount"] = String.Format("{0:N}", Convert.ToDouble(sPayment) / iRowCount); ; oRow["PrincipalReduction"] = String.Format("{0:N}", Convert.ToDouble(sPrincipalPaid) / iRowCount); oRow["InterestAmount"] = String.Format("{0:N}", Convert.ToDouble(sInterestPaid) / iRowCount); oRow["PaidAmount"] = 0; oRow["OtherCharges"] = 0; this.LineScheduleOfPayment.Rows.Add(oRow); iRowCounter = iRowCounter + 1; } txtNoOfPayments.Text = (iRowCounter - 1).ToString("#,###"); }
private void BindPayDayCode() { PayDayCodeManager oManager = new PayDayCodeManager(); oManager.ConnectionString = this.ConnectionString; oManager.Open(); DataTable dtHeader = oManager.GetPayDayCodeHeader(); DataTable dtLineItems = oManager.GetPayDayCodeLineItems(); DataSet dsPayDayCode = new DataSet(); dsPayDayCode.Tables.Add(dtHeader); dsPayDayCode.Tables.Add(dtLineItems); DataColumn keyColumn = dsPayDayCode.Tables[0].Columns["PayDayCode"]; DataColumn foreignKeyColumn = dsPayDayCode.Tables[1].Columns["PayDayCode"]; dsPayDayCode.Relations.Add("PayDayCode", keyColumn, foreignKeyColumn); //Bind the grid control to the data source gridControl1.DataSource = dsPayDayCode.Tables[0]; gridControl1.Refresh(); }