Esempio n. 1
0
 public Upload(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 2
0
 public MultiUpload(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 3
0
 public CheckBox(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 4
0
 public MultiLineHtml(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 5
0
 public MultiPicture(ModuleField moduleField)
     : base(moduleField)
 {
 }
 public CustomText(ModuleField moduleField)
     : base(moduleField)
 {
 }
 public MultiDropDownList(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 8
0
 public Captcha(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (!this.IsPostBack)
            //{
            string ModelName = Request.QueryString["ModelName"]; //表名
            string tableCode = Request.QueryString["tableCode"]; //用户数据内容GUID
            string EditMode  = Request.QueryString["EditMode"];  //编辑模式
            List <ContentModel1._5.Entities.ModelField> fields          = new List <ContentModel1._5.Entities.ModelField>();
            List <ContentModel1._5.Common.ModuleField>  moduleFieldList = new List <ContentModel1._5.Common.ModuleField>();

            #region Edit
            if (EditMode == "Edit")
            {
                using (TestDBEntities entities = new TestDBEntities())
                {
                    fields = entities.ModelField.Where(s => s.ModelName == ModelName).ToList();
                }
                //读取特定用户表数据行
                SqlConnection  con     = new SqlConnection("Data Source=180.85.152.37;Initial Catalog=TestDB;Persist Security Info=True;User ID=sa;Password=123456");
                SqlDataAdapter ada     = new SqlDataAdapter("SELECT * FROM App_" + ModelName + " WHERE " + ModelName + "Code='" + tableCode + "'", con);
                DataSet        userset = new DataSet();
                ada.Fill(userset, "usertable");
                con.Close();
                foreach (ModelField field in fields)
                {
                    #region 根据数据库中ModuleField构造对应表的字段控件
                    ContentModel1._5.Common.ModuleField commonField = new ContentModel1._5.Common.ModuleField();
                    commonField.FieldID         = field.FieldID;
                    commonField.ModelCode       = field.ModelCode;
                    commonField.ModelName       = field.ModelName;
                    commonField.TargetModelName = field.TargetModelName == null?null:field.TargetModelName;
                    commonField.Code            = field.Code;
                    commonField.Name            = field.Name;
                    commonField.Nick            = field.Nick == null ? null : field.Nick;
                    commonField.Tooltip         = field.Tooltip == null ? null : field.Tooltip;
                    commonField.Remark          = field.Remark == null ? null : field.Remark;
                    commonField.ErrorText       = field.ErrorText == null ? null : field.ErrorText;
                    commonField.NullText        = field.NullText == null ? null : field.NullText;
                    if (field.Width != null)
                    {
                        commonField.Width = Convert.ToInt16(field.Width);
                    }
                    if (field.Height != null)
                    {
                        commonField.Height = Convert.ToInt16(field.Height);
                    }
                    if (field.MaxLength != null)
                    {
                        commonField.MaxLength = Convert.ToInt16(field.MaxLength);
                    }
                    commonField.GroupCode = field.GroupCode == null ? null : field.GroupCode;
                    commonField.GroupName = field.GroupName == null ? null : field.GroupName;
                    if (field.DisplayOrder != null)
                    {
                        commonField.DisplayOrder = Convert.ToInt16(field.DisplayOrder);
                    }
                    if (field.IsRequired != null)
                    {
                        commonField.IsRequired = Convert.ToBoolean(field.IsRequired);
                    }
                    if (field.IsAllowSearch != null)
                    {
                        commonField.IsAllowSearch = Convert.ToBoolean(field.IsAllowSearch);
                    }
                    if (field.IsReadOnly != null)
                    {
                        commonField.IsReadOnly = Convert.ToBoolean(field.IsReadOnly);
                    }
                    if (field.IsVisible != null)
                    {
                        commonField.IsVisible = Convert.ToBoolean(field.IsVisible);
                    }
                    commonField.DefaultValue = field.DefaultValue == null ? null : field.DefaultValue;
                    commonField.MaxValue     = field.MaxValue == null ? null : field.MaxValue;
                    commonField.MinValue     = field.MinValue == null ? null : field.MinValue;
                    if (field.FieldType == 4 || field.FieldType == 5 || field.FieldType == 6 || field.FieldType == 7 || field.FieldType == 22 || field.FieldType == 23 || field.FieldType == 24 || field.FieldType == 25)
                    {
                        //if (field.Name.Substring(field.Name.Length - 4, 4) == "Code")
                        //{
                        //    commonField.CurrentValue = userset.Tables["usertable"].Rows[0][field.Name].ToString() == "" ? null : userset.Tables["usertable"].Rows[0][field.Name];
                        //    commonField.CurrentCode = userset.Tables["usertable"].Rows[0][field.Name].ToString() == "" ? null : userset.Tables["usertable"].Rows[0][field.Name];
                        //}
                        if (field.Name.Substring(field.Name.Length - 5, 5) == "Value")
                        {
                            commonField.CurrentValue = userset.Tables["usertable"].Rows[0][field.Name].ToString() == "" ? null : userset.Tables["usertable"].Rows[0][field.Name];
                            commonField.CurrentCode  = userset.Tables["usertable"].Rows[0][field.Name.Substring(0, field.Name.Length - 5) + "Code"].ToString() == "" ? null : userset.Tables["usertable"].Rows[0][field.Name];
                        }
                    }
                    else
                    {
                        commonField.CurrentValue = userset.Tables["usertable"].Rows[0][field.Name].ToString() == "" ? null : userset.Tables["usertable"].Rows[0][field.Name];
                    }
                    commonField.CodeCat       = field.CodeCat == null ? null : field.CodeCat;
                    commonField.DisplayFormat = field.DisplayFormat == null ? null : field.DisplayFormat;
                    if (field.HasWaterMark != null)
                    {
                        commonField.HasWaterMark = Convert.ToBoolean(field.HasWaterMark);
                    }
                    if (field.WaterMarkType != null)
                    {
                        commonField.WaterMarkType = field.WaterMarkType == null ? null : field.WaterMarkType;
                    }
                    if (field.ImageSize != null)
                    {
                        commonField.ImageSize = Convert.ToInt16(field.ImageSize);
                    }
                    if (field.SingleOrMultiple != null)
                    {
                        commonField.SingleOrMultiple = Convert.ToBoolean(field.SingleOrMultiple);
                    }
                    if (field.FieldType != null)
                    {
                        commonField.FieldType = (FieldType)field.FieldType;
                    }
                    else
                    {
                        commonField.FieldType = FieldType.None;
                    }
                    #endregion
                    moduleFieldList.Add(commonField);
                }
                /// <summary>
                /// 初始化该页面并添加到主页面中
                /// </summary>
                PageInput pi   = new PageInput(moduleFieldList, this);
                Control   ctrl = pi.Build();
                this.Form.Controls.Add(new LiteralControl("<br>"));
                this.Form.Controls.Add(new LiteralControl("<br>"));
                this.Form.Controls.Add(new LiteralControl("<br>"));
                this.Form.Controls.Add(new LiteralControl("<br>"));
                this.Form.Controls.Add(new LiteralControl("<table border='1' align= 'center'>"));
                this.Form.Controls.Add(ctrl);
                this.Form.Controls.Add(new LiteralControl("<td>"));
                this.Form.Controls.Add(new LiteralControl("</td>"));
                this.Form.Controls.Add(new LiteralControl("<td>"));
                ASPxButton button = new ASPxButton();
                button.Click += new EventHandler(this.update_Click);
                button.Text   = "提交更改";
                //button.Attributes.Add("onclick", "myButton_Click");
                this.Form.Controls.Add(button);
                this.Form.Controls.Add(new LiteralControl("</td>"));
                this.Form.Controls.Add(new LiteralControl("</table>"));
            }
            #endregion
            #region Add
            else
            {
                using (TestDBEntities entities = new TestDBEntities())
                {
                    fields = entities.ModelField.Where(s => s.ModelName == ModelName).ToList();
                }
                foreach (ModelField field in fields)
                {
                    #region 根据数据库中ModuleField构造对应表的字段控件
                    ContentModel1._5.Common.ModuleField commonField = new ContentModel1._5.Common.ModuleField();
                    commonField.FieldID         = field.FieldID;
                    commonField.ModelCode       = field.ModelCode;
                    commonField.ModelName       = field.ModelName;
                    commonField.TargetModelName = field.TargetModelName == null ? null : field.TargetModelName;
                    commonField.Code            = field.Code;
                    commonField.Name            = field.Name;
                    commonField.Nick            = field.Nick == null ? null : field.Nick;
                    commonField.Tooltip         = field.Tooltip == null ? null : field.Tooltip;
                    commonField.Remark          = field.Remark == null ? null : field.Remark;
                    commonField.ErrorText       = field.ErrorText == null ? null : field.ErrorText;
                    commonField.NullText        = field.NullText == null ? null : field.NullText;
                    if (field.Width != null)
                    {
                        commonField.Width = Convert.ToInt16(field.Width);
                    }
                    if (field.Height != null)
                    {
                        commonField.Height = Convert.ToInt16(field.Height);
                    }
                    if (field.MaxLength != null)
                    {
                        commonField.MaxLength = Convert.ToInt16(field.MaxLength);
                    }
                    commonField.GroupCode = field.GroupCode == null ? null : field.GroupCode;
                    commonField.GroupName = field.GroupName == null ? null : field.GroupName;
                    if (field.DisplayOrder != null)
                    {
                        commonField.DisplayOrder = Convert.ToInt16(field.DisplayOrder);
                    }
                    if (field.IsRequired != null)
                    {
                        commonField.IsRequired = Convert.ToBoolean(field.IsRequired);
                    }
                    if (field.IsAllowSearch != null)
                    {
                        commonField.IsAllowSearch = Convert.ToBoolean(field.IsAllowSearch);
                    }
                    if (field.IsReadOnly != null)
                    {
                        commonField.IsReadOnly = Convert.ToBoolean(field.IsReadOnly);
                    }
                    if (field.IsVisible != null)
                    {
                        commonField.IsVisible = Convert.ToBoolean(field.IsVisible);
                    }
                    commonField.DefaultValue  = field.DefaultValue == null ? null : field.DefaultValue;
                    commonField.MaxValue      = field.MaxValue == null ? null : field.MaxValue;
                    commonField.MinValue      = field.MinValue == null ? null : field.MinValue;
                    commonField.CodeCat       = field.CodeCat == null ? null : field.CodeCat;
                    commonField.DisplayFormat = field.DisplayFormat == null ? null : field.DisplayFormat;
                    if (field.HasWaterMark != null)
                    {
                        commonField.HasWaterMark = Convert.ToBoolean(field.HasWaterMark);
                    }
                    if (field.WaterMarkType != null)
                    {
                        commonField.WaterMarkType = field.WaterMarkType == null ? null : field.WaterMarkType;
                    }
                    if (field.ImageSize != null)
                    {
                        commonField.ImageSize = Convert.ToInt16(field.ImageSize);
                    }
                    if (field.SingleOrMultiple != null)
                    {
                        commonField.SingleOrMultiple = Convert.ToBoolean(field.SingleOrMultiple);
                    }
                    if (field.FieldType != null)
                    {
                        commonField.FieldType = (FieldType)field.FieldType;
                    }
                    else
                    {
                        commonField.FieldType = FieldType.None;
                    }
                    #endregion
                    moduleFieldList.Add(commonField);
                }
                #region 测试数据

                //ModuleField selectcode = new ModuleField();
                //selectcode.FieldType = FieldType.SelectCode;
                //selectcode.Nick = "代码选择:";
                //selectcode.CodeCat = "003";
                ////selectcode.Width = 500;
                ////selectcode.Height = 400;
                //selectcode.SingleOrMultiple = true;
                //selectcode.DisplayFormat = CommonField.TreeList.ToString();
                //moduleFieldList.Add(selectcode);

                #endregion
                PageInput pi   = new PageInput(moduleFieldList, this);
                Control   ctrl = pi.Build();
                this.Form.Controls.Add(new LiteralControl("<br>"));
                this.Form.Controls.Add(new LiteralControl("<br>"));
                this.Form.Controls.Add(new LiteralControl("<br>"));
                this.Form.Controls.Add(new LiteralControl("<br>"));
                this.Form.Controls.Add(new LiteralControl("<table border='1' align= 'center'>"));
                this.Form.Controls.Add(ctrl);
                this.Form.Controls.Add(new LiteralControl("<td>"));
                this.Form.Controls.Add(new LiteralControl("</td>"));
                this.Form.Controls.Add(new LiteralControl("<td>"));
                ASPxButton button = new ASPxButton();
                button.Click += new EventHandler(this.insert_Click);
                button.Text   = "添加";
                this.Form.Controls.Add(button);
                this.Form.Controls.Add(new LiteralControl("</td>"));
                this.Form.Controls.Add(new LiteralControl("</table>"));
                //}
            }
            #endregion
        }
Esempio n. 10
0
 public ControlBase(ModuleField moduleField)
 {
     this.ModuleField = moduleField;
 }
 public SingleLineText(ModuleField moduleField) : base(moduleField)
 {
 }
Esempio n. 12
0
 public TimeField(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 13
0
 public Color(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 14
0
 public Number(ModuleField mouduleField)
     : base(mouduleField)
 {
 }
Esempio n. 15
0
        public SelectCode(ModuleField moduleField)
            : base(moduleField)
        {
            // 解决static造成的数据冲突问题
            List <DictionaryItem> detailist = new List <DictionaryItem>();

            if (Code != null)
            {
                // 不是Role,Org,User的情况,若为上述情况,则需要保存SelectCode当前值
                if (ModuleField.CodeCat != null)
                {
                    // 若为不同类型的SL(即Nav,TreeList,GridView情况)
                    if (Code.StartsWith(ModuleField.CodeCat))
                    {
                        int len = Code.Length + 4;
                        using (TestDBEntities entity = new TestDBEntities())
                        {
                            detailist = entity.DictionaryItem.Where(pp => pp.DictionaryItemCode.StartsWith(Code) && pp.DictionaryItemCode.Length == len).ToList();
                        }
                        _codedetaillist = detailist;
                    }
                    else
                    {
                        Code            = ModuleField.CodeCat;
                        _codedetaillist = null;
                    }
                }
                //若为Role,Org,User的情况,则需要保存SelectCode当前值
                else
                {
                    int len = Code.Length + 4;
                    using (TestDBEntities entity = new TestDBEntities())
                    {
                        detailist = entity.DictionaryItem.Where(pp => pp.DictionaryItemCode.StartsWith(Code) && pp.DictionaryItemCode.Length == len).ToList();
                    }
                    _codedetaillist = detailist;
                }

                //// 用于Nav
                //int len = Code.Length + 4;
                //using (TestDBEntities entity = new TestDBEntities())
                //{
                //    detailist = entity.DictionaryItem.Where(pp => pp.DictionaryItemCode.StartsWith(Code) && pp.DictionaryItemCode.Length == len).ToList();
                //}
                //_codedetaillist = detailist;

                //if (Code.Equals(ModuleField.CodeCat) && ModuleField.CodeCat != null)
                //{
                //    int len = Code.Length + 4;
                //    using (TestDBEntities entity = new TestDBEntities())
                //    {
                //        detailist = entity.DictionaryItem.Where(pp => pp.DictionaryItemCode.StartsWith(Code) && pp.DictionaryItemCode.Length == len).ToList();
                //    }
                //    _codedetaillist = detailist;
                //}
                //else
                //{
                //    Code = null;
                //    _codedetaillist = null;
                //}
            }
        }
Esempio n. 16
0
 public RadioButton(ModuleField moduleField)  : base(moduleField)
 {
 }
 public SingleDropDownList(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 18
0
 public PhoneFixed(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 19
0
 public Picture(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 20
0
 public Vote(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 21
0
 public PhoneMobile(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 22
0
 public DateField(ModuleField moduleField) : base(moduleField)
 {
 }
Esempio n. 23
0
 public Money(ModuleField moduleField)
     : base(moduleField)
 {
 }
Esempio n. 24
0
 public Link(ModuleField moduleField)
     : base(moduleField)
 {
 }