コード例 #1
0
        public Message EditReportName(ReportTemplate info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                // 获得上下文对象中的用户信息表
                ReportTemplate dbinfo = dd.GetTable <ReportTemplate>().Where(p => p.RID == info.RID).SingleOrDefault();
                //定义修改主键
                dbinfo.ReportName = info.ReportName;
                // 更新操作
                dd.SubmitChanges();
                dbinfo.ReportTemplate1 = null;
                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <ReportTemplate>(dbinfo)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "修改失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #2
0
        public Message Edit(IoT_ValveControl info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                IoT_ValveControl dbinfo = dd.GetTable <IoT_ValveControl>().Where(p =>
                                                                                 p.CompanyID == info.CompanyID && p.ID == info.ID).SingleOrDefault();

                ConvertHelper.Copy <IoT_ValveControl>(dbinfo, info);

                // 更新操作
                dd.SubmitChanges();
                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <IoT_ValveControl>(dbinfo)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "编辑阀门控制记录失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #3
0
        /// <summary>
        /// 编辑用户
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public Message Edit(Olb_User info)
        {
            Message m;

            try
            {
                DataContext dd     = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);
                Olb_User    dbinfo = dd.GetTable <Olb_User>().Where(p => p.ID == info.ID).SingleOrDefault();

                info.PassWord = dbinfo.PassWord;
                ConvertHelper.Copy <Olb_User>(dbinfo, info);

                dd.SubmitChanges();
                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <Olb_User>(dbinfo)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "修改用户信息失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #4
0
        public Message AddPaymentRecord(Olb_PaymentRecord info) {


            Message m;
            try
            {
                DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);
                Table<Olb_PaymentRecord> tbl = dd.GetTable<Olb_PaymentRecord>();

                string guid = Guid.NewGuid().ToString();
                info.ID = guid;

                tbl.InsertOnSubmit(info);
                dd.SubmitChanges();

                m = new Message()
                {
                    Result = true,
                    TxtMessage = JSon.TToJson<Olb_PaymentRecord>(info)
                };

            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result = false,
                    TxtMessage = "警속심롤션쩌呵겨!" + e.Message
                };
            }
            return m;

        }
コード例 #5
0
        /// <summary>
        /// 添加用户
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public Message Add(Olb_User info)
        {
            Message m;

            try
            {
                //需要为每个方法创建一个DataContext实例 原因在于DataContext的缓存机制
                DataContext      dd  = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);
                Table <Olb_User> tbl = dd.GetTable <Olb_User>();

                string guid = Guid.NewGuid().ToString();
                info.ID = guid;

                tbl.InsertOnSubmit(info);
                dd.SubmitChanges();

                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <Olb_User>(info)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "注册用户失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #6
0
        public Message Add(IoT_ValveControl 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_ValveControl> tbl = dd.GetTable <IoT_ValveControl>();

                // 调用新增方法
                tbl.InsertOnSubmit(info);
                // 更新操作
                dd.SubmitChanges();

                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <IoT_ValveControl>(info)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "新增阀门控制记录失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #7
0
ファイル: BaseHandler.cs プロジェクト: wuyb13526487308/-
 public virtual void DoNoLoginHandlerWork(HttpContext context)
 {
     context.Response.Write(JSon.TToJson <Message>(new Message()
     {
         Result = false, TxtMessage = "用户未登陆或登陆已超时。"
     }));
 }
コード例 #8
0
        /// <summary>
        /// Ìí¼ÓȼÆøÕ˺Å
        /// </summary>
        /// <param name="account"></param>
        /// <param name="userId"></param>
        /// <param name="companyId"></param>
        /// <returns></returns>
        public Message AddGasUser(string account, string userId, string companyId)
        {
            Message m;

            try
            {
                DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);
                Table <Olb_GasUserRelation> tbl = dd.GetTable <Olb_GasUserRelation>();

                Olb_GasUserRelation relation = new Olb_GasUserRelation()
                {
                    Account   = account,
                    CompanyID = companyId,
                    GasUserID = userId
                };

                tbl.InsertOnSubmit(relation);
                dd.SubmitChanges();

                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <Olb_GasUserRelation>(relation)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "Ìí¼ÓȼÆøÕ˺Åʧ°Ü£¡" + e.Message
                };
            }
            return(m);
        }
コード例 #9
0
        public Message AddCompany(CompanyInfo info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                if (info.CompanyID == string.Empty)
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "新增失败!企业编号不能为空。"
                    };
                }
                else
                {
                    // 获得上下文对象中的信息表
                    Table <CompanyInfo> tbl = dd.GetTable <CompanyInfo>();
                    //判断账号是否存在。
                    int existsCount = (from p in tbl where p.CompanyID == info.CompanyID select p.CompanyID).Count();
                    if (existsCount > 0)
                    {
                        m = new Message()
                        {
                            Result     = false,
                            TxtMessage = string.Format("新增失败!企业编号{0}已存在。", info.CompanyID)
                        };
                    }
                    else
                    {
                        // 调用新增方法
                        tbl.InsertOnSubmit(info);
                        // 更新操作
                        dd.SubmitChanges();
                        ResetCompanyAdmin(info);
                        m = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.TToJson <CompanyInfo>(info)
                        };
                    }
                }
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "新增失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #10
0
        public Message AddTemp(IoT_UserTemp info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                var count = dd.GetTable <IoT_Meter>().Where(p =>
                                                            p.CompanyID == info.CompanyID && p.MeterNo == info.MeterNo).Count();

                if (count > 0)
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "表号不能重复!"
                    };
                    return(m);
                }

                Table <IoT_UserTemp> tbl = dd.GetTable <IoT_UserTemp>();
                count = tbl.Where(p => p.CompanyID == info.CompanyID && p.MeterNo == info.MeterNo).Count();
                if (count > 0)
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "表号不能重复!"
                    };
                    return(m);
                }

                // 调用新增方法
                tbl.InsertOnSubmit(info);
                // 更新操作
                dd.SubmitChanges();

                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <IoT_UserTemp>(info)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "新增临时用户失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #11
0
        public Message Add(IoT_SetUploadCycle info, List <IoT_UploadCycleMeter> meterList)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                //添加设置上传周期参数任务到通讯队列
                string result = new SetMeterParameter().SetUploadCycle(info, meterList);
                if (result != "")
                {
                    throw new Exception(result);
                }

                Table <IoT_SetUploadCycle> tbl = dd.GetTable <IoT_SetUploadCycle>();

                // 调用新增方法
                tbl.InsertOnSubmit(info);
                // 更新操作
                dd.SubmitChanges();
                // 更新操作
                Table <IoT_UploadCycleMeter> tbl_meter = dd.GetTable <IoT_UploadCycleMeter>();
                foreach (IoT_UploadCycleMeter meter in meterList)
                {
                    IoT_Meter tempMeter = MeterManageService.QueryMeter(meter.MeterNo);
                    meter.MeterID = tempMeter.ID;
                    meter.ID      = info.ID;
                    meter.Context = info.Context;
                    meter.State   = '0';//申请
                    info.TaskID   = meter.TaskID;
                    tbl_meter.InsertOnSubmit(meter);
                }
                // 更新操作
                dd.SubmitChanges();

                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <IoT_SetUploadCycle>(info)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "新增设置上传周期失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #12
0
        public Message Edit(IoT_Community info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                string   checkSQL = $"Select count(*) from IoT_Street where ID={info.ID}";
                object[] param    = new object[0];
                int      iCount   = dd.ExecuteQuery <int>(checkSQL, param).Single <int>();
                if (iCount > 0)
                {
                    throw new Exception("小区已被使用,不能删除");
                }

                var count = dd.GetTable <IoT_Community>().Where(p => p.StreetID == info.StreetID && p.Ser == info.Ser && p.ID != info.ID).Count();

                if (count > 0)
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "小区编号不能重复!"
                    };
                    return(m);
                }

                IoT_Community dbinfo = dd.GetTable <IoT_Community>().Where(p =>
                                                                           p.ID == info.ID).SingleOrDefault();

                ConvertHelper.Copy <IoT_Community>(dbinfo, info);

                // 更新操作
                dd.SubmitChanges();
                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <IoT_Community>(dbinfo)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "编辑小区参数失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #13
0
        public Message AddCompanyDefineRight(DefineRight dRight, List <DefineRightMenu> list)
        {
            string  sqlText = string.Empty;
            Message m       = new Message()
            {
                Result = true, TxtMessage = "操作成功。"
            };

            try
            {
                //先删除再执行添加
                if (DelCompanyDefineRight(dRight).Result)
                {
                    sqlText = string.Format("Insert Into S_DefineRight" +
                                            "(RightCode,CompanyID,RightName,Context)" +
                                            "values('{0}','{1}','{2}','{3}')"
                                            , dRight.RightCode, dRight.CompanyID, dRight.RightName, dRight.Context);
                    SQLHelper.ExecuteScalar(SQLHelper.SchuleConnection, CommandType.Text, sqlText);
                    foreach (DefineRightMenu tmp in list)
                    {
                        sqlText = string.Format("Insert Into S_DefineRightMenu" +
                                                "(CompanyID,RightCode,MenuCode)" +
                                                "values('{0}','{1}','{2}')"
                                                , tmp.CompanyID, tmp.RightCode, tmp.MenuCode);
                        SQLHelper.ExecuteScalar(SQLHelper.SchuleConnection, CommandType.Text, sqlText);
                    }
                    m = new Message()
                    {
                        Result = true, TxtMessage = JSon.TToJson <DefineRight>(dRight)
                    };
                }
                else
                {
                    m = new Message()
                    {
                        Result = false, TxtMessage = "操作失败,【删除相同编码权限出错】。"
                    };
                }
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result = false, TxtMessage = "操作失败,【" + e.Message + "】。"
                };
            }
            return(m);
        }
コード例 #14
0
        public Message Add(IoT_Community 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_Community> tbl = dd.GetTable <IoT_Community>();

                var count = tbl.Where(p => p.StreetID == info.StreetID && p.Ser == info.Ser).Count();

                if (count > 0)
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "小区编号不能重复!"
                    };
                    return(m);
                }


                // 调用新增方法
                tbl.InsertOnSubmit(info);
                // 更新操作
                dd.SubmitChanges();

                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <IoT_Community>(info)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "新增小区参数失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #15
0
        public Message Edit(IoT_Street info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                var count = dd.GetTable <IoT_Street>().Where(p =>
                                                             p.CompanyID == info.CompanyID && p.Ser == info.Ser && p.ID != info.ID).Count();

                if (count > 0)
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "街区编号不能重复!"
                    };
                    return(m);
                }

                IoT_Street dbinfo = dd.GetTable <IoT_Street>().Where(p =>
                                                                     p.CompanyID == info.CompanyID && p.ID == info.ID).SingleOrDefault();

                ConvertHelper.Copy <IoT_Street>(dbinfo, info);

                // 更新操作
                dd.SubmitChanges();
                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <IoT_Street>(dbinfo)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "编辑街道参数失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #16
0
        public Message EditMenu(MenuInfo info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                if (info.MenuCode == string.Empty)
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "编辑失败!菜单编号不能为空。"
                    };
                }
                else
                {
                    // 获得上下文对象中的用户信息表
                    MenuInfo dbinfo = dd.GetTable <MenuInfo>().Where(p => p.MenuCode == info.MenuCode).SingleOrDefault();
                    //定义修改主键
                    string MenuCode = dbinfo.MenuCode;
                    ConvertHelper.Copy <MenuInfo>(dbinfo, info);
                    dbinfo.MenuCode = MenuCode;
                    // 更新操作
                    dd.SubmitChanges();
                    m = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.TToJson <MenuInfo>(dbinfo)
                    };
                }
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "编辑失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #17
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);
        }
コード例 #18
0
        public Message AddSystemLog(SystemLog info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                if (info.CompanyID == string.Empty)
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "记录系统日志失败!企业编号不能为空。"
                    };
                }
                else
                {
                    // 获得上下文对象中的信息表
                    Table <SystemLog> tbl = dd.GetTable <SystemLog>();
                    // 调用新增方法
                    tbl.InsertOnSubmit(info);
                    // 更新操作
                    dd.SubmitChanges();
                    m = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.TToJson <SystemLog>(info)
                    };
                }
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "记录系统日志失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #19
0
        public override void DoNoLoginHandlerWork(HttpContext context)
        {
            Message jsonMessage = new Message();
            //获取操作类型AType:ADD,EDIT,DELETE,QUERY
            WCFServiceProxy <ILoginerManage> proxyLoginer;
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            switch (AjaxType)
            {
            case "USERLOGIN":
                jsonMessage = UserLogin(context);
                break;

            case "USERLOGINOUT":
                proxyLoginer = new WCFServiceProxy <ILoginerManage>();
                if (context.Session["LoginCompanyOperator"] != null)
                {
                    context.Session.Remove("LoginCompanyOperator");
                }
                string webCookie = context.Session.SessionID.ToString();
                try
                {
                    jsonMessage = proxyLoginer.getChannel.UnLRegisterClientByMd5Cookie(Md5.GetMd5(webCookie));
                }
                catch
                { }
                finally
                {
                    proxyLoginer.CloseChannel();
                }
                break;

            default:
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = "操作未定义。"
                };
                break;
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
コード例 #20
0
ファイル: HuanBiaoService.cs プロジェクト: wuyb13526487308/-
        /// <summary>
        /// 添加申请
        /// </summary>
        /// <param name="info"></param>
        /// <param name="meterList"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public Message AddShenQing(IoT_ChangeMeter info)
        {
            Message     m;
            string      configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            DataContext dd         = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                Table <IoT_ChangeMeter> tbl = dd.GetTable <IoT_ChangeMeter>();
                //查询数据库中是否存在该用户的申请单(申请单状态为申请中或者是在审核流程中)
                int count = (from n in tbl
                             where n.UserID == info.UserID && n.OldMeterNo == info.OldMeterNo && (n.State == '1' || n.State == '2')
                             select n).Count();
                if (count > 0)
                {
                    return(new Message()
                    {
                        Result = false,
                        TxtMessage = "新增换表申请失败,该用户已提交申请!"
                    });
                }
                // 调用新增方法
                tbl.InsertOnSubmit(info);
                // 更新操作
                dd.SubmitChanges();
                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <IoT_ChangeMeter>(info)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "新增换表申请失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #21
0
        public Message Edit(IoT_Meter info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                IoT_Meter dbinfo = dd.GetTable <IoT_Meter>().Where(p =>
                                                                   p.CompanyID == info.CompanyID && p.MeterNo == info.MeterNo).SingleOrDefault();
                if (dbinfo.MKeyVer == 0)
                {
                    //重新设置密钥
                }

                //ConvertHelper.Copy<IoT_Meter>(dbinfo, info);
                dbinfo.MeterState = info.MeterState;
                // 更新操作
                dd.SubmitChanges();

                new TaskManageDA().UpdateMeter(info);//同时更新数据到mongoDB中
                m = new Message()
                {
                    Result     = true,
                    TxtMessage = JSon.TToJson <IoT_Meter>(dbinfo)
                };
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "编辑表具失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #22
0
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="oldPwd"></param>
        /// <param name="newPwd"></param>
        /// <param name="account"></param>
        /// <returns></returns>
        public Message UpdatePwd(string oldPwd, string newPwd, string account)
        {
            Message m;

            try
            {
                DataContext dd     = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);
                Olb_User    dbinfo = dd.GetTable <Olb_User>().Where(p => p.Account == account).SingleOrDefault();

                if (oldPwd == dbinfo.PassWord)
                {
                    dbinfo.PassWord = newPwd;
                    dd.SubmitChanges();
                    m = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.TToJson <Olb_User>(dbinfo)
                    };
                }
                else
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "原密码错误!"
                    };
                }
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "修改密码失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #23
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string       AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            IoT_PricePar Info;
            WCFServiceProxy <IPriceParManage> proxy = null;

            try
            {
                switch (AjaxType)
                {
                case "QUERY":

                    CommonSearch <IoT_PricePar> InfoSearch = new CommonSearch <IoT_PricePar>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName      = "IoT_PricePar",
                        TFieldKey   = "ID",
                        TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "ID ASC", TWhere = Where
                    };
                    List <IoT_PricePar> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <IoT_PricePar>(list, sCondition.TTotalCount)
                    };
                    break;

                case "ADD":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "jggl_tjjg"))
                    {
                        Info           = new CommonModelFactory <IoT_PricePar>().GetModelFromContext(context);
                        Info.CompanyID = loginOperator.CompanyID;
                        proxy          = new WCFServiceProxy <IPriceParManage>();
                        jsonMessage    = proxy.getChannel.Add(Info);
                    }
                    break;

                case "EDIT":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "jggl_bjjg"))
                    {
                        Info        = new CommonModelFactory <IoT_PricePar>().GetModelFromContext(context);
                        proxy       = new WCFServiceProxy <IPriceParManage>();
                        jsonMessage = proxy.getChannel.Edit(Info);
                    }
                    break;

                case "DELETE":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "jggl_scjg"))
                    {
                        Info        = new CommonModelFactory <IoT_PricePar>().GetModelFromContext(context);
                        proxy       = new WCFServiceProxy <IPriceParManage>();
                        jsonMessage = proxy.getChannel.Delete(Info);
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex) {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
コード例 #24
0
        public Message AddMenu(MenuInfo info)
        {
            // 定义执行结果
            Message m;
            string  configName = System.Configuration.ConfigurationManager.AppSettings["defaultDatabase"];
            //Linq to SQL 上下文对象
            DataContext dd = new DataContext(System.Configuration.ConfigurationManager.ConnectionStrings[configName].ConnectionString);

            try
            {
                if (info.MenuCode == string.Empty)
                {
                    m = new Message()
                    {
                        Result     = false,
                        TxtMessage = "新增失败!菜单编号不能为空。"
                    };
                }
                else
                {
                    // 获得上下文对象中的信息表
                    Table <MenuInfo> tbl = dd.GetTable <MenuInfo>();
                    //判断菜单是否存在。
                    int existsCount = (from p in tbl where p.MenuCode == info.MenuCode select p.MenuCode).Count();
                    if (existsCount > 0)
                    {
                        m = new Message()
                        {
                            Result     = false,
                            TxtMessage = string.Format("新增失败!菜单编号{0}已存在。", info.MenuCode)
                        };
                    }
                    else
                    {
                        //加载单位报表菜单
                        if (info.Type == "03")
                        {
                            info.UrlClass = "../Report/Report.aspx?id=" + info.RID;
                        }

                        // 调用新增方法
                        tbl.InsertOnSubmit(info);
                        // 更新操作
                        dd.SubmitChanges();

                        m = new Message()
                        {
                            Result     = true,
                            TxtMessage = JSon.TToJson <MenuInfo>(info)
                        };
                    }
                }
            }
            catch (Exception e)
            {
                m = new Message()
                {
                    Result     = false,
                    TxtMessage = "新增失败!" + e.Message
                };
            }
            return(m);
        }
コード例 #25
0
ファイル: UserManage.ashx.cs プロジェクト: wuyb13526487308/-
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();

            try
            {
                switch (AjaxType)
                {
                case "LOADLOGINER":
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.TToJson <Olb_User>(base.loginOperator)
                    };
                    break;

                case "USEREDIT":
                    Olb_User user = base.loginOperator;
                    if (context.Request.Form["Name"] != null && context.Request.Form["Name"].ToString().Trim() != string.Empty)
                    {
                        user.Name = context.Request.Form["Name"].ToString().Trim();
                    }
                    if (context.Request.Form["IdentityCard"] != null && context.Request.Form["IdentityCard"].ToString().Trim() != string.Empty)
                    {
                        user.IdentityCard = context.Request.Form["IdentityCard"].ToString().Trim();
                    }
                    if (context.Request.Form["Address"] != null && context.Request.Form["Address"].ToString().Trim() != string.Empty)
                    {
                        user.Address = context.Request.Form["Address"].ToString().Trim();
                    }

                    jsonMessage = UserManageService.GetInstance().Edit(user);
                    break;

                case "UPDATEPWD":
                    string oldPwd = "", newPwd = "", account = "";
                    if (context.Request.Form["oldPwd"] != null && context.Request.Form["oldPwd"].ToString().Trim() != string.Empty)
                    {
                        oldPwd = context.Request.Form["oldPwd"].ToString().Trim();
                    }
                    if (context.Request.Form["newPwd"] != null && context.Request.Form["newPwd"].ToString().Trim() != string.Empty)
                    {
                        newPwd = context.Request.Form["newPwd"].ToString().Trim();
                    }
                    if (oldPwd != "" && newPwd != "" && account != "")
                    {
                        account     = base.loginOperator.Account;
                        oldPwd      = Md5.GetMd5(oldPwd);
                        newPwd      = Md5.GetMd5(newPwd);
                        jsonMessage = UserManageService.GetInstance().UpdatePwd(oldPwd, newPwd, account);
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
コード例 #26
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            WCFServiceProxy <IUserManage> proxy = null;

            try
            {
                switch (AjaxType)
                {
                //查询用户表讯息
                case "QUERY":
                    CommonSearch <View_UserMeter> InfoSearch = new CommonSearch <View_UserMeter>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_UserMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID ASC", TWhere = Where
                    };
                    List <View_UserMeter> list = InfoSearch.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_UserMeter>(list, sCondition.TTotalCount)
                    };
                    break;

                //查询用户表具视图
                case "QUERYHISTORY":
                    CommonSearch <View_UserMeterHistory> InfoSearchView = new CommonSearch <View_UserMeterHistory>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request["UserID"] != null && context.Request["UserID"].ToString().Trim() != string.Empty)
                    {
                        Where += "and UserID='" + context.Request["UserID"].ToString() + "'";
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_UserMeterHistory", TFieldKey = "ReadDate", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "ReadDate DESC", TWhere = Where
                    };
                    List <View_UserMeterHistory> listView = InfoSearchView.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_UserMeterHistory>(listView, sCondition.TTotalCount)
                    };
                    break;

                //查询街道
                case "QUERYSTREET":
                    //CommonSearch<IoT_Street> InfoSearch = new CommonSearch<IoT_Street>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName       = "View_Community",
                        TFieldKey    = "ID",
                        TTotalCount  = -1,
                        TPageCurrent = 1,
                        TFieldOrder  = "ID ASC",
                        TWhere       = Where
                    };
                    CommonSearch <View_Community> InfoSearchStreet = new CommonSearch <View_Community>();
                    List <View_Community>         listStreet       = InfoSearchStreet.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_Community>(listStreet, sCondition.TTotalCount)
                    };
                    break;

                //查询历史资料笔数
                case "GETHISTORYCOUNT":
                    string TimeKind  = string.Empty;   //按照时间类型
                    string UserKind  = string.Empty;   //按照人员类型
                    string CompanyID = string.Empty;   //公司ID
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    //CommonSearch<IoT_Street> InfoSearch = new CommonSearch<IoT_Street>();
                    try
                    {
                        if (context.Request["Time"] != null && context.Request["Time"].ToString().Trim() != string.Empty)
                        {
                            TimeKind = context.Request["Time"];
                        }
                        if (context.Request["User"] != null && context.Request["User"].ToString().Trim() != string.Empty)
                        {
                            UserKind = context.Request["User"];
                        }
                        if (UserKind != "*" && UserKind != "")
                        {
                            Where += "AND charindex(','+CAST(Community AS NVARCHAR(10))+',',','+'" + UserKind + "'+',')>=1";
                        }
                        if (TimeKind != "*")
                        {
                            Where += "and CONVERT(varchar(100), ReadDate, 23)='" + TimeKind + "'";
                        }
                        WCFServiceProxy <IChaoBiao>  proxy1  = new WCFServiceProxy <IChaoBiao>();
                        List <View_UserMeterHistory> listAll = proxy1.getChannel.GetModelList(Where);
                        if (listAll == null || listAll.Count <= 0)
                        {    //如果查询出笔数大于0,返回True
                            jsonMessage = new Message()
                            {
                                Result     = true,
                                TxtMessage = ""
                            };
                        }
                        else
                        {    //否则返回False
                            jsonMessage = new Message()
                            {
                                Result     = false,
                                TxtMessage = ""
                            };
                        }
                    }
                    catch (Exception)
                    {
                        jsonMessage = new Message()
                        {
                            Result     = false,
                            TxtMessage = ""
                        };
                    }
                    break;

                //获取当前的公司
                case "GETCOMPANY":
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = loginOperator.CompanyID
                    };
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
コード例 #27
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            string    AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            IoT_Meter Info;
            WCFServiceProxy <IMeterManage> proxyMeter = null;
            WCFServiceProxy <IDianHuo>     proxy      = null;

            try
            {
                switch (AjaxType)
                {
                //撤销点火
                case "REVOKE":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dhtq_cx"))
                    {
                        Info  = new CommonModelFactory <IoT_Meter>().GetModelFromContext(context);
                        proxy = new WCFServiceProxy <IDianHuo>();
                        string reslut = proxy.getChannel.Undo(Info);

                        if (reslut != "")
                        {
                            jsonMessage = new Message {
                                Result = false, TxtMessage = reslut
                            };
                        }
                        else
                        {
                            jsonMessage = new Message {
                                Result = true, TxtMessage = "操作成功"
                            };
                        }
                    }
                    break;

                //点火
                case "REGISTRATION":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "dhtq_dh"))
                    {
                        proxy      = new WCFServiceProxy <IDianHuo>();
                        proxyMeter = new WCFServiceProxy <IMeterManage>();

                        Int64         PriceType       = 0;
                        string        EnableMeterOper = string.Empty;
                        List <String> meterNoList     = null;
                        List <String> lstUserID       = null;
                        DateTime      EnableDate      = DateTime.Now;
                        string        strPriceType    = string.Empty;
                        string        meterType       = context.Request.Form["MType"].ToString();
                        if (context.Request.Form["PriceType"] != null && context.Request.Form["PriceType"].ToString().Trim() != string.Empty)
                        {
                            PriceType    = Int64.Parse(context.Request.Form["PriceType"].ToString().Trim());
                            strPriceType = context.Request.Form["PriceType"].ToString().Trim();
                        }
                        if (!string.IsNullOrEmpty(context.Request.Form["MType"]) && context.Request.Form["MType"] == "01" && strPriceType == "")
                        {
                            jsonMessage = new Message()
                            {
                                Result     = false,
                                TxtMessage = "请选择价格类型!"
                            };
                            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
                            return;
                        }
                        if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                        {
                            string   strNo = context.Request.Form["strNo"];
                            string[] arrNo = strNo.Split(',');
                            meterNoList = arrNo.ToList();
                        }
                        if (context.Request.Form["UserID"] != null && context.Request.Form["UserID"].ToString().Trim() != string.Empty)
                        {
                            string   strNo = context.Request.Form["UserID"];
                            string[] arrNo = strNo.Split(',');
                            lstUserID = arrNo.ToList();
                        }
                        if (context.Request.Form["EnableDate"] != null && context.Request.Form["EnableDate"].ToString().Trim() != string.Empty)
                        {
                            EnableDate = Convert.ToDateTime(context.Request.Form["EnableDate"].ToString().Trim());
                        }
                        EnableMeterOper = string.IsNullOrEmpty(context.Request.Form["EnableOper"]) == true ? "" : context.Request.Form["EnableOper"];
                        //if (context.Request.Form["EnableOper"] != null && context.Request.Form["EnableOper"].ToString().Trim() != string.Empty)
                        //{
                        //    EnableMeterOper = context.Request.Form["EnableOper"].ToString().Trim();
                        //}
                        jsonMessage = proxy.getChannel.DianHuo(meterNoList, meterType, PriceType, this.loginOperator.CompanyID, EnableDate, lstUserID, EnableMeterOper);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
コード例 #28
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            IoT_SetSettlementDay          Info;
            WCFServiceProxy <ISettlement> proxy = null;

            try
            {
                switch (AjaxType)
                {
                //查询
                case "QUERY":
                    CommonSearch <View_SettlementDayMeterView> InfoSearch = new CommonSearch <View_SettlementDayMeterView>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";

                    if (context.Request.Form["Date1"] != null && context.Request.Form["Date1"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND convert(char(10),RegisterDate,120)='" + context.Request.Form["Date1"].ToString() + "'";;
                    }
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_SettlementDayMeterView", TFieldKey = "DayID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "RegisterDate DESC", TWhere = Where
                    };
                    List <View_SettlementDayMeterView> list = InfoSearch.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_SettlementDayMeterView>(list, sCondition.TTotalCount)
                    };
                    break;

                //查询失败用户
                case "QUERYUSERFILE":
                    CommonSearch <View_SettlementDayMeter> InfoSearch_UserFILE = new CommonSearch <View_SettlementDayMeter>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "'  AND State='3'";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    if (context.Request.Form["DayID"] != null && context.Request.Form["DayID"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND MeterID=" + context.Request.Form["DayID"].ToString().Trim();
                    }
                    sCondition = new SearchCondition()
                    {
                        TBName = "View_SettlementDayMeter", TFieldKey = "MeterID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "MeterID DESC", TWhere = Where
                    };
                    List <View_SettlementDayMeter> list_UserFILE = InfoSearch_UserFILE.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_SettlementDayMeter>(list_UserFILE, sCondition.TTotalCount)
                    };
                    break;

                //查询所有设定结算日的用户
                case "QUERYUSER":
                    CommonSearch <View_SettlementDayMeter> InfoSearch_User = new CommonSearch <View_SettlementDayMeter>();
                    Where  = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    if (context.Request.Form["MeterID"] != null && context.Request.Form["MeterID"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND MeterID=" + context.Request.Form["MeterID"].ToString().Trim();
                    }

                    sCondition = new SearchCondition()
                    {
                        TBName = "View_SettlementDayMeter", TFieldKey = "UserID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "UserID DESC", TWhere = Where
                    };
                    List <View_SettlementDayMeter> list_User = InfoSearch_User.GetList(ref sCondition, context);
                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_SettlementDayMeter>(list_User, sCondition.TTotalCount)
                    };
                    break;

                //新增结算日
                case "ADD":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs"))
                    {
                        Info              = new CommonModelFactory <IoT_SetSettlementDay>().GetModelFromContext(context);
                        Info.CompanyID    = base.loginOperator.CompanyID;
                        Info.Oper         = base.loginOperator.Name;
                        Info.RegisterDate = DateTime.Now;
                        List <IoT_SettlementDayMeter> alarmMeter = new List <IoT_SettlementDayMeter>();
                        string Total           = string.IsNullOrEmpty(context.Request.Form["Total"]) == true ? "" : context.Request.Form["Total"].ToString();
                        string Context         = string.IsNullOrEmpty(context.Request.Form["Context"]) == true ? "" : context.Request.Form["Context"].ToString();
                        string SettlementDay   = (string.IsNullOrEmpty(context.Request.Form["strDay"]) == true ? "0" : context.Request.Form["strDay"].ToString());
                        string SettlementMonth = (string.IsNullOrEmpty(context.Request.Form["strMonth"]) == true ? "0" : context.Request.Form["strMonth"].ToString());
                        Info.CompanyID = base.loginOperator.CompanyID;
                        Info.Context   = Context;
                        //Info.ReportType = ReportType;
                        Info.RegisterDate    = DateTime.Now;
                        Info.SettlementDay   = int.Parse(SettlementDay);
                        Info.State           = '0';
                        Info.TaskID          = "";//目前还不知道任务ID的取值方法
                        Info.Total           = int.Parse(Total);
                        Info.SettlementMonth = int.Parse(SettlementMonth);
                        proxy = new WCFServiceProxy <ISettlement>();
                        if (!string.IsNullOrEmpty(context.Request.Form["hidType"]) && (context.Request.Form["hidType"].ToString() != ""))
                        {
                            //判断所选用户类型
                            alarmMeter = new List <IoT_SettlementDayMeter>();
                            if (context.Request.Form["hidType"].ToString() == "1")
                            {
                                Info.Scope = "所有用户";
                                //jsonMessage = proxy.getChannel.AddSetAlarmAll(Info);
                            }
                            else if (context.Request.Form["hidType"].ToString() == "2")
                            {
                                Info.Scope = "选择用户";
                            }
                            else
                            {
                                //Info.Scope = context.Request.Form["hidType"].ToString();
                                string   strNo = context.Request.Form["communityStr"] == null ? "" : context.Request.Form["communityStr"];
                                string[] arrNo = strNo.Split(',');
                                Info.Scope = context.Request.Form["hidType"].ToString();
                                //jsonMessage = proxy.getChannel.AddSetAlarmArea(Info, arrNo.ToList());
                            }
                            if (context.Request.Form["strNo"] != null && context.Request.Form["strNo"].ToString().Trim() != string.Empty)
                            {
                                string   strNo = context.Request.Form["strNo"];
                                string[] arrNo = strNo.Split(',');
                                for (int i = 0; i < arrNo.Length; i++)
                                {
                                    IoT_SettlementDayMeter meter = new IoT_SettlementDayMeter();
                                    meter.MeterNo = arrNo[i];
                                    alarmMeter.Add(meter);
                                }
                            }
                            jsonMessage = proxy.getChannel.Add(Info, alarmMeter);
                        }
                    }
                    break;

                //撤销
                case "REVOKE":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "RVJSR"))
                    {
                        proxy = new WCFServiceProxy <ISettlement>();
                        string ID = string.Empty;
                        if (context.Request["ID"] != null && context.Request["ID"].ToString().Trim() != string.Empty)
                        {
                            ID = context.Request["ID"].ToString() == "" ? "0" : context.Request["ID"].ToString();
                        }
                        jsonMessage = proxy.getChannel.revoke(ID, loginOperator.CompanyID);
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                    //修改
                    //case "EDIT":
                    //    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "szbjcs"))
                    //    {
                    //        Info = new CommonModelFactory<IoT_SetSettlementDay>().GetModelFromContext(context);
                    //        proxy = new WCFServiceProxy<ISettlement>();
                    //        jsonMessage = proxy.getChannel.Edit(Info);
                    //    }
                    //    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
コード例 #29
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;

            jsonMessage = new Message()
            {
                Result     = false,
                TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            //获取操作类型AType:ADD,EDIT,DELETE
            string AjaxType = context.Request.QueryString["AType"] == null ? string.Empty : context.Request.QueryString["AType"].ToString().ToUpper();
            WCFServiceProxy <ISetUploadCycle> proxy = null;

            try
            {
                switch (AjaxType)
                {
                //查询充值的历史资料
                case "QUERY":
                    CommonSearch <View_ChongZhi> InfoSearch = new CommonSearch <View_ChongZhi>();
                    string Where = "1=1 ";
                    Where += "AND CompanyID='" + loginOperator.CompanyID + "' ";
                    if (context.Request.Form["DateS"] != null && context.Request.Form["DateS"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND convert(char(10),TopUpDate,120)>='" + context.Request.Form["DateS"].ToString() + "'";;
                    }
                    if (context.Request.Form["DateE"] != null && context.Request.Form["DateE"].ToString().Trim() != string.Empty)
                    {
                        Where += " AND convert(char(10),TopUpDate,120)<='" + context.Request.Form["DateE"].ToString() + "'";;
                    }
                    if (context.Request.Form["TWhere"] != null && context.Request.Form["TWhere"].ToString().Trim() != string.Empty)
                    {
                        Where += context.Request.Form["TWhere"].ToString();
                    }
                    SearchCondition sCondition = new SearchCondition()
                    {
                        TBName = "View_ChongZhi", TFieldKey = "AID", TTotalCount = -1, TPageCurrent = 1, TFieldOrder = "TopUpDate DESC", TWhere = Where
                    };
                    List <View_ChongZhi> list = InfoSearch.GetList(ref sCondition, context);

                    jsonMessage = new Message()
                    {
                        Result     = true,
                        TxtMessage = JSon.ListToJson <View_ChongZhi>(list, sCondition.TTotalCount)
                    };
                    break;

                //执行充值动作
                case "CXCHONGZHI":
                    if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "CZ_CXCZ"))    //营业厅撤销充值
                    {
                        IoT_MeterTopUp Info;
                        WCFServiceProxy <IChongzhiManage> proxy1 = null;
                        Info = new CommonModelFactory <IoT_MeterTopUp>().GetModelFromContext(context);
                        List <IoT_MeterTopUp> lstIoT_MeterTopUp = new List <IoT_MeterTopUp>();
                        //表号
                        string MeterNo = string.IsNullOrEmpty(context.Request["MeterNo"]) == true ? "" : context.Request["MeterNo"].ToString();
                        //充值金额
                        string Amount = string.IsNullOrEmpty(context.Request["Amount"]) == true ? "" : context.Request["Amount"].ToString();
                        //表ID
                        string MeterID = string.IsNullOrEmpty(context.Request["MeterID"]) == true ? "" : context.Request["MeterID"].ToString();
                        //人员ID
                        string UserID = string.IsNullOrEmpty(context.Request["UserID"]) == true ? "" : context.Request["UserID"].ToString();
                        //PK
                        string ID = string.IsNullOrEmpty(context.Request["AID"]) == true ? "" : context.Request["AID"].ToString();
                        //任务编号
                        string TaskID  = string.IsNullOrEmpty(context.Request["TaskID"]) == true ? "" : context.Request["TaskID"].ToString();
                        string Context = string.IsNullOrEmpty(context.Request["Context"]) == true ? "" : context.Request["Context"].ToString();
                        Info.Amount    = decimal.Parse(Amount);
                        Info.MeterID   = int.Parse(MeterID);
                        Info.MeterNo   = MeterNo;
                        Info.ID        = int.Parse(ID);
                        Info.Context   = Context;
                        Info.Oper      = base.loginOperator.Name;
                        Info.CompanyID = base.loginOperator.CompanyID;
                        Info.TopUpDate = DateTime.Now;
                        Info.UserID    = UserID;
                        Info.TopUpType = '1';    //充值类型目前未知
                        Info.State     = '0';    //等待充值状态
                        Info.TaskID    = TaskID; //等待充值状态
                        proxy1         = new WCFServiceProxy <IChongzhiManage>();
                        jsonMessage    = proxy1.getChannel.UPD(Info);
                    }
                    break;

                default:
                    jsonMessage = new Message()
                    {
                        Result     = false,
                        TxtMessage = "操作未定义。"
                    };
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonMessage = new Message()
                {
                    Result     = false,
                    TxtMessage = ex.Message
                };
            }
            finally
            {
                if (proxy != null)
                {
                    proxy.CloseChannel();
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }
コード例 #30
0
        public override void DoLoginedHandlerWork(HttpContext context)
        {
            Message jsonMessage;
            bool    isUpdate = false;

            //检查用户有没有更新报表权限,
            if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "gxbbmb"))
            {
                isUpdate = context.Request.Form["isUpdate"] == null ? false : bool.Parse(context.Request.Form["isUpdate"].ToString());
            }
            string strUploadPath = string.Format("{0}\\ReportTemplate\\{1}\\{2}\\{3}\\",
                                                 context.Server.MapPath("~"), base.loginOperator.CompanyID, base.loginOperator.OperID, System.DateTime.Now.ToString("yyyyMMdd"));

            jsonMessage = new Message()
            {
                Result = false, TxtMessage = "权限验证失败,可能原因:\n1、数据中心通讯失败。\n2、系统管理员未与您分配对应操作权限。"
            };
            string fileName = string.Empty;

            //创建路径记录上传者账号信息
            if (CommonOperRightHelper.CheckMenuCode(base.loginOperator, "drbbmb"))
            {
                if (context.Request.Files != null && context.Request.Files.Count == 1)
                {
                    if (!Directory.Exists(strUploadPath))
                    {
                        Directory.CreateDirectory(strUploadPath);
                    }
                    HttpPostedFile postedFile = context.Request.Files[0];
                    fileName = strUploadPath + System.Web.HttpUtility.UrlDecode(Path.GetFileName(postedFile.FileName));
                    if (fileName != "" && Path.GetExtension(fileName) == ".pkf")
                    {
                        try
                        {
                            postedFile.SaveAs(fileName);
                            FilePacket pft = new FilePacket(fileName);
                            pft.OpenPacket(strUploadPath);
                            pft = null;
                            ImportReport(strUploadPath, isUpdate);
                            string ShowInfo = string.Empty;
                            ShowInfo += string.Format("成功{0}个。<br>", success);
                            int i = 0;
                            foreach (string tmp in successName)
                            {
                                i++;
                                ShowInfo += string.Format("{0}、【{1}】", i, tmp);
                            }
                            if (failed > 0)
                            {
                                ShowInfo += string.Format("<br>失败{0}个。<br>", failed);
                                i         = 0;
                                foreach (string tmp in failedReasons)
                                {
                                    i++;
                                    ShowInfo += string.Format("{0}、【{1}】", i, tmp);
                                }
                            }
                            jsonMessage = new Message()
                            {
                                Result = true, TxtMessage = ShowInfo
                            };
                        }
                        catch (Exception ex)
                        {
                            jsonMessage = new Message()
                            {
                                Result = false, TxtMessage = ex.Message
                            };
                            if (File.Exists(fileName))
                            {
                                File.Delete(fileName);
                            }
                        }
                    }
                }
            }
            context.Response.Write(JSon.TToJson <Message>(jsonMessage));
        }