public JsonResult GetRelationList(MvcAdapter.QueryBuilder qb) { //流程定义增加子公司权限 if (System.Configuration.ConfigurationManager.AppSettings["CorpAuthEnabled"].ToLower() == "true" && Request["listType"] == "subCompany") { qb.Add("CompanyID", QueryMethod.Like, FormulaHelper.GetUserInfo().UserCompanyID); } GridData data; string categoryID = Request["NodeFullID"]; if (string.IsNullOrEmpty(categoryID)) { data = new GridData(entities.Set <S_WF_DefFlow>().Where(qb).Select(c => new { ID = c.ID, Code = c.Code, Name = c.Name, ConnName = c.ConnName, TableName = c.TableName, Description = c.Description, AlreadyReleased = c.AlreadyReleased, ModifyTime = c.ModifyTime })); data.total = qb.TotolCount; } else { categoryID = categoryID.Split('.').Last(); SQLHelper baseSqlHelper = SQLHelper.CreateSqlHelper(ConnEnum.Base); string sql = string.Format("select ID from S_M_Category where ID='{0}' or ParentID='{0}'", categoryID); var dt = baseSqlHelper.ExecuteDataTable(sql); string ids = string.Join(",", dt.AsEnumerable().Select(c => c["ID"].ToString()).ToArray()); qb.Add("CategoryID", QueryMethod.In, ids); data = new GridData(entities.Set <S_WF_DefFlow>().Where(qb).Select(c => new { ID = c.ID, Code = c.Code, Name = c.Name, ConnName = c.ConnName, TableName = c.TableName, Description = c.Description, AlreadyReleased = c.AlreadyReleased, ModifyTime = c.ModifyTime })); data.total = qb.TotolCount; } return(Json(data)); }
public JsonResult GetFormList(MvcAdapter.QueryBuilder qb) { if (!string.IsNullOrEmpty(Request["CategoryID"])) { qb.Add("CategoryID", QueryMethod.Equal, Request["CategoryID"]); } var list = entities.Set <S_UI_Form>().Where(qb).Select(c => new { ID = c.ID, Code = c.Code, Name = c.Name, ConnName = c.ConnName, TableName = c.TableName, ModifyTime = c.ModifyTime, Category = c.Category }); GridData data = new GridData(list); data.total = qb.TotolCount; return(Json(data)); }
public JsonResult GetList(MvcAdapter.QueryBuilder qb) { if (!string.IsNullOrEmpty(Request["CategoryID"])) { string categoryID = Request["CategoryID"]; var arr = entities.Set <S_M_Category>().Where(c => c.ID == categoryID || c.ParentID == categoryID).Select(c => c.ID).ToArray(); string ids = string.Join(",", arr); qb.Add("CategoryID", QueryMethod.In, ids); } //列表定义增加子公司权限 if (System.Configuration.ConfigurationManager.AppSettings["CorpAuthEnabled"].ToLower() == "true" && Request["listType"] == "subCompany") { qb.Add("CompanyID", QueryMethod.Equal, FormulaHelper.GetUserInfo().AdminCompanyID); } var list = entities.Set <S_UI_List>().Where(qb).Select(c => new { ID = c.ID, Code = c.Code, Name = c.Name, ConnName = c.ConnName, SQL = c.SQL, ModifyTime = c.ModifyTime, CompanyName = c.CompanyName }); GridData data = new GridData(list); data.total = qb.TotolCount; return(Json(data)); }
public JsonResult GetList(MvcAdapter.QueryBuilder qb) { if (!string.IsNullOrEmpty(Request["CategoryID"])) { string categoryID = Request["CategoryID"]; var arr = entities.Set <S_M_Category>().Where(c => c.ID == categoryID || c.ParentID == categoryID).Select(c => c.ID).ToArray(); string ids = string.Join(",", arr); qb.Add("CategoryID", QueryMethod.In, ids); } var list = entities.Set <S_UI_FreePivot>().Where(qb).Select(c => new { ID = c.ID, Code = c.Code, Name = c.Name, ConnName = c.ConnName, ModifyTime = c.ModifyTime, Description = c.Description }); GridData data = new GridData(list); data.total = qb.TotolCount; return(Json(data)); }
public JsonResult GetWordList(MvcAdapter.QueryBuilder qb) { if (!string.IsNullOrEmpty(Request["CategoryID"])) { string categoryID = Request["CategoryID"]; var arr = entities.Set <S_M_Category>().Where(c => c.ID == categoryID || c.ParentID == categoryID).Select(c => c.ID).ToArray(); string ids = string.Join(",", arr); qb.Add("CategoryID", QueryMethod.In, ids); } //word定义增加子公司权限 if (System.Configuration.ConfigurationManager.AppSettings["CorpAuthEnabled"].ToLower() == "true" && Request["listType"] == "subCompany") { qb.Add("CompanyID", QueryMethod.Like, FormulaHelper.GetUserInfo().AdminCompanyID); } SQLHelper sqlHelper = SQLHelper.CreateSqlHelper(ConnEnum.Base); // string sql = @" //select * from( //select S_UI_Word.*,HasForm=case when S_UI_Form.Code is null then '0' else '1' end,S_UI_Form.ID FormID //from S_UI_Word left join S_UI_Form on S_UI_Word.Code=S_UI_Form.Code where S_UI_Word.VersionEndDate is null //) tb1 //"; string sql = "select * from S_UI_Word where VersionEndDate is null"; DataTable dt = sqlHelper.ExecuteDataTable(sql, qb); //是否存在word模板标识 dt.Columns.Add("HasWord"); foreach (DataRow row in dt.Rows) { var versionNum = row["VersionNum"].ToString(); string tmplName = row["Code"].ToString() + ".docx"; if (!string.IsNullOrEmpty(tmplName)) { string newTmplName = row["Code"].ToString() + "_" + versionNum + ".docx"; string path = HttpContext.Server.MapPath("/") + "WordTemplate/" + tmplName; string newPath = HttpContext.Server.MapPath("/") + "WordTemplate/" + newTmplName; if (System.IO.File.Exists(path) || System.IO.File.Exists(newPath)) { row["HasWord"] = "1"; } } } //设置版本数量 dt.Columns.Add("VersionCount"); sql = string.Format("select Code,VersionCount=COUNT(1) from S_UI_Word where Code in('{0}') group by Code ", string.Join("','", dt.AsEnumerable().Select(c => c["Code"].ToString()))); var dtVersionCount = sqlHelper.ExecuteDataTable(sql); foreach (DataRow row in dt.Rows) { row["VersionCount"] = dtVersionCount.AsEnumerable().SingleOrDefault(c => c["Code"].ToString() == row["Code"].ToString())["VersionCount"]; } //设置是否有对应表单定义 dt.Columns.Add("HasForm"); sql = string.Format("select Code,VersionCount=COUNT(1) from S_UI_Form where Code in('{0}') group by Code ", string.Join("','", dt.AsEnumerable().Select(c => c["Code"].ToString()))); var dtVersionFormCount = sqlHelper.ExecuteDataTable(sql); foreach (DataRow row in dt.Rows) { if (dtVersionFormCount.AsEnumerable().Count(c => c["Code"].ToString() == row["Code"].ToString()) > 0) { row["HasForm"] = 1; } else { row["HasForm"] = 0; } } GridData data = new GridData(dt); data.total = qb.TotolCount; return(Json(data)); }