コード例 #1
0
        public ActionResult UpdateHDaySta(UpdateHDayTraInfoViewModel args)
        {
            args.StationType = 1;
            try
            {
                ReportFactory.Instance.log.WriteLog(OperationType.Update, Utility.GetReportNameByType(8), Utility.GetFormatDate(args.DataDate, null));

                return Json(ReportFactory.Instance.report8.Update(args));
            }
            catch (Exception ex)
            {
                CustomResult ret = new CustomResult();
                ret.ResultKey = 0;
                ret.ResultValue = ex.Message;
                return Json(ret);
            }
        }
コード例 #2
0
        /// <summary>
        /// 批量修改
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public CustomResult Update(UpdateHDayTraInfoViewModel args)
        {
            CustomResult pReturnValue = new CustomResult();
            pReturnValue.ResultKey = (byte)EResult.Fail;
            pReturnValue.ResultValue = TipInfo.UpdateFaile;
            if (args.DataInfo == null)
            {
                pReturnValue.ResultKey = (byte)EResult.Succeed;
                pReturnValue.ResultValue = TipInfo.DataNull;
                return pReturnValue;
            }
            List<UpdateDataDailyInfo> pNewUpdateData = new List<UpdateDataDailyInfo>();

            using (DataSubmittedEntities db = new DataSubmittedEntities())
            {
                //获取修改日期的数据
                var pReportData = db.RP_AADTSta.Where(s => s.CalculTime == args.DataDate).ToList();
                if (pReportData.Count > 0)
                {
                    using (TransactionScope transaction = new TransactionScope())
                    {
                        try
                        {
                            foreach (var item in args.DataInfo)
                            {
                                var pDataTemp = pReportData.SingleOrDefault();
                                pDataTemp.FeeSum = item.FeeSum;
                                pDataTemp.ExSmaCarFee = item.ExSmaCarFee;
                                pDataTemp.EnSmaCarFee = item.EnSmaCarFee;
                                pDataTemp.SmaCarFee = item.SmaCarFee;
                                pDataTemp.ExChagNum = item.ExChagNum;
                                pDataTemp.EnChagNum = item.EnChagNum;
                                pDataTemp.ChagAmount = item.ChagAmount;
                                pDataTemp.GreNum = item.GreNum;
                                pDataTemp.GreFee = item.GreFee;
                                pDataTemp.StaExSum = item.StaExSum;
                                pDataTemp.StaEnSum = item.StaEnSum;
                                pDataTemp.WorkPeoNum = item.WorkPeoNum;
                                pDataTemp.InfoNum = item.InfoNum;
                                pDataTemp.SitState = item.SitState;
                                pDataTemp.LineExSum = item.ExSmaCarFee + item.ExChagNum;
                                pDataTemp.LineEnSum = item.EnSmaCarFee + item.EnChagNum;
                                pDataTemp.LineSum = pDataTemp.LineExSum + pDataTemp.LineEnSum;
                                pDataTemp.UpdDate = DateTime.Now;
                                pDataTemp.State = "1";
                                if (SessionManage.GetLoginUser() != null)
                                {
                                    pDataTemp.UpdBy = SessionManage.GetLoginUser().UserName;
                                }
                            }
                            db.SaveChanges();
                            transaction.Complete();
                            pReturnValue.ResultKey = (byte)EResult.Succeed;
                            pReturnValue.ResultValue = TipInfo.UpdateSuccess;
                        }
                        catch (Exception ex)
                        {
                            Common.SystemLog.GetInstance().Log.Info(TipInfo.UpdateDataRepeat, ex);
                            pReturnValue.ResultKey = (byte)EResult.Fail;
                            pReturnValue.ResultValue = TipInfo.UpdateDataRepeat;
                        }
                    }
                }
                else
                {
                    pReturnValue.ResultKey = (byte)EResult.Fail;
                    pReturnValue.ResultValue = TipInfo.DataNull;
                }
                return pReturnValue;
            }
        }