예제 #1
0
        public ActionResult Create(string year)
        {
            var fsm = new FundingSourceModel();
            var model = new FundingSourceViewModel();
            model.FundingSource = fsm;
            model.TipYear = year;

            return View("Create", model);
        }
예제 #2
0
        /// <summary>
        /// Gets the model for the TipFundingSource view
        /// </summary>
        /// <param name="tipYear"></param>
        /// <returns></returns>
        public IList<FundingSourceModel> GetTipFundingSources(string tipYear)
        {
            var model = new FundingSourceViewModel();
            SqlCommand cmd = new SqlCommand("[TIP].[GetFundingSources]");
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@TIPYEAR", tipYear);
            var list = new List<FundingSourceModel>();
            using (IDataReader rdr = this.ExecuteReader(cmd))
            {
                while (rdr.Read())
                {
                    var fs= new FundingSourceModel();

                    fs.FundingTypeId = (int)rdr["FundingTypeId"];
                    fs.FundingType = rdr["FundingType"].ToString();
                    //fs.FundingLevel = rdr["FundingLevel"] != DBNull.Value ? rdr["FundingLevel"].ToString() : "NULL IN DB";
                    fs.Code= rdr["Code"].ToString();
                    fs.RecipentOrganization = new Organization() { OrganizationName = rdr["Recipient"].ToString() };
                    fs.SourceOrganization= new Organization() { OrganizationName = rdr["Source"].ToString() };
                    fs.TimePeriod = tipYear;
                    fs.Selector = "Not in DB";
                    fs.IsDiscretionary = (bool)rdr["Discretion"];

                    list.Add(fs);
                }

            }
            return list;
        }
예제 #3
0
        /// <summary>
        /// Detail/Edit view for a funding record
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public ActionResult Detail(string year, int id)
        {
            //var fsm = new FundingSourceModel();

            var fsm = _tipRepository.GetFundingSourceModel(year, id);

            var model = new FundingSourceViewModel();
            model.FundingSource = fsm;
            model.TipYear = year;

            return View("Detail",model);
        }