//初始化 private void GetInit() { M_CommonData dtinfo = cbll.GetCommonData(sid); DataTable dt = cbll.GetContent(sid); this.Namelabel.Text = dtinfo.Title; this.Label1.Text = dtinfo.Inputer; string tablename = dtinfo.TableName; B_ModelField mfll = new B_ModelField(); SafeSC.CheckDataEx(tablename); DataTable tableinfo = mfll.SelectTableName("ZL_Model", "tablename = '" + tablename + "'"); B_Model mll = new B_Model(); if (tableinfo.Rows.Count > 0) { this.Label6.Text = mbll.GetModelById(DataConverter.CLng(dt.Rows[0]["StoreModelID"].ToString())).ModelName; } else { this.Label6.Text = "查询错误!请核实此模型是否存在"; } //string tophtml = "<tr><td width=\"20%\"></td><td width = \"80%\"></td>"; //string endhtml = "</tr>"; //this.ModelHtml.Text = tophtml + this.mfbll.GetUpdateHtmlUser(int.Parse(dt.Rows[0]["StoreModelID"].ToString()), 0, dt) + endhtml; //this.ModelHtml.Text = this.mfbll.GetUpdateHtmlUser(int.Parse(dt.Rows[0]["StoreModelID"].ToString()), 0, dt); }
/// <summary> /// 移除用户,用法同于AddMember /// </summary> /// <param name="ids">需移除的用户</param> public void DelMember(string ids, int gid, int flag = 0) { SafeSC.CheckDataEx(ids); string uids = "", uids2 = "", set = ""; M_Plat_Group model = SelReturnModel(gid); switch (flag) { case 0: //管理员与成员 uids = function.RemoveRepeat(model.MemberIDS, ids); uids2 = function.RemoveRepeat(model.ManageIDS, ids); set = "MemberIDS= '" + uids + "',ManageIDS='" + uids2 + "'"; break; case 1: uids = function.RemoveRepeat(model.MemberIDS, ids); set = "MemberIDS= '" + uids + "'"; break; case 2: uids = function.RemoveRepeat(model.ManageIDS, ids); set = "ManageIDS= '" + uids + "'"; break; } DBCenter.UpdateSQL(TbName, set, "ID=" + gid); }
public DataTable SelByFieldL(string field, string value) { SafeSC.CheckDataEx(field); string sql = "Select * From " + strTableName + " Where " + field + " Like @value"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("value", "%" + value + "%") }; return(SqlHelper.ExecuteTable(CommandType.Text, sql, sp)); }
public bool RealDelByIDS(string ids, string items) { SafeSC.CheckDataEx(items); SafeSC.CheckIDSEx(ids); DBCenter.DelByIDS(TbName, PK, ids); DBCenter.DelByIDS("ZL_P_Shop", "ID", items); return(true); }
public DataTable GetContent(string tablename, int Itemid) { if (string.IsNullOrEmpty(tablename) || Itemid < 1) { return(null); } SafeSC.CheckDataEx(tablename); return(DBCenter.Sel(tablename, "ID=" + Itemid)); }
public IActionResult Default_Field() { DataTable dt = new DataTable(); if (!string.IsNullOrEmpty(TbName)) { SafeSC.CheckDataEx(TbName); dt = DBHelper.Table_FieldList(TbName); } return(PartialView(dt)); }
public bool UpdateByField(string fieldName, string value, string ids) { SafeSC.CheckDataEx(fieldName); SafeSC.CheckIDSEx(ids); string sql = "Update " + strTableName + " Set " + fieldName + " =@value Where [id] in(" + ids + ")"; SqlParameter[] sp = new SqlParameter[] { new SqlParameter("value", value) }; SqlHelper.ExecuteNonQuery(CommandType.Text, sql, sp); return(true); }
/// <summary> /// 指定组添加成员 /// </summary> /// <param name="flag">1:添加成员,2:添加管理员(需要验证用户权限是否为网络管理员用户s)</param> public void AddMember(string ids, int gid, int flag = 1) { SafeSC.CheckDataEx(ids); string uids = "", uids2 = "", set = ""; M_Plat_Group model = SelReturnModel(gid); uids = CombineIDS(model.MemberIDS, ids); switch (flag) { case 1: set = "MemberIDS= '" + uids + "'"; break; case 2: //添加为管理员的同时也添加为成员 uids2 = CombineIDS(model.ManageIDS, ids); set = "MemberIDS='" + uids + "',ManageIDS='" + uids2 + "'"; break; } DBCenter.UpdateSQL(TbName, set, "ID=" + gid); }
public DataTable Sel(string qid, int uid = -100, int askid = -100, int ansid = -100) { string where = " 1=1 "; if (uid != -100) { where += " AND UserID=" + uid; } if (askid != -100) { where += " AND AskID=" + askid; } if (ansid != -100) { where += " AND AnsID=" + ansid; } if (!string.IsNullOrEmpty(qid)) { SafeSC.CheckDataEx(qid); where += " AND Qid IN (" + qid + ")"; } return(DBCenter.JoinQuery("A.*,B.QType,B.QTitle,B.QOption,B.QFlag,B.Required", TbName, "ZL_Design_Question", "A.Qid=B.ID", where, "A.ID DESC")); }
/// <summary> /// 从数据库中获取数据,并生成Excel,字段填充后台完成,不要开放给前台用户 /// </summary> /// <param name="tbname">数据库表名</param> /// <param name="where">数据库删选条件</param> /// <param name="columnNames">要出的列名,无则使用dt的列名</param> /// <param name="fields">需要导出的字段列表(!--为安全考虑选择性开放--)</param> /// title用地址栏传,其余用Session传,不允许地址栏与Form传值 /// 示例:SafeSC.DownStr(officeHelp.GetExcelByDB("ZL_User", "","用户名,用户ID", "UserName", "UserID"), title); public string GetExcelByDB(string tbname, string where, string fields, string columnNames) { SafeSC.CheckDataEx(tbname); SafeSC.CheckDataEx(fields.Split(',')); foreach (string s in fields.Split(',')) { if (s.Equals("*")) { fields = "*,"; } else { fields += "[" + s + "],"; } } fields = fields.TrimEnd(','); string sql = "Select " + fields + " From " + tbname + where; DataTable dt = SqlHelper.ExecuteTable(CommandType.Text, sql); return(ExportExcel(dt, columnNames)); }
public ActionResult PageInfo() { //传递到页面的数据 bool ShowRegPage = true;//显示表单 string PageTitle = "", TableTitle = "添加企业黄页"; int InfoID = 0; int SelModelID = 0; //对应申请类型,相关功能暂移除 string menu = DataSecurity.FilterBadChar(Request.QueryString["menu"]); M_PageReg prMod = prBll.GetSelectByUserID(mu.UserID); if (prMod != null) { SelModelID = prMod.ModelID; } DataTable RegDT = fieldBll.SelectTableName("ZL_Pagereg", "TableName like 'ZL/_Reg/_%' escape '/' and UserID='" + mu.UserID + "'"); DataTable UPageDT = new DataTable(); string TableNames = ""; if (RegDT.Rows.Count > 0) { TableNames = RegDT.Rows[0]["TableName"].ToString(); SafeSC.CheckDataEx(TableNames); if (!modBll.IsExistTemplate(TableNames)) { function.WriteErrMsg("找不到系统黄页信息!请到后台创建用户模型"); return(Content("")); } DataTable modeinfo = fieldBll.SelectTableName("ZL_Model", "TableName = '" + TableNames + "'"); UPageDT = fieldBll.SelectTableName(TableNames, "UserID='" + mu.UserID + "'"); } if (TableNames != "") { DataTable modetb = fieldBll.SelectTableName("ZL_Model", "TableName ='" + TableNames + "'"); if (modetb.Rows.Count > 0) { SelModelID = DataConverter.CLng(modetb.Rows[0]["ModelID"]); } } DataTable typeDt = modBll.GetListPage(); if (SelModelID <= 0 && typeDt.Rows.Count > 0) { SelModelID = DataConverter.CLng(typeDt.Rows[0]["ModelID"]); } int UPageCount = UPageDT.Rows.Count; int RegCount = RegDT.Rows.Count; int PageStatus = 0; if (UPageCount > 0 && RegCount > 0) { PageStatus = DataConverter.CLng(RegDT.Rows[0]["Status"]); } if (UPageCount == 0 && RegCount == 0 && PageStatus != 99)//注册黄页 { //ModelHtml = fieldBll.InputallHtml(SelModelID, 0, new ModelConfig() { Source = ModelConfig.SType.Admin }); } else { if (UPageCount > 0 && RegCount > 0 && PageStatus != 99)//审核黄页 { #region 正在审核黄页 if (menu == "modifile") { TableTitle = "修改企业黄页"; //InfoID = DataConverter.CLng(RegDT.Rows[0]["InfoID"]); //ModelHtml = fieldBll.InputallHtml(SelModelID, 0, new ModelConfig() //{ // ValueDT = UPageDT //}); } else { ShowRegPage = false; } #endregion } else if (UPageCount > 0 && RegCount > 0 && PageStatus == 99)//审核通过和注册 { #region 审核通过的用户(修改资料) if (menu.Equals("modifile")) { TableTitle = "修改企业黄页"; InfoID = DataConverter.CLng(RegDT.Rows[0]["InfoID"]); //显示域名绑定 //ModelHtml = fieldBll.InputallHtml(SelModelID, 0, new ModelConfig() //{ // ValueDT = UPageDT //}); } else { ShowRegPage = false; RedirectToAction("PageInfo", "Pages", new { menu = "modifile" }); } #endregion } else { if (menu.Equals("modifile")) { DataTable dt1 = fieldBll.SelectTableName(RegDT.Rows[0]["TableName"].ToString(), "ID = " + RegDT.Rows[0]["GeneralID"] + ""); TableTitle = "修改企业黄页"; InfoID = DataConverter.CLng(RegDT.Rows[0]["InfoID"]); DataTable tbinfo = fieldBll.SelectTableName(TableNames, "UserID = '" + mu.UserID + "'"); //ModelHtml = fieldBll.InputallHtml(SelModelID, 0, new ModelConfig() { ValueDT = UPageDT }); } else { ShowRegPage = false; } } } DataTable styleDt = styleBll.GetPagestylelist(); styleDt.Columns["PageNodeid"].ColumnName = "TemplateID"; styleDt.Columns["TemplateIndex"].ColumnName = "TemplateUrl"; styleDt.Columns["TemplateIndexPic"].ColumnName = "TemplatePic"; styleDt.Columns["PageNodeName"].ColumnName = "rname"; ViewBag.PageTitle = PageTitle; ViewBag.TableTitle = TableTitle; ViewBag.ShowRegPage = ShowRegPage; if (UPageDT.Rows.Count > 0) { ViewBag.valuedr = UPageDT.Rows[0]; } else { ViewBag.valuedr = null; } //ViewBag.ModelHtml = ModelHtml; ViewBag.typeDt = typeDt; ViewBag.styleDt = styleDt; ViewBag.UserName = mu.UserName; ViewBag.ModelID = SelModelID; ViewBag.InfoID = InfoID; return(View(prMod)); }