public ActionResult DeleteSummary(int id = 0) { FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket(); int mana_id = authentication == null ? 0 : Convert.ToInt32(authentication.Name); var json_result = new JsonResult(); InterfaceSummaryService summary_service = new SummaryService(); try { t_summary delete = summary_service.GetByID(id); if (delete != null && delete.mana_id == mana_id) { summary_service.Delete(delete); json_result.Data = new { Result = true, Message = "" }; } else { json_result.Data = new { Result = false, Message = HtmlExtensions.Lang("_Error_Comm_Para") }; } } catch { json_result.Data = new { Result = false, Message = HtmlExtensions.Lang("_Error_Comm_Para") }; } return(json_result); }
public ActionResult SummaryType() { ViewBag.Title = HtmlExtensions.Lang("Financing_SummaryType_Title"); FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket(); int mana_id = authentication == null ? 0 : Convert.ToInt32(authentication.Name); List <t_summary> summary_list = new List <t_summary>(); InterfaceSummaryService summary_service = new SummaryService(); try { summary_list = summary_service.SearchByManagerID(mana_id).ToList(); } catch { } #if login_debug t_summary add1 = new t_summary(); add1.mana_id = 1; add1.summ_desc = "123"; add1.summ_id = 1; summary_list.Add(add1); #endif ViewBag.DATA = JsonConvert.SerializeObject(summary_list); return(View()); }
private string CheckRecordAdjust(int mana_id, AdjustRecordModel model) { string result = ""; InterfaceSummaryService summary_service = new SummaryService(); List <t_summary> summary_list = new List <t_summary>(); try { summary_list = summary_service.SearchByManagerID(mana_id).ToList(); } catch { } foreach (int id in model.summ_id) { t_summary summary = summary_list.Where(M => M.summ_id == id).FirstOrDefault(); if (summary == null) { result = HtmlExtensions.Lang("_Error_Comm_Para"); } } return(result); }
private string CreateShowSummaryRecord(int mana_id, List <t_summary_record> summary_record_list) { List <object> list = new List <object>(); InterfaceRecordTypeService record_type_service = new RecordTypeService(); InterfaceSummaryService summary_service = new SummaryService(); InterfaceLoanTypeService loan_type_service = new LoanTypeService(); List <t_record_type> record_type_list = new List <t_record_type>(); List <t_summary> summary_list = new List <t_summary>(); List <t_loan_type> loan_type_list = new List <t_loan_type>(); try { record_type_list = record_type_service.Table().ToList(); summary_list = summary_service.SearchByManagerID(mana_id).ToList(); loan_type_list = loan_type_service.Table().ToList(); } catch { } foreach (t_summary_record foreach_data in summary_record_list) { t_record_type find_record_type = record_type_list.Where(M => M.reco_code == foreach_data.reco_type_code).FirstOrDefault(); t_summary find_summary = summary_list.Where(M => M.summ_id == foreach_data.summ_id).FirstOrDefault(); //转账处理 t_summary find_tran_summary = null; if (foreach_data.summ_tran_id != 0) { foreach_data.amount = -foreach_data.amount; find_tran_summary = summary_list.Where(M => M.summ_id == foreach_data.summ_tran_id).FirstOrDefault(); } string tran_summary_desc = find_tran_summary == null ? "" : "->" + find_tran_summary.summ_desc; //借贷处理 t_loan_type loan_type = loan_type_list.Where(M => M.loan_code == foreach_data.loan_type_code).FirstOrDefault(); string loan_desc = loan_type == null ? "" : "(" + loan_type.loan_desc + ")"; if (find_record_type != null && find_summary != null) { var insert = new { summary_record_id = foreach_data.summ_reco_id, add_date = foreach_data.add_time.ToString("yyyy-MM-dd HH:mm:ss"), record_type_desc = find_record_type.reco_desc + loan_desc, summary_desc = find_summary.summ_desc + tran_summary_desc, amount = foreach_data.amount, remark = foreach_data.remark, is_deal = foreach_data.is_deal }; list.Add(insert); } } return(JsonConvert.SerializeObject(list)); }
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")); }
private string CheckSearchRecord(string s_date, string e_date, int record_type, int summary) { string result = ""; DateTime start_date_datetime; DateTime end_date_datetime; bool try_start_date_result = DateTime.TryParse(s_date, out start_date_datetime); bool try_end_date_result = DateTime.TryParse(e_date, out end_date_datetime); if (try_start_date_result && try_end_date_result) { InterfaceRecordTypeService record_type_service = new RecordTypeService(); InterfaceSummaryService summary_service = new SummaryService(); t_record_type record_type_find = null; try { record_type_find = record_type_service.SearchByCode(record_type).FirstOrDefault(); } catch {} if (record_type_find == null && record_type != -1) { result = HtmlExtensions.Lang("_Error_Financing_RecordDetail_RecordType"); } else { t_summary summary_find = summary_service.GetByID(summary); if (summary_find == null && summary != -1) { result = HtmlExtensions.Lang("_Error_Financing_RecordDetail_Summary"); } } } else { result = HtmlExtensions.Lang("_Error_Financing_RecordDetail_Date"); } return(result); }
public ActionResult Record() { ViewBag.Title = HtmlExtensions.Lang("Financing_Record_Title"); FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket(); int mana_id = authentication == null ? 0 : Convert.ToInt32(authentication.Name); InterfaceRecordTypeService record_type_service = new RecordTypeService(); InterfaceSummaryService summary_service = new SummaryService(); InterfaceLoanTypeService loan_type_service = new LoanTypeService(); List <t_record_type> record_type_list = new List <t_record_type>(); List <t_summary> summary_list = new List <t_summary>(); List <t_loan_type> loan_type_list = new List <t_loan_type>(); try { record_type_list = record_type_service.Table().ToList(); summary_list = summary_service.SearchByManagerID(mana_id).ToList(); loan_type_list = loan_type_service.Table().ToList(); } catch { } #if login_debug t_record_type type1 = new t_record_type(); type1.reco_type_id = 1; type1.reco_desc = "支出"; type1.reco_code = 1; record_type_list.Add(type1); t_record_type type2 = new t_record_type(); type2.reco_type_id = 2; type2.reco_desc = "收入"; type2.reco_code = 2; record_type_list.Add(type2); t_record_type type3 = new t_record_type(); type3.reco_type_id = 3; type3.reco_desc = "转账"; type3.reco_code = 3; record_type_list.Add(type3); t_record_type type4 = new t_record_type(); type4.reco_type_id = 4; type4.reco_desc = "借贷"; type4.reco_code = 4; record_type_list.Add(type4); t_summary summary1 = new t_summary(); summary1.mana_id = 1; summary1.summ_desc = "Summary"; summary1.summ_id = 1; summary_list.Add(summary1); t_loan_type loan1 = new t_loan_type(); loan1.loan_type_id = 10; loan1.loan_desc = "借入"; loan1.loan_code = 41; loan_type_list.Add(loan1); t_loan_type loan2 = new t_loan_type(); loan2.loan_type_id = 11; loan2.loan_desc = "借出"; loan2.loan_code = 42; loan_type_list.Add(loan2); t_loan_type loan3 = new t_loan_type(); loan3.loan_type_id = 12; loan3.loan_desc = "还款"; loan3.loan_code = 43; loan_type_list.Add(loan3); t_loan_type loan4 = new t_loan_type(); loan4.loan_type_id = 13; loan4.loan_desc = "收款"; loan4.loan_code = 44; loan_type_list.Add(loan4); #endif ViewBag.RECORD_TYPE = JsonConvert.SerializeObject(record_type_list); ViewBag.SUMMARY = JsonConvert.SerializeObject(summary_list); ViewBag.LOAN_TYPE = JsonConvert.SerializeObject(loan_type_list); return(View()); }
private string CheckRecord(AddRecordModel model) { string result = ""; InterfaceRecordTypeService record_type_service = new RecordTypeService(); InterfaceSummaryService summary_service = new SummaryService(); InterfaceLoanTypeService loan_type_service = new LoanTypeService(); #region 常规检查 t_record_type record_type = null; try { record_type = record_type_service.SearchByCode(model.record_type_code).FirstOrDefault(); } catch { } if (record_type == null) { result = HtmlExtensions.Lang("_Error_Financing_Record_RecordType"); } else { t_summary summary = null; try { summary = summary_service.GetByID(model.summary_id); } catch { } if (summary == null) { result = HtmlExtensions.Lang("_Error_Financing_Record_Summary"); } else { if (model.record_amount <= 0) { result = HtmlExtensions.Lang("_Error_Financing_Record_Amount"); } else { if (model.remark != null && model.remark.Length > 100) { result = HtmlExtensions.Lang("_Error_Financing_Record_Remark"); } } } } #endregion #region 特殊字段检查 if (model.record_type_code == WebCont.RECORD_TYPE_TRANSFER) { t_summary summary_transfer = null; try { summary_transfer = summary_service.GetByID(model.summary_transfer_id); } catch { } if (summary_transfer == null) { result = HtmlExtensions.Lang("_Error_Financing_Record_ToSummary"); } } else { model.summary_transfer_id = 0; } if (model.record_type_code == WebCont.RECORD_TYPE_LOAN) { t_loan_type loan_type = null; try { loan_type = loan_type_service.SearchByCode(model.loan_type_code).FirstOrDefault(); } catch { } if (loan_type == null) { result = HtmlExtensions.Lang("_Error_Financing_Record_LoanType"); } } else { model.loan_type_code = 0; } #endregion return(result); }