예제 #1
0
 public M_ModelField GetModel(int FieldId)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@FieldId", SqlDbType.Int, 4) };
     commandParameters[0].Value = FieldId;
     M_ModelField field = new M_ModelField();
     DataSet set = SqlHelper.ExecuteDataSet(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "UP_ModelField_GetModel", commandParameters);
     field.FieldId = FieldId;
     if (set.Tables[0].Rows.Count > 0)
     {
         if (set.Tables[0].Rows[0]["ModelId"].ToString() != "")
         {
             field.ModelId = int.Parse(set.Tables[0].Rows[0]["ModelId"].ToString());
         }
         field.Name = set.Tables[0].Rows[0]["Name"].ToString();
         field.Alias = set.Tables[0].Rows[0]["Alias"].ToString();
         field.Description = set.Tables[0].Rows[0]["Description"].ToString();
         if (set.Tables[0].Rows[0]["IsNotNull"].ToString() != "")
         {
             if ((set.Tables[0].Rows[0]["IsNotNull"].ToString() == "1") || (set.Tables[0].Rows[0]["IsNotNull"].ToString().ToLower() == "true"))
             {
                 field.IsNotNull = true;
             }
             else
             {
                 field.IsNotNull = false;
             }
         }
         if (set.Tables[0].Rows[0]["IsSearchForm"].ToString() != "")
         {
             if ((set.Tables[0].Rows[0]["IsSearchForm"].ToString() == "1") || (set.Tables[0].Rows[0]["IsSearchForm"].ToString().ToLower() == "true"))
             {
                 field.IsSearchForm = true;
             }
             else
             {
                 field.IsSearchForm = false;
             }
         }
         field.Type = set.Tables[0].Rows[0]["Type"].ToString();
         field.Content = set.Tables[0].Rows[0]["Content"].ToString();
         if (set.Tables[0].Rows[0]["OrderId"].ToString() != "")
         {
             field.OrderId = int.Parse(set.Tables[0].Rows[0]["OrderId"].ToString());
         }
         if (set.Tables[0].Rows[0]["AddDate"].ToString() != "")
         {
             field.AddDate = DateTime.Parse(set.Tables[0].Rows[0]["AddDate"].ToString());
         }
         return field;
     }
     return null;
 }
예제 #2
0
 public void Add(M_ModelField model)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@ModelId", SqlDbType.Int, 4), new SqlParameter("@Name", SqlDbType.NVarChar), new SqlParameter("@Alias", SqlDbType.NVarChar), new SqlParameter("@Description", SqlDbType.NVarChar), new SqlParameter("@IsNotNull", SqlDbType.Bit), new SqlParameter("@IsSearchForm", SqlDbType.Bit), new SqlParameter("@Type", SqlDbType.NVarChar), new SqlParameter("@Content", SqlDbType.NText), new SqlParameter("@AddDate", SqlDbType.DateTime) };
     commandParameters[0].Value = model.ModelId;
     commandParameters[1].Value = model.Name;
     commandParameters[2].Value = model.Alias;
     commandParameters[3].Value = model.Description;
     commandParameters[4].Value = model.IsNotNull;
     commandParameters[5].Value = model.IsSearchForm;
     commandParameters[6].Value = model.Type;
     commandParameters[7].Value = model.Content;
     commandParameters[8].Value = model.AddDate;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_ModelField_Add", commandParameters);
 }
예제 #3
0
    protected void RepModelField_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        M_InfoModel infoModel = InfoModelBll.GetModel(ModelId);
        if (e.CommandName == "Delete")
        {
            int FieldId = int.Parse(e.CommandArgument.ToString());
            MModelField = BModelField.GetModel(FieldId);

            if (MModelField.Type == "ErLinkageType")
            {
                BModelField.DelField(infoModel.TableName, BModelField.GetFieldContent(MModelField.Content, 2, 1));
                BModelField.DelField(infoModel.TableName, BModelField.GetFieldContent(MModelField.Content, 2, 1) + "_Id");
                BModelField.DelField(infoModel.TableName, MModelField.Name+"_Id");
            }

            //if (MModelField.Type == "SanLinkageType")
            //{
            //    BModelField.DelField(infoModel.TableName, BModelField.GetFieldContent(MModelField.Content, 2, 1));
            //    BModelField.DelField(infoModel.TableName, BModelField.GetFieldContent(MModelField.Content, 4, 1));
            //}
            BModelField.Del(FieldId);
            BModelField.DelField(infoModel.TableName, MModelField.Name);
        }

        if (e.CommandName == "UpMove")
        {
            int FieldId = int.Parse(e.CommandArgument.ToString());

            BModelField.MoveField(ModelId, FieldId, "UpMove");
        }

        if (e.CommandName == "DownMove")
        {
            int FieldId = int.Parse(e.CommandArgument.ToString());

            BModelField.MoveField(ModelId, FieldId, "DownMove");
        }

        #region 自动生成
        if (!infoModel.IsHtml)
        {
            DataTable dt = new DataTable();
            dt = BModelField.GetList(ModelId);
            StringBuilder sb = new StringBuilder();

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (i == dt.Rows.Count - 1)
                    {
                        sb.Append("<tr>\r\n<td align=\"right\" class=\"bqleft\">" + dt.Rows[i]["Alias"].ToString() + ":</td>\r\n<td class=\"bqright\">" + GetShowStyle(dt.Rows[i]["Name"].ToString(), dt.Rows[i]["IsNotNull"].ToString(), dt.Rows[i]["Type"].ToString(), dt.Rows[i]["Content"].ToString(), dt.Rows[i]["Description"].ToString()) + "</td>\r\n</tr>");
                    }
                    else
                    {
                        sb.Append("<tr>\r\n<td align=\"right\" class=\"bqleft\">" + dt.Rows[i]["Alias"].ToString() + ":</td>\r\n<td class=\"bqright\">" + GetShowStyle(dt.Rows[i]["Name"].ToString(), dt.Rows[i]["IsNotNull"].ToString(), dt.Rows[i]["Type"].ToString(), dt.Rows[i]["Content"].ToString(), dt.Rows[i]["Description"].ToString()) + "</td>\r\n</tr>\r\n");
                    }
                }
            }

            MInfoModel.ModelId = ModelId;
            MInfoModel.ModelHtml = sb.ToString();

            BInfoModel.UpdateModelHtml(MInfoModel);
        }
        DataList();
        #endregion
    }
예제 #4
0
 public void Add(M_ModelField model)
 {
     this.dal.Add(model);
 }
예제 #5
0
 public void Update(M_ModelField model)
 {
     this.dal.Update(model);
 }
예제 #6
0
    private void GetShow()
    {
        MModelField = BModelField.GetModel(FieldId);

        Name.Text = MModelField.Name;
        Alias.Text = MModelField.Alias;
        Description.Text = MModelField.Description;
        IsNotNull.SelectedValue = MModelField.IsNotNull.ToString();
        IsSearchForm.SelectedValue = MModelField.IsSearchForm.ToString();

        string MyType = MModelField.Type;
        string MyContent = MModelField.Content;

        Type.SelectedValue = MyType;

        if (MyType == "TextType")
        {
            TitleSize.Text = BModelField.GetFieldContent(MyContent, 0, 1);
            IsPassword.SelectedValue = BModelField.GetFieldContent(MyContent, 1, 1);
            TextType_DefaultValue.Text = BModelField.GetFieldContent(MyContent, 2, 1);
        }

        if (MyType == "MultipleTextType")
        {
            MultipleTextType_Width.Text = BModelField.GetFieldContent(MyContent, 0, 1);
            MultipleTextType_Height.Text = BModelField.GetFieldContent(MyContent, 1, 1);
        }

        if (MyType == "MultipleHtmlType")
        {
            MultipleHtmlType_Width.Text = BModelField.GetFieldContent(MyContent, 0, 1);
            MultipleHtmlType_Height.Text = BModelField.GetFieldContent(MyContent, 1, 1);
            IsEditor.SelectedValue = BModelField.GetFieldContent(MyContent, 2, 1);
        }

        if (MyType == "RadioType")
        {
            RadioType_Content.Text = Function.Decode(BModelField.GetFieldContent(MyContent, 0, 1).Replace("|", "<br>"));
            RadioType_Type.SelectedValue = BModelField.GetFieldContent(MyContent, 0, 0);
            RadioType_Property.SelectedValue = BModelField.GetFieldContent(MyContent, 1, 1).ToString();
            RadioType_Default.Text = BModelField.GetFieldContent(MyContent, 2, 1).ToString();
        }

        if (MyType == "ListBoxType")
        {
            ListBoxType_Content.Text = Function.Decode(BModelField.GetFieldContent(MyContent, 0, 1).Replace("|", "<br>"));
            ListBoxType_Type.SelectedValue = BModelField.GetFieldContent(MyContent, 0, 0);
        }

        if (MyType == "NumberType")
        {
            NumberType_TitleSize.Text = BModelField.GetFieldContent(MyContent, 0, 1);
            NumberType_DefaultValue.Text = BModelField.GetFieldContent(MyContent, 1, 1);
        }

        if (MyType == "ErLinkageType")
        {
            ErLinkage_Value.Text = BModelField.GetFieldContent(MyContent, 0, 1);
            MDictionary = BDictionary.GetModel(int.Parse(BModelField.GetFieldContent(MyContent, 0, 1)));
            ErLinkage_Value_Show.Text = MDictionary.DicName;
            ErLinkage_Er_Alias.Text = BModelField.GetFieldContent(MyContent, 1, 1);
            ErLinkage_Er_Name.Text = BModelField.GetFieldContent(MyContent, 2, 1);
        }

        if (MyType == "SanLinkageType")
        {
            SanLinkage_Value.Text = BModelField.GetFieldContent(MyContent, 0, 1);
            SanLinkage_Er_Alias.Text = BModelField.GetFieldContent(MyContent, 1, 1);
            SanLinkage_Er_Name.Text = BModelField.GetFieldContent(MyContent, 2, 1);
            SanLinkage_San_Alias.Text = BModelField.GetFieldContent(MyContent, 3, 1);
            SanLinkage_San_Name.Text = BModelField.GetFieldContent(MyContent, 4, 1);
        }
    }