예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }