protected string WBXMBH = ""; //外包项目编号 protected void Page_Load(object sender, EventArgs e) { WebServices.Services Resource = new WebServices.Services(); UserID = CurrentUser.ID; if (Request["RecID"] != null && Request["RecID"].ToString() != "") { RecID = Request["RecID"].ToString(); DataTable dt = Resource.GetDataListByResID(ResID, "", " and ID=" + RecID, UserID).Tables[0]; if (dt != null && dt.Rows.Count > 0) { LCBH = dt.Rows[0]["流程编号"].ToString(); //流程编号 SQRQ = dt.Rows[0]["申请日期"].ToString(); //申请日期 SQR = dt.Rows[0]["申请人"].ToString(); //申请人 CGJEHJ = dt.Rows[0]["采购金额合计"].ToString(); //采购金额合计 QKSY = dt.Rows[0]["请款事由"].ToString(); //请款事由 QKJE = dt.Rows[0]["请款金额"].ToString(); //请款金额 TD = dt.Rows[0]["退单"].ToString(); //退单 SFYHK = dt.Rows[0]["是否已汇款"].ToString(); //是否已汇款 SFYZWBX = dt.Rows[0]["是否已转为报销"].ToString(); //是否已转为报销 GLBXDBH = dt.Rows[0]["关联报销单编号"].ToString(); //关联报销单编号 BXKMDM = dt.Rows[0]["报销科目代码"].ToString(); //报销科目代码 BXKMMC = dt.Rows[0]["报销科目名称"].ToString(); //报销科目名称 WBXMBH = dt.Rows[0]["外包项目编号"].ToString(); //外包项目编号 } } }
protected void Page_Load(object sender, EventArgs e) { UserID = CurrentUser.ID; UserName = CurrentUser.Name; if (Request["RecID"] != null) { RecID = Request["RecID"].ToString(); } if (Request["keyWordValue"] != null) { keyWordValue = Request["keyWordValue"].ToString(); } if (Request["SearchType"] != null) { SearchType = Request["SearchType"].ToString(); } if (Request["转移联单编号"] != null) { FormNumber = Request["转移联单编号"].ToString(); } WebServices.Services Resource = new WebServices.Services(); DataTable dt = Resource.GetDataListByResID("564794299148", "", "AND 联单编号='" + FormNumber + "'", UserID).Tables[0]; if (dt != null && dt.Rows.Count > 0) { ProduceUnit = dt.Rows[0]["废物产生单位"].ToString(); WasteName = dt.Rows[0]["废物名称"].ToString(); WasteCode = dt.Rows[0]["废物代码"].ToString(); Position = dt.Rows[0]["存放位置"].ToString(); } }
/// <summary> /// 根据资源ID,获取资源配置信息 /// </summary> /// <param name="ResID"></param> /// <returns></returns> public static SysSettings GetSysSettingsByResID(string ResID) { SysSettings Sys = null; WebServices.Services Resource = new WebServices.Services(); // string sql = "select top(1) * from SysSettings where [Value]='" + ResID + "' "; // DataSet ds = Resource.SelectData(sql); UserInfo user = CommonGetInfo.GetUser(); DataSet ds = Resource.GetDataListByResID("437496952875", "", CommonMethod.FilterSql(" and 值='" + ResID + "'"), user.ID); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { Sys = new SysSettings(); Sys.ShowTitle = ds.Tables[0].Rows[0]["显示Title"].ToString(); Sys.ENTableName = ds.Tables[0].Rows[0]["参数关键字"].ToString(); Sys.KeyWordValue = ds.Tables[0].Rows[0]["参数关键字"].ToString(); Sys.ResID = ds.Tables[0].Rows[0]["值"].ToString(); Sys.AlignColStr = ds.Tables[0].Rows[0]["左对齐显示字段"].ToString(); Sys.AddUrl = ds.Tables[0].Rows[0]["添加地址"].ToString(); Sys.EidtUrl = ds.Tables[0].Rows[0]["编辑地址"].ToString(); Sys.AccessoryCol = ds.Tables[0].Rows[0]["附件字段"].ToString(); Sys.FJGLJD = ds.Tables[0].Rows[0]["附件主子表关联字段"].ToString(); Sys.AccessoryResID = ds.Tables[0].Rows[0]["附件ResID"].ToString(); Sys.SettingsNum = ds.Tables[0].Rows[0]["列表配置号"].ToString(); Sys.LBLX = ds.Tables[0].Rows[0]["列表类型"].ToString(); Sys.DialogWidth = ds.Tables[0].Rows[0]["弹出层宽度"].ToString() == "" ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["弹出层宽度"]); Sys.DialogHeight = ds.Tables[0].Rows[0]["弹出层高度"].ToString() == "" ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["弹出层高度"]); Sys.DefaultOrder = ds.Tables[0].Rows[0]["默认排序"].ToString(); Sys.SortBy = ds.Tables[0].Rows[0]["排序类型"].ToString(); Sys.TableName = ds.Tables[0].Rows[0]["数据表名称"].ToString(); Sys.FilterCondtion = ds.Tables[0].Rows[0]["数据筛选条件"].ToString(); DataRow dr = ds.Tables[0].Rows[0]; Sys.IsCheckBox = NetReusables.DbField.GetBool(ref dr, "是否显示复选框"); Sys.IsAdd = NetReusables.DbField.GetBool(ref dr, "启用添加"); Sys.IsUpdate = NetReusables.DbField.GetBool(ref dr, "启用修改"); Sys.IsDelete = NetReusables.DbField.GetBool(ref dr, "启用删除"); Sys.IsExp = NetReusables.DbField.GetBool(ref dr, "启用导出"); Sys.IsStartWidth = NetReusables.DbField.GetBool(ref dr, "启用字段宽度设置"); Sys.IsOrder = NetReusables.DbField.GetBool(ref dr, "是否支持排序"); Sys.IsRowRight = NetReusables.DbField.GetBool(ref dr, "是否启用行过滤"); Sys.URLTarget = ds.Tables[0].Rows[0]["页面打开方式"].ToString(); Sys.FootStr = ds.Tables[0].Rows[0]["统计字段"].ToString(); return(Sys); } else { return(Sys); } } else { return(Sys); } }
/// <summary> /// 获取资源ID /// </summary> /// <param name="KeyWord"></param> /// <returns></returns> public static string GetResIDByENKekWord(string KeyWord) { WebServices.Services Resource = new WebServices.Services(); //string sql = "select [Value] from SysSettings where ENKeyWord='" + KeyWord + "'"; //DataSet ds = Resource.SelectData(sql); UserInfo user = CommonGetInfo.GetUser(); DataSet ds = Resource.GetDataListByResID("437496952875", "", CommonMethod.FilterSql(" and 参数关键字='" + KeyWord + "'"), user.ID); if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { return(ds.Tables[0].Rows[0]["值"].ToString()); } else { return(""); } } else { return(""); } }
protected string QKJE = ""; //请款金额 protected void Page_Load(object sender, EventArgs e) { UserID = CurrentUser.ID; WebServices.Services Resource = new WebServices.Services(); try { if (Request["RecID"] != null && Request["RecID"].ToString() != "") { RecID = Request["RecID"].ToString(); DataTable dt = Resource.GetDataListByResID(ResID, "", " and ID=" + RecID, UserID).Tables[0]; if (dt != null && dt.Rows.Count > 0) { BXDBH = dt.Rows[0]["报销单编号"].ToString(); //报销单编号 RQ = dt.Rows[0]["日期"].ToString(); //日期 BXR = dt.Rows[0]["报销人"].ToString(); //报销人 BXNR = dt.Rows[0]["报销内容"].ToString(); //报销内容 BXSM = dt.Rows[0]["报销说明"].ToString(); //报销说明 BXJE = dt.Rows[0]["报销金额"].ToString(); //报销金额 PZZS = dt.Rows[0]["凭证张数"].ToString(); //凭证张数 BXKMDM = dt.Rows[0]["报销科目代码"].ToString(); //报销科目代码 BXKMMC = dt.Rows[0]["报销科目名称"].ToString(); //报销科目名称 WBXMBH = dt.Rows[0]["外包项目编号"].ToString(); //外包项目编号 BZ = dt.Rows[0]["备注"].ToString(); //备注 SFYHK = dt.Rows[0]["是否已汇款"].ToString(); //是否已汇款 PZSFYDCW = dt.Rows[0]["凭证是否已到财务"].ToString(); //凭证是否已到财务 SFYYQK = dt.Rows[0]["是否已有请款"].ToString(); //是否已有请款 QKBH = dt.Rows[0]["请款编号"].ToString(); //请款编号 QKJE = dt.Rows[0]["请款金额"].ToString(); //请款金额 } } } catch (Exception) { throw; } }
protected void Page_Load(object sender, EventArgs e) { oEmployee = CurrentUser; UserID = oEmployee.ID; UserName = oEmployee.Name; string json = ""; string typeValue = Request["typeValue"]; if (typeValue == "GetField") { string keywordParameters = Request.QueryString["keyWordValue"]; string MenuResID = Request.QueryString["MenuResID"]; bool IsChildResource = Convert.ToBoolean(Convert.ToInt32(Request.QueryString["IsChildResource"])); json = CommonMethod.GetFieldJson(keywordParameters, MenuResID, oEmployee);//获取grid的Field里面的值 } if (typeValue == "GetfieldInfo") { string ColTitle = Request["ColName"]; string ColField = Request["ColField"]; string ColWidth = Request["ColWidth"]; string OperatePageUrl = Request["OperatePageUrl"]; string OperateText = Request["OperateText"]; string OperateFunction = Request["OperateFunction"]; Int32 OperatePageWidth = 1000; if (Request["OperatePageWidth"] != null) { OperatePageWidth = Convert.ToInt32(Request["OperatePageWidth"]); } Int32 OperatePageHeight = 800; if (Request["OperatePageHeight"] != null) { OperatePageHeight = Convert.ToInt32(Request["OperatePageHeight"]); } bool IsOperateButton = true; if (Request["IsOperateButton"] != null) { IsOperateButton = Convert.ToBoolean(Convert.ToInt32(Request["IsOperateButton"])); } json = CommonMethod.Getfield(ColTitle, ColField, ColWidth, OperatePageWidth, OperatePageHeight, IsOperateButton, OperatePageUrl, OperateFunction, OperateText); } if (typeValue == "GetChildField") { string keywordParameters = Request.QueryString["keyWordValue"]; string ParentKeyWord = Request.QueryString["ParentKeyWord"]; string MenuResID = Request.QueryString["MenuResID"]; json = CommonMethod.GetFieldJson_ChildResource(keywordParameters, ParentKeyWord, MenuResID, oEmployee);//获取grid的Field里面的值 } if (typeValue == "GetSysSettings") { string keyWordValue = Request.QueryString["keyWordValue"]; json = Newtonsoft.Json.JsonConvert.SerializeObject(Common.GetSysSettingsByENKey(keyWordValue)); json = "[" + json + "]"; } if (typeValue == "GetData") { string ResID = Request["ResID"].ToString(); string Condition = Request["Condition"].ToString(); json = CommonMethod.GetDataJson(ResID, "ID", Condition, UserID); } if (typeValue == "GetChildDataByParent") { string ParentResID = Request["ParentResID"].ToString(); string ParentRecID = Request["ParentRecID"].ToString(); string ResID = Request["ResID"].ToString(); json = CommonMethod.GetDataJson(ParentResID, ResID, ParentRecID, "ID", UserID); } if (typeValue == "GetDataOfPageByTableName") { string KeyWord = Request["keyWordValue"]; SysSettings sys = Common.GetSysSettingsByENKey(KeyWord); string ResID = Request["ResID"].ToString(); int PageSize = Request["rows"] == null ? 10 : Convert.ToInt32(Request["rows"]); int PageNumber = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]); string SortField = ""; string SortBy = ""; if (Request["sort"] != null) { SortField = Request["sort"].ToString(); } if (Request["order"] != null) { SortBy = Request["order"].ToString(); } string Condition = Request["Condition"]; string TableName = Request["TableName"]; json = CommonMethod.GetDataJsonOfPageByTableName(KeyWord, ResID, PageNumber, PageSize, Condition, UserID); } if (typeValue == "GetDataByTableName") { string KeyWord = Request["keyWordValue"]; SysSettings sys = Common.GetSysSettingsByENKey(KeyWord); string ResID = Request["ResID"].ToString(); string SortField = ""; string SortBy = ""; if (Request["sort"] != null) { SortField = Request["sort"].ToString(); } if (Request["order"] != null) { SortBy = Request["order"].ToString(); } string Condition = Request["Condition"]; string TableName = Request["TableName"]; json = CommonMethod.GetDataJsonByTableName(KeyWord, ResID, Condition, UserID); } if (typeValue == "GetDataOfPage") { string ResID = Request["ResID"].ToString(); if (ResID == "") { json = "{\"total\":0,\"rows\":[]}"; } else { string KeyWord = Request["keyWordValue"]; int PageSize = Request["rows"] == null?10: Convert.ToInt32(Request["rows"]); int PageNumber = Request["page"] == null ? 1 : Convert.ToInt32(Request["page"]); string SortField = ""; string SortBy = ""; string Condition = "";//条件 if (Request["sort"] != null) { SortField = Request["sort"]; } if (Request["order"] != null) { SortBy = Request["order"]; } //关键字查询条件 string where = Request["Condition"] == null ? "" : Request["Condition"]; if (where.Trim() != "") { Condition += CommonMethod.GetResouceCondtion(KeyWord, where.Trim()); } //列表初始化筛选条件 if (Request["Authority"] != null && Request["Authority"] != "") { Condition += CommonMethod.GetFilterCondition(Server.UrlDecode(Request["Authority"]), oEmployee); } if (ResID == "1300") { Condition += " and 登录帐号 not in ('admin','sysuser','security')"; } //高级组合筛选条件 if (Request["FilterRules"] != null && Request["FilterRules"] != "") { Condition += " and " + Request["FilterRules"]; } //主子表关联字段筛选,主子表关联字段只能有一个 if (Request["RelationCondtion"] != null && Request["RelationCondtion"] != "") { string str = Request["RelationCondtion"]; string str1 = Request["RelationCondtion"].Substring(0, Request["RelationCondtion"].IndexOf("=") + 1); string str2 = Request["RelationCondtion"].Substring(Request["RelationCondtion"].IndexOf("=") + 1); //截取出关联字段值,判断是否需要添加引号 if (str2.Trim().Length > 0) { //if (!CommonMethod.IsNum(str2.Trim()))//判断类型 // Condition += " and " + Request["RelationCondtion"]; //else Condition += " and " + str1 + "'" + str2 + "'"; } } string footName = Request["FootStr"]; if (footName != null && footName != "") { json = CommonMethod.GetDataOfPageForFooter(KeyWord, ResID, PageNumber, PageSize, SortField, SortBy, Condition, UserID, footName); } else { json = CommonMethod.GetDataJsonOfPage(KeyWord, ResID, PageNumber, PageSize, SortField, SortBy, Condition, UserID); } } } if (typeValue == "GetDataBySql") { string Condition = Request["Condition"].ToString(); int PageSize = 0; if (Request["rows"] != null) { PageSize = Convert.ToInt32(Request["rows"]); } int PageNumber = 0; if (Request["rows"] != null) { PageNumber = Convert.ToInt32(Request["page"]); } string sqlData = Request["sqlData"].ToString(); string SortField = ""; string SortBy = ""; if (Request["SortField"] != null) { SortField = Request["SortField"].ToString(); } if (Request["SortBy"] != null) { SortBy = Request["SortBy"].ToString(); } string sql = "select * from (" + sqlData + ") as c where 1=1 " + Condition; string OrderBy = "";//order by if (SortField != "" && SortBy != "") { OrderBy = " " + SortField + " " + SortBy; } WebServices.Services services = new WebServices.Services(); DataTable dt = null; string dtCount = "0"; string[] changePassWord = Common.getChangePassWord(); if (PageSize == 0 && PageNumber == 0) { dt = services.Query(sql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0]; } else { dt = GetDataListPage(sql, PageNumber, PageSize, OrderBy).Tables[0]; dtCount = services.Query(sql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0].Rows.Count.ToString(); } Newtonsoft.Json.Converters.IsoDateTimeConverter timeConverter = new Newtonsoft.Json.Converters.IsoDateTimeConverter(); // //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy'-'MM'-'dd"; string str = Newtonsoft.Json.JsonConvert.SerializeObject(dt, timeConverter); json = "{\"total\":" + dtCount + ",\"rows\":" + str + "}"; } //单表单记录查询 if (typeValue == "GetOneRowByRecID") { string RecID = Request["RecID"]; string ResID = Request["ResID"]; json = CommonMethod.GetOneRowByRecID(ResID, RecID); } //单表单记录查询 if (typeValue == "GetOneRowBySql") { Services oServices = new Services(); string strSql = Request["sql"]; string RecID = Request["RecID"]; if (strSql.ToLower().Contains("where")) { strSql += " and ID=" + RecID; } else { strSql += " where ID=" + RecID; } string[] changePassWord = Common.getChangePassWord(); json = Newtonsoft.Json.JsonConvert.SerializeObject(oServices.SelectData(strSql, changePassWord[0], changePassWord[1], changePassWord[2]).Tables[0]); } //删除普通Grid数据 if (typeValue == "DeleteRow") { json = DeleteRow(); } //由于筛选条件和要导出的Excel列字段数据较大,无法通过url传递,因此先通过此方法将其存储在cookes中 if (typeValue.Equals("saveExcelData")) { string s1 = Request["conditionStr"] == null ? "" : Request["conditionStr"]; string where = Request["Condition"] == null ? "" : Request["Condition"]; string KeyWord = Request["KeyWord"] == null ? "" : Request["KeyWord"]; if (where.Trim() != "") { where = CommonMethod.GetResouceCondtion(KeyWord, where.Trim()); s1 += where.Substring(4, where.Length - 4); } //string s2 = Request["columnStr"]; //if (Request["columnStr"] == null || Request["columnStr"] == "") // json = "{\"success\": false,\"key\": \"0\"}"; //else //{ string CookieKey = Guid.NewGuid().ToString(); HttpCookie CookieCdn = new HttpCookie("cdn" + CookieKey); CookieCdn.Value = s1; CookieCdn.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(CookieCdn); HttpCookie CookiecdnCol = new HttpCookie("col" + CookieKey); CookiecdnCol.Value = ""; CookiecdnCol.Expires = DateTime.Now.AddDays(1); Response.Cookies.Add(CookiecdnCol); json = "{\"success\": true,\"key\": \"" + CookieKey + "\"}"; //} } if (typeValue.Equals("Excel")) { if (Request.QueryString["cookeId"] == null) { Response.Write("导出失败,请重新操作!"); Response.End(); } string cookeId = Request.QueryString["cookeId"]; //从Cookies中取出存储的参数 筛选条件、导出字段,然后在销毁Cookies string Condition = Request.Cookies["cdn" + cookeId].Value; string Column = Request.Cookies["col" + cookeId].Value; Request.Cookies["col" + cookeId].Expires = DateTime.Now.AddDays(-1); Request.Cookies["cdn" + cookeId].Expires = DateTime.Now.AddDays(-1); Condition = Condition.Equals("") ? "" : " and " + Condition; //导出筛选条件 Column = Column.Equals("") ? "*" : Column; //导出的列 string fileName = Request.QueryString["ExcelfileName"] == null ? "数据" : Request.QueryString["ExcelfileName"]; //获取资源ID及资源关键字参数 string resid = Request.QueryString["resId"]; string keyWord = Request.QueryString["KeyWord"]; //根据筛选条件及字段列,获取导出数据 WebServices.Services services = new WebServices.Services(); //列表初始化筛选条件 if (Request["Authority"] != null && Request["Authority"] != "") { Condition += CommonMethod.GetFilterCondition(Server.UrlDecode(Request["Authority"]), oEmployee); } DataTable dt = services.GetDataListByResID(resid, "", Condition, UserID).Tables[0]; DataTable newDt = new DataTable(); DataTable colDt = services.GetDataListByResID("502816446274", " 排序号 asc", " and 参数关键字='" + keyWord + "'", UserID).Tables[0]; for (int i = 0; i < colDt.Rows.Count; i++) { newDt.Columns.Add(colDt.Rows[i]["显示字段"].ToString()); } for (int i = 0; i < dt.Rows.Count; i++) { newDt.ImportRow(dt.Rows[i]); } // DataTable dt = services.GetDataColumnListByResID(resid, Column, "ID", Condition, UserID).Tables[0]; Byte[] fileByte = new DoExcel().ExportExcel(newDt, fileName); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Length", fileByte.Length.ToString()); Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fileName + DateTime.Now.ToString("yyyyMMdd") + ".xlsx", System.Text.Encoding.UTF8)); Response.BinaryWrite(fileByte); Response.Flush(); Response.End(); } Response.Write(json); }