Exemple #1
0
        // 保存并关闭
        protected void btnSaveClose_Click(object sender, EventArgs e)
        {
            int  id   = Asp.GetQueryIntValue("id").Value;
            User item = DAL.User.Get(id);

            DAL.User.SetPassword(item, tbxPassword.Text.Trim());
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
Exemple #2
0
        // 初始化
        protected void Page_Load(object sender, EventArgs e)
        {
            string typeName = "App.DAL.Log"; // Request.QueryString["type"];

            this.SimpleForm1.EntityTypeName = typeName;
            this.SimpleForm1.EntityID       = Asp.GetQueryIntValue("id").Value;
            this.SimpleForm1.Mode           = PageMode.View;
            this.SimpleForm1.InitForm();
        }
Exemple #3
0
        // 初始化
        protected void Page_Load(object sender, EventArgs e)
        {
            string typeName = Request.QueryString["type"];

            this.SimpleForm1.EntityTypeName = Asp.GetQueryString("type");
            this.SimpleForm1.EntityID       = Asp.GetQueryIntValue("id").Value;
            this.SimpleForm1.Mode           = this.Mode;
            this.SimpleForm1.InitForm();
        }
Exemple #4
0
        // 清空数据
        public override void NewData()
        {
            this.lblId.Text    = "-1";
            this.tbName.Text   = "";
            this.tbSeq.Text    = "0";
            this.tbRemark.Text = "";
            int?parentId = Asp.GetQueryIntValue("parentid");

            BindDDL(parentId, parentId);
        }
Exemple #5
0
        // 新建数据
        public override void NewData()
        {
            tbName.Text     = "";
            tbUrl.Text      = "";
            tbSeq.Text      = "0";
            tbIcon.Text     = "";
            tbRemark.Text   = "";
            chkOpen.Checked = false;

            // 图标列表, 上级菜单,权限下拉框
            int?parentId = Asp.GetQueryIntValue("parentid");

            BindDDLMenu(parentId, null);
            BindDDLPower(null);
            BindIcons("");
        }
Exemple #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int id   = Asp.GetQueryIntValue("id").Value;
         var item = DAL.Article.Get(id);
         item.VisitCnt += 1;
         item.Save();
         this.lblTitle.Text       = item.Title;
         this.lblAuthor.Text      = item.Author;
         this.lblPostDt.Text      = item.PostDt.ToString("yyyy-MM-dd");
         this.lblVisitCnt.Text    = item.VisitCnt.ToText();
         this.lblContent.Text     = item.Body;
         this.rptImage.DataSource = item.Images;
         this.rptImage.DataBind();
     }
 }
Exemple #7
0
        // 读取用户信息
        private void LoadData()
        {
            int  id   = Asp.GetQueryIntValue("id").Value;
            User user = DAL.User.Get(id);

            if (user == null)
            {
                Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
                return;
            }
            if (user.Name == "admin" && AuthHelper.GetIdentityName() != "admin")
            {
                Alert.Show("你无权编辑超级管理员!", String.Empty, ActiveWindow.GetHideReference());
                return;
            }
            labUserName.Text     = user.Name;
            labUserRealName.Text = user.RealName;
        }
Exemple #8
0
        /// <summary>
        /// 显示表单,请在页面首次初始化代码中调用
        /// </summary>
        public void ShowForm()
        {
            // 新建
            var mode = this.Mode;

            if (mode == PageMode.New)
            {
                NewData();
                ShowButtons(true, true, true);
                return;
            }

            // 尝试获取实体
            var id = Asp.GetQueryIntValue("id");

            if (id == null)
            {
                return;
            }
            T item = GetData(id.Value);

            if (item == null)
            {
                Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
                return;
            }

            // 显示表单数据
            ShowData(item);

            // 查看或编辑
            if (mode == PageMode.View)
            {
                ShowButtons(true, false, false);
                FormHelper.SetFormEditable(this.frm, false);
            }
            if (mode == PageMode.Edit)
            {
                ShowButtons(true, true, false);
            }
        }
Exemple #9
0
 /// <summary>保存(含新增或修改逻辑)</summary>
 public virtual bool Save()
 {
     try
     {
         T item = (this.Mode == PageMode.New) ? AppContext.Current.Set <T>().Create() : GetData(Asp.GetQueryIntValue("id").Value);
         CollectData(ref item);
         var error = CheckData(item);
         if (!error.IsNullOrEmpty())
         {
             UI.ShowAlert(error);
             return(false);
         }
         else
         {
             SaveData(item);
             return(true);
         }
     }
     catch (Exception ex)
     {
         UI.ShowAlert("保存失败。{0}", ex.Message);
         return(false);
     }
 }