Exemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         Bind();
         if (!string.IsNullOrEmpty(Request["enum"]))
         {
             string enumName = Request["enum"].Trim(new char[] { '【', '】' });
             txtName.Text = enumName;
             EnumInfoModel info = DbDataLoader.GetEnumInfo(SlnID, enumName).FirstOrDefault();
             if (info != null)
             {
                 txtDescription.Text = info.enumDescription;
                 txtValueInfo.Text   = info.enumValueInfo;
                 AddorEditMode(true);
                 EditKey.Text = info.ID.ToString();
             }
             else
             {
                 txtName.Text = enumName;
                 AddorEditMode(false);
             }
         }
     }
 }
Exemplo n.º 2
0
        protected void GridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int id = int.Parse(e.CommandArgument.ToString());

            switch (e.CommandName)
            {
            case "sel":
            {
                EnumInfoModel info = DbDataLoader.GetEnumInfo(f =>
                    {
                        f.Condition = f.FormatExpression("ID");
                        f.AddParam("ID", id);
                    }).FirstOrDefault();
                txtName.Text        = info.enumName;
                txtDescription.Text = info.enumDescription;
                txtValueInfo.Text   = info.enumValueInfo;
                AddorEditMode(true);
                EditKey.Text = e.CommandArgument.ToString();
            }
            break;

            case "del":
            {
                DbDataLoader.Delete(new EnumInfoModel()
                    {
                        ID = id
                    });
                Bind();
            }
            break;
            }
        }
Exemplo n.º 3
0
        private void BindEnumInfo(int slnId)
        {
            //enum bind
            StringBuilder enumBuilder = new StringBuilder();
            var           list        = DbDataLoader.GetEnumInfo(slnId);

            if (list.Count == 0)
            {
                enumBuilder.AppendFormat("No enum value.");
            }
            foreach (var dr in list)
            {
                enumBuilder.AppendFormat("<div id=\"tabEnum_{0}\">【{0}】-{1}<br>", dr.enumName, dr.enumDescription);
                enumBuilder.AppendFormat("┗{0}<br><br></div>", dr.enumValueInfo.Replace("\r\n", "<br>┗").Replace("\n", "<br>┗").TrimEnd('┗'));
            }
            lblEnumDescp.InnerHtml = enumBuilder.ToString();
        }
Exemplo n.º 4
0
 private void Bind()
 {
     GridView.DataSource = DbDataLoader.GetEnumInfo(SlnID);
     GridView.DataBind();
 }