public bool Update(ZoomLa.Model.M_ModelField MField) { string strSql = "PR_ModelField_Update"; SqlParameter[] cmdParams = GetParameters(MField); return(SqlHelper.ExecuteProc(strSql, cmdParams)); }
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", "|") + ",Property=" + this.RadioType_Property.Text + ",Default=" + this.RadioType_Default.Text + ""; break; //多选项 case "ListBoxType": str7 = "" + this.ListBoxType_Type.SelectedValue + "=" + this.ListBoxType_Content.Text.Trim().Replace(" ", "").Replace("\r\n", "|") + ""; 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); this.bll.Update(modelfield); //this.bll.ModelFieldHtml(ModelID); Response.Redirect("ModelField.aspx?ModelID=" + ModelID.ToString()); }
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> /// 将模型信息的各属性值传递到参数中 /// </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; }
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(); 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 = 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 = 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; } }
/// <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; }
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); }
public void Add(M_ModelField info) { this.dal.Add(info); }
public void UpdateOrder(M_ModelField info) { this.dal.UpdateOrder(info); }
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"; } }