Exemplo n.º 1
0
        private t_summary_record CreateSummaryRecord(AddRecordModel model)
        {
            t_summary_record insert = null;

            if (model.record_type_code == WebCont.RECORD_TYPE_PAY)
            {
                insert = CreateSummaryRecord(model, -model.record_amount, 0, true);
            }
            else if (model.record_type_code == WebCont.RECORD_TYPE_INCOME)
            {
                insert = CreateSummaryRecord(model, model.record_amount, 0, true);
            }
            else if (model.record_type_code == WebCont.RECORD_TYPE_TRANSFER)
            {
                insert = CreateSummaryRecord(model, -model.record_amount, model.record_amount, true);
            }
            else if (model.record_type_code == WebCont.RECORD_TYPE_LOAN)
            {
                if (model.loan_type_code == WebCont.LOAN_TYPE_BORROW_IN || model.loan_type_code == WebCont.LOAN_TYPE_REPAY_IN)
                {
                    insert = CreateSummaryRecord(model, model.record_amount, 0, false);
                }
                else if (model.loan_type_code == WebCont.LOAN_TYPE_BORROW_OUT || model.loan_type_code == WebCont.LOAN_TYPE_REPAY_OUT)
                {
                    insert = CreateSummaryRecord(model, -model.record_amount, 0, false);
                }
            }
            return(insert);
        }
Exemplo n.º 2
0
        public ActionResult Record(AddRecordModel model)
        {
            if (ModelState.IsValid)
            {
                string check_result = CheckRecord(model);
                if (!string.IsNullOrEmpty(check_result))
                {
                    return(Content(ReturnMessageAndRedirect(check_result, "Financing", "Record")));
                }
                else
                {
                    InterfaceSummaryRecordService summary_record_service = new SummaryRecordService();

                    t_summary_record summary_record = CreateSummaryRecord(model);
                    try
                    {
                        summary_record_service.Insert(summary_record);
                    }
                    catch
                    {
                    }
                }
            }
            return(RedirectToAction("Record", "Financing"));
        }
Exemplo n.º 3
0
        public void AddRecord(AddRecordModel record)
        {
            var command = new AddJournalRecordCommand {
                Date = record.Date, Sum = record.Sum
            };

            _journalProvider.AddJournalRecord(command);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 入场补录
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool RecordInToEntryCamera(AddRecordModel model)
        {
            bool flag = SendRecordInToEntryCamera(model);

            if (flag)
            {
                ////保存至数据库,形成报表记录
                flag = _iParkLotContext.AddRecordToDatabase(model);
            }
            return(flag);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 补发入场记录到入口相机
        /// </summary>
        /// <param name="model">补录车牌实体参数</param>
        /// <returns></returns>
        public bool SendRecordInToEntryCamera(AddRecordModel model)
        {
            CommandEntity <AddRecordModel> entity = new CommandEntity <AddRecordModel>()
            {
                command = BussineCommand.AddRecord,
                idMsg   = Convert.ToBase64String(Guid.NewGuid().ToByteArray()),
                message = model
            };

            //将补发入场的数据通过mq交给相机去处理业务
            return(m_rabbitMQ.SendMessageForRabbitMQ("发送补录入场命令", m_serializer.Serialize(entity), entity.idMsg, model.ParkingCode));
        }
Exemplo n.º 6
0
        private t_summary_record CreateSummaryRecord(AddRecordModel model, decimal record_amount, decimal tran_record_amount, bool is_deal)
        {
            FormsAuthenticationTicket authentication = CommonFuntion.GetAuthenticationTicket();
            int mana_id = authentication == null ? 0 : Convert.ToInt32(authentication.Name);

            t_summary_record insert = new t_summary_record();

            insert.mana_id        = mana_id;
            insert.reco_type_code = model.record_type_code;
            insert.summ_id        = model.summary_id;
            insert.summ_tran_id   = model.summary_transfer_id;
            insert.loan_type_code = model.loan_type_code;
            insert.amount         = record_amount;
            insert.tran_amount    = tran_record_amount;
            insert.remark         = model.remark == null ? "" : model.remark.Trim();
            insert.add_time       = model.add_time;
            insert.is_deal        = is_deal;
            return(insert);
        }
        public AddRecordModel GetTableAddRecordModel(long tableId, long?entryId = null, long?languageId = null)
        {
            var result = new AddRecordModel();

            result.Table = _tableManager.GetById(tableId);

            if (entryId.HasValue)
            {
                var getQuery = $"SELECT * FROM {result.Table.Name} WHERE Id = " + entryId.Value;
                result.Entry          = _sqlProvider.Get(getQuery);
                result.Language       = _languageManager.GetById(Convert.ToInt64(result.Entry["LanguageId"]));
                result.LanguagePairId = Convert.ToInt64(result.Entry["LanguagePairId"]);
            }
            else
            {
                result.Language = languageId.HasValue ? _languageManager.GetById(languageId.Value) : App.Common.Language;
            }

            foreach (var item in _columnManager.List(x => x.TableId == tableId).OrderBy(x => x.FormOrder).ToList())
            {
                var model = new ColumnInputModel();
                model.Id          = item.Id;
                model.Name        = item.Name;
                model.DisplayName = item.DisplayName;
                model.ColumnType  = item.ColumnType;
                model.InputExtra  = item.InputExtra;
                if (result.Entry != null && !(item.ColumnType == ColumnType.MultipleImage ||
                                              item.ColumnType == ColumnType.MultipleSelectList))
                {
                    model.Value = result.Entry[model.Name]?.ToString();
                }

                var    table = _tableManager.GetById(item.TargetTableId);
                string q;
                switch (item.ColumnType)
                {
                case ColumnType.SelectList:
                    q = $"SELECT Id,{item.TargetTableTextColumn} FROM {item.TargetTable}";
                    if (table.MultipleLanguage)
                    {
                        q += " WHERE LanguageId=" + App.Common.Language.Id;
                    }

                    foreach (DataRow row in _sqlProvider.List(q).Rows)
                    {
                        model.SelectListItems.Add(new SelectListItem()
                        {
                            Text     = row[item.TargetTableTextColumn]?.ToString(),
                            Value    = row["Id"]?.ToString(),
                            Selected = row["Id"]?.ToString() == model.Value
                        });
                    }

                    break;

                case ColumnType.MultipleSelectList:
                    q = $"SELECT Id,{item.TargetTableTextColumn} FROM {item.TargetTable}";
                    if (table.MultipleLanguage)
                    {
                        q += " WHERE LanguageId=" + App.Common.Language.Id;
                    }

                    var currentEntries = new List <long>();
                    if (entryId.HasValue)
                    {
                        var currentEntriesTable = _sqlProvider
                                                  .List(
                            $"SELECT * FROM {result.Table.Name}{item.TargetTable} WHERE {result.Table.Name}Id={entryId}");
                        foreach (DataRow row in currentEntriesTable.Rows)
                        {
                            currentEntries.Add(Convert.ToInt64(row[item.TargetTable + "Id"]));
                        }
                    }

                    foreach (DataRow row in _sqlProvider.List(q).Rows)
                    {
                        model.SelectListItems.Add(new SelectListItem()
                        {
                            Text     = row[item.TargetTableTextColumn]?.ToString(),
                            Value    = row["Id"].ToString(),
                            Selected = currentEntries.Contains(Convert.ToInt64(row["Id"].ToString()))
                        });
                    }

                    break;

                case ColumnType.MultipleImage:
                    break;
                }

                result.Columns.Add(model);
            }


            return(result);
        }
Exemplo n.º 8
0
 /// <summary>
 /// 补录数据添加数据库
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool AddRecordToDatabase(AddRecordModel model)
 {
     return(recorddatabaseoperate.SaveToDataBase(model));
 }
Exemplo n.º 9
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);
        }