예제 #1
0
 public static List <string> GetEditRoleList(string docId)
 {
     try
     {
         using (IDbConnection conn = DbSwitcher.GetOpenConnection())
         {
             List <string> vs  = new List <string>();
             var           lst = conn.GetList <Model.DocRoleCtrl>(new { DocId = docId }).ToList();
             if (lst != null && lst.Count > 0)
             {
                 foreach (var item in lst)
                 {
                     if (!vs.Contains(item.RoleId))
                     {
                         vs.Add(item.RoleId);
                     }
                 }
             }
             return(vs);
         }
     }
     catch (Exception)
     {
     }
     return(new List <string>());
 }
예제 #2
0
 public static List <string> GetListByDocId(string docId)
 {
     try
     {
         using (IDbConnection conn = DbSwitcher.GetOpenConnection())
         {
             List <string> vs  = new List <string>();
             var           lst = conn.GetList <Model.DocUsrRole>(new { DocId = docId }).ToList();
             if (lst != null && lst.Count > 0)
             {
                 foreach (var item in lst)
                 {
                     if (!vs.Contains(item.roleId))
                     {
                         vs.Add(item.roleId);
                     }
                 }
             }
             return(vs);
         }
     }
     catch (Exception ex)
     {
         string str = ex.Message;
     }
     return(new List <string>());
 }
예제 #3
0
        public static bool Delete(string docTypeId, out string strTips)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select COUNT(1) from helpdoc where docTypeId=?docTypeId");

            using (IDbConnection conn = DbSwitcher.GetOpenConnection())
            {
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("?docTypeId", docTypeId);
                int.TryParse(conn.ExecuteScalar(strSql.ToString(), parameters)?.ToString(), out int result);
                if (result > 0)
                {
                    strTips = ActionService.ResponseMessageTips.MSG_DOCTYPE_HAS_BIND_DOC;
                    return(false);
                }
                strSql = new StringBuilder();
                strSql.Append("delete from doctypeconfig ");
                strSql.Append(" where docTypeId=?docTypeId");

                int rows = mysql.ExcuteNonQuery <Model.DocTypeConfig>(DapperMySQLHelper.ConnectionString, strSql.ToString(), parameters, false);
                strTips = rows > 0
                    ? ActionService.ResponseMessageTips.MSG_DOCTYPE_DELETE_SUCCESS
                    : ActionService.ResponseMessageTips.MSG_DOCTYPE_DELETE_FAIL;
                return(rows > 0);
            }
        }
예제 #4
0
 public static bool Delete(Model.DocRoleCtrl docRoleCtrl)
 {
     using (IDbConnection conn = DbSwitcher.GetOpenConnection())
     {
         conn.Delete(docRoleCtrl);
     }
     return(false);
 }
예제 #5
0
 public static List <Model.DocRoleCtrl> Get(string docId)
 {
     using (IDbConnection conn = DbSwitcher.GetOpenConnection())
     {
         var lst = conn.GetList <Model.DocRoleCtrl>(new { DocId = docId })?.ToList();
         return(lst);
     }
 }
예제 #6
0
파일: Dept.cs 프로젝트: BeanCjc/HelpCenter
        public static string GetMaxDeptNumByPreDeptId(string preDeptId)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select max(deptNO) from dept where preDeptId=?preDeptId");
            //DynamicParameters parameters = new DynamicParameters();
            //parameters.Add("?preDeptId", preDeptId);

            using (IDbConnection conn = DbSwitcher.GetOpenConnection())
            {
                DynamicParameters parameters = new DynamicParameters();
                parameters.Add("?preDeptId", preDeptId);
                return(conn.ExecuteScalar(strSql.ToString(), parameters)?.ToString());
            }
            //return mysql.FindOne<Model.Dept>(DapperMySQLHelper.ConnectionString, strSql.ToString(), parameters, false);
        }
예제 #7
0
        public static bool Add(List <Model.DocRoleCtrl> docRoleCtrls)
        {
            if (docRoleCtrls != null && docRoleCtrls.Count > 0)
            {
                Delete(docRoleCtrls);
                using (IDbConnection conn = DbSwitcher.GetOpenConnection())
                {
                    foreach (var item in docRoleCtrls)
                    {
                        if (Get(item.DocId, item.RoleId) == null || Get(item.DocId, item.RoleId).Count == 0)
                        {
                            conn.Insert(item);
                        }
                    }
                    return(true);
                }
            }

            return(false);
        }
예제 #8
0
 public static bool Delete(List <Model.DocRoleCtrl> docRoleCtrlList)
 {
     try
     {
         using (IDbConnection conn = DbSwitcher.GetOpenConnection())
         {
             foreach (var item in docRoleCtrlList)
             {
                 var lst = Get(item.DocId);
                 foreach (var _item in lst)
                 {
                     conn.Delete(_item);
                 }
             }
             return(true);
         }
     }
     catch (Exception)
     {
     }
     return(false);
 }