public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string type = context.Request.QueryString["type"]; string employid = context.Session["EmployeeId"] as string; string where = ""; switch (type) { case "0": where = "and d.BizType='救济难' "; break; case "1": where = "and d.BizType='临时救助' "; break; case "2": where = "and d.BizType='转办' "; break; case "3": where = "and d.BizType='转介' "; break; default: break; } where += $" and (ownerId='{employid}' or agentId='{employid}') "; string countsql = "BizType,COUNT(1) ct", datasql = " top 20 instanceName +' '+ CreateUser +' '++CONVERT(varchar(10), ArriveTime,111) title ,BizType,uTaskId taskId"; string cmdText = $@" from (select d.BizType as BizType /*业务分类*/,i.employeeName as CreateUser ,i._createtime,i.deptName,i.instanceName /*流程名称*/,i._autoid as instanceId,i.AppName,i.AppId,d.WorkflowCode ,t._AutoId as taskId,t.TaskName,t.ArriveTime /*到达时间*/,u.IsRead /*是否已读 0 未 1 已读 */ ,u.OwnerId,u.isshare,u.taskState,d.workflowname,i.companyname,u._autoId as uTaskId ,e.employeeName agentName,isnull(u.agentId,'') agentId,t.CanBatch,i.InstanceState from t_e_wf_instance i with(nolock) inner join t_e_wf_task t with(nolock) on i._AutoId=t.instanceId inner join t_e_wf_usertask u with(nolock) on t._AutoId=u.taskid inner join t_e_wf_define d with(nolock) on d._autoid=i.workflowid left join t_e_org_employee e with(nolock) on isnull(u.agentId,'')=e._autoId where u._IsDel=0 {where} ) t where (InstanceState = '处理中' or InstanceState = '未发起' ) and (TaskState ='0'or TaskState ='1') "; string sql = $"select {datasql} {cmdText}"; string sql2 = $"select {countsql} {cmdText} group by BizType"; DataTable dtMsg = null, dtcount = null; try { dtMsg = SysDatabase.ExecuteTable(sql); dtcount = SysDatabase.ExecuteTable(sql2); } catch (Exception ex) { context.Response.Write(cmdText); context.Response.Write(ex.Message + ex.Source + ex.StackTrace); context.Response.End(); return; } string json = JsonConvert.SerializeObject(new { code = 0, msg = "", count = dtcount, data = dtMsg }); context.Response.Write(json); context.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { bool logged = default(bool); newsId = this.GetParaValue("newsId"); bool flag = !base.IsPostBack; if (flag) { logged = base.Logged; if (!logged) { Button1.Enabled = false; string text = "update " + appName + " set ReadCount=IsNull(ReadCount,0) + 1 where _Autoid='" + newsId + "'"; SysDatabase.ExecuteNonQuery(text); } else { WebTools.UpdateRead(this.EmployeeID, appName, newsId); string text = "update " + appName + " set ReadCount=IsNull(ReadCount,0) + 1 where _Autoid='" + newsId + "'"; SysDatabase.ExecuteNonQuery(text); readContentᜀ(); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; var categorid = context.Request.Params["categorid"]; var categorName = context.Request.Params["categorName"]; var rowcount = context.Request.Params["rowcount"]; string cmdText = $@"select top {rowcount} _AutoID,IssueDept,Title ,IssueTime,attachId from T_R_Note_Jzfb where NewsType='{categorid}' and _IsDel=0 order by IssueTime desc"; DataTable dtMsg = null; try { dtMsg = SysDatabase.ExecuteTable(cmdText); } catch (Exception ex) { context.Response.Write(cmdText); context.Response.Write(ex.Message + ex.Source + ex.StackTrace); context.Response.End(); return; } string json = JsonConvert.SerializeObject(new { code = 0, categorid = categorid, msg = cmdText, total = dtMsg.Rows.Count, rows = dtMsg }); context.Response.Write(json); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string cmdText = $@"select LBBH,LBMC from T_R_FBLB order by LBBH"; DataTable dtMsg = null; try { dtMsg = SysDatabase.ExecuteTable(cmdText); } catch (Exception ex) { context.Response.Write(cmdText); context.Response.Write(ex.Message + ex.Source + ex.StackTrace); context.Response.End(); return; } string json = JsonConvert.SerializeObject(new { code = 0, msg = "", total = dtMsg.Rows.Count, rows = dtMsg }); context.Response.Write(json); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string type = context.Request.QueryString["type"]; string start = context.Request.QueryString["start"]; string end = context.Request.QueryString["end"] + "-01"; end = DateTime.Parse(end).AddMonths(1).ToString("yyyy-MM-dd"); string where = "and ywlx='" + type + "' and ywrq>='" + start + "-01' and ywrq<'" + end + "'"; string cmdText = $@" select top 5 * from V_ERescue_Sate WHERE 1=1 " + where; DataTable dtMsg = null; try { dtMsg = SysDatabase.ExecuteTable(cmdText); } catch (Exception ex) { context.Response.Write(cmdText); context.Response.Write(ex.Message + ex.Source + ex.StackTrace); context.Response.End(); return; } string json = JsonConvert.SerializeObject(new { code = 0, msg = "", total = dtMsg.Rows.Count, rows = dtMsg }); context.Response.Write(json); context.Response.End(); }
/// <summary> /// 开辟新线程备份数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e) { //格式化备份,(删除以前的备份) if (this.chkDeleteBefor.Checked) { //备份数据成功。 if (SysDatabase.Backup(GetBakUpPath() + @"\DataBackup\DesktopApp.bak", true)) { this.picLoading.Visible = false; lvwBackup.Items.Clear(); this.BindeListVeiw(); } else//备份数据失败。 { untCommon.InfoMsg("备份数据失败。"); } } //普通备份 else { //备份数据成功。 if (SysDatabase.Backup(GetBakUpPath() + @"\DataBackup\DesktopApp.bak", false)) { this.picLoading.Visible = false; lvwBackup.Items.Clear(); this.BindeListVeiw(); } else { this.picLoading.Visible = false; untCommon.InfoMsg("备份数据失败。"); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string cmdText = $@"select _AutoID,ItemCode,ItemName from T_E_Sys_DictEntry where DictID='9cd72492-c34c-4288-bc44-e6ca5007ee47' and _IsDel=0 order by ItemOrder"; DataTable dtMsg = null; try { dtMsg = SysDatabase.ExecuteTable(cmdText); } catch (Exception ex) { context.Response.Write(cmdText); context.Response.Write(ex.Message + ex.Source + ex.StackTrace); context.Response.End(); return; } string json = JsonConvert.SerializeObject(new { code = 0, msg = "", total = dtMsg.Rows.Count, rows = dtMsg }); context.Response.Write(json); context.Response.End(); }
public void BindeListVeiw() { DataTable dt = SysDatabase.GetBackupLog(GetBakUpPath() + @"\DataBackup\DesktopApp.bak"); if (dt != null) { for (int i = 0; i < dt.Rows.Count; i++) { lvwBackup.Items.Add(dt.Rows[i][5].ToString(), dt.Rows[i][18].ToString(), 0); lvwBackup.Items[i].ToolTipText = "还原到" + dt.Rows[i][18].ToString() + "的数据"; lvwBackup.Items[i].Tag = dt.Rows[i][5].ToString(); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string type = context.Request.QueryString["type"]; string where = ""; switch (type) { case "0": where = "and d.BizType='救济难' "; break; case "1": where = "and d.BizType='临时救助' "; break; case "2": where = "and d.BizType='转办' "; break; case "3": where = "and d.BizType='转介' "; break; default: break; } string cmdText = $@" select _AutoID,Title,IssueTime,IssueDept from T_OA_Note where _isdel=0 and NewsState='是'"; DataTable dtMsg = null; try { dtMsg = SysDatabase.ExecuteTable(cmdText); } catch (Exception ex) { context.Response.Write(cmdText); context.Response.Write(ex.Message + ex.Source + ex.StackTrace); context.Response.End(); return; } string json = JsonConvert.SerializeObject(new { code = 0, msg = "", count = dtMsg.Rows.Count, data = dtMsg }); context.Response.Write(json); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string type = context.Request.QueryString["type"]; string rootwbs = "0"; string cmdText = $@" select T_E_Org_Department._AutoID,DeptWBS,DeptPWBS,DeptName ,DeptCode ,DeptAbbr,TypeID,TypeName from T_E_Org_Department left join T_E_Org_DeptType on TypeCode=TypeID where T_E_Org_Department._IsDel=0 and T_E_Org_Department.DeptState ='正常' order by T_E_Org_Department.DeptWBS,T_E_Org_Department.OrderID"; DataTable dtMsg = null; List <dwtree> list = new List <dwtree>(); List <dwtree> resultList = new List <dwtree>(); try { dtMsg = SysDatabase.ExecuteTable(cmdText); foreach (DataRow item in dtMsg.Rows) { list.Add(new dwtree { autoid = item["_AutoID"] as string, id = item["DeptWBS"] as string, DeptWBS = item["DeptWBS"] as string, parentid = item["DeptPWBS"] as string, typeid = item["TypeID"] as string, typename = item["TypeName"] as string, DeptAbbr = item["DeptAbbr"] as string, DeptCode = item["DeptCode"] as string, name = item["DeptName"] as string }); } var root = list.Find(p => p.id == rootwbs); root.path = root.id; loadChild(root, list); resultList.Add(root); } catch (Exception ex) { context.Response.Write(cmdText); context.Response.Write(ex.Message + ex.Source + ex.StackTrace); context.Response.End(); return; } string json = JsonConvert.SerializeObject(new { code = 0, msg = "", data = resultList }); context.Response.Write(json); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string type = context.Session["DeptWbs"] as string; string CompanyId = context.Session["CompanyId"] as string; string sql = $@"select distinct CompanyId,OrgLBBH,OrgLBMC,LXBH,LXMC,JBBH,JBMC from T_E_Org_Department left join T_R_TransOrgRelex on OrgLBBH = TypeID left join T_R_TransOrgRelex_LX on T_R_TransOrgRelex._AutoID = T_R_TransOrgRelex_LX._MainID where T_E_Org_Department.CompanyId = '{CompanyId}' "; DataTable dtMsg = SysDatabase.ExecuteTable(sql); string json = JsonConvert.SerializeObject(new { code = 0, msg = "", DeptWbs = type, count = dtMsg.Rows.Count, data = dtMsg }); context.Response.Write(json); context.Response.End(); }
/// <summary> /// 开辟新线程还原数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) { if (lvwBackup.SelectedItems.Count == 0) { untCommon.InfoMsg("请选择恢复到数据的备份日期"); return; } string filename = GetBakUpPath() + @"\DataBackup\DesktopApp.bak"; int file = int.Parse(this.lvwBackup.SelectedItems[0].Tag.ToString()); if (SysDatabase.RestoeData(filename, file)) { this.picLoading.Visible = false; untCommon.InfoMsg("恢复数据成功。系统将自动注销,请重新登录"); Application.Restart(); } else { this.picLoading.Visible = false; untCommon.InfoMsg("恢复数据失败。"); } }
private void readContentᜀ() { string text = "select * from " + appName + " where _Autoid='" + newsId + "'"; DataTable dataTable = SysDatabase.ExecuteTable(text); if (dataTable.Rows.Count > 0) { DataRow dataRow4 = dataTable.Rows[0]; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendFormat("{0}<span>发布人:{1} 发布日期:{2:yyyy-MM-dd HH:mm} 阅读次数:{3} 次</span>", dataRow4["Title"], dataRow4["Creator"], dataRow4["IssueTime"], dataRow4["ReadCount"]); newstitle = stringBuilder.ToString(); newscontent = dataTable.Rows[0]["Content"].ToString(); FileService val = new FileService(); string attachid = dataTable.Rows[0]["attachId"] as string; IList <AppFile> files = val.GetFiles(appName, attachid); stringBuilder = new StringBuilder(); stringBuilder.Append("<ul style='list-style-type:disc'>"); foreach (var current in files) { stringBuilder.AppendFormat("<li style='list-style-type:disc'><a href='../../SysFolder/Common/FileDown.aspx?fileId={0}' target='_blank'>{1}</a>({2})</li>", current._AutoID, current.FactFileName, Utility.GetFriendlySize((long)current.FileSize)); } stringBuilder.Append("</ul>"); fjlist = stringBuilder.ToString(); text = "select * from T_OA_Comment where AppID='" + newsId + "' order by AddTime"; DataTable dataTable2 = SysDatabase.ExecuteTable(text); stringBuilder = new StringBuilder(); int i = 1; foreach (DataRow dataRow3 in dataTable2.Rows) { stringBuilder.AppendFormat("<div class=\"c_list\"><span class=\"c_writer\">评论人:{0}</span><span class=\"c_time\">{3}楼 {1}</span><p>{2}</p></div>", dataRow3["EmployeeName"], dataRow3["AddTime"], dataRow3["Content"], i++); } commentlist = stringBuilder.ToString(); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string where = ""; var pageNumStr = context.Request.Params["page"]; var pageSizeStr = context.Request.Params["rows"]; var pageNum = 1; var pageSize = 20; if (!string.IsNullOrWhiteSpace(pageNumStr)) { pageNum = int.Parse(pageNumStr); } if (!string.IsNullOrWhiteSpace(pageSizeStr)) { pageSize = int.Parse(pageSizeStr); } DataTable dtMsg = null; DataSet ds = null; string para = ""; int totalCount = 0; try { SqlCommand sqlCommand = new SqlCommand { CommandType = CommandType.StoredProcedure, CommandText = "GSIDPPUB_PAGETOPKEYPROC", }; sqlCommand.Parameters.Add(new SqlParameter("PK", "_AutoID")); sqlCommand.Parameters.Add(new SqlParameter("ordfld", "IssueTime desc")); sqlCommand.Parameters.Add(new SqlParameter("selfld", "")); sqlCommand.Parameters.Add(new SqlParameter("table", "T_OA_News")); sqlCommand.Parameters.Add(new SqlParameter("wherestr", "where 1=1 " + where)); sqlCommand.Parameters.Add(new SqlParameter("pageSize", pageSize)); sqlCommand.Parameters.Add(new SqlParameter("pageIndex", pageNum)); para += "where 1=1 " + where; para += ";pageSize" + pageSize; para += ";pageIndex" + pageNum; SqlParameter returnpara = new SqlParameter() { Direction = ParameterDirection.ReturnValue, }; ds = SysDatabase.ExecuteDataSet(sqlCommand); dtMsg = ds.Tables[0]; para += ";tablecount:" + ds.Tables.Count; totalCount = Convert.ToInt32(ds.Tables[1].Rows[0][0]); } catch (Exception ex) { context.Response.Write(ex.Message + ex.Source + ex.StackTrace); context.Response.End(); return; } string json = JsonConvert.SerializeObject(new { code = 0, msg = para, total = totalCount, rows = dtMsg }); context.Response.Write(json); context.Response.End(); }
/// <summary> /// 保存后事件 /// </summary> /// <param name="tblName">表名</param> /// <param name="mainRow">主表数据</param> /// <param name="flag">1为新建,2为修改</param> /// <param name="tran"></param> /// <returns></returns> public string JJNAfterSave(string tablName, DataRow mainRow, int flag, DbTransaction tran) { string result = string.Empty; string sql = string.Empty; DataTable dtMx = null; try { string jtid = mainRow["FamilyID"] as string; //家庭ID string ZBID = mainRow["_AutoID"] as string; //主表ID if (!string.IsNullOrWhiteSpace(jtid)) { //在此处处理业务逻辑 //1.获取家庭成员信息 sql = $"select * from T_R_ERescue_JTMX where _MainID='{ZBID}'"; dtMx = SysDatabase.ExecuteTable(sql, tran); //先删T_R_FamilyInfo_JZMX sql = $"delete T_R_FamilyInfo_JZMX where _MainID='{jtid}'"; SysDatabase.ExecuteNonQuery(sql, tran); //删T_R_FamilyInfo_JTMX sql = $"delete T_R_FamilyInfo_JTMX where _MainID='{jtid}'"; SysDatabase.ExecuteNonQuery(sql, tran); //删T_R_FamilyInfo sql = $"delete T_R_FamilyInfo where _AutoID='{jtid}'"; SysDatabase.ExecuteNonQuery(sql, tran); //插入T_R_FamilyInfo sql = $@"INSERT INTO T_R_FamilyInfo ([_AutoID] ,[_UserName] ,[_OrgCode] ,[_CreateTime] ,[_UpdateTime] ,[_IsDel] ,[_CompanyID] ,[_WFState] ,[_GDState] ,[_WFCurNode] ,[_WFCurUser] ,[OperatorID] ,[Operator] ,[AreaID] ,[AreaName] ,[CorpID] ,[CorpName] ,[DeptID] ,[DeptName] ,[PosID] ,[PosName] ,[CreateDate] ,[ApplyDate] ,[Street] ,[SheetNo] ,[ApplyMan] ,[Sex] ,[CardID] ,[JTLX] ,[Tel] ,[RescueCode] ,[Addr] ,[PAddr] ,[Income] ,[AccountName] ,[BankName] ,[AccountNo] ,[Cause] ,[JE] ,[JEDX] ,[FileId] ,[CommunityID] ,[Nation] ,[Apanage] ,[IDType] ,[PostCode] ,[CSRQ] ,[StreetID] ,[ModiDate] ,[Modifier] ,[Community])values('{jtid}','{HttpContext.Current.Session["EmployeeName"]}','{HttpContext.Current.Session["CompanyCode"]}',getdate(),getdate(),0,'{HttpContext.Current.Session["CompanyId"]}','未发起',null, '','','{HttpContext.Current.Session["EmployeeId"]}','{HttpContext.Current.Session["EmployeeName"]}','{mainRow["AreaID"]}','{mainRow["AreaName"]}','{mainRow["CorpID"]}','{mainRow["CorpName"]}','{mainRow["DeptID"]}','{mainRow["DeptName"]}', '{mainRow["PosID"]}','{mainRow["PosName"]}',getdate(),getdate(),'{mainRow["Street"]}','{mainRow["SheetNo"]}','{mainRow["ApplyMan"]}','{mainRow["Sex"]}','{mainRow["CardID"]}' ,'{mainRow["JTLX"]}','{mainRow["Tel"]}','{mainRow["RescueCode"]}','{mainRow["Addr"]}','{mainRow["PAddr"]}','{mainRow["Income"]}','{mainRow["AccountName"]}','{mainRow["BankName"]}','{mainRow["AccountNo"]}' ,'{mainRow["Cause"]}','{mainRow["JE"]}','{mainRow["JEDX"]}','{mainRow["FileId"]}','{mainRow["CommunityID"]}','{mainRow["Nation"]}','{mainRow["Apanage"]}' ,'{mainRow["IDType"]}','{mainRow["PostCode"]}','{mainRow["CSRQ"]}','{mainRow["StreetID"]}',getdate(),'{HttpContext.Current.Session["EmployeeName"]}','{mainRow["Community"]}' )"; SysDatabase.ExecuteNonQuery(sql, tran); //插入T_R_FamilyInfo_JTMX sql = $@"INSERT INTO [T_R_FamilyInfo_JTMX] ([_AutoID] ,[_UserName] ,[_OrgCode] ,[_CreateTime] ,[_UpdateTime] ,[_IsDel] ,[_MainID] ,[_MainTbl] ,[_RowNo] ,[Name] ,[Relation] ,[CardID] ,[Income] ,[Memo]) select [_AutoID] ,[_UserName] ,[_OrgCode] ,[_CreateTime] ,[_UpdateTime] ,[_IsDel] ,'{jtid}' ,'T_R_FamilyInfo' ,[_RowNo] ,[Name] ,[Relation] ,[CardID] ,[Income] ,[Memo] from T_R_ERescue_JTMX where _MainID='{ZBID}'"; SysDatabase.ExecuteNonQuery(sql, tran); //插入T_R_FamilyInfo_JZMX sql = $@"INSERT INTO [T_R_FamilyInfo_JZMX] ([_AutoID] ,[_UserName] ,[_OrgCode] ,[_CreateTime] ,[_UpdateTime] ,[_IsDel] ,[_MainID] ,[_MainTbl] ,[_RowNo] ,[ApplyDate] ,[SQLB] ,[KNLB] ,[KNLX] ,[SheetNo] ,[JE] ,[PayDate] ,[SQID] ,[SQState]) SELECT newid() ,[_UserName] ,[_OrgCode] ,[_CreateTime] ,[_UpdateTime] ,[_IsDel] ,'{jtid}' ,'T_R_FamilyInfo' ,1 ,[ApplyDate] ,[SQLB] ,[KNLB] ,[KNLX] ,[SheetNo] ,[JE] ,[_AutoID] ,PayDate ,[_WFState] FROM [T_R_ERescue] where _AutoID='{ZBID}'"; SysDatabase.ExecuteNonQuery(sql, tran); } } catch (Exception error) { fileLogger.Error(error); throw new Exception(error.Message + error.Source + error.StackTrace); } return(result); }