private List <SupplierPaymentMOE> getSavedSupplierPaymentMOEs()
        {
            List <SupplierPaymentMOE> lstPayment = new List <SupplierPaymentMOE>();
            string strConnection = ConfigurationManager.ConnectionStrings["UsedConnection"].ConnectionString;

            using (var conn = new SqlConnection(strConnection))
                using (var cmd = conn.CreateCommand())
                {
                    conn.Open();
                    cmd.CommandText = "SELECT  " +
                                      "* " +
                                      " FROM " +
                                      " SupplierPayment_MOE_Header ";
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    DataTable      dt = new DataTable();
                    da.Fill(dt);
                    foreach (DataRow dr in dt.Rows)
                    {
                        SupplierPaymentMOE row = new SupplierPaymentMOE();
                        row.PaymentNo    = Convert.ToString(dr["PaymentID"]);
                        row.PaymentDate  = Convert.ToString(dr["PaymentDate"]);
                        row.Year         = Convert.ToInt32(dr["Year"]);
                        row.Month        = Convert.ToString(dr["Month"]);
                        row.Amount       = Convert.ToDecimal(dr["Amount"]);
                        row.ChequeNumber = Convert.ToString(dr["ChequeNumber"]);
                        row.ChequeDate   = Convert.ToDateTime(dr["ChequeDate"]);

                        lstPayment.Add(row);
                    }
                    return(lstPayment);
                }
        }
        public ActionResult Index()
        {
            SupplierPaymentMOE model = new SupplierPaymentMOE();

            List <SupplierPaymentMOE> paymentRequestList = getSavedSupplierPaymentMOEs();


            ViewBag.SupplierPaymentRequestList = paymentRequestList;
            ViewBag.Month = GetMonthsString();
            ViewBag.Year  = GetResentYears(model.Year.ToString());
            ViewBag.Banks = GetBanks();


            ViewBag.GrantTotal = (from od in model.PaymentSummary select od.TotalAmount).Sum();

            return(View(model));
        }