コード例 #1
0
        public string SetPricingPlan(IoT_Pricing info, List <IoT_PricingMeter> meterList)
        {
            string result            = "";
            M_SetParameterService sp = new M_SetParameterService();

            //整理调价参数
            foreach (IoT_PricingMeter m in meterList)
            {
                PricingPlan pp = new PricingPlan()
                {
                    IsUsedLadder   = (bool)info.IsUsed,
                    Ladder         = (int)info.Ladder,
                    MeterType      = info.MeterType,
                    SettlementType = info.SettlementType,
                    Price1         = (decimal)info.Price1,
                    Price2         = (decimal)info.Price2,
                    Price3         = (decimal)info.Price3,
                    Price4         = (decimal)info.Price4,
                    Price5         = (decimal)info.Price5,
                    Gas1           = (decimal)info.Gas1,
                    Gas2           = (decimal)info.Gas2,
                    Gas3           = (decimal)info.Gas3,
                    Gas4           = (decimal)info.Gas4,
                    UseDate        = ((DateTime)info.UseDate).ToString("yyyy-MM-dd")
                };
                pp.MeterNo = m.MeterNo.Trim();
                result     = sp.SetPricingPlan(pp, m);
                //记录调价计划
            }
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 设置结算日
        /// </summary>
        /// <param name="settlementDay"></param>
        /// <param name="meters"></param>
        /// <returns></returns>
        public string SetSettlementDay(IoT_SetSettlementDay settlementDay, List <IoT_SettlementDayMeter> meters)
        {
            string result            = "";
            M_SetParameterService sp = new M_SetParameterService();

            foreach (IoT_SettlementDayMeter m in meters)
            {
                result = sp.SetSettlementDay(settlementDay, m);
            }
            return(result);
        }
コード例 #3
0
        /// <summary>
        /// 设置上传周期(通讯层)
        /// </summary>
        /// <param name="info"></param>
        /// <param name="meterList"></param>
        /// <returns></returns>
        public string SetUploadCycle(IoT_SetUploadCycle info, List <IoT_UploadCycleMeter> meterList)
        {
            string result            = "";
            M_SetParameterService sp = new M_SetParameterService();

            foreach (IoT_UploadCycleMeter m in meterList)
            {
                result = sp.SetUploadCycle(info, m);
            }
            return(result);
        }
コード例 #4
0
        /// <summary>
        /// 添加报警参数设置任务
        /// </summary>
        /// <param name="info"></param>
        /// <param name="meterList"></param>
        /// <returns></returns>
        public string SetWarinningPararmeter(IoT_SetAlarm info, List <IoT_AlarmMeter> meterList)
        {
            string result            = "";
            M_SetParameterService sp = new M_SetParameterService();

            foreach (IoT_AlarmMeter alarm in meterList)
            {
                result = sp.SetWariningParameter(info, alarm);
            }

            return(result);
        }
コード例 #5
0
        /// <summary>
        /// 撤销调价计划
        /// </summary>
        /// <param name="info"></param>
        /// <param name="meterList"></param>
        /// <returns></returns>
        public Message UnSetParamter(IoT_Pricing info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                Table <IoT_PricingMeter> tbl_meter = dd.GetTable <IoT_PricingMeter>();
                List <IoT_PricingMeter>  list      = tbl_meter.Where(p => p.ID == info.ID && p.State == '0').ToList();
                M_SetParameterService    ps        = new M_SetParameterService();
                foreach (IoT_PricingMeter meter in list)
                {
                    string result = new SetMeterParameter().UnSetParamter(meter.TaskID);
                    meter.State        = '2';
                    meter.FinishedDate = DateTime.Now;
                    ps.UnSetParameter(meter.TaskID);
                }
                if (list.Count > 0)
                {
                    Table <IoT_Pricing> tbl = dd.GetTable <IoT_Pricing>();
                    var dbinfo = tbl.Where(p => p.CompanyID == info.CompanyID && p.ID == info.ID).Single();

                    dbinfo.State   = '1';          //任务撤销
                    dbinfo.Context = info.Context; //撤销原因
                    dd.SubmitChanges();
                    m = new Message()
                    {
                        Result     = true,
                        TxtMessage = "操作成功"
                    };
                }
                else
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "调价计划已执行完成。"
                    };
                }
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "撤销设置报警参数失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #6
0
        public Message revoke(string ID, string CompanyID)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                M_SetParameterService ps = new M_SetParameterService();

                //更新主表
                IoT_SetSettlementDay dbinfo = dd.GetTable <IoT_SetSettlementDay>().Where(p =>
                                                                                         p.CompanyID == CompanyID && p.ID == int.Parse(ID.Trim())).SingleOrDefault();

                dbinfo.State = '1';
                ps.UnSetParameter(dbinfo.TaskID);
                List <IoT_SettlementDayMeter> LstdbinfoMeter = dd.GetTable <IoT_SettlementDayMeter>().Where(p =>
                                                                                                            p.ID == int.Parse(ID.Trim())).ToList();
                foreach (var item in LstdbinfoMeter)
                {
                    item.State = '1';
                    ps.UnSetParameter(item.TaskID);
                }

                dd.SubmitChanges();
                // 更新操作
                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <IoT_SetSettlementDay>(dbinfo)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "编辑设置结算日失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #7
0
        /// <summary>
        /// 撤销参数设置
        /// </summary>
        /// <param name="taskID"></param>
        /// <returns></returns>
        public string UnSetParamter(string taskID)
        {
            M_SetParameterService sp = new M_SetParameterService();

            return(sp.UnSetParameter(taskID));
        }