protected void Page_Load(object sender, EventArgs e) { //sCorpID = ConfigurationManager.AppSettings["wx_CorpID"].ToString(); //wx_checkurl = ConfigurationManager.AppSettings["wx_checkurl"].ToString(); denglu_title.InnerHtml = ConfigurationManager.AppSettings["SYSname"]; if (Request["u"] != null && Request["u"].ToString() != "") { homeurl = StringOP.uncMe(Request["u"].ToString(), "mima"); } //处理退出 if (Request["f"] != null && Request["f"].ToString() == "exit") { Session.RemoveAll(); } //特殊的无权登录提示 if (Request["meiyouquanxian"] != null && Request["meiyouquanxian"].ToString() == "yes") { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "keys", "alert('此账号无权登录后台内部管理!');", true); } if (Request.Cookies["user_Uloginname_onlyforinput"] != null) { inputzhanghao = Server.UrlDecode(Request.Cookies["user_Uloginname_onlyforinput"].Value); //输入框记忆 } }
protected void Page_Load(object sender, EventArgs e) { //表单识别号 string FID = "160805000002"; #region 必备的配置代码 //获取表单配置 dsFPZ = CallIPCPB.Get_FormInfoDB(FID); htPP = FUPpublic.initPP(Request, dsFPZ); //给控件传值 wuc_content._dsFPZ = dsFPZ; wuc_content._htPP = htPP; wuc_script._dsFPZ = dsFPZ; wuc_script._htPP = htPP; #endregion if (this.Page.Request["cscscs"] != null) { cscscs = StringOP.uncMe(Request["cscscs"].ToString(), "mima"); } else { cscscs = "a=1"; } }
/// <summary> /// 增加数据 /// </summary> /// <param name="parameter_forUI">前台表单传来的参数</param> /// <returns></returns> public DataSet NRS_ADD(DataTable parameter_forUI) { //接收转换参数 Hashtable ht_forUI = new Hashtable(); for (int i = 0; i < parameter_forUI.Rows.Count; i++) { ht_forUI[parameter_forUI.Rows[i]["参数名"].ToString()] = parameter_forUI.Rows[i]["参数值"].ToString(); } //初始化返回值 DataSet dsreturn = initReturnDataSet().Clone(); dsreturn.Tables["返回值单条"].Rows.Add(new string[] { "err", "初始化" }); //参数合法性各种验证,这里要根据具体业务逻辑处理 //开始真正的处理,根据业务逻辑操作数据库 I_Dblink I_DBL = (new DBFactory()).DbLinkSqlMain(""); Hashtable return_ht = new Hashtable(); ArrayList alsql = new ArrayList(); Hashtable param = new Hashtable(); //以可排序guid方式生成 string guid = CombGuid.GetMewIdFormSequence("ZZZ_gonggao"); param.Add("@GID", guid); param.Add("@Gtitle", ht_forUI["Gtitle"].ToString()); string htmlstr = ht_forUI["Gneirong_html"].ToString(); htmlstr = StringOP.uncMe(htmlstr, "mima"); param.Add("@Gneirong", htmlstr); param.Add("@Glaiyuan", ht_forUI["Glaiyuan"].ToString()); param.Add("@Gzt", ht_forUI["Gzt"].ToString()); param.Add("@Gaddren", ht_forUI["yhbsp_session_uer_UAid"].ToString()); alsql.Add("INSERT INTO ZZZ_gonggao(GID, Gtitle, Gneirong, Glaiyuan, Gaddren, Gzt) VALUES(@GID, @Gtitle, @Gneirong, @Glaiyuan, @Gaddren, @Gzt)"); if (ht_forUI["Gzt"].ToString() == "显示") { alsql.Add("INSERT INTO auth_znx(touser, msgtitle, msurl) select UAid as touser, '有新的公告发布' as msgtitle, '/adminht/corepage/bas/list_ss_gonggao.aspx' as msurl from ZZZ_userinfo where zhuangtai='在职' "); } return_ht = I_DBL.RunParam_SQL(alsql, param); if ((bool)(return_ht["return_float"])) { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "ok"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "保存成功!{" + guid + "}"; } else { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "err"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "系统故障,保存失败:" + return_ht["return_errmsg"].ToString(); } return(dsreturn); }
/// <summary> /// 编辑数据前获取数据 /// </summary> /// <param name="parameter_forUI">前台表单传来的参数</param> /// <returns></returns> public DataSet NRS_EDIT_INFO(DataTable parameter_forUI) { //接收转换参数 Hashtable ht_forUI = new Hashtable(); for (int i = 0; i < parameter_forUI.Rows.Count; i++) { ht_forUI[parameter_forUI.Rows[i]["参数名"].ToString()] = parameter_forUI.Rows[i]["参数值"].ToString(); } //初始化返回值 DataSet dsreturn = initReturnDataSet().Clone(); dsreturn.Tables["返回值单条"].Rows.Add(new string[] { "err", "初始化" }); //参数合法性各种验证,这里省略 //开始真正的处理,这里只是演示,所以直接在这里写业务逻辑代码了 I_Dblink I_DBL = (new DBFactory()).DbLinkSqlMain(""); Hashtable return_ht = new Hashtable(); Hashtable param = new Hashtable(); param.Add("@UAid", ht_forUI["idforedit"].ToString()); return_ht = I_DBL.RunParam_SQL("select top 1 *, sheng as yhb_city_Promary_shengshiqu, shi as yhb_city_City_shengshiqu, qu as yhb_city_Qu_shengshiqu from view_ZZZ_userinfo_ex where UAid=@UAid", "数据记录", param); if ((bool)(return_ht["return_float"])) { DataTable redb = ((DataSet)return_ht["return_ds"]).Tables["数据记录"].Copy(); if (redb.Rows.Count < 1) { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "err"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "没有找到指定数据!"; return(dsreturn); } redb.Rows[0]["Uloginpassword"] = StringOP.uncMe(redb.Rows[0]["Uloginpassword"].ToString(), "mima"); dsreturn.Tables.Add(redb); dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "ok"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = ""; } else { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "err"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "意外错误,获取失败:" + return_ht["return_errmsg"].ToString(); } return(dsreturn); }
public static DataTable ToDataTable(this string json) { json = StringOP.uncMe(json, "mima"); DataTable dataTable = new DataTable("接收的子表数据"); //实例化 DataTable result; JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); javaScriptSerializer.MaxJsonLength = Int32.MaxValue; //取得最大数值 ArrayList arrayList = javaScriptSerializer.Deserialize <ArrayList>(json); if (arrayList.Count > 0) { foreach (Dictionary <string, object> dictionary in arrayList) { if (dictionary.Keys.Count <string>() == 0) { result = dataTable; return(result); } if (dataTable.Columns.Count == 0) { foreach (string current in dictionary.Keys) { dataTable.Columns.Add(current, dictionary[current].GetType()); } } DataRow dataRow = dataTable.NewRow(); foreach (string current in dictionary.Keys) { dataRow[current] = dictionary[current]; } dataTable.Rows.Add(dataRow); //循环添加行到DataTable中 } } result = dataTable; return(result); }
/// <summary> /// 增加数据 /// </summary> /// <param name="parameter_forUI">前台表单传来的参数</param> /// <returns></returns> public DataSet NRS_ADD(DataTable parameter_forUI) { //接收转换参数 Hashtable ht_forUI = new Hashtable(); for (int i = 0; i < parameter_forUI.Rows.Count; i++) { ht_forUI[parameter_forUI.Rows[i]["参数名"].ToString()] = parameter_forUI.Rows[i]["参数值"].ToString(); } //初始化返回值 DataSet dsreturn = initReturnDataSet().Clone(); dsreturn.Tables["返回值单条"].Rows.Add(new string[] { "err", "初始化" }); //参数合法性各种验证,这里要根据具体业务逻辑处理 //开始真正的处理,根据业务逻辑操作数据库 I_Dblink I_DBL = (new DBFactory()).DbLinkSqlMain(""); Hashtable return_ht = new Hashtable(); ArrayList alsql = new ArrayList(); Hashtable param = new Hashtable(); //以可排序guid方式生成 //string guid = CombGuid.GetNewCombGuid("D"); //以两位年+两位月+两位日+6位序列顺序号方式生成 string guid = CombGuid.GetMewIdFormSequence("FUP_FormsDemoDB"); param.Add("@id", guid); param.Add("@fieldtest", ht_forUI["fieldtest"].ToString()); //取图片比较特殊需要判断 if (ht_forUI.Contains("allpath_file1")) { param.Add("@tupiantest", ht_forUI["allpath_file1"].ToString()); } else { param.Add("@tupiantest", ""); } //取下拉框和单选框和多选框也比较特殊,需要判断 if (ht_forUI.Contains("xingbie")) { param.Add("@xingbie", ht_forUI["xingbie"].ToString()); } else { param.Add("@xingbie", ""); } //取编辑器比较特殊 if (ht_forUI.Contains("bianjiqi_html")) { string jjneirong = StringOP.uncMe(ht_forUI["bianjiqi_html"].ToString().Trim(), "mima"); string jjneirong_onlytext = StringOP.uncMe(ht_forUI["bianjiqi_text"].ToString().Trim(), "mima"); param.Add("@bianjiqi", jjneirong); } else { param.Add("@bianjiqi", ""); } //日期段会根据id自动增加1和2 //取当前登录账号的uaid param.Add("@beizhu", ht_forUI["yhbsp_session_uer_UAid"].ToString()); alsql.Add("INSERT INTO FUP_FormsDemoDB(id ,fieldtest,tupiantest) VALUES(@id ,@fieldtest,@tupiantest )"); //遍历子表, 插入 string zibiao_gts_id = "grid-table-subtable-sys_ddmo_0002"; DataTable subdt = jsontodatatable.ToDataTable(ht_forUI[zibiao_gts_id].ToString()); //必须验证js脚本获取的数量和c#反序列化获取的数量一致才能继续。防止出错 if (ht_forUI[zibiao_gts_id + "_fcjsq"].ToString() != subdt.Rows.Count.ToString()) { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "err"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "子表数据量与获取量不相符,系统出现问题。"; return(dsreturn); } param.Add("@sub_" + "MainID", guid); //隶属主表id for (int i = 0; i < subdt.Rows.Count; i++) { param.Add("@sub_" + "id" + "_" + i, CombGuid.GetMewIdFormSequence("demouser_sub_test")); param.Add("@sub_" + "Sname" + "_" + i, subdt.Rows[i]["姓名"].ToString()); param.Add("@sub_" + "Scity" + "_" + i, subdt.Rows[i]["城市"].ToString()); param.Add("@sub_" + "Sint" + "_" + i, subdt.Rows[i]["整数"].ToString()); param.Add("@sub_" + "Sdecimal" + "_" + i, subdt.Rows[i]["小数"].ToString()); param.Add("@sub_" + "CreateTime" + "_" + i, subdt.Rows[i]["添加日期"].ToString()); string INSERTsql = "INSERT INTO demouser_sub_test ( id, SID, Sname, Scity, Sint, Sdecimal,CreateTime ) VALUES(@sub_" + "id" + "_" + i + ", @sub_MainID, @sub_" + "Sname" + "_" + i + ", @sub_" + "Scity" + "_" + i + ", @sub_" + "Sint" + "_" + i + ", @sub_" + "Sdecimal" + "_" + i + ", @sub_" + "CreateTime" + "_" + i + " )"; alsql.Add(INSERTsql); } return_ht = I_DBL.RunParam_SQL(alsql, param); if ((bool)(return_ht["return_float"])) { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "ok"; //dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "新增成功!"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "新增成功!{" + guid + "}"; } else { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "err"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "系统故障,保存失败:" + return_ht["return_errmsg"].ToString(); } return(dsreturn); }
/// <summary> /// 编辑数据 /// </summary> /// <param name="parameter_forUI">前台表单传来的参数</param> /// <returns></returns> public DataSet NRS_EDIT(DataTable parameter_forUI) { //接收转换参数 Hashtable ht_forUI = new Hashtable(); for (int i = 0; i < parameter_forUI.Rows.Count; i++) { ht_forUI[parameter_forUI.Rows[i]["参数名"].ToString()] = parameter_forUI.Rows[i]["参数值"].ToString(); } //初始化返回值 DataSet dsreturn = initReturnDataSet().Clone(); dsreturn.Tables["返回值单条"].Rows.Add(new string[] { "err", "初始化" }); //参数合法性各种验证,这里省略 if (ht_forUI["idforedit"].ToString().Trim() == "") { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "err"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "没有明确的修改目标!"; return(dsreturn); } //开始真正的处理,这里只是演示,所以直接在这里写业务逻辑代码了 // id, fieldtest, mima, xialakuang, xingbie, quanxian, xialakuangduoxuan, zhengshushuliang, erweixiao, yigeriqi, riqiqujian1, riqiqujian2, beizhu, bianjiqi, yhb_city_Promary_diquxian, yhb_city_City_diquxian, yhb_city_Qu_diquxian, sheng, shi, qu, zhanghao, tupiantest, dizhi, xingming I_Dblink I_DBL = (new DBFactory()).DbLinkSqlMain(""); Hashtable return_ht = new Hashtable(); ArrayList alsql = new ArrayList(); Hashtable param = new Hashtable(); param.Add("@id", ht_forUI["idforedit"].ToString()); param.Add("@fieldtest", ht_forUI["fieldtest"].ToString()); //取图片比较特殊需要判断 if (ht_forUI.Contains("allpath_file1")) { param.Add("@tupiantest", ht_forUI["allpath_file1"].ToString()); } else { param.Add("@tupiantest", ""); } //取下拉框和单选框和多选框也比较特殊,需要判断 if (ht_forUI.Contains("xingbie")) { param.Add("@xingbie", ht_forUI["xingbie"].ToString()); } else { param.Add("@xingbie", ""); } //取编辑器比较特殊 if (ht_forUI.Contains("bianjiqi_html")) { string jjneirong = StringOP.uncMe(ht_forUI["bianjiqi_html"].ToString().Trim(), "mima"); string jjneirong_onlytext = StringOP.uncMe(ht_forUI["bianjiqi_text"].ToString().Trim(), "mima"); param.Add("@bianjiqi", jjneirong); } else { param.Add("@bianjiqi", ""); } //日期段会根据id自动增加1和2 //取当前登录账号的uaid param.Add("@beizhu", ht_forUI["yhbsp_session_uer_UAid"].ToString()); alsql.Add("UPDATE FUP_FormsDemoDB SET fieldtest = @fieldtest,tupiantest=@tupiantest where id=@id "); //遍历子表,先删除,再插入,已有主键的不重新生成。 string zibiao_gts_id = "grid-table-subtable-sys_ddmo_0002"; DataTable subdt = jsontodatatable.ToDataTable(ht_forUI[zibiao_gts_id].ToString()); //必须验证js脚本获取的数量和c#反序列化获取的数量一致才能继续。防止出错 if (ht_forUI[zibiao_gts_id + "_fcjsq"].ToString() != subdt.Rows.Count.ToString()) { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "err"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "子表数据量与获取量不相符,系统出现问题。"; return(dsreturn); } param.Add("@sub_" + "MainID", ht_forUI["idforedit"].ToString()); //隶属主表id alsql.Add("delete demouser_sub_test where SID = @sub_" + "MainID"); for (int i = 0; i < subdt.Rows.Count; i++) { if (subdt.Rows[i]["隐藏编号"].ToString().Trim() == "") { param.Add("@sub_" + "id" + "_" + i, CombGuid.GetMewIdFormSequence("demouser_sub_test")); } else { param.Add("@sub_" + "id" + "_" + i, subdt.Rows[i]["隐藏编号"].ToString()); } param.Add("@sub_" + "Sname" + "_" + i, subdt.Rows[i]["姓名"].ToString()); param.Add("@sub_" + "Scity" + "_" + i, subdt.Rows[i]["城市"].ToString()); param.Add("@sub_" + "Sint" + "_" + i, subdt.Rows[i]["整数"].ToString()); param.Add("@sub_" + "Sdecimal" + "_" + i, subdt.Rows[i]["小数"].ToString()); param.Add("@sub_" + "CreateTime" + "_" + i, subdt.Rows[i]["添加日期"].ToString()); string INSERTsql = "INSERT INTO demouser_sub_test ( id, SID, Sname, Scity, Sint, Sdecimal,CreateTime ) VALUES(@sub_" + "id" + "_" + i + ", @sub_MainID, @sub_" + "Sname" + "_" + i + ", @sub_" + "Scity" + "_" + i + ", @sub_" + "Sint" + "_" + i + ", @sub_" + "Sdecimal" + "_" + i + ", @sub_" + "CreateTime" + "_" + i + " )"; alsql.Add(INSERTsql); } return_ht = I_DBL.RunParam_SQL(alsql, param); if ((bool)(return_ht["return_float"])) { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "ok"; //dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "修改成功!"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "修改成功!{" + ht_forUI["idforedit"].ToString() + "}"; } else { //其实要记录日志,而不是输出,这里只是演示 //dsreturn.Tables.Add(parameter_forUI.Copy()); dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "err"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "系统故障,修改失败:" + return_ht["return_errmsg"].ToString(); } return(dsreturn); }
/// <summary> /// 编辑数据 /// </summary> /// <param name="parameter_forUI">前台表单传来的参数</param> /// <returns></returns> public DataSet NRS_EDIT(DataTable parameter_forUI) { //接收转换参数 Hashtable ht_forUI = new Hashtable(); for (int i = 0; i < parameter_forUI.Rows.Count; i++) { ht_forUI[parameter_forUI.Rows[i]["参数名"].ToString()] = parameter_forUI.Rows[i]["参数值"].ToString(); } //初始化返回值 DataSet dsreturn = initReturnDataSet().Clone(); dsreturn.Tables["返回值单条"].Rows.Add(new string[] { "err", "初始化" }); //参数合法性各种验证,这里省略 if (ht_forUI["idforedit"].ToString().Trim() == "") { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "err"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "没有明确的修改目标!"; return(dsreturn); } //开始真正的处理,这里只是演示,所以直接在这里写业务逻辑代码了 I_Dblink I_DBL = (new DBFactory()).DbLinkSqlMain(""); Hashtable return_ht = new Hashtable(); ArrayList alsql = new ArrayList(); Hashtable param = new Hashtable(); param.Add("@GID", ht_forUI["idforedit"].ToString()); param.Add("@Gtitle", ht_forUI["Gtitle"].ToString()); string htmlstr = ht_forUI["Gneirong_html"].ToString(); htmlstr = StringOP.uncMe(htmlstr, "mima"); param.Add("@Gneirong", htmlstr); param.Add("@Glaiyuan", ht_forUI["Glaiyuan"].ToString()); param.Add("@Gzt", ht_forUI["Gzt"].ToString()); alsql.Add("UPDATE ZZZ_gonggao SET Gtitle=@Gtitle, Gneirong=@Gneirong, Glaiyuan=@Glaiyuan, Gzt=@Gzt where GID =@GID "); return_ht = I_DBL.RunParam_SQL(alsql, param); if ((bool)(return_ht["return_float"])) { dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "ok"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "修改成功!{" + ht_forUI["idforedit"].ToString() + "}"; } else { //其实要记录日志,而不是输出,这里只是演示 //dsreturn.Tables.Add(parameter_forUI.Copy()); dsreturn.Tables["返回值单条"].Rows[0]["执行结果"] = "err"; dsreturn.Tables["返回值单条"].Rows[0]["提示文本"] = "系统故障,修改失败:" + return_ht["return_errmsg"].ToString(); } return(dsreturn); }