예제 #1
0
        private void SetDefaultData(IEnumerable <string> verticals)
        {
            string      setcellName = "AVERAGE";
            int         defaultVal  = 0;
            string      setCmbVal   = cmbBillingCycle.SelectedItem.ToString();
            Particulars p           = new Particulars();
            var         particulars = p.GetAllParticulars();

            foreach (var part in particulars)
            {
                foreach (var subtype in part.ParticularsSubTypes)
                {
                    dataGridView1.Rows[subtype.SubTypeID].Cells[setcellName].Value = defaultVal;
                    dataGridView1.Rows[subtype.SubTypeID].Cells[setCmbVal].Value   = defaultVal;
                }
            }

            //----------------Calculations According to verticals
            int rowno = 17;
            int verticalsubSecCount = Properties.Settings.Default.VerticalsSubSection.Split(',').Length;

            foreach (var vert in verticals)
            {
                for (int subver = 0; subver < verticalsubSecCount; subver++)
                {
                    dataGridView1.Rows[rowno].Cells[setcellName].Value = defaultVal;
                    dataGridView1.Rows[rowno].Cells[setCmbVal].Value   = defaultVal;
                    rowno++;
                }
                rowno++;
            }
        }
예제 #2
0
        public List <Particulars> GetParticularList()
        {
            List <Particulars> verticalList = new List <Particulars>();
            Particulars        vertical;

            try
            {
                using (System.Data.SQLite.SQLiteConnection con = new System.Data.SQLite.SQLiteConnection(BaseDbContext.databasestring))
                {
                    using (System.Data.SQLite.SQLiteCommand com = new System.Data.SQLite.SQLiteCommand(con))
                    {
                        con.Open();                                                              // Open the connection to the database
                        com.CommandText = "Select ParticularID,ParticularName FROM Particulars"; // Select all rows from our database table
                        using (System.Data.SQLite.SQLiteDataReader reader = com.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                vertical = new Particulars();
                                vertical.ParticularsID   = Convert.ToInt32(reader["ParticularID"]);
                                vertical.ParticularsName = Convert.ToString(reader["ParticularName"]);
                                verticalList.Add(vertical);
                            }
                        }
                        con.Close();        // Close the connection to the database
                    }
                }
                return(verticalList);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
예제 #3
0
        protected override string GenerateBankFileDetail(GenericBankFileDetail bankFileDetail)
        {
            string[] bankFileDetailPaymentRecord = new string[31];

            // Record Type 9(1)
            bankFileDetailPaymentRecord[0] = "2";
            // Receiving Bank Code 9(3)
            bankFileDetailPaymentRecord[1] = bankFileDetail.BankCode.PadRight(3).Substring(0, 3);
            // Receiving Branch Code 9(3)
            bankFileDetailPaymentRecord[2] = bankFileDetail.BranchCode.PadRight(3).Substring(0, 3);
            // Receiving Account Code 9(11)
            bankFileDetailPaymentRecord[3] = bankFileDetail.AccountNo.PadRight(11).Substring(0, 11);
            // Receiving A/c Name X(20)
            bankFileDetailPaymentRecord[4] = bankFileDetail.EmpBankAccountHolderName.ToUpper().PadRight(20).Substring(0, 20);
            // Transaction Code 9(2)
            bankFileDetailPaymentRecord[5] = ((int)TransactionType).ToString("00");
            // Amount 9(9)V9(2)
            string m_amount = bankFileDetail.Amount.ToString("0.00").Replace(".", "");

            bankFileDetailPaymentRecord[6] = m_amount.PadLeft(11);
            // Particulars X(6)
            bankFileDetailPaymentRecord[7] = Particulars.PadRight(6).Substring(0, 6);
            // Reference X(18)
            bankFileDetailPaymentRecord[8] = "".PadRight(18);
            // Print Payment Advice Indicator X(1)
            bankFileDetailPaymentRecord[9] = "N";
            // Delivery Mode (Print) X(1)
            bankFileDetailPaymentRecord[10] = "".PadRight(1);
            // Delivery Mode (Email) X(1)
            bankFileDetailPaymentRecord[11] = "".PadRight(1);
            // Delivery Mode (Fax) X(1)
            bankFileDetailPaymentRecord[12] = "".PadRight(1);
            // Delivery Mode (-) X(1)
            bankFileDetailPaymentRecord[13] = "".PadRight(1);
            // Advice Format X(1)
            bankFileDetailPaymentRecord[14] = "".PadRight(1);
            // Beneficiary ID X(20)
            bankFileDetailPaymentRecord[15] = "".PadRight(20);
            // Beneficiary Name (line 1) X(35)
            bankFileDetailPaymentRecord[16] = "".PadRight(35);
            // Beneficiary Name (line 2) X(35)
            bankFileDetailPaymentRecord[17] = "".PadRight(35);
            // Beneficiary Name (Address 1) X(35)
            bankFileDetailPaymentRecord[18] = "".PadRight(35);
            // Beneficiary Name (Address 2) X(35)
            bankFileDetailPaymentRecord[19] = "".PadRight(35);
            // Beneficiary Name (Address 3) X(35)
            bankFileDetailPaymentRecord[20] = "".PadRight(35);
            // Beneficiary Name (Address 4) X(35)
            bankFileDetailPaymentRecord[21] = "".PadRight(35);
            // Beneficiary City X(17)
            bankFileDetailPaymentRecord[22] = "".PadRight(17);
            // Beneficiary Country Code X(3)
            bankFileDetailPaymentRecord[23] = "".PadRight(3);
            // Beneficiary Postal Code X(15)
            bankFileDetailPaymentRecord[24] = "".PadRight(15);
            // Email Address of Beneficiary X(50)
            bankFileDetailPaymentRecord[25] = "".PadRight(50);
            // Facsimile Number of Beneficiary X(20)
            bankFileDetailPaymentRecord[26] = "".PadRight(20);
            // Payer's name (line 1) X(35)
            bankFileDetailPaymentRecord[27] = "".PadRight(35);
            // Payer's name (line 2) X(35)
            bankFileDetailPaymentRecord[28] = "".PadRight(35);
            // Payer/Customer Reference X(30)
            bankFileDetailPaymentRecord[29] = "".PadRight(30);
            // Filler X(84)
            bankFileDetailPaymentRecord[30] = "".PadRight(84);


            //bankFileDetailPaymentRecord[0] = bankFileDetail.BankCode.PadRight(3).Substring(0, 3) + "-" + bankFileDetail.BranchCode.PadRight(3).Substring(0, 3) + "-" + bankFileDetail.AccountNo.PadRight(9).Substring(0,9).Trim();
            //bankFileDetailPaymentRecord[1] = bankFileDetail.EmpBankAccountHolderName.ToUpper().PadRight(20).Substring(0, 20).Trim();
            //bankFileDetailPaymentRecord[2] = bankFileDetail.Amount.ToString("0.00");
            //string detailSecondPartyReference = m_SecondPartyReference;
            //if (m_IsSecondPartyReferenceIncludeEmpNo)
            //    detailSecondPartyReference = bankFileDetail.EmpNo + " " + detailSecondPartyReference;
            //bankFileDetailPaymentRecord[3] = detailSecondPartyReference.PadRight(18).Substring(0, 18).Trim();

            string bankFileDetailData = String.Join(FIELD_DELIMITER, bankFileDetailPaymentRecord);

            if (bankFileDetailData.Length != 600)
            {
                throw new Exception("Incorrect Bank File Detail Length:\r\n" + bankFileDetailData);
            }

            m_totalCreditAmount += bankFileDetail.Amount;
            m_detailCount++;

            return(bankFileDetailData);
        }
예제 #4
0
        private void CreateColumnsForGrid(IEnumerable <string> VerticalNames)
        {
            if (dataGridView1.ColumnCount > 0)
            {
                dataGridView1.ColumnCount = dataGridView1.ColumnCount + 1;
                if (cmbBillingCycle.SelectedIndex != -1)
                {
                    dataGridView1.Columns[dataGridView1.Columns.Count - 1].Name = cmbBillingCycle.SelectedItem.ToString();
                }
            }
            else
            {
                dataGridView1.ColumnCount = 4;

                dataGridView1.Columns[0].Name = DateTime.Now.Year.ToString();
                dataGridView1.Columns[1].Name = " ";
                dataGridView1.Columns[2].Name = "AVERAGE";
                if (cmbBillingCycle.SelectedIndex != -1)
                {
                    dataGridView1.Columns[dataGridView1.Columns.Count - 1].Name = cmbBillingCycle.SelectedItem.ToString();
                }

                Particulars P = new Particulars();
                var         s = P.GetAllParticulars();
                foreach (var l in s)
                {
                    int rowIndex = this.dataGridView1.Rows.Add();
                    var row      = this.dataGridView1.Rows[rowIndex];
                    row.Cells[0].Value             = l.ParticularsName;
                    row.DefaultCellStyle.BackColor = Color.LightGray;
                    foreach (var b in l.ParticularsSubTypes)
                    {
                        int rowIndex1 = this.dataGridView1.Rows.Add();
                        //Obtain a reference to the newly created DataGridViewRow
                        var row1 = this.dataGridView1.Rows[rowIndex1];
                        row1.Cells[1].Value = b.SubTypeName;
                    }
                }

                var verticals = VerticalNames;
                if (verticals != null)
                {
                    foreach (var vert in verticals)
                    {
                        int rowIndex = this.dataGridView1.Rows.Add();
                        var row      = this.dataGridView1.Rows[rowIndex];
                        row.Cells[1].Value             = vert;
                        row.DefaultCellStyle.BackColor = Color.LightBlue;

                        string[] testarray = Properties.Settings.Default.VerticalsSubSection.Split(',');//{ "% of Rev", "Onsite % of Rev", "Offshore % of Rev", "Onsite GM", "Offshore GM" };
                        foreach (string b in testarray)
                        {
                            int rowIndex1 = this.dataGridView1.Rows.Add();
                            //Obtain a reference to the newly created DataGridViewRow
                            var row1 = this.dataGridView1.Rows[rowIndex1];
                            row1.Cells[1].Value = b;
                        }
                    }
                }
            }
        }