Ejemplo n.º 1
0
        public int UpdateManager(RLib.DB.DbConn dbconn, Model.Manager model)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("UPDATE  manager set ");
            sb.Append("name = @name,");
            sb.Append("subName = @subname,");
            sb.Append("loginName = @loginname,");
            //  sb.Append("loginPwd = @loginpwd,");
            sb.Append("allowLogin = @allowlogin,");
            sb.Append("state = @state,");
            sb.Append("updateTime = getdate(),");
            sb.Append("remark = @remark ");
            sb.Append(" WHERE managerId = @managerid;");

            int rows = dbconn.ExecuteSql(sb.ToString(), new
            {
                managerid = model.ManagerId,

                name       = model.Name,
                subname    = model.SubName ?? "",
                loginname  = model.LoginName ?? "",
                loginpwd   = model.LoginPwd ?? "",
                allowlogin = model.AllowLogin,
                state      = model.State,
                remark     = model.Remark ?? ""
            });

            return(rows);
        }
Ejemplo n.º 2
0
        public int UpdateManagerPwd(RLib.DB.DbConn dbconn, int managerid, string newpwd)
        {
            string sql  = "update manager set loginpwd=@loginpwd where managerid=@managerid;";
            int    rows = dbconn.ExecuteSql(sql, new { managerid = managerid, loginpwd = newpwd ?? "" });

            return(rows);
        }
Ejemplo n.º 3
0
        public int DeleteManager(RLib.DB.DbConn dbconn, int managerid)
        {
            string sql  = "update manager set state=-1 where managerid=@managerid;";
            int    rows = dbconn.ExecuteSql(sql, new { managerid = managerid });

            return(rows);
        }
Ejemplo n.º 4
0
        public void SetTagPermission(RLib.DB.DbConn dbconn, int usertagid, List <string> keys)
        {
            DeleteTagPermission(dbconn, usertagid);
            string sqlinsert = "insert into   tagpermission(usertagid,permissionKey) values(@usertagid,@key);";

            foreach (var k in keys)
            {
                if (string.IsNullOrEmpty(k))
                {
                    continue;
                }
                dbconn.ExecuteSql(sqlinsert, new { usertagid = usertagid, key = k });
            }
        }
Ejemplo n.º 5
0
        public Model.Manager AddManager(RLib.DB.DbConn dbconn, Model.Manager model)
        {
            string sql = "insert into manager(name,subname,loginname,loginpwd,allowlogin,state,createtime,remark)" +
                         "values(@name,@subname,@loginname,@loginpwd,@allowlogin,@state,getdate(),@remark);";

            dbconn.ExecuteSql(sql, new
            {
                name       = model.Name,
                subname    = model.SubName ?? "",
                loginname  = model.LoginName ?? "",
                loginpwd   = model.LoginPwd ?? "",
                allowlogin = model.AllowLogin,
                state      = model.State,
                remark     = model.Remark ?? ""
            });
            model.ManagerId = dbconn.GetIdentity();
            return(model);
        }
Ejemplo n.º 6
0
        public int DeleteTagPermission(RLib.DB.DbConn dbconn, int usertagid)
        {
            string sql = "delete from   tagpermission where usertagid=@usertagid;";

            return(dbconn.ExecuteSql(sql, new { usertagid = usertagid }));
        }