예제 #1
0
        public ActionResult SummaryType(AddSummaryTypeModel model)
        {
            FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket();
            int mana_id = authentication == null ? 0 : Convert.ToInt32(authentication.Name);

            string check_result = CheckSummary(model);

            if (!string.IsNullOrEmpty(check_result))
            {
                ViewBag.SubmitError = check_result;
            }

            InterfaceSummaryService summary_service = new SummaryService();

            if (ModelState.IsValid && string.IsNullOrEmpty(check_result))
            {
                t_summary add_summary = new t_summary();
                add_summary.summ_desc = model.add_summary;
                add_summary.mana_id   = mana_id;
                add_summary.sort_by   = 10000;
                try
                {
                    summary_service.Insert(add_summary);
                }
                catch
                {
                }
            }
            else
            {
                List <t_summary> summary_list = new List <t_summary>();
                try
                {
                    summary_list = summary_service.SearchByManagerID(mana_id).ToList();
                }
                catch
                {
                }
                ViewBag.DATA = JsonConvert.SerializeObject(summary_list);
                return(View());
            }
            return(RedirectToAction("SummaryType", "Financing"));
        }