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("#,###");
        }
Beispiel #2
0
        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();
        }