Esempio n. 1
0
        public ApiResult <Map> IsExit(Map model, Trans t = null)
        {
            var rst = new ApiResult <Map>()
            {
                Message = "暂无记录"
            };

            try
            {
                CreateMySqlConnection(t);
                var sql = new StringBuilder("select * from map where ");
                sql.Append("remote=@remote and remote_port=@remote_port ".If(model.protocol.Contains("http")));
                sql.Append("remote_port=@remote_port ".If(model.protocol == "tcp" || model.protocol == "udp"));
                sql.Append("and id!=@id".If(model.id > 0));
                rst.Data = conn.QueryFirstOrDefault <Map>(sql.ToString(), model, t?.DbTrans);
                if (rst.Data != null)
                {
                    rst.Result  = true;
                    rst.Message = "获取成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"获取失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }
Esempio n. 2
0
        public ApiResult <bool> UpdateUser(User model, Trans t = null)
        {
            var rst = new ApiResult <bool>()
            {
                Message = "更新失败"
            };

            try
            {
                CreateMySqlConnection(t);
                var sql = new StringBuilder();
                sql.Append("update user set ");
                sql.Append("user_name=@user_name,");
                sql.Append("role_id=@role_id,");
                sql.Append("password=@password,".If(!string.IsNullOrWhiteSpace(model.password)));
                sql.Append("wechat=@wechat,");
                sql.Append("email=@email,");
                sql.Append("tel=@tel ");
                sql.Append("where user_id=@user_id ");
                if (conn.Execute(sql.ToString(), model, t?.DbTrans) > 0)
                {
                    rst.Result  = true;
                    rst.Message = "更新成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"更新失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }
Esempio n. 3
0
 public void WriteRequest()
 {
     Task.Run(() =>
     {
         while (true)
         {
             try
             {
                 List <Request> requestList = new List <Request>();
                 while (requestList.Count <= 10 && RequestQueue.TryDequeue(out Request request))
                 {
                     requestList.Add(request);
                 }
                 if (requestList.Any())
                 {
                     new RequestBll().AddList(requestList);
                 }
             }
             catch (Exception ex)
             {
                 Log4netUtil.Error($"写请求失败:{ex}");
             }
             Thread.Sleep(10000);
         }
     });
 }
Esempio n. 4
0
        public ReturnResult <List <Map> > GetMapList(string secret)
        {
            var rst = new ReturnResult <List <Map> >()
            {
                Message = "暂无记录"
            };

            try
            {
                rst.Data = conn.Query <Map>(@"SELECT
	                                            t1.*, t2.`name` client_name,
                                                t2.user_id,
	                                            t3.user_name
                                            FROM
	                                            `map` t1
                                            INNER JOIN client t2 ON t1.client_id = t2.id
                                            INNER JOIN `user` t3 ON t2.user_id = t3.user_id
                                            WHERE t2.secret = @secret
                                            ORDER BY t2.user_id,t1.client_id,t1.remote", new { secret }).ToList();
                if (rst.Data != null)
                {
                    rst.Result  = true;
                    rst.Message = "获取成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"获取失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }
Esempio n. 5
0
        public ApiResult <bool> DisableUser(User model, Trans t = null)
        {
            var rst = new ApiResult <bool>()
            {
                Message = "更新失败"
            };

            try
            {
                CreateMySqlConnection(t);
                var sql = new StringBuilder();
                sql.Append("update user set ");
                sql.Append("is_disabled=@is_disabled ");
                sql.Append("where user_id=@user_id ");
                if (conn.Execute(sql.ToString(), model) > 0)
                {
                    rst.Result  = true;
                    rst.Message = "更新成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"更新失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }
Esempio n. 6
0
        public ApiResult <bool> AddRole(Role model)
        {
            var rst = new ApiResult <bool>()
            {
                Message = "添加失败"
            };

            try
            {
                using Trans t = new Trans();
                if (roleDal.Add(model, t).Result)
                {
                    //插入角色菜单关联表
                    model.menu_ids?.ForEach(c => authorityDal.Add(new Authority()
                    {
                        menu_id = c, role_id = model.role_id
                    }, t));
                    t.Commit();
                    rst.Result  = true;
                    rst.Message = "添加成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"添加失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }
Esempio n. 7
0
        public ApiResult <T> GetOne(IModel model, Trans t = null)
        {
            var rst = new ApiResult <T>()
            {
                Message = "暂无记录"
            };

            try
            {
                CreateMySqlConnection(t);
                rst.Data = conn.Get <T>(model.id, t?.DbTrans);
                if (rst.Data != null)
                {
                    rst.Result  = true;
                    rst.Message = "获取成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"获取失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }
Esempio n. 8
0
        /// <summary>
        /// 新增一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <bool> Add(Subscription model)
        {
            var rst = new ReturnResult <bool>();

            try
            {
                //判断重复
                var checkQuery = Check(model);
                if (checkQuery.Result)
                {
                    rst.Message = "已存在";
                    return(rst);
                }

                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into subscription(");
                strSql.Append("SubscriptionId,NotifyType,CallbackUrl,AppId) ");
                strSql.Append("values (");
                strSql.Append("@SubscriptionId,@NotifyType,@CallbackUrl,@AppId)");
                conn.Execute(strSql.ToString(), model);

                rst.Result  = true;
                rst.Message = "添加成功";
            }
            catch (Exception ex)
            {
                rst.Message = "添加失败:" + ex.Message;
                Log4netUtil.Error("SubscriptionDal/Add", ex);
            }

            return(rst);
        }
Esempio n. 9
0
        /// <summary>
        /// 添加时判断关键内容是否已存在
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <Subscription> Check(Subscription model)
        {
            var rst = new ReturnResult <Subscription>();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append(@"SELECT sub.Id,sub.SubscriptionId,sub.NotifyType,sub.CallbackUrl,sub.AppId,
                                ap.AppServer,ap.AppType,ap.DeviceServer,ap.`Name` AS AppName,ap.Secret 
                                FROM subscription AS sub
                                LEFT JOIN apps as ap ON sub.AppId = ap.Id ");
                strSql.Append("where CallbackUrl=@CallbackUrl");
                var query = conn.Query <Subscription>(strSql.ToString(), model).FirstOrDefault();
                if (query == null)
                {
                    rst.Message = "数据不存在";
                }
                else
                {
                    rst.Result  = true;
                    rst.Data    = query;
                    rst.Message = "查询成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = "查询失败:" + ex.Message;
                Log4netUtil.Error("SubscriptionDal/Check", ex);
            }

            return(rst);
        }
Esempio n. 10
0
        public DataTable RunWithBody(string retxml)
        {
            try
            {
                DataSet   ds    = Tools.CXmlToDataSet(retxml);
                DataTable resDt = ds.Tables["RESULT"] ?? null;

                if (resDt == null || resDt.Rows.Count <= 0)
                {
                    Log4netUtil.Warn("作业【" + this.Cur_Job.name + "】结果表未返回:" + retxml);
                    return(null);
                }
                if (resDt.Rows[0]["RST"].ToString() != "T")
                {
                    Log4netUtil.Warn("作业【" + this.Cur_Job.name + "】结果表返回错误:" + retxml);
                    return(null);
                }
                DataTable jgDt = ds.Tables[this.Cur_Job.businesstable] ?? null;
                return(jgDt);
            }
            catch (Exception ex)
            {
                Log4netUtil.Error("作业【" + this.Cur_Job.name + "】RunWithBody发生异常:" + ex.Message, ex);
                return(null);
            }
        }
Esempio n. 11
0
        public virtual string WebRequest()
        {
            try
            {
                string requestxml = !this.Cur_Job.isdbpara?this.Cur_Job.requestxml: GlobalInstanceManager <GlobalSqlManager> .Intance.GetDataTable(0, this.Cur_Job.targetdbstring, this.Cur_Job.requestxml).Rows[0][0].ToString();

                Log4netUtil.Info("作业【" + this.Cur_Job.name + "】Run入参:" + requestxml);
                string userid   = this.Cur_Job.isencode ? SecurityHelper.DESEnCode(this.Cur_Job.CloudUserId, this.Cur_Job.Key) : this.Cur_Job.CloudUserId;
                string password = this.Cur_Job.isencode ? SecurityHelper.DESEnCode(this.Cur_Job.CloudUserPassword, this.Cur_Job.Key) : this.Cur_Job.CloudUserPassword;
                string xml      = this.Cur_Job.isencode ? SecurityHelper.DESEnCode(requestxml, this.Cur_Job.Key) : requestxml;
                string retxml   = "";
                using (WebReference.NetHisWebService websrv = new WebReference.NetHisWebService())
                {
                    websrv.Url = this.Cur_Job.weburl;
                    retxml     = websrv.nethis_common_business(userid, password, this.Cur_Job.businesscode, xml);
                }
                Log4netUtil.Info("作业【" + this.Cur_Job.name + "】Run出参:" + retxml);
                return(retxml);
            }
            catch (Exception ex)
            {
                Log4netUtil.Error("作业【" + this.Cur_Job.name + "】WebRequest发生异常:" + ex.Message, ex);
                return("");
            }
        }
Esempio n. 12
0
        /// <summary>
        /// 修改一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <bool> Update(AdminToken model)
        {
            var rst = new ReturnResult <bool>();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("update admin_token set ");
                strSql.Append("AdminId=@AdminId,");
                strSql.Append("Token=@Token,");
                strSql.Append("TimeOut=@TimeOut ");
                strSql.Append("where Id=@Id");
                int count = conn.Execute(strSql.ToString(), model);

                if (count > 0)
                {
                    rst.Result  = true;
                    rst.Message = "更新成功";
                }
                else
                {
                    rst.Message = "更新失败";
                }
            }
            catch (Exception ex)
            {
                rst.Message = "更新失败:" + ex.Message;
                Log4netUtil.Error("AdminTokenDal/Update", ex);
            }

            return(rst);
        }
Esempio n. 13
0
        /// <summary>
        /// 新增多条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <bool> AddList(List <AdminToken> list)
        {
            var rst  = new ReturnResult <bool>();
            var tran = conn.BeginTransaction();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into admin_token(");
                strSql.Append("AdminId,Token,TimeOut) ");
                strSql.Append("values (");
                strSql.Append("@AdminId,@Token,@TimeOut)");
                conn.Execute(strSql.ToString(), list, tran);
                tran.Commit();

                rst.Result  = true;
                rst.Message = "批量添加成功";
            }
            catch (Exception ex)
            {
                tran.Rollback();
                rst.Message = "批量添加失败:" + ex.Message;
                Log4netUtil.Error("AdminTokenDal/AddList", ex);
            }

            return(rst);
        }
Esempio n. 14
0
        /// <summary>
        /// 获取一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <AdminToken> GetOne(AdminToken model)
        {
            var rst = new ReturnResult <AdminToken>();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append(@"select Id,AdminId,Token,TimeOut from admin_token ");
                strSql.Append("where Id=@Id");
                var query = conn.Query <AdminToken>(strSql.ToString(), model).FirstOrDefault();
                if (query == null)
                {
                    rst.Message = "数据不存在";
                }
                else
                {
                    rst.Result  = true;
                    rst.Data    = query;
                    rst.Message = "查询成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = "查询失败:" + ex.Message;
                Log4netUtil.Error("AdminTokenDal/GetOne", ex);
            }

            return(rst);
        }
Esempio n. 15
0
        /// <summary>
        /// 新增多条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <bool> AddList(List <User> list)
        {
            var rst  = new ReturnResult <bool>();
            var tran = conn.BeginTransaction();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into user(");
                strSql.Append("Phone,Password,AppId,CreateTime) ");
                strSql.Append("values (");
                strSql.Append("@Phone,@Password,@AppId,@CreateTime)");
                conn.Execute(strSql.ToString(), list, tran);
                tran.Commit();

                rst.Result  = true;
                rst.Message = "批量添加成功";
            }
            catch (Exception ex)
            {
                tran.Rollback();
                rst.Message = "批量添加失败:" + ex.Message;
                Log4netUtil.Error("UserDal/AddList", ex);
            }

            return(rst);
        }
Esempio n. 16
0
        /// <summary>
        /// 新增多条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <bool> AddList(List <Subscription> list)
        {
            var rst  = new ReturnResult <bool>();
            var tran = conn.BeginTransaction();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into subscription(");
                strSql.Append("SubscriptionId,NotifyType,CallbackUrl,AppId) ");
                strSql.Append("values (");
                strSql.Append("@SubscriptionId,@NotifyType,@CallbackUrl,@AppId)");
                conn.Execute(strSql.ToString(), list, tran);
                tran.Commit();

                rst.Result  = true;
                rst.Message = "批量添加成功";
            }
            catch (Exception ex)
            {
                tran.Rollback();
                rst.Message = "批量添加失败:" + ex.Message;
                Log4netUtil.Error("SubscriptionDal/AddList", ex);
            }

            return(rst);
        }
Esempio n. 17
0
        /// <summary>
        /// 修改一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <bool> Update(User model)
        {
            var rst = new ReturnResult <bool>();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("update user set ");
                strSql.Append("Phone=@Phone,");
                strSql.Append("Password=@Password,");
                strSql.Append("AppId=@AppId,");
                strSql.Append("CreateTime=@CreateTime ");
                strSql.Append("where Id=@Id");
                int count = conn.Execute(strSql.ToString(), model);

                if (count > 0)
                {
                    rst.Result  = true;
                    rst.Message = "更新成功";
                }
                else
                {
                    rst.Message = "更新失败";
                }
            }
            catch (Exception ex)
            {
                rst.Message = "更新失败:" + ex.Message;
                Log4netUtil.Error("UserDal/Update", ex);
            }

            return(rst);
        }
Esempio n. 18
0
        /// <summary>
        /// 修改一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <bool> Update(Subscription model)
        {
            var rst = new ReturnResult <bool>();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("update subscription set ");
                strSql.Append("SubscriptionId=@SubscriptionId,");
                strSql.Append("NotifyType=@NotifyType,");
                strSql.Append("CallbackUrl=@CallbackUrl,");
                strSql.Append("AppId=@AppId ");
                strSql.Append("where Id=@Id");
                int count = conn.Execute(strSql.ToString(), model);

                if (count > 0)
                {
                    rst.Result  = true;
                    rst.Message = "更新成功";
                }
                else
                {
                    rst.Message = "更新失败";
                }
            }
            catch (Exception ex)
            {
                rst.Message = "更新失败:" + ex.Message;
                Log4netUtil.Error("SubscriptionDal/Update", ex);
            }

            return(rst);
        }
Esempio n. 19
0
        public ApiResult <bool> UpdateRole(Role model)
        {
            var rst = new ApiResult <bool>()
            {
                Message = "更新失败"
            };

            try
            {
                using Trans t = new Trans();
                if (roleDal.Update(model, t).Result)
                {
                    //删除替换
                    authorityDal.DeleteCustom("where role_id=@role_id", new { model.role_id }, t);
                    //插入角色菜单关联表
                    model.menu_ids?.ForEach(c => authorityDal.Add(new Authority()
                    {
                        menu_id = c, role_id = model.role_id
                    }, t));
                    t.Commit();
                    rst.Result  = true;
                    rst.Message = "更新成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"更新失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }
Esempio n. 20
0
        public ReturnResult <List <ServerConfig> > GetServerConfig()
        {
            var rst = new ReturnResult <List <ServerConfig> >()
            {
                Message = "暂无记录"
            };

            try
            {
                conn = CreateMySqlConnection();
                var sql = new StringBuilder(@"SELECT
	                                                protocol,
	                                                GROUP_CONCAT(`port`) `port`
                                                FROM
	                                                server_config
                                                GROUP BY
	                                                protocol "    );

                rst.Data = conn.Query <ServerConfig>(sql.ToString()).ToList();
                if (rst.Data != null)
                {
                    rst.Result  = true;
                    rst.Message = "获取成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"获取失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }
Esempio n. 21
0
 static void Main()
 {
     try
     {
         //处理未捕获的异常
         Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
         //处理UI线程异常
         Application.ThreadException += Application_ThreadException;
         //处理非UI线程异常
         AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
         DevExpress.UserSkins.BonusSkins.Register();
         DevExpress.Skins.SkinManager.EnableFormSkins();
         Application.EnableVisualStyles();
         Application.SetCompatibleTextRenderingDefault(false);
         Tools.AutoStart(AppSetting.Default.isautostart, AppSetting.Default.appname, true);
         bool  flag;
         Mutex mutex = new Mutex(true, AppSetting.Default.appname, out flag);
         if (flag)
         {
             Application.Run(new FrmMain());
         }
         else
         {
             MessageBox.Show("本程序不能同时运行两个", "操作提醒", MessageBoxButtons.OK);
             Application.Exit();
         }
     }
     catch (Exception ex)
     {
         Log4netUtil.Error("系统出现未知异常,原因:" + ex.Message, ex);
     }
 }
Esempio n. 22
0
        /// <summary>
        /// 删除一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <bool> Delete(User model)
        {
            var rst = new ReturnResult <bool>();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append("delete from user ");
                strSql.Append("where Id=@Id");
                int count = conn.Execute(strSql.ToString(), model);

                if (count > 0)
                {
                    rst.Result  = true;
                    rst.Message = "删除成功";
                }
                else
                {
                    rst.Message = "删除失败";
                }
            }
            catch (Exception ex)
            {
                rst.Message = "删除失败:" + ex.Message;
                Log4netUtil.Error("UserDal/Delete", ex);
            }

            return(rst);
        }
Esempio n. 23
0
        public ReturnResult <Map> GetOne(Map model)
        {
            var rst = new ReturnResult <Map>()
            {
                Message = "暂无记录"
            };

            try
            {
                rst.Data = conn.QueryFirstOrDefault <Map>(@"SELECT
	                                                            t1.*, t2.`name` client_name,
                                                                t2.user_id,
	                                                            t3.user_name
                                                            FROM
	                                                            `map` t1
                                                            INNER JOIN client t2 ON t1.client_id = t2.id
                                                            INNER JOIN `user` t3 ON t2.user_id = t3.user_id
                                                            WHERE t1.id=@id", new { model.id });
                if (rst.Data != null)
                {
                    rst.Result  = true;
                    rst.Message = "获取成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"获取失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }
Esempio n. 24
0
        /// <summary>
        /// 新增一条数据
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <bool> Add(User model)
        {
            var rst = new ReturnResult <bool>();

            try
            {
                //判断重复
                var checkQuery = Check(model);
                if (checkQuery.Result)
                {
                    rst.Message = "手机号已存在";
                    return(rst);
                }
                StringBuilder strSql = new StringBuilder();
                strSql.Append("insert into user(");
                strSql.Append("Phone,Password,AppId,CreateTime) ");
                strSql.Append("values (");
                strSql.Append("@Phone,@Password,@AppId,@CreateTime)");
                conn.Execute(strSql.ToString(), model);

                rst.Result  = true;
                rst.Message = "添加成功";
            }
            catch (Exception ex)
            {
                rst.Message = "添加失败:" + ex.Message;
                Log4netUtil.Error("UserDal/Add", ex);
            }

            return(rst);
        }
Esempio n. 25
0
        public ApiResult <bool> UpdateLastLogin(User model, Trans t = null)
        {
            var rst = new ApiResult <bool>()
            {
                Message = "更新失败"
            };

            try
            {
                CreateMySqlConnection(t);
                var sql = new StringBuilder();
                sql.Append("update user set ");
                sql.Append("last_login_time=@last_login_time,");
                sql.Append("login_times=login_times+1 ");
                sql.Append("where user_id=@user_id ");
                if (conn.Execute(sql.ToString(), model, t?.DbTrans) > 0)
                {
                    rst.Result  = true;
                    rst.Message = "更新成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"更新失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }
Esempio n. 26
0
        /// <summary>
        /// 判断是否存在
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <User> Check(User model)
        {
            var rst = new ReturnResult <User>();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append(@"select u.Id,u.Phone,u.Password,app.`Name` as AppName,u.AppId,u.CreateTime 
                                from user as u
                                left join apps as app on u.AppId = app.Id ");
                strSql.Append("where Phone=@Phone");

                var query = conn.Query <User>(strSql.ToString(), model).FirstOrDefault();
                if (query == null)
                {
                    rst.Message = "数据不存在";
                }
                else
                {
                    rst.Result  = true;
                    rst.Data    = query;
                    rst.Message = "查询成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = "查询失败:" + ex.Message;
                Log4netUtil.Error("UserDal/Check", ex);
            }

            return(rst);
        }
Esempio n. 27
0
 private void btnok_Click(object sender, EventArgs e)
 {
     try
     {
         List <int> list = this.gvjob.GetSelectedRows().Where(a => a >= 0).ToList();
         if (this.Cur_popc == null || list == null || list.Count <= 0)
         {
             return;
         }
         foreach (int rowhanlde in list)
         {
             JobInfoSyncData info = this.gvjob.GetRow(rowhanlde) as JobInfoSyncData;
             if (this.Cur_popc == this.popctarget)
             {
                 info.targetdbtype   = this.cbetdbtype.SelectedIndex;
                 info.targetdbstring = this.txttstr.Text.Trim();
             }
             else
             {
                 info.sourcedbtype   = this.cbesdbtype.SelectedIndex;
                 info.sourcedbstring = this.txtsstr.Text.Trim();
             }
         }
         this.Cur_JobInfo.Save();
         MessageBox.Show("配置传递成功", "操作提示", MessageBoxButtons.OK);
     }
     catch (Exception ex)
     {
         Log4netUtil.Error("配置传递失败", ex);
     }
 }
Esempio n. 28
0
        /// <summary>
        /// 登陆验证
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnResult <User> UserLogin(User model)
        {
            var rst = new ReturnResult <User>();

            try
            {
                StringBuilder strSql = new StringBuilder();
                strSql.Append(@"select Id,Phone,Password from user ");
                strSql.Append("where Phone=@Phone ");
                strSql.Append("and Password=@Password ");

                var query = conn.Query <User>(strSql.ToString(), model).FirstOrDefault();
                if (query == null)
                {
                    rst.Message = "数据不存在";
                }
                else
                {
                    rst.Result  = true;
                    rst.Data    = query;
                    rst.Message = "查询成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = "查询失败:" + ex.Message;
                Log4netUtil.Error("UserDal/GetOne", ex);
            }

            return(rst);
        }
Esempio n. 29
0
        public override void Run()
        {
            string    strsql = "exec usp_rims_wx_notifydoctor @cxlb=2";
            DataTable dt     = GlobalInstanceManager <GlobalSqlManager> .Intance.GetDataTable(this.Cur_Job.dbtype, this.Cur_Job.dbstring, strsql);

            if (dt == null || dt.Rows.Count <= 0)
            {
                return;
            }

            var list = dt.AsEnumerable().GroupBy(a => new { ysdm = a["ysdm"].ToString(), ysmc = a["ysmc"].ToString(),
                                                            idNo = a["wxsbh"].ToString(), idType = a["wxklx"].ToString(), content = a["txnr"].ToString() }).
                       Select(a => new { ysdm = a.Key.ysdm, ysmc = a.Key.ysmc, idNo = a.Key.idNo, idType = a.Key.idType, content = a.Key.content, list = a.ToList() });

            foreach (var item in list)
            {
                FszyyWeChatMessage msg = new FszyyWeChatMessage();
                msg.url     = "";
                msg.content = item.content;
                msg.idNo    = item.idNo;
                msg.idType  = item.idType;
                string result = this.PostRequest(JsonConvert.SerializeObject(msg));
                Log4netUtil.Info("作业【" + this.Cur_Job.name + "】返回值:" + result);
                FszyyWeChatResult fr = JsonConvert.DeserializeObject <FszyyWeChatResult>(result);
                if (fr != null && fr.code == "0")
                {
                    strsql = "exec usp_rims_wx_notifydoctor @cxlb=1,@txxh='" + string.Join(",", item.list.Select(a => a["xh"].ToString())) + "'";
                    DataTable redt = GlobalInstanceManager <GlobalSqlManager> .Intance.GetDataTable(this.Cur_Job.dbtype, this.Cur_Job.dbstring, strsql);
                }
            }
        }
Esempio n. 30
0
        public ReturnResult <Client> GetOne(string secret, Trans t = null)
        {
            var rst = new ReturnResult <Client>()
            {
                Message = "暂无记录"
            };

            try
            {
                conn     = CreateMySqlConnection(t);
                rst.Data = conn.QueryFirstOrDefault <Client>(@"SELECT
	                                                                t1.*, t2.user_name
                                                                FROM
	                                                                client t1
                                                                LEFT JOIN `user` t2 ON t1.user_id = t2.user_id
                                                                WHERE
	                                                                t1.secret =@secret"    , new { secret }, t?.DbTrans);
                if (rst.Data != null)
                {
                    rst.Result  = true;
                    rst.Message = "获取成功";
                }
            }
            catch (Exception ex)
            {
                rst.Message = $"获取失败:{ex.InnerException ?? ex}";
                Log4netUtil.Error($"{ex.InnerException ?? ex}");
            }

            return(rst);
        }