private void InitFileExtArr() { this.m_ModelId = DataConverter.CLng(this.ViewState["ModelId"].ToString()); this.m_FieldName = this.ViewState["FieldName"].ToString(); this.m_ModelField = bfield.GetModelByFieldName(this.m_ModelId, this.m_FieldName); string[] Setting = this.m_ModelField.Content.Split(new char[] { ',' }); if (this.m_ModelField.FieldType == "PicType") { this.m_MaxFileSize = DataConverter.CLng(Setting[1].Split(new char[] { '=' })[1]); this.ViewState["MaxFileSize"] = Setting[1].Split(new char[] { '=' })[1]; this.m_FileExtArr = Setting[2].Split(new char[] { '=' })[1]; this.ViewState["FileExtArr"] = Setting[2].Split(new char[] { '=' })[1]; this.ViewState["UploadType"] = "PicType"; } if (this.m_ModelField.FieldType == "FileType") { string chkSize = Setting[0].Split(new char[] { '=' })[1]; string SizeField = Setting[1].Split(new char[] { '=' })[1]; this.ViewState["SizeField"] = SizeField; this.m_MaxFileSize = DataConverter.CLng(Setting[2].Split(new char[] { '=' })[1]); this.ViewState["MaxFileSize"] = Setting[2].Split(new char[] { '=' })[1]; this.m_FileExtArr = Setting[3].Split(new char[] { '=' })[1]; this.ViewState["FileExtArr"] = Setting[3].Split(new char[] { '=' })[1]; this.ViewState["UploadType"] = "FileType"; } }
protected void LinkButton_Command(object sender, CommandEventArgs e) { int Id = DataConverter.CLng(e.CommandArgument.ToString().Split('|')[0].Trim()); M_ModelField nowFieldinfo = this.bll.GetModelByID(ModelID.ToString(), Id); string col = e.CommandArgument.ToString().Split('|')[1].Trim(); switch (col) { case "Null": nowFieldinfo.IsNotNull = !nowFieldinfo.IsNotNull; break; case "Show": nowFieldinfo.ShowList = !nowFieldinfo.ShowList; //nowFieldinfo.IsShow = !nowFieldinfo.IsShow; break; case "Copy": nowFieldinfo.IsCopy ^= 1; break; case "BatchAdd": nowFieldinfo.Islotsize = !nowFieldinfo.Islotsize; break; } bll.Update(nowFieldinfo); }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { B_Admin badmin = new B_Admin(); if (!B_ARoleAuth.Check(ZLEnum.Auth.page, "PageModelManage")) { function.WriteErrMsg("没有权限进行此项操作"); } if (string.IsNullOrEmpty(base.Request.QueryString["FieldID"])) { function.WriteErrMsg("没有指定要修改字段的字段ID!"); } int FieldID = DataConverter.CLng(base.Request.QueryString["FieldID"]); int ModelID = DataConverter.CLng(base.Request.QueryString["ModelID"]); this.HdfFieldID.Value = FieldID.ToString(); M_ModelField field = this.bll.GetModelByID(ModelID.ToString(), FieldID); //int ModelID = field.ModelID; M_ModelInfo model = this.bModel.GetModelById(ModelID); this.HdfModelID.Value = ModelID.ToString(); this.GetShow(field); Call.SetBreadCrumb(Master, "<li>后台管理</li><li>企业黄页</li><li>字段列表</li><li>修改[" + model.ModelName + "模型]字段</li>"); } }
protected void Page_Load(object sender, EventArgs e) { B_ARoleAuth.CheckEx(ZLEnum.Auth.model, "ModelEdit"); if (function.isAjax()) { string action = Request.Form["action"]; string result = ""; switch (action) { case "orderup": M_ModelField curmod = bll.SelReturnModel(DataConverter.CLng(Request.Form["curid"])); curmod.OrderID = DataConverter.CLng(Request.Form["curorder"]); M_ModelField tagmod = bll.SelReturnModel(DataConverter.CLng(Request.Form["tagid"])); tagmod.OrderID = DataConverter.CLng(Request.Form["tagorder"]); bll.UpdateOrder(curmod, tagmod); result = "1"; break; default: break; } Response.Write(result); Response.Flush(); Response.End(); return; } if (!IsPostBack) { //负数为其它固定表的模型 if (ModelID == 0) { function.WriteErrMsg("没有指定模块ID"); } MyBind(); Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ContentManage.aspx'>内容管理</a></li><li><a href='ModelManage.aspx?ModelType=" + ModelType + "'>" + modelName + "</a></li><li class='active'><a href='ModelField.aspx" + Request.Url.Query + "'> 字段列表</a> " + tabNameStr + " <a id='ShowLink' class='reds' href='javascript:ShowList()'>[显示所有字段]</a> <a href='AddModelField.aspx" + Request.Url.Query + "' class='reds'>[添加字段]</a></li>" + Call.GetHelp(63)); } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { B_Admin badmin = new B_Admin(); if (!B_ARoleAuth.Check(ZLEnum.Auth.model, "ModelEdit")) { function.WriteErrMsg("没有权限进行此项操作"); } if (string.IsNullOrEmpty(base.Request.QueryString["FieldID"])) { function.WriteErrMsg("没有指定要修改字段的字段ID!"); } int FieldID = DataConverter.CLng(base.Request.QueryString["FieldID"]); int ModelID = DataConverter.CLng(base.Request.QueryString["ModelID"]); this.HdfFieldID.Value = FieldID.ToString(); M_ModelField field = this.bll.GetModelByID(ModelID.ToString(), FieldID); //int ModelID = field.ModelID; this.m_mdid = ModelID.ToString(); M_ModelInfo model = this.bModel.GetModelById(ModelID); this.Literal1.Text = model.ModelName; Label1.Text = "当前表:" + model.TableName; this.HdfModelID.Value = ModelID.ToString(); this.GradeOptionType_Cate.DataSource = B_GradeOption.GetCateList(); this.GradeOptionType_Cate.DataTextField = "CateName"; this.GradeOptionType_Cate.DataValueField = "CateID"; this.GradeOptionType_Cate.DataBind(); this.GradeOptionType_Cate.Items.Insert(0, new ListItem("选择多级选项分类", "0")); this.GetShow(field); Call.SetBreadCrumb(Master, "<li>后台管理</li><li>企业黄页</li><li><a href='/manage/Page/PageModelManage.aspx'>模型管理</a></li><li>修改[" + model.ModelName + "模型]字段</li>"); } }
protected void Page_Load(object sender, EventArgs e) { ZoomLa.Common.function.AccessRulo(); if (!this.Page.IsPostBack) { B_Admin badmin = new B_Admin(); if (!B_ARoleAuth.Check(ZLEnum.Auth.model, "ShopModelEdit")) { function.WriteErrMsg("没有权限进行此项操作"); } if (string.IsNullOrEmpty(base.Request.QueryString["FieldID"])) { function.WriteErrMsg("没有指定要修改字段的字段ID!"); } int FieldID = DataConverter.CLng(base.Request.QueryString["FieldID"]); int ModelID = DataConverter.CLng(base.Request.QueryString["ModelID"]); this.HdfFieldID.Value = FieldID.ToString(); M_ModelField field = this.bll.GetModelByIDXML(FieldID); ModelID = field.ModelID; // M_ModelField field = this.bll.GetModelByID(ModelID.ToString(), FieldID); //int ModelID = field.ModelID; M_ModelInfo model = this.bModel.GetModelById(ModelID); this.lblModel.Text = model.ModelName; this.HdfModelID.Value = ModelID.ToString(); this.GetShow(field); } }
public string Field_API() { string ids = DataConvert.CStr(RequestEx["ids"]); string action = Request.Query["action"]; switch (action) { case "del": { if (!string.IsNullOrEmpty(ids)) { fieldBll.DelByFieldID(ids);; } } break; case "orderup": { M_ModelField curmod = fieldBll.SelReturnModel(DataConverter.CLng(RequestEx["curid"])); curmod.OrderID = DataConverter.CLng(RequestEx["curorder"]); M_ModelField tagmod = fieldBll.SelReturnModel(DataConverter.CLng(RequestEx["tagid"])); tagmod.OrderID = DataConverter.CLng(RequestEx["tagorder"]); fieldBll.UpdateOrder(curmod, tagmod); } break; } return(Success.ToString()); }
/// <summary> /// 将模型信息的各属性值传递到参数中 /// </summary> /// <param name="administratorInfo"></param> /// <returns></returns> private static SqlParameter[] GetParameters(M_ModelField ModelField) { SqlParameter[] parameter = new SqlParameter[] { new SqlParameter("@FieldID", SqlDbType.Int, 4), new SqlParameter("@ModelID", SqlDbType.Int, 4), new SqlParameter("@FieldName", SqlDbType.NVarChar, 50), new SqlParameter("@FieldAlias", SqlDbType.NVarChar, 20), new SqlParameter("@FieldTips", SqlDbType.NVarChar, 50), new SqlParameter("@FieldType", SqlDbType.NVarChar, 50), new SqlParameter("@Description", SqlDbType.NVarChar, 255), new SqlParameter("@Content", SqlDbType.NText), new SqlParameter("@IsNotNull", SqlDbType.Bit), new SqlParameter("@IsSearchForm", SqlDbType.Bit) }; parameter[0].Value = ModelField.FieldID; parameter[1].Value = ModelField.ModelID; parameter[2].Value = ModelField.FieldName; parameter[3].Value = ModelField.FieldAlias; parameter[4].Value = ModelField.FieldTips; parameter[5].Value = ModelField.FieldType; parameter[6].Value = ModelField.Description; parameter[7].Value = ModelField.Content; parameter[8].Value = ModelField.IsNotNull; parameter[9].Value = ModelField.IsSearchForm; return(parameter); }
public void Del(int FieldID, string tablename) { M_ModelField info = this.dal.GetModelByID(FieldID); this.dal.Del(FieldID); this.dal.DelField(tablename, info.FieldName); }
/// <summary> /// 通过ModelID ,itemID查找图片路径 /// </summary> /// <param name="modelID"></param> /// <param name="itemID"></param> /// <returns></returns> private string GetPicPathByModelID(int modelID, int itemID) { B_Model bm = new B_Model(); M_ModelInfo modelinfo = bm.GetModelById(modelID); B_ModelField bmf = new B_ModelField(); M_ModelField mf = bmf.GetFieldNameByMID(modelID); string fieldName = ""; if (mf != null && mf.ModelID > 0) { fieldName = mf.FieldName; } if (modelinfo != null && modelinfo.ModelID > 0) { //DataSet ds = cll.PRoContentChilds(modelinfo.TableName, itemID); //if (ds != null && ds.Tables[0].Rows.Count > 0) //{ // DataRow dr = ds.Tables[0].Rows[0]; // foreach (DataColumn item in ds.Tables[0].Columns) // { // if (item.ToString().Trim().Equals(fieldName)) // { // return dr[item].ToString(); // } // } //} } return(""); }
protected void BtnUpload_Click(object sender, EventArgs e) { long size = FupFile.FileContent.Length; if (size > 10 * 1024 * 1024) { function.Script(this, "alert('文件不能大于10mb');"); return; } M_ModelField fieldmod = fieldBll.GetModelByFieldName(ModelID, FieldName); if (fieldmod == null) { return; } if (SafeSC.FileNameCheck(FupFile.FileName)) { function.Script(this, "alert('此文件格式不允许上传!');"); return; } if (fieldmod.FieldType.Equals("SqlType") && !SafeSC.IsImage(FupFile.FileName)) { function.Script(this, "alert('只能上传图片!');"); return; } string content = fieldmod.Content; Stream filedata = FupFile.FileContent; byte[] filebyte = new byte[filedata.Length]; filedata.Read(filebyte, 0, filebyte.Length); function.Script(this, "parent.DealwithUploadPic('" + FupFile.FileName + "|" + Convert.ToBase64String(filebyte) + "','FIT_" + FieldName + "');"); function.Script(this, "parent.DealwithUploadPic('" + FupFile.FileName + "','txt_" + FieldName + "');"); LblMessage.Text = "文件上传成功"; }
private void InitFileExtArr() { string content = ""; string fieldType = ""; if (ModelID > 0) { B_ModelField bmf = new B_ModelField(); M_ModelField mmf = bmf.GetModelByFieldName(ModelID, FieldName); mmf = (mmf == null) ? new M_ModelField() : mmf; content = mmf.Content; fieldType = mmf.FieldType; } else { B_UserBaseField bubf = new B_UserBaseField(); M_UserBaseField mubf = bubf.getUserBaseFieldByFieldName(FieldName); mubf = (mubf == null) ? new M_UserBaseField() : mubf; content = mubf.Content; fieldType = mubf.FieldType; } if (content != null) { string[] Setting = content.Split(new char[] { ',' }); if (fieldType == "PicType") { this.m_MaxFileSize = DataConverter.CLng(Setting[1].Split(new char[] { '=' })[1]); this.ViewState["MaxFileSize"] = Setting[1].Split(new char[] { '=' })[1]; this.m_FileExtArr = Setting[2].Split(new char[] { '=' })[1]; this.ViewState["FileExtArr"] = Setting[2].Split(new char[] { '=' })[1]; this.ViewState["UploadType"] = "PicType"; } if (fieldType == "FileType") { string chkSize = Setting[0].Split(new char[] { '=' })[1]; string SizeField = Setting[1].Split(new char[] { '=' })[1]; this.ViewState["SizeField"] = SizeField; this.m_MaxFileSize = DataConverter.CLng(Setting[2].Split(new char[] { '=' })[1]); this.ViewState["MaxFileSize"] = Setting[2].Split(new char[] { '=' })[1]; this.m_FileExtArr = Setting[3].Split(new char[] { '=' })[1]; this.ViewState["FileExtArr"] = Setting[3].Split(new char[] { '=' })[1]; this.ViewState["UploadType"] = "FileType"; } if (fieldType == "SmallFileType") { string chkSize = Setting[0].Split(new char[] { '=' })[1]; string SizeField = Setting[1].Split(new char[] { '=' })[1]; this.ViewState["SizeField"] = SizeField; this.m_MaxFileSize = DataConverter.CLng(chkSize); this.ViewState["MaxFileSize"] = chkSize; this.m_FileExtArr = SizeField; this.ViewState["FileExtArr"] = SizeField; this.ViewState["UploadType"] = "SmallFileType"; } } }
//添加一个字段 private void AddField(DataRow dr, M_ModelInfo model) { M_ModelField fieldMod = new M_ModelField().GetModelFromReader(dr); fieldMod.ModelID = model.ModelID; fieldMod.FieldID = 0; fieldBll.AddModelField(model, fieldMod); //fieldBll.Add(fieldMod); //fieldBll.AddFieldCopy(model.TableName, fieldMod.FieldName, fieldMod.FieldType, "", "");//加入表 }
public bool UpdateOrder(M_ModelField info) { string strSql = "Update ZL_ModelField Set OrderId=@OrderId Where FieldID=@FieldID"; SqlParameter[] cmdParams = new SqlParameter[] { new SqlParameter("@OrderId", SqlDbType.Int), new SqlParameter("@FieldID", SqlDbType.Int) }; cmdParams[0].Value = info.OrderID; cmdParams[1].Value = info.FieldID; return(SqlHelper.ExecuteSql(strSql, cmdParams)); }
protected void Repeater1_ItemCommand(object sender, RepeaterCommandEventArgs e) { if (e.CommandName == "UpMove") { int Id = DataConverter.CLng(e.CommandArgument); M_ModelField Fieldinfo = this.bll.GetModelByID(Id); if (Fieldinfo.OrderID != this.bll.GetMinOrder(Fieldinfo.ModelID)) { M_ModelField FieldPre = this.bll.GetPreField(Fieldinfo.ModelID, Fieldinfo.OrderID); int CurrOrder = Fieldinfo.OrderID; Fieldinfo.OrderID = FieldPre.OrderID; FieldPre.OrderID = CurrOrder; this.bll.UpdateOrder(Fieldinfo); this.bll.UpdateOrder(FieldPre); } } if (e.CommandName == "DownMove") { int Id = DataConverter.CLng(e.CommandArgument); M_ModelField Fieldinfo = this.bll.GetModelByID(Id); if (Fieldinfo.OrderID != this.bll.GetMaxOrder(Fieldinfo.ModelID)) { M_ModelField FieldPre = this.bll.GetNextField(Fieldinfo.ModelID, Fieldinfo.OrderID); int CurrOrder = Fieldinfo.OrderID; Fieldinfo.OrderID = FieldPre.OrderID; FieldPre.OrderID = CurrOrder; this.bll.UpdateOrder(Fieldinfo); this.bll.UpdateOrder(FieldPre); } } if (e.CommandName == "Delete") { int Id = DataConverter.CLng(e.CommandArgument); int ModelID; ModelID = DataConverter.CLng(this.ViewState["ModelID"].ToString()); B_Model bll1 = new B_Model(); string tablename = bll1.GetModelById(ModelID).TableName; M_ModelField fieldinfo = this.bll.GetModelByID(Id); if (fieldinfo.FieldType == "PicType" || fieldinfo.FieldType == "FileType") { string[] Setting = fieldinfo.Content.Split(new char[] { ',' }); bool chk = DataConverter.CBool(Setting[0].Split(new char[] { '=' })[1]); string fieldname = Setting[1].Split(new char[] { '=' })[1]; if (chk && fieldname != "") { this.bll.DelSubField(tablename, fieldname); } } this.bll.Del(Id, tablename); } DataBindList(); }
public string Strsplit(string str, int maxlength) { M_ModelField mideld = bfield.GetModelByIDXML(maxlength); // M_ModelField mideld = bfield.GetModelByID(this.ModelIDs.ToString(), maxlength); string strg = string.Empty; if (str.Length > maxlength) { strg = str.Substring(0, maxlength) + "..."; } else { strg = str; } return(str); }
private void InitFileExtArr() { this.m_ModelId = DataConverter.CLng(this.ViewState["ModelId"].ToString()); this.m_FieldName = this.ViewState["FieldName"].ToString(); this.m_ModelField = bfield.GetModelByFieldName(this.m_ModelId, this.m_FieldName); string[] Setting = this.m_ModelField.Content.Split(new char[] { ',' }); string ChkThumb = Setting[0].Split(new char[] { '=' })[1]; string ThumbField = Setting[1].Split(new char[] { '=' })[1]; this.ViewState["ThumbField"] = ThumbField; this.m_MaxFileSize = DataConverter.CLng(Setting[2].Split(new char[] { '=' })[1]); this.ViewState["MaxFileSize"] = Setting[3].Split(new char[] { '=' })[1]; this.m_FileExtArr = Setting[4].Split(new char[] { '=' })[1]; this.ViewState["FileExtArr"] = Setting[4].Split(new char[] { '=' })[1]; }
/// <summary> /// 从DataReader中读取模型记录 /// </summary> /// <param name="rdr">DataReader</param> /// <returns>M_ModelField 模型信息</returns> private static M_ModelField GetFieldFromReader(SqlDataReader rdr) { M_ModelField info = new M_ModelField(); info.FieldID = DataConverter.CLng(rdr["FieldID"]); info.ModelID = DataConverter.CLng(rdr["ModelID"]); info.FieldName = rdr["FieldName"].ToString(); info.FieldAlias = rdr["FieldAlias"].ToString(); info.FieldTips = rdr["FieldTips"].ToString(); info.Description = rdr["Description"].ToString(); info.IsNotNull = DataConverter.CBool(rdr["IsNotNull"].ToString()); info.IsSearchForm = DataConverter.CBool(rdr["IsSearchForm"].ToString()); info.FieldType = rdr["FieldType"].ToString(); info.Content = rdr["Content"].ToString(); info.OrderID = DataConverter.CLng(rdr["OrderID"]); return(info); }
protected void Order_B_Click(object sender, EventArgs e) { string[] ordervalues = Order_Hid.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string value in ordervalues) { if (string.IsNullOrWhiteSpace(value.Split('|')[0])) { continue; } int fid = Convert.ToInt32(value.Split('|')[0]); int orderid = Convert.ToInt32(value.Split('|')[1]); M_ModelField modfield = bll.GetModelByID(ModelID.ToString(), fid); modfield.OrderID = orderid; bll.UpdateOrder(modfield); } function.WriteSuccessMsg("保存排序成功"); }
protected void Repeater1_ItemCommand(object sender, RepeaterCommandEventArgs e) { int ModelID = DataConverter.CLng(this.ViewState["ModelID"]); if (e.CommandName == "UpMove") { int Id = DataConverter.CLng(e.CommandArgument); M_ModelField Fieldinfo = this.bll.GetModelByID(ModelID.ToString(), Id); if (Fieldinfo.OrderID != this.bll.GetMinOrder(Fieldinfo.ModelID)) { M_ModelField FieldPre = bll.GetPreField(Fieldinfo.ModelID, Fieldinfo.OrderID); int CurrOrder = Fieldinfo.OrderID; Fieldinfo.OrderID = FieldPre.OrderID; FieldPre.OrderID = CurrOrder; //this.bll.UpdateByID(Fieldinfo); //this.bll.UpdateByID(FieldPre); this.bll.UpdateOrder(Fieldinfo, FieldPre); //this.bll.UpdateOrder(FieldPre); } } if (e.CommandName == "DownMove") { int Id = DataConverter.CLng(e.CommandArgument); M_ModelField Fieldinfo = this.bll.GetModelByID(ModelID.ToString(), Id); if (Fieldinfo.OrderID != this.bll.GetMaxOrder(Fieldinfo.ModelID)) { M_ModelField FieldPre = this.bll.GetNextField(Fieldinfo.ModelID, Fieldinfo.OrderID); int CurrOrder = Fieldinfo.OrderID; Fieldinfo.OrderID = FieldPre.OrderID; FieldPre.OrderID = CurrOrder; //this.bll.UpdateByID(Fieldinfo); //this.bll.UpdateByID(FieldPre); this.bll.UpdateOrder(Fieldinfo, FieldPre); } } if (e.CommandName == "Delete") { int Id = DataConverter.CLng(e.CommandArgument); bll.DelByFieldID(Id); } MyBind(); }
//保存字段排序 public string Order_Submit() { M_APIResult retMod = new M_APIResult(M_APIResult.Failed); string[] ordervalues = DataConvert.CStr(RequestEx["Order_Hid"]).Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); foreach (string value in ordervalues) { if (string.IsNullOrWhiteSpace(value.Split('|')[0])) { continue; } int fid = Convert.ToInt32(value.Split('|')[0]); int orderid = Convert.ToInt32(value.Split('|')[1]); M_ModelField modfield = fieldBll.GetModelByID(Mid.ToString(), fid); modfield.OrderID = orderid; fieldBll.UpdateOrder(modfield); } retMod.retcode = M_APIResult.Success; return(retMod.ToString()); }
public IActionResult FieldAdd() { M_ModelField fieldMod = new M_ModelField(); M_ModelInfo modInfo = new M_ModelInfo(); if (Mid > 0) { fieldMod = fieldBll.SelReturnModel(Mid); modInfo = bll.SelReturnModel(fieldMod.ModelID); } else { modInfo = bll.SelReturnModel(ModelID); } if (modInfo == null) { return(WriteErr("未指定模型信息")); } ViewBag.modInfo = modInfo; return(View("FieldAdd", fieldMod)); }
protected void RepairData_Btn_Click(object sender, EventArgs e) { B_ModelField fieldBll = new B_ModelField(); DataTable dt = fieldBll.Sel(); foreach (DataRow dr in dt.Rows) { int fid = DataConverter.CLng(dr["FieldID"]); string content = DataConverter.CStr(dr["Content"]); if (!content.Contains("||") || !content.Contains("=")) { continue; } //1=是||否,Property=True,Default= string itemStr = content.Split(',')[0].Split('=')[1]; M_ModelField fieldMod = fieldBll.SelReturnModel(fid); fieldMod.Content = content.Replace(itemStr, SortStr(itemStr)); fieldBll.Update(fieldMod); } function.WriteSuccessMsg("操作成功"); }
private void Serverlist() { if (this.SetDownFiled.SelectedValue == "1") { this.downserver.Visible = true; B_DownServer downdll = new B_DownServer(); DataTable downlist = downdll.GetDownServerAll(); downlist.DefaultView.Sort = "ServerID"; this.serverlist.DataSource = downlist; this.serverlist.DataTextField = "ServerName"; this.serverlist.DataValueField = "ServerID"; this.serverlist.DataBind(); this.serverlist.Items.Insert(0, new ListItem("请选择服务器", "")); for (int i = 0; i < this.Type.Items.Count; i++) { if (this.Type.Items[i].Value != "SmallFileType") { this.Type.Items[i].Enabled = false; } else { int FieldID = DataConverter.CLng(base.Request.QueryString["FieldID"]); int ModelID = DataConverter.CLng(base.Request.QueryString["ModelID"]); M_ModelField field = this.bll.GetModelByID(ModelID.ToString(), FieldID); string content = field.Content; this.ChkFileSize.Enabled = false; this.TxtFileSizeField.Enabled = false; this.TxtMaxFileSizes.Text = this.bll.GetFieldContent(content, 0, 1); this.TxtUploadFileTypes.Text = this.bll.GetFieldContent(content, 1, 1); this.DivSmallFileType.Style["display"] = ""; this.tbSearch.Style["display"] = "none"; this.DivTextType.Style["display"] = "none"; this.Type.Items[i].Selected = true; } } } }
//根据字段类型,完成初始化 private void InitFileExtArr() { fieldMod = fieldBll.GetModelByFieldName(ModelID, FieldName); if (fieldMod.FieldID < 1) { RepStr("[" + FieldName + "]字段不存在"); } if (fieldMod.FieldID > 0) { string[] Setting = fieldMod.Content.Split(new char[] { ',' }); if (fieldMod.FieldType == "PicType") { show1.Visible = true; show2.Visible = true; int isWater = DataConverter.CLng(Setting[0].Split(new char[] { '=' })[1]); RadioButtonList1.SelectedValue = (isWater == 1 ? "1" : "0"); m_MaxFileSize = DataConverter.CLng(Setting[1].Split(new char[] { '=' })[1]); ViewState["MaxFileSize"] = Setting[1].Split(new char[] { '=' })[1]; UploadType = "PicType"; } if (fieldMod.FieldType == "FileType") { string chkSize = Setting[0].Split(new char[] { '=' })[1]; string SizeField = Setting[1].Split(new char[] { '=' })[1]; ViewState["SizeField"] = SizeField; m_MaxFileSize = DataConverter.CLng(Setting[2].Split(new char[] { '=' })[1]); ViewState["MaxFileSize"] = Setting[2].Split(new char[] { '=' })[1]; UploadType = "FileType"; } if (fieldMod.FieldType == "SmallFileType") { m_MaxFileSize = DataConverter.CLng(Setting[0].Split(new char[] { '=' })[1]); ViewState["MaxFileSize"] = Setting[0].Split(new char[] { '=' })[1]; UploadType = "SmallFileType"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { B_Admin badmin = new B_Admin(); badmin.CheckMulitLogin(); if (!badmin.ChkPermissions("ModelEdit")) { function.WriteErrMsg("没有权限进行此项操作"); } if (string.IsNullOrEmpty(base.Request.QueryString["FieldID"])) { function.WriteErrMsg("没有指定要修改字段的字段ID!"); } int FieldID = DataConverter.CLng(base.Request.QueryString["FieldID"]); this.HdfFieldID.Value = FieldID.ToString(); M_ModelField field = this.bll.GetModelByID(FieldID); int ModelID = field.ModelID; M_ModelInfo model = this.bModel.GetModelById(ModelID); this.lblModel.Text = model.ModelName; this.HdfModelID.Value = ModelID.ToString(); this.GetShow(field); } }
protected void Button1_Click(object sender, EventArgs e) { int ModelID = DataConverter.CLng(this.HdfModelID.Value); this.GetIsOk(); string text = this.Name.Text; string str2 = this.Alias.Text; string str3 = this.Description.Text; bool flag = DataConverter.CBool(this.IsNotNull.SelectedValue); bool flag2 = DataConverter.CBool(this.IsSearchForm.SelectedValue); string fieldType = "nvarchar"; string defaultValue = ""; string selectedValue = this.Type.SelectedValue; string str7 = ""; string tempFieldName = ""; string tempFieldType = ""; switch (selectedValue) { //单行文本 case "TextType": str7 = "TitleSize=" + this.TitleSize.Text + ",IsPassword="******",DefaultValue=" + this.TextType_DefaultValue.Text + ""; fieldType = "nvarchar"; break; //多行文本(不支持Html) case "MultipleTextType": str7 = "Width=" + this.MultipleTextType_Width.Text + ",Height=" + this.MultipleTextType_Height.Text + ""; fieldType = "ntext"; break; //多行文本(支持Html) case "MultipleHtmlType": str7 = "Width=" + this.MultipleHtmlType_Width.Text + ",Height=" + this.MultipleHtmlType_Height.Text + ",IsEditor=" + this.IsEditor.SelectedValue + ""; fieldType = "ntext"; break; //单选项 case "OptionType": str7 = "" + this.RadioType_Type.SelectedValue + "=" + this.RadioType_Content.Text.Trim().Replace(" ", "").Replace("\r\n", "|") + ",Property=" + this.RadioType_Property.Text + ",Default=" + this.RadioType_Default.Text + ""; fieldType = "nvarchar"; defaultValue = this.RadioType_Default.Text; break; //多选项 case "ListBoxType": str7 = "" + this.ListBoxType_Type.SelectedValue + "=" + this.ListBoxType_Content.Text.Trim().Replace(" ", "").Replace("\r\n", "|") + ""; fieldType = "ntext"; break; //数字 case "NumType": str7 = "TitleSize=" + this.NumberType_TitleSize.Text + ",NumberType=" + this.NumberType_Style.SelectedValue + ",DefaultValue=" + this.NumberType_DefaultValue.Text + ""; int numstyle = DataConverter.CLng(this.NumberType_Style.SelectedValue); if (numstyle == 1) { fieldType = "int"; } if (numstyle == 2) { fieldType = "float"; } if (numstyle == 3) { fieldType = "money"; } break; //日期时间 case "DateType": str7 = ""; fieldType = "datetime"; break; //图片 case "PicType": str7 = "Warter=" + this.RBLPicWaterMark.SelectedValue + ",MaxPicSize=" + this.TxtSPicSize.Text + ",PicFileExt=" + this.TxtPicExt.Text; fieldType = "nvarchar"; break; //多图片 case "MultiPicType": str7 = "ChkThumb=" + (this.ChkThumb.Checked ? "1" : "0") + ",ThumbField=" + this.TxtThumb.Text + ",Warter=" + this.RBLPicWaterMark.SelectedValue + ",MaxPicSize=" + this.TxtSPicSize.Text + ",PicFileExt=" + this.TextImageType.Text; if (this.ChkThumb.Checked) { tempFieldName = this.TxtThumb.Text; tempFieldType = "nvarchar"; } fieldType = "ntext"; break; //文件 case "FileType": str7 = "ChkFileSize=" + (this.ChkFileSize.Checked ? "1" : "0") + ",FileSizeField=" + this.TxtFileSizeField.Text + ",MaxFileSize=" + this.TxtMaxFileSize.Text + ",UploadFileExt=" + this.TxtUploadFileType.Text; if (this.ChkFileSize.Checked) { tempFieldName = this.TxtFileSizeField.Text; tempFieldType = "nvarchar"; } fieldType = "ntext"; break; //运行平台 case "OperatingType": str7 = "TitleSize=" + this.OperatingType_TitleSize.Text + ",OperatingList=" + this.TxtOperatingOption.Text.Trim().Replace(" ", "").Replace("\r\n", "|") + ",DefaultValue=" + this.OperatingType_DefaultValue.Text; fieldType = "nvarchar"; break; //超链接 case "SuperLinkType": str7 = "TitleSize=" + this.SuperLinkType_TitleSize.Text + ",DefaultValue=" + this.SuperLinkType_DefaultValue.Text; fieldType = "nvarchar"; break; default: str7 = ""; break; } M_ModelField modelfield = new M_ModelField(); modelfield.ModelID = ModelID; modelfield.FieldID = 0; modelfield.FieldName = text; modelfield.FieldAlias = str2; modelfield.Description = str3; modelfield.FieldTips = this.Tips.Text.Trim(); modelfield.FieldType = selectedValue; modelfield.Content = str7; modelfield.IsNotNull = flag; modelfield.IsSearchForm = flag2; modelfield.OrderID = this.bll.GetMaxOrder(ModelID) + 1; this.bll.Add(modelfield); if (!string.IsNullOrEmpty(tempFieldName) && !string.IsNullOrEmpty(tempFieldType)) { this.bll.AddField(this.HdfTableName.Value, tempFieldName, tempFieldType, ""); } this.bll.AddField(this.HdfTableName.Value, text, fieldType, defaultValue); Response.Redirect("UserModelField.aspx?ModelID=" + ModelID.ToString()); }
private void GetShow(M_ModelField field) { this.Name.Text = field.FieldName; this.Name.Enabled = false; this.Alias.Text = field.FieldAlias; this.Description.Text = field.Description; this.Tips.Text = field.FieldTips; this.IsNotNull.SelectedValue = field.IsNotNull.ToString(); this.IsSearchForm.SelectedValue = field.IsSearchForm.ToString(); this.IsShow.SelectedValue = field.IsShow.ToString(); string type = field.FieldType; string content = field.Content; this.Type.SelectedValue = type; this.Type.Enabled = false; this.hdfOrder.Value = field.OrderID.ToString(); switch (type) { //单行文本 case "TextType": this.TitleSize.Text = this.bll.GetFieldContent(content, 0, 1); this.IsPassword.SelectedValue = this.bll.GetFieldContent(content, 1, 1); this.TextType_DefaultValue.Text = this.bll.GetFieldContent(content, 2, 1); break; //多行文本(不支持Html) case "MultipleTextType": this.MultipleTextType_Width.Text = this.bll.GetFieldContent(content, 0, 1); this.MultipleTextType_Height.Text = this.bll.GetFieldContent(content, 1, 1); this.DivMultipleTextType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //多行文本(支持Html) case "MultipleHtmlType": this.MultipleHtmlType_Width.Text = this.bll.GetFieldContent(content, 0, 1); this.MultipleHtmlType_Height.Text = this.bll.GetFieldContent(content, 1, 1); this.IsEditor.SelectedValue = this.bll.GetFieldContent(content, 2, 1); this.DivMultipleHtmlType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //单选项 case "OptionType": this.RadioType_Content.Text = SortStr(this.bll.GetFieldContent(content, 0, 1)).Replace("||", "\r\n"); this.RadioType_Type.SelectedValue = this.bll.GetFieldContent(content, 0, 0); this.RadioType_Property.SelectedValue = this.bll.GetFieldContent(content, 1, 1).ToString(); this.RadioType_Default.Text = this.bll.GetFieldContent(content, 2, 1).ToString(); this.DivOptionType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //多选项 case "ListBoxType": this.ListBoxType_Content.Text = SortStr(this.bll.GetFieldContent(content, 0, 1)).Replace("||", "\r\n"); this.ListBoxType_Type.SelectedValue = this.bll.GetFieldContent(content, 0, 0); this.DivListBoxType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //数字 case "NumType": this.NumberType_TitleSize.Text = this.bll.GetFieldContent(content, 0, 1); this.NumberType_Style.SelectedValue = this.bll.GetFieldContent(content, 1, 1); this.NumberType_Style.Enabled = false; this.NumberType_DefaultValue.Text = this.bll.GetFieldContent(content, 2, 1); this.DivNumType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //日期时间 case "DateType": this.DivDateType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //图片 case "PicType": this.RBLPicWaterMark.SelectedValue = this.bll.GetFieldContent(content, 0, 1); this.TxtSPicSize.Text = this.bll.GetFieldContent(content, 1, 1); this.TxtPicExt.Text = this.bll.GetFieldContent(content, 2, 1); this.DivPicType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //多图片 case "MultiPicType": if (DataConverter.CBool(this.bll.GetFieldContent(content, 0, 1))) { this.ChkThumb.Checked = true; this.TxtThumb.Text = this.bll.GetFieldContent(content, 1, 1); } else { this.ChkThumb.Checked = false; this.TxtThumb.Text = ""; } this.ChkThumb.Enabled = false; this.TxtThumb.Enabled = false; this.RBLWaterMark.SelectedValue = this.bll.GetFieldContent(content, 2, 1); this.TxtPicSize.Text = this.bll.GetFieldContent(content, 3, 1); this.TextImageType.Text = this.bll.GetFieldContent(content, 4, 1); this.DivMultiPicType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //文件 case "FileType": if (DataConverter.CBool(this.bll.GetFieldContent(content, 0, 1))) { this.ChkFileSize.Checked = true; this.TxtFileSizeField.Text = this.bll.GetFieldContent(content, 1, 1); } else { this.ChkFileSize.Checked = false; this.TxtFileSizeField.Text = ""; } this.ChkFileSize.Enabled = false; this.TxtFileSizeField.Enabled = false; this.TxtMaxFileSize.Text = this.bll.GetFieldContent(content, 2, 1); this.TxtUploadFileType.Text = this.bll.GetFieldContent(content, 3, 1); this.DivFileType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //运行平台 case "OperatingType": this.TxtOperatingOption.Text = this.bll.GetFieldContent(content, 1, 1).Replace("|", "\r\n"); this.OperatingType_TitleSize.Text = this.bll.GetFieldContent(content, 0, 1); this.OperatingType_DefaultValue.Text = this.bll.GetFieldContent(content, 2, 1); this.DivOperatingType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //超链接 case "SuperLinkType": this.SuperLinkType_TitleSize.Text = this.bll.GetFieldContent(content, 0, 1); this.SuperLinkType_DefaultValue.Text = this.bll.GetFieldContent(content, 1, 1); this.DivSuperLinkType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; break; //多级选项 case "GradeOptionType": this.GradeOptionType_Cate.SelectedValue = this.bll.GetFieldContent(content, 0, 1); this.GradeOptionType_Direction.SelectedValue = this.bll.GetFieldContent(content, 1, 1); this.DivTextType.Style["display"] = "none"; this.DivGradeOptionType.Style["display"] = ""; break; //颜色字段 case "ColorType": this.ColorDefault.Text = this.bll.GetFieldContent(content, 1, 1); this.DivColorType.Style["display"] = ""; this.DivTextType.Style["display"] = "none"; this.tbSearch.Style["display"] = "none"; break; } }
protected void Button1_Click(object sender, EventArgs e) { this.GetIsOk(); int ModelID = DataConverter.CLng(this.HdfModelID.Value); int FieldID = DataConverter.CLng(this.HdfFieldID.Value); string text = this.Name.Text; string str2 = this.Alias.Text; string str3 = this.Description.Text; bool flag = DataConverter.CBool(this.IsNotNull.SelectedValue); bool flag2 = DataConverter.CBool(this.IsSearchForm.SelectedValue); string selectedValue = this.Type.SelectedValue; string str7 = ""; switch (selectedValue) { //单行文本 case "TextType": str7 = "TitleSize=" + this.TitleSize.Text + ",IsPassword="******",DefaultValue=" + this.TextType_DefaultValue.Text + ""; break; //多行文本(不支持Html) case "MultipleTextType": str7 = "Width=" + this.MultipleTextType_Width.Text + ",Height=" + this.MultipleTextType_Height.Text + ""; break; //多行文本(支持Html) case "MultipleHtmlType": str7 = "Width=" + this.MultipleHtmlType_Width.Text + ",Height=" + this.MultipleHtmlType_Height.Text + ",IsEditor=" + this.IsEditor.SelectedValue + ""; break; //单选项 case "OptionType": str7 = "" + this.RadioType_Type.SelectedValue + "=" + this.RadioType_Content.Text.Trim().Replace(" ", "").Replace("\r\n", "||").Replace("|||", "||") + ",Property=" + this.RadioType_Property.Text + ",Default=" + this.RadioType_Default.Text + ""; break; //多选项 case "ListBoxType": if (this.ListBoxType_Type.SelectedValue == "3") { string r = @"^*\|*\$0$"; str7 = Regex.Replace(this.ListBoxType_Content.Text, "(\\r\\n)+", "^"); string[] s = str7.Split(new string[] { "^" }, StringSplitOptions.RemoveEmptyEntries); str7 = "" + this.ListBoxType_Type.SelectedValue + "="; for (int i = 0; i < s.Length; i++) { if (!(Regex.IsMatch(s[i], r))) { str7 += s[i].Trim() + "|" + s[i].Trim() + "$0"; if (i < s.Length - 1) { str7 += "||"; } } else { str7 += s[i]; if (i < s.Length - 1) { str7 += "||"; } } } } else { str7 = "" + this.ListBoxType_Type.SelectedValue + "=" + this.ListBoxType_Content.Text.Trim().Replace(" ", "").Replace("\r\n", "||").Replace("|||", "||") + ""; } break; //数字 case "NumType": str7 = "TitleSize=" + this.NumberType_TitleSize.Text + ",NumberType=" + this.NumberType_Style.SelectedValue + ",DefaultValue=" + this.NumberType_DefaultValue.Text + ""; break; //日期时间 case "DateType": str7 = ""; break; //图片 case "PicType": str7 = "Warter=" + this.RBLPicWaterMark.SelectedValue + ",MaxPicSize=" + this.TxtSPicSize.Text + ",PicFileExt=" + this.TxtPicExt.Text; break; //多图片 case "MultiPicType": str7 = "ChkThumb=" + (this.ChkThumb.Checked ? "1" : "0") + ",ThumbField=" + this.TxtThumb.Text + ",Warter=" + this.RBLPicWaterMark.SelectedValue + ",MaxPicSize=" + this.TxtSPicSize.Text + ",PicFileExt=" + this.TextImageType.Text; break; //文件 case "FileType": str7 = "ChkFileSize=" + (this.ChkFileSize.Checked ? "1" : "0") + ",FileSizeField=" + this.TxtFileSizeField.Text + ",MaxFileSize=" + this.TxtMaxFileSize.Text + ",UploadFileExt=" + this.TxtUploadFileType.Text; break; //运行平台 case "OperatingType": str7 = "TitleSize=" + this.OperatingType_TitleSize.Text + ",OperatingList=" + this.TxtOperatingOption.Text.Trim().Replace(" ", "").Replace("\r\n", "|") + ",DefaultValue=" + this.OperatingType_DefaultValue.Text; break; //超链接 case "SuperLinkType": str7 = "TitleSize=" + this.SuperLinkType_TitleSize.Text + ",DefaultValue=" + this.SuperLinkType_DefaultValue.Text; break; default: str7 = ""; break; } M_ModelField modelfield = new M_ModelField(); modelfield.ModelID = ModelID; modelfield.FieldID = FieldID; modelfield.FieldName = text; modelfield.FieldAlias = str2; modelfield.Description = str3; modelfield.FieldTips = this.Tips.Text.Trim(); modelfield.FieldType = selectedValue; modelfield.Content = str7; modelfield.IsNotNull = flag; modelfield.IsSearchForm = flag2; //modelfield.OrderID = DataConverter.CLng(this.hdfOrder.Value); modelfield.IsShow = DataConverter.CBool(Request.Form["IsShow"]); this.bll.Update(modelfield); //this.bll.ModelFieldHtml(ModelID); function.WriteSuccessMsg("修改成功!", "ApplyStyleEdit.aspx?ModelID=" + ModelID.ToString()); }
//互动模型需要扩展 public void RestoreByName(string name) { B_Model modelBll = new B_Model(); B_ModelField fieldBll = new B_ModelField(); B_Pub pubBll = new B_Pub(); string ppath = SafeSC.PathDeal(pdir + name); if (!File.Exists(ppath)) { function.WriteErrMsg("备份文件[" + name + "]不存在"); } //清空数据 modelBll.DeleteAll(); foreach (string tbname in tbnames) { SqlHelper.ExecuteSql("TRUNCATE TABLE " + tbname); } SqlHelper.ExecuteSql("TRUNCATE TABLE ZL_CommonModel"); //开始恢复 DataSet ds = new DataSet(); ds.ReadXml(ppath); //批量导入部分数据 SqlHelper.Insert_Bat(ds.Tables["ZL_Node"], SqlHelper.ConnectionString); if (ds.Tables["ZL_Pub"] != null) { SqlHelper.Insert_Bat(ds.Tables["ZL_Pub"], SqlHelper.ConnectionString); } if (ds.Tables["ZL_Node_ModelTemplate"] != null) { SqlHelper.Insert_Bat(ds.Tables["ZL_Node_ModelTemplate"], SqlHelper.ConnectionString); } if (ds.Tables["ZL_UserPromotions"] != null) { SqlHelper.Insert_Bat(ds.Tables["ZL_UserPromotions"], SqlHelper.ConnectionString); } if (ds.Tables["ZL_NodeRole"] != null) { SqlHelper.Insert_Bat(ds.Tables["ZL_NodeRole"], SqlHelper.ConnectionString); } //恢复模型数据与其对应的表 DataTable modelDT = ds.Tables["ZL_Model"]; DataTable fieldDT = ds.Tables["ZL_ModelField"]; DataTable pubDT = ds.Tables["ZL_Pub"]; foreach (DataRow dr in modelDT.Rows) { M_ModelInfo modelMod = new M_ModelInfo().GetModelFromReader(dr); ZoomLa.SQLDAL.DBHelper.Table_Del(modelMod.TableName); switch (modelMod.ModelType.ToString()) { case "3": //用户模型和黄页申请模型 modelBll.AddUserModel(modelMod); break; case "6": //店铺申请模型 modelBll.AddStoreModel(modelMod); break; case "7": //互动模型 if (pubDT == null) { break; } M_Pub pubmodel = new M_Pub(); pubmodel.PubName = modelMod.ModelName; pubmodel.PubTableName = modelMod.TableName; DataRow[] drs = pubDT.Select("PubModelID=" + modelMod.ModelID); pubmodel.PubType = drs.Length > 0 ? DataConvert.CLng(drs[0]["PubType"]) : 0; pubBll.CreateModelInfo(pubmodel); break; case "8": //功能模型 modelBll.AddFunModel(modelMod); break; default: //内容模型、商城模型、黄页内容模型、店铺商品模型 modelBll.AddModel(modelMod); break; } } //恢复字段 if (fieldDT != null && fieldDT.Rows.Count > 0) { fieldDT.DefaultView.RowFilter = "sys_type ='false'"; foreach (DataRow dr in fieldDT.DefaultView.ToTable().Rows) { int modelID = DataConvert.CLng(dr["ModelID"]); if (modelID < 1) { continue; } DataRow[] drs = modelDT.Select("ModelID='" + modelID + "'"); //OA不处理,未找到不处理 if (drs.Length < 1 || drs[0]["ModelType"].ToString().Equals("12")) { continue; } M_ModelInfo modelMod = new M_ModelInfo().GetModelFromReader(drs[0]); M_ModelField fieldMod = new M_ModelField().GetModelFromReader(dr); //Pub表会报重复 if (fieldBll.IsExists(modelMod.ModelID, fieldMod.FieldName)) { continue; } if (DBCenter.DB.Table_Exist(modelMod.TableName)) //互动表可能未创建,忽略 { fieldBll.AddModelField(modelMod, fieldMod); } } SqlHelper.ExecuteSql("TRUNCATE TABLE ZL_ModelField"); SqlHelper.Insert_Bat(fieldDT, SqlHelper.ConnectionString); } }