/// <summary>
 ///
 /// </summary>
 /// <param name="total"></param>
 public IncomeTotal(CorporateIncomeTotal total)
 {
     IncomeType       = total.IncomeType;                                              //类型
     IncomeTotal      = total.IncomeTotal;                                             //公司进账
     OrderTotalMoney  = total.OrderTotalMoney;                                         //订单完成金额
     RefundTotalMoney = total.RefundTotalMoney;                                        //退单金额
     OrderTotal       = total.OrderTotal;                                              //订单数
     CreatedOn        = total.CreatedOn;                                               //时间
     IncomeWater      = Math.Round(total.OrderTotalMoney + total.RefundTotalMoney, 2); //流水 可能为负数
 }
        public async Task <ObjectResultModule> CreateCorporateIncomeTotal([FromBody] CorporateIncomeTotal CorporateIncomeTotalInfo)
        {
            if (!Commons.CheckSecret(CorporateIncomeTotalInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var CreateCorporateIncomeTotal = new CorporateIncomeTotal()
            {
                IncomeType  = CorporateIncomeTotalInfo.IncomeType,
                IncomeTotal = CorporateIncomeTotalInfo.IncomeTotal,

                CreatedBy = userid,
                CreatedOn = DateTime.Now,
            };
            var result = await _corporateIncomeTotalService.CreateCorporateIncomeTotal(CreateCorporateIncomeTotal);

            if (result.Id > 0)
            {
                this.ObjectResultModule.Object     = result;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            else
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 400;
                this.ObjectResultModule.Message    = "error!";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "CreateCorporateIncomeTotal",
                OperContent = JsonHelper.ToJson(CorporateIncomeTotalInfo),
                OperType    = "CreateCorporateIncomeTotal",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(ObjectResultModule);
        }
        public async Task <ObjectResultModule> UpdateCorporateIncomeTotal([FromBody] CorporateIncomeTotal CorporateIncomeTotalInfo)
        {
            if (!Commons.CheckSecret(CorporateIncomeTotalInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var UpdateCorporateIncomeTotal = await _corporateIncomeTotalService.CorporateIncomeTotalByID(CorporateIncomeTotalInfo.Id);

            if (UpdateCorporateIncomeTotal != null)
            {
                UpdateCorporateIncomeTotal.IncomeType  = CorporateIncomeTotalInfo.IncomeType;
                UpdateCorporateIncomeTotal.IncomeTotal = CorporateIncomeTotalInfo.IncomeTotal;
                UpdateCorporateIncomeTotal.ModifyOn    = DateTime.Now;
                UpdateCorporateIncomeTotal.ModifyBy    = userid;
                var result = await _corporateIncomeTotalService.UpdateCorporateIncomeTotal(UpdateCorporateIncomeTotal);

                this.ObjectResultModule.Object     = result;
                this.ObjectResultModule.StatusCode = 200;
                this.ObjectResultModule.Message    = "success";
            }
            else
            {
                this.ObjectResultModule.Object     = "";
                this.ObjectResultModule.StatusCode = 404;
                this.ObjectResultModule.Message    = "NotFound";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "UpdateCorporateIncomeTotal",
                OperContent = JsonHelper.ToJson(CorporateIncomeTotalInfo),
                OperType    = "UpdateCorporateIncomeTotal",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(ObjectResultModule);
        }
        public async Task <ObjectResultModule> DeleteCorporateIncomeTotal([FromBody] CorporateIncomeTotal CorporateIncomeTotalInfo)
        {
            if (!Commons.CheckSecret(CorporateIncomeTotalInfo.Secret))
            {
                this.ObjectResultModule.StatusCode = 422;
                this.ObjectResultModule.Message    = "Wrong Secret";
                this.ObjectResultModule.Object     = "";
                return(this.ObjectResultModule);
            }
            var userid = _IabpSession.UserId > 0 ? (int)_IabpSession.UserId : 0;
            var query  = await _corporateIncomeTotalService.CorporateIncomeTotalByID(CorporateIncomeTotalInfo.Id);

            if (query != null)
            {
                query.DeleteBy   = userid;
                query.DeleteTime = DateTime.Now;
                query.IsDelete   = true;
                var res = await _corporateIncomeTotalService.DeleteCorporateIncomeTotal(query);

                this.ObjectResultModule.Object     = res;
                this.ObjectResultModule.Message    = "sucess";
                this.ObjectResultModule.StatusCode = 200;
            }
            else
            {
                this.ObjectResultModule.Message    = "NotFound";
                this.ObjectResultModule.StatusCode = 404;
                this.ObjectResultModule.Object     = "";
            }
            #region 操作日志
            var CreateYaeherOperList = new YaeherOperList()
            {
                OperExplain = "DeleteCorporateIncomeTotal",
                OperContent = JsonHelper.ToJson(CorporateIncomeTotalInfo),
                OperType    = "DeleteCorporateIncomeTotal",
                CreatedBy   = userid,
                CreatedOn   = DateTime.Now
            };
            var resultLog = await _yaeherOperListService.CreateYaeherOperList(CreateYaeherOperList);

            #endregion
            return(this.ObjectResultModule);
        }
Esempio n. 5
0
 public async Task TotalCorporateIncomeTotal(CorporateIncomeTotal CorporateIncomeTotalInfo)
 {
     await _repository.InsertAsync(CorporateIncomeTotalInfo);
 }
Esempio n. 6
0
        public async Task <CorporateIncomeTotal> CreateCorporateIncomeTotal(CorporateIncomeTotal CorporateIncomeTotalInfo)
        {
            CorporateIncomeTotalInfo.Id = await _repository.InsertAndGetIdAsync(CorporateIncomeTotalInfo);

            return(CorporateIncomeTotalInfo);
        }
Esempio n. 7
0
 public async Task <CorporateIncomeTotal> DeleteCorporateIncomeTotal(CorporateIncomeTotal CorporateIncomeTotalInfo)
 {
     return(await _repository.UpdateAsync(CorporateIncomeTotalInfo));
 }