private string GetDesignTaskContent(BaseBlock bl) { string sql = @"select ID,Name as TaskName,WBSFULLID,CreateDate from S_W_TaskWork Where (DesignerUserID like '{0}%' or DesignerUserID like '%{0}%' or DesignerUserID like '%{0}') And (State is null Or State='' or State !='Finish')"; sql = string.Format(sql, FormulaHelper.UserID); string template = bl.RepeatItemTemplate; string html = ""; SQLHelper helper = SQLHelper.CreateSqlHelper("Project"); DataTable source = helper.ExecuteDataTable(sql, 0, 8, CommandType.Text); if (source != null && source.Rows.Count > 0) { foreach (DataRow dr in source.Rows) { string item = template; Regex rg = new Regex("\\[[^][]*\\]", RegexOptions.Multiline); MatchCollection mtc = rg.Matches(template); foreach (Match mt in mtc) { item = item.Replace(mt.Value, dr[mt.Value.Substring(1, mt.Value.Length - 2)].ToString()); } html += item; } } html += bl.GetFootHtml(); return(html); }
private string GetFrameContent(BaseBlock bl) { if (bl != null) { return(bl.RepeatItemTemplate + bl.GetFootHtml()); } else { return(string.Empty); } }
private string GetBlockContent(BaseBlock bl) { try { //特殊Block直接输出html switch (bl.BlockKey) { case "MyHead": //头像 return(GetPhotoContent()); case "Weather": //天气 return(GetWeatherContent()); case "Frame": //图片新闻 return(GetFrameContent(bl)); case "AuditTask": return(GetAuditTaskContent(bl)); case "AuditedTask": return(GetAuditedTaskContent(bl)); case "DesignTask": return(GetDesignTaskContent(bl)); default: { //如果是[Delegate]类型则自定义 if (bl.RepeatDataDataSql != null && bl.RepeatDataDataSql.StartsWith("[")) { bl.GetServiceData += new GetServiceHandler(bl_GetServiceData); } return(bl.GetContentHtml() + bl.GetFootHtml()); } } } catch (Exception dpe) { LogWriter.Error(dpe); return(dpe.Message); } }
private string GetAuditTaskContent(BaseBlock bl) { string preYear = DateTime.Now.AddYears(-1).ToString("yyyy-MM-dd"); string sql = @"select S_WF_InsTaskExec.ID,S_WF_InsTask.TaskName,FormUrl,FormInstanceID,S_WF_InsTaskExec.CreateTime,FormWidth,FormHeight from S_WF_InsTaskExec join S_WF_InsTask on ExecTime is null and ExecUserID='{0}' and S_WF_InsTask.Type in('Normal','Inital') and (WaitingRoutings='' or WaitingRoutings is null) and (WaitingSteps='' or WaitingSteps is null) and (S_WF_InsTaskExec.CreateTime >= {1} ) and S_WF_InsTask.ID=InsTaskID join S_WF_InsFlow on S_WF_InsFlow.Status='Processing' and S_WF_InsFlow.ID=S_WF_InsTask.InsFlowID join S_WF_InsDefFlow on S_WF_InsFlow.InsDefFlowID=S_WF_InsDefFlow.ID order by S_WF_InsTaskExec.CreateTime desc"; sql = string.Format(sql, FormulaHelper.UserID, Config.Constant.IsOracleDb ? string.Format("to_date('{0}','yyyy-MM-dd')", preYear) : string.Format("'{0}'", preYear) ); string template = bl.RepeatItemTemplate; string html = ""; SQLHelper helper = SQLHelper.CreateSqlHelper("WorkFlow"); int iCount = 8; if (bl.RepeatItemCount != null) { iCount = bl.RepeatItemCount.Value; } DataTable source = helper.ExecuteDataTable(sql, 0, iCount, CommandType.Text); if (source != null && source.Rows.Count > 0) { foreach (DataRow dr in source.Rows) { string item = template; Regex rg = new Regex("\\[[^][]*\\]", RegexOptions.Multiline); MatchCollection mtc = rg.Matches(template); foreach (Match mt in mtc) { item = item.Replace(mt.Value, dr[mt.Value.Substring(1, mt.Value.Length - 2)].ToString()); } html += item; } } html += bl.GetFootHtml(); return(html); }
private string GetAuditedTaskContent(BaseBlock bl) { string sql = @"select FormUrl,FormWidth,FormHeight,FormInstanceID,S_WF_InsTaskExec.ID,S_WF_InsTask.TaskName,S_WF_InsTaskExec.ExecTime from S_WF_InsTaskExec join S_WF_InsTask on ExecTime is not null and ExecUserID='{0}' and S_WF_InsTask.Type in ('Normal','Inital') and S_WF_InsTask.ID=InsTaskID join S_WF_InsFlow on S_WF_InsFlow.ID=S_WF_InsTask.InsFlowID join S_WF_InsDefFlow on S_WF_InsDefFlow.ID=S_WF_InsFlow.InsDefFlowID order by S_WF_InsTaskExec.ExecTime desc"; sql = string.Format(sql, FormulaHelper.UserID); string template = bl.RepeatItemTemplate; string html = ""; SQLHelper helper = SQLHelper.CreateSqlHelper("WorkFlow"); int iCount = 8; if (bl.RepeatItemCount != null) { iCount = bl.RepeatItemCount.Value; } DataTable source = helper.ExecuteDataTable(sql, 0, iCount, CommandType.Text); if (source != null && source.Rows.Count > 0) { foreach (DataRow dr in source.Rows) { string item = template; Regex rg = new Regex("\\[[^][]*\\]", RegexOptions.Multiline); MatchCollection mtc = rg.Matches(template); foreach (Match mt in mtc) { item = item.Replace(mt.Value, dr[mt.Value.Substring(1, mt.Value.Length - 2)].ToString()); } html += item; } } html += bl.GetFootHtml(); return(html); }