Example #1
0
 public void Add(M_UserGroupModelField 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("@IsList", SqlDbType.Bit), new SqlParameter("@IsUserInsert", SqlDbType.Bit), 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.IsList;
     commandParameters[9].Value = model.IsUserInsert;
     commandParameters[10].Value = model.AddDate;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "Up_UserGroupModelField_Add", commandParameters);
 }
Example #2
0
 public void Add(M_UserGroupModelField model)
 {
     this.dal.Add(model);
 }
Example #3
0
 public void Update(M_UserGroupModelField model)
 {
     this.dal.Update(model);
 }
    protected void RepUserGroupModelField_ItemCommand(object sender, RepeaterCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            int FieldId = int.Parse(e.CommandArgument.ToString());
            MUserGroupModelField = BUserGroupModelField.GetModel(FieldId);
            MUserGroupModel = BUserGroupModel.GetModel(ModelId);

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

            BUserGroupModelField.Del(FieldId);
            BModelField.DelField(MUserGroupModel.TableName, MUserGroupModelField.Name);

            if (!MUserGroupModel.IsHtml)
            {
                DataTable dt = new DataTable();
                dt = BUserGroupModelField.GetIsUserList(ModelId);
                StringBuilder sb = new StringBuilder();
                string MorePicType = "";

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (dt.Rows[i]["Type"].ToString() == "MorePicType")
                        {
                            MorePicType = "(<span id=\"txt_" + dt.Rows[i]["Name"].ToString() + "_count\" style=\"color:Red;\">0</span>)";
                        }

                        if (i == dt.Rows.Count - 1)
                        {
                            sb.Append("<tr>\r\n<td align=\"right\" class=\"bqleft\">" + dt.Rows[i]["Alias"].ToString().Trim() + "" + MorePicType + ":</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().Trim() + "" + MorePicType + ":</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");
                        }
                        MorePicType = "";
                    }
                }

                MUserGroupModel.Id = ModelId;
                MUserGroupModel.ModelHtml = sb.ToString();

                BUserGroupModel.UpdateModelHtml(MUserGroupModel);
            }

            DataList();
        }

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

            BUserGroupModelField.MoveField(ModelId, FieldId, "UpMove");

            DataList();
        }

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

            BUserGroupModelField.MoveField(ModelId, FieldId, "DownMove");

            DataList();
        }
    }
    private void GetShow()
    {
        MUserGroupModelField = BUserGroupModelField.GetModel(FieldId);

        Name.Text = MUserGroupModelField.Name;
        Alias.Text = MUserGroupModelField.Alias;
        Description.Text = MUserGroupModelField.Description;
        IsNotNull.SelectedValue = MUserGroupModelField.IsNotNull.ToString();
        IsList.SelectedValue = MUserGroupModelField.IsList.ToString();
        IsUserInsert.SelectedValue = MUserGroupModelField.IsUserInsert.ToString();
        IsSearchForm.SelectedValue = MUserGroupModelField.IsSearchForm.ToString();

        string MyType = MUserGroupModelField.Type;
        string MyContent = MUserGroupModelField.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);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        AdminGroupBll.Power_Judge(49);

        if (!string.IsNullOrEmpty(Request.QueryString["ModelId"]))
        {
            try
            {
                ModelId = int.Parse(Request.QueryString["ModelId"]);
            }
            catch { }
        }

        if (!string.IsNullOrEmpty(Request.QueryString["FieldId"]))
        {
            try
            {
                FieldId = int.Parse(Request.QueryString["FieldId"]);
            }
            catch { }
        }

        MUserGroupModel = BUserGroupModel.GetModel(ModelId);

        if (!Page.IsPostBack)
        {

            if (ModelId != 0)
            {
                if (MUserGroupModel == null)
                {
                    Function.ShowSysMsg(0, "<li>用户注册模型不存在或已经被删除</li><li><a href='UserGroupModel/UserGroupModelList.aspx'>返回用户注册模型管理列表</a> <a href='UserGroupModel/UserGroupModelFieldList.aspx?ModelId=" + ModelId + "'>返回字段管理列表</a></li>");
                }
            }

            if (FieldId != 0)
            {
                MUserGroupModelField = BUserGroupModelField.GetModel(FieldId);

                if (MUserGroupModelField == null)
                {
                    Function.ShowSysMsg(0, "<li>该字段不存在或已经被删除</li><li><a href='UserGroupModel/UserGroupModelList.aspx'>返回用户注册模型管理列表</a> <a href='UserGroupModel/UserGroupModelFieldList.aspx?ModelId=" + ModelId + "'>返回字段管理列表</a></li>");
                }

                GetShow();
                Name.Enabled = false;
                Type.Enabled = false;
                Button1.Text = " 确认修改 ";
            }

            ModelName.Text = MUserGroupModel.Name;
        }
    }
Example #7
0
 public M_UserGroupModelField GetModel(int FieldId)
 {
     SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@FieldId", SqlDbType.Int, 4), new SqlParameter("@TypeId", SqlDbType.Int, 4) };
     commandParameters[0].Value = FieldId;
     commandParameters[1].Value = 1;
     M_UserGroupModelField field = new M_UserGroupModelField();
     DataSet set = SqlHelper.ExecuteDataSet(SqlHelper.ConnectionStringKy, CommandType.StoredProcedure, "UP_UserGroupModelField_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]["IsList"].ToString() != "")
         {
             if ((set.Tables[0].Rows[0]["IsList"].ToString() == "1") || (set.Tables[0].Rows[0]["IsList"].ToString().ToLower() == "true"))
             {
                 field.IsList = true;
             }
             else
             {
                 field.IsList = false;
             }
         }
         if (set.Tables[0].Rows[0]["IsUserInsert"].ToString() != "")
         {
             if ((set.Tables[0].Rows[0]["IsUserInsert"].ToString() == "1") || (set.Tables[0].Rows[0]["IsUserInsert"].ToString().ToLower() == "true"))
             {
                 field.IsUserInsert = true;
             }
             else
             {
                 field.IsUserInsert = false;
             }
         }
         if (set.Tables[0].Rows[0]["AddDate"].ToString() != "")
         {
             field.AddDate = DateTime.Parse(set.Tables[0].Rows[0]["AddDate"].ToString());
         }
         return field;
     }
     return null;
 }