Beispiel #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtD_Name.Text.Trim().Length == 0)
            {
                strErr += "健康知识文档名称不能为空!\\n";
            }
            if (this.txtD_Url.Text.Trim().Length == 0)
            {
                strErr += "健康知识文档地址不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string D_Name = this.txtD_Name.Text;
            string D_Url  = this.txtD_Url.Text;

            Maticsoft.Model.education_Document model = new Maticsoft.Model.education_Document();
            model.D_Name = D_Name;
            model.D_Url  = D_Url;

            Maticsoft.BLL.education_Document bll = new Maticsoft.BLL.education_Document();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Beispiel #2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtD_Name.Text.Trim().Length==0)
            {
                strErr+="健康知识文档名称不能为空!\\n";
            }
            if(this.txtD_Url.Text.Trim().Length==0)
            {
                strErr+="健康知识文档地址不能为空!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int DocumentID=int.Parse(this.lblDocumentID.Text);
            string D_Name=this.txtD_Name.Text;
            string D_Url=this.txtD_Url.Text;

            Maticsoft.Model.education_Document model=new Maticsoft.Model.education_Document();
            model.DocumentID=DocumentID;
            model.D_Name=D_Name;
            model.D_Url=D_Url;

            Maticsoft.BLL.education_Document bll=new Maticsoft.BLL.education_Document();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Beispiel #3
0
 private void ShowInfo(int DocumentID)
 {
     Maticsoft.BLL.education_Document bll=new Maticsoft.BLL.education_Document();
     Maticsoft.Model.education_Document model=bll.GetModel(DocumentID);
     this.lblDocumentID.Text=model.DocumentID.ToString();
     this.txtD_Name.Text=model.D_Name;
     this.txtD_Url.Text=model.D_Url;
 }
Beispiel #4
0
 private void ShowInfo(int DocumentID)
 {
     Maticsoft.BLL.education_Document   bll   = new Maticsoft.BLL.education_Document();
     Maticsoft.Model.education_Document model = bll.GetModel(DocumentID);
     this.lblDocumentID.Text = model.DocumentID.ToString();
     this.txtD_Name.Text     = model.D_Name;
     this.txtD_Url.Text      = model.D_Url;
 }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Maticsoft.BLL.education_Document bll=new Maticsoft.BLL.education_Document();
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             int DocumentID=(Convert.ToInt32(Request.Params["id"]));
             bll.Delete(DocumentID);
             Response.Redirect("list.aspx");
         }
     }
 }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         Maticsoft.BLL.education_Document bll = new Maticsoft.BLL.education_Document();
         if (Request.Params["id"] != null && Request.Params["id"].Trim() != "")
         {
             int DocumentID = (Convert.ToInt32(Request.Params["id"]));
             bll.Delete(DocumentID);
             Response.Redirect("list.aspx");
         }
     }
 }
Beispiel #7
0
        /// <summary>
        /// 点击确定按钮执行的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.education_Document education_Document_bll = new Maticsoft.BLL.education_Document();
            Maticsoft.Model.education_Document education_Document_model = education_Document_bll.GetModel(DocumentID);
            if (education_Document_model == null)
            {
                education_Document_model = new Maticsoft.Model.education_Document();
            }

            education_Document_model.D_Name = D_Name.Text;
            education_Document_model.D_UserID = UserData.GetUserDate.UserID;
            education_Document_model.D_DateTime = Convert.ToDateTime(DateTime.Now.ToShortDateString());
            education_Document_model.D_Committee = UserData.GetUserDate.U_GroupID;

            switch (CMD)
            {
                case "New":
                    CMD_Txt = "增加";
                    FileUpLoadCommon fc = new FileUpLoadCommon(Common.UpLoadDir + "Document/", false);
                    bool flag = fc.SaveFile(D_Url, false);
                    if (flag)
                    {
                        education_Document_model.D_Url = fc.newFileName;
                        education_Document_model.DocumentID = education_Document_bll.Add(education_Document_model);
                    }
                    else
                    {
                        EventMessage.MessageBox(1, "操作失败", fc.errorMsg, Icon_Type.Error, Common.GetHomeBaseUrl("InfoManager.aspx?CMD=New"));
                    }
                    break;
                case "Edit":
                    CMD_Txt = "修改";
                    education_Document_bll.Update(education_Document_model);
                    break;
            }
            All_Title_Txt = CMD_Txt + App_Txt;
            EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", education_Document_model.DocumentID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
        }
Beispiel #8
0
 /// <summary>
 /// 绑定列表数据
 /// </summary>
 private void BindData()
 {
     string orderby = OrderType == 0 ? Orderfld + " asc" : Orderfld + " desc";
     int startIndex = (this.AspNetPager1.CurrentPageIndex - 1) * this.AspNetPager1.PageSize + 1;
     int endIndex = this.AspNetPager1.CurrentPageIndex * this.AspNetPager1.PageSize;
     Maticsoft.BLL.education_Document bll = new Maticsoft.BLL.education_Document();
     DataSet datas = bll.GetListByPage(SearchTerms, orderby, startIndex, endIndex);
     GridView1.DataSource = datas;
     GridView1.DataBind();
     this.AspNetPager1.RecordCount = bll.GetRecordCount(SearchTerms);
 }
Beispiel #9
0
 /// <summary>
 /// 在编辑的时候将对应的值绑定到Label上
 /// </summary>
 private void InputData()
 {
     Maticsoft.BLL.education_Document education_Document_bll = new Maticsoft.BLL.education_Document();
     Maticsoft.Model.education_Document education_Document_model = education_Document_bll.GetModel(DocumentID);
     if (education_Document_model != null)
     {
         D_Name.Text = education_Document_model.D_Name;
         D_Url.Visible = false;
         D_Url_link.Visible = true;
         D_Url_link.HRef = Page.ResolveUrl("~/") + "Manager/Public/Document/" + education_Document_model.D_Url;
         D_Url_link.InnerText = education_Document_model.D_Url;
     }
 }
Beispiel #10
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void OnStart()
        {
            if (CMD == "New")
            {

            }
            else if (CMD == "Edit")
            {
                HeadMenuButtonItem bi2 = new HeadMenuButtonItem();
                bi2.ButtonPopedom = PopedomType.Delete;
                bi2.ButtonUrlType = UrlType.JavaScript;
                bi2.ButtonUrl = string.Format("DelData('?CMD=Delete&DocumentID={0}')", DocumentID);
                HeadMenuWebControls1.ButtonList.Add(bi2);

                InputData();
            }
            else if (CMD == "Delete")
            {
                Maticsoft.BLL.education_Document bll = new Maticsoft.BLL.education_Document();
                Maticsoft.Model.education_Document model = bll.GetModel(DocumentID);
                bll.Delete(model.DocumentID);
                if (model.D_Url != "")
                    File.Delete(Server.MapPath("~/") + "Manager\\Public\\Document\\" + model.D_Url); //删除本地文件
                EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", DocumentID, "删除信息"), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
            }
        }