Beispiel #1
0
        /// <summary>
        /// 获取按时计费策略表
        /// </summary>
        /// <param name="tempID"></param>
        /// <returns></returns>
        public JsonResult FindHourDetail(int tempID)
        {
            CWTariff         cwtariff = new CWTariff();
            HourChargeDetail policy   = cwtariff.FindHourChgDetail(hr => hr.TempChgID == tempID);

            if (policy == null)
            {
                List <HourChargeDetail> hourList = cwtariff.FindHourChgDetailList();
                if (hourList.Count > 0)
                {
                    policy = hourList[0];
                    if (policy != null)
                    {
                        policy.TempChgID = tempID;
                        cwtariff.UpdateHourChgDetail(policy);
                    }
                }
                else
                {
                    policy             = new HourChargeDetail();
                    policy.TempChgID   = tempID;
                    policy.StrideDay   = EnmStrideDay.Continue;
                    policy.CycleTime   = EnmCycleTime.Hour_24;
                    policy.CycleTopFee = 0;
                    cwtariff.AddHourChgDetail(policy);
                }
            }
            return(Json(policy, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public ActionResult ModifyTempRuleOfHour()
        {
            Response resp    = new Response();
            CWTariff cwtarff = new CWTariff();
            int      mainID  = 0;
            string   mID     = Request.Form["MID"];

            if (!string.IsNullOrEmpty(mID))
            {
                TempChargingRule rule = cwtarff.FindTempChgRule(Convert.ToInt32(mID));
                if (rule != null)
                {
                    string preID = Request.Form["PreID"];
                    string tType = Request.Form["TType"];

                    rule.TempChgType = (EnmTempChargeType)Convert.ToInt16(tType);
                    rule.PreChgID    = Convert.ToInt32(preID);

                    cwtarff.UpdateTempChgRule(rule);

                    mainID = rule.ID;
                }
            }
            string hourID = Request.Form["hourID"];

            if (!string.IsNullOrEmpty(hourID))
            {
                string strided = Request.Form["StrideDay"];
                string cyclet  = Request.Form["CycleTime"];
                string topfee  = Request.Form["StrideTopFee"];
                if (hourID == "0")
                {
                    //新增
                    HourChargeDetail hour = new HourChargeDetail
                    {
                        StrideDay   = (EnmStrideDay)Convert.ToInt16(strided),
                        CycleTime   = (EnmCycleTime)Convert.ToInt16(cyclet),
                        CycleTopFee = Convert.ToSingle(topfee),
                        TempChgID   = mainID
                    };
                    resp = cwtarff.AddHourChgDetail(hour);
                }
                else
                {
                    //修改
                    HourChargeDetail detail = cwtarff.FindHourChgDetail(Convert.ToInt32(hourID));
                    if (detail != null)
                    {
                        detail.StrideDay   = (EnmStrideDay)Convert.ToInt16(strided);
                        detail.CycleTime   = (EnmCycleTime)Convert.ToInt16(cyclet);
                        detail.CycleTopFee = Convert.ToSingle(topfee);

                        resp = cwtarff.UpdateHourChgDetail(detail);
                    }
                }
            }
            resp.Message = "修改数据成功";
            return(Json(resp));
        }
Beispiel #3
0
        public ActionResult AddTempRuleByHour()
        {
            Response resp = new Response();

            CWTariff cwtrff = new CWTariff();
            List <TempChargingRule> ruleList = cwtrff.GetTempChgRuleList();

            if (ruleList.Count > 0)
            {
                resp.Code    = 0;
                resp.Message = "系统故障,存在临时类记录,无法完成新增工作!";
                return(Json(resp));
            }
            string           preID = Request.Form["PreID"];
            string           tType = Request.Form["TType"]; //计费类型
            TempChargingRule rule  = new TempChargingRule()
            {
                ICType      = EnmICCardType.Temp,
                TempChgType = (EnmTempChargeType)Convert.ToInt16(tType),
                PreChgID    = Convert.ToInt32(preID)
            };

            resp = cwtrff.AddTempChgRule(rule);
            if (resp.Code == 1)
            {
                string strided = Request.Form["StrideDay"];
                string cyclet  = Request.Form["CycleTime"];
                string topfee  = Request.Form["StrideTopFee"];

                HourChargeDetail hour = new HourChargeDetail {
                    StrideDay   = (EnmStrideDay)Convert.ToInt16(strided),
                    CycleTime   = (EnmCycleTime)Convert.ToInt16(cyclet),
                    CycleTopFee = Convert.ToSingle(topfee),
                    TempChgID   = rule.ID
                };
                resp = cwtrff.AddHourChgDetail(hour);

                resp.Data = null;
                if (resp.Code == 1)
                {
                    var da = new
                    {
                        mainID = rule.ID,
                        hourID = hour.ID
                    };
                    resp.Data = da;
                }
            }
            return(Json(resp));
        }