Beispiel #1
0
        public ResultRate DeletePeriodByID(int id)
        {
            ResultRate resultModel = new ResultRate();

            resultModel.IsSucess = _dal.DeletePeriodByID(id);
            return(resultModel);
        }
Beispiel #2
0
        public override string FormateContent(object primaryKey)
        {
            try
            {
                #region 变量

                string     content  = string.Empty;
                string     treeName = string.Empty;
                ResultRate model    = Newtonsoft.Json.JsonConvert.DeserializeObject <ResultRate>(primaryKey.ToString());

                if (model != null)
                {
                    treeName = model.TreeName;
                }
                string editTime = string.Empty;

                #endregion



                #region 组织数据

                editTime = DateTime.Now.ToString("yyyy年MM月dd日hh时mm分ss秒");
                content  = string.Format("{0}用户在{1}执行了[{2}]的分摊操作。", _userName, editTime, treeName);

                return(content);

                #endregion
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 阶梯模式保存 (新增、修改)
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public ResultRate SaveRatePrice(List <QueryRate> list)
        {
            ResultRate resultModel = new ResultRate();
            string     sql         = @" declare @ItemID int,@RuleID int ";

            foreach (QueryRate model in list)
            {
                if (model.ItemID == 0)
                {
                    sql += string.Format(@"insert into TB_BillItem(ItemName,EnergyCode,TypeID)values('{0}','{1}',{2}) select @@IDENTITY;
                                        select @ItemID=MAX(ItemID) from TB_BillItem
                                        update TB_BillItem set ItemName='{0}'+CONVERT(varchar(10),@ItemID) where ItemID=@ItemID
                                        insert into TB_Rule_RateBill(MaxValue,MinValue,ItemID)values({3},{4},@ItemID) select @@IDENTITY;
                                        select @RuleID=MAX(RuleID) from TB_Rule_RateBill
                                        insert into TB_Price_RateBill(RuleID,Price) values(@RuleID,{5})", "阶梯",
                                         model.EnergyCode, model.TypeID, model.MaxValue, model.MinValue, model.Price);
                }
                else
                {
                    sql += string.Format(@"update TB_Rule_RateBill set MaxValue={0},MinValue={1} where RuleID={2};
                                            update TB_Price_RateBill set Price={3} where ID={4};",
                                         model.MaxValue, model.MinValue, model.RuleID, model.Price, model.ID);
                }
            }
            resultModel.IsSucess = _dal.SaveRatePrice(sql);
            return(resultModel);
        }
Beispiel #4
0
        public ResultRate SavePeriod(List <QueryTime> list)
        {
            ResultRate resultModel = new ResultRate();
            string     sql         = "";

            foreach (QueryTime m in list)
            {
                if (m != null)
                {
                    if (m.ID == 0)
                    {
                        sql += string.Format(@" INSERT INTO TB_TIME_PERIOD_SET (TYPEID,CNAME,STARTHOUR,ENDHOUR,TYPE,PRICE,DATE,STARTMINUTE,ENDMINUTE) 
                                            values('{0}','{1}',{2},{3},{4},{5},{6},{7},{8}); ", m.TYPEID, m.CNAME, m.STARTHOUR, m.ENDHOUR, m.TYPE, m.PRICE, m.DATE, m.STARTMINUTE, m.ENDMINUTE);
                    }
                    else
                    {
                        sql += string.Format(@" UPDATE TB_TIME_PERIOD_SET SET STARTHOUR={0},ENDHOUR={1},TYPE={2},PRICE={3},DATE={4},STARTMINUTE={5},ENDMINUTE={6},CNAME='{7}' where ID={8}",
                                             m.STARTHOUR, m.ENDHOUR, m.TYPE, m.PRICE, m.DATE, m.STARTMINUTE, m.ENDMINUTE, m.CNAME, m.ID);
                    }
                }
            }

            resultModel.IsSucess = _dal.SaveRatePrice(sql);
            return(resultModel);
        }
Beispiel #5
0
        public ResultRate SaveAlloctionAndLog(QueryAlloction model)
        {
            ResultRate modelResult = new ResultRate();
            string     sql         = "";

            if (model.ListConfig != null)
            {
                foreach (Model.TB_ALLOCTION_CONFIG c in model.ListConfig)
                {
                    if (c.ID == 0)
                    {
                        sql += string.Format(@"insert into TB_ALLOCTION_CONFIG(ParentAREAID,AREAID,ALLOCTION_FEE,CFGPERCENT,ALLOCTION_StartDate,PAYTYPE,ALLOCTION_EndDate,PAYClass)
                        values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}')", c.ParentAREAID, c.AREAID, c.ALLOCTION_FEE, c.CFGPERCENT, c.ALLOCTION_StartDate,
                                             c.PAYTYPE, c.ALLOCTION_EndDate, c.PAYClass);
                    }
                    else
                    {
                        sql += string.Format(@"update TB_ALLOCTION_CONFIG set ALLOCTION_FEE='{0}',CFGPERCENT='{1}',ALLOCTION_StartDate='{2}',ALLOCTION_EndDate='{3}',PAYClass='{4}' where ID={5}"
                                             , c.ALLOCTION_FEE, c.CFGPERCENT, c.ALLOCTION_StartDate, c.ALLOCTION_EndDate, c.PAYClass, c.ID);
                    }
                }
            }
            if (model.ConfigLog != null)
            {
                Model.TB_ALLOCTION_CONFIG_History h = model.ConfigLog;
                sql += string.Format(@" insert into TB_ALLOCTION_CONFIG_History (OPTIONUSER,CFGOBJECT,CFGDEC,CFGDATE,OPTIONTIME,PAYClass)
                                        values('{0}','{1}','{2}','{3}','{4}','{5}')", h.OPTIONUSER, h.CFGOBJECT, h.CFGDEC, h.CFGDATE, h.OPTIONTIME, h.PAYClass);
            }
            modelResult.IsSucess = _dal.SaveAlloctionAndLog(sql);
            return(modelResult);
        }
Beispiel #6
0
        public ResultRate DeleteAlarmScaleByID(int id)
        {
            ResultRate result = new ResultRate();

            result.IsSucess = _dal.DeleteAlarmScaleByID(id);
            return(result);
        }
Beispiel #7
0
        public ResultRate SaveAlarmScale(QueryAlarmScaleSetting query)
        {
            ResultRate result = new ResultRate();

            if (query != null)
            {
                if (query.ID == 0)
                {
                    result.IsSucess = _dal.InsertAlarmScale(query.AlarmType, query.Scale);
                }
                else
                {
                    result.IsSucess = _dal.UpdateAlarmScaleByID(query.ID, query.Scale);
                }
            }
            return(result);
        }
Beispiel #8
0
        /// <summary>
        /// 平价模式保存  (新增、修改)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultRate SaveCommPrice(QueryComm model)
        {
            ResultRate resultModel = new ResultRate();

            Model.TB_Price_CommBill commModel = new TB_Price_CommBill()
            {
                Price = model.Price, EnergyCode = model.EnergyCode, ID = model.ID
            };
            if (model.ID == 0)
            {
                resultModel.IsSucess = _dal.AddCommPrice(commModel);
            }
            else
            {
                resultModel.IsSucess = _dal.UpdateCommPrice(commModel);
            }
            return(resultModel);
        }
Beispiel #9
0
        /// <summary>
        /// 平价模式保存  (新增、修改)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultRate SaveParValue(QueryComm model)
        {
            ResultRate resultModel = new ResultRate();

            Model.TB_PAR_VALUE_SET commModel = new TB_PAR_VALUE_SET()
            {
                PRICE = model.PRICE, TYPEID = model.TYPEID, ID = model.ID, CNAME = model.CNAME, DATE = model.DATE
            };
            if (model.ID == 0)
            {
                resultModel.IsSucess = _dal.AddParValue(commModel);
            }
            else
            {
                resultModel.IsSucess = _dal.UpdateParValue(commModel);
            }
            return(resultModel);
        }
Beispiel #10
0
        /// <summary>
        /// 分时模式 (新增、修改)
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ResultRate SaveTimePrice(QueryTime model)
        {
            ResultRate resultModel = new ResultRate();
            string     sql         = "";

            //if (model.listPrice != null)
            //{
            //    foreach (TimePrice m in model.listPrice)
            //    {
            //        if (m != null)
            //            if (m.ID == 0)
            //            {
            //                sql += string.Format(@" insert into TB_TIME_PERIOD_SET (ItemID,Price) values({0},{1}); ", m.ItemID, m.Price);
            //            }
            //            else
            //            {
            //                sql += string.Format(@" update TB_Price_TimeBill set Price={0} where ID={1}", m.Price, m.ID);
            //            }
            //    }
            //}
            //if (model.ListRule != null)
            //{
            //    foreach (TimeRule m in model.ListRule)
            //    {
            //        if (m != null)
            //            if (m.RuleID == 0)
            //            {
            //                sql += string.Format(@" insert into TB_Rule_TimeBill (StartTime,EndTime,ItemID) values({0},{1},{2}); ", m.StartTime, m.EndTime, m.ItemID);
            //            }
            //            else
            //            {
            //                sql += string.Format(@" update TB_Rule_TimeBill set StartTime={0},EndTime={1} where RuleID={2}", m.StartTime, m.EndTime, m.RuleID);
            //            }
            //    }
            //}

            resultModel.IsSucess = _dal.SaveRatePrice(sql);
            return(resultModel);
        }
Beispiel #11
0
        /// <summary>
        /// 阶梯模式保存 (新增、修改)
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public ResultRate SaveMultiStep(List <QueryRate> list)
        {
            ResultRate resultModel = new ResultRate();
            string     sql         = "";

            foreach (QueryRate model in list)
            {
                if (model.ID == 0)
                {
                    sql += string.Format(@"INSERT INTO TB_MULTI_STEP(GEARSID,GEARNAME,TYPEID,START_GEARS_VALUE,END_GEARS_VALUE,PRICE,DATE)
                                            VALUES ({0},'{1}','{2}',{3},{4},{5},{6})",
                                         model.GEARSID, model.GEARNAME, model.TYPEID, model.START_GEARS_VALUE, model.END_GEARS_VALUE, model.PRICE, model.DATE);
                }
                else
                {
                    sql += string.Format(@"UPDATE TB_MULTI_STEP SET START_GEARS_VALUE={0},END_GEARS_VALUE={1},PRICE={2},DATE={3} where ID={4};",
                                         model.START_GEARS_VALUE, model.END_GEARS_VALUE, model.PRICE, model.DATE, model.ID);
                }
            }
            resultModel.IsSucess = _dal.SaveRatePrice(sql);
            return(resultModel);
        }