Esempio n. 1
0
        /// <summary>
        /// 点击确定按钮执行的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.AR_Announcement AR_Announcement_bll = new Maticsoft.BLL.AR_Announcement();
            Maticsoft.Model.AR_Announcement AR_Announcement_model = AR_Announcement_bll.GetModel(AnnouncementID);
            if (AR_Announcement_model == null)
            {
                AR_Announcement_model = new Maticsoft.Model.AR_Announcement();
            }

            AR_Announcement_model.A_Type = Convert.ToInt32(A_Type.SelectedValue);
            AR_Announcement_model.A_Title = A_Title.Text;
            AR_Announcement_model.A_Content = A_Content.Text;
            AR_Announcement_model.A_DateTime = DateTime.Now;
            AR_Announcement_model.A_ResponsibilityUserID = UserData.GetUserDate.UserID;  //获取当前用户ID
            AR_Announcement_model.A_GroupID = UserData.GetUserDate.U_GroupID;
            switch (CMD)
            {
                case "New":
                    CMD_Txt = "增加";
                    //如果是增加操作,就调用Add方法
                    AR_Announcement_model.AnnouncementID = AR_Announcement_bll.Add(AR_Announcement_model);
                    break;
                case "Edit":
                    CMD_Txt = "修改";
                    //如果是修改操作,就调用Update方法
                    AR_Announcement_bll.Update(AR_Announcement_model);
                    break;
            }
            All_Title_Txt = CMD_Txt + App_Txt;
            //以下方法的第4个参数需要更改
            EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", AR_Announcement_model.AnnouncementID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
        }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtA_Title.Text.Trim().Length == 0)
            {
                strErr += "公告标题不能为空!\\n";
            }
            if (this.txtA_Content.Text.Trim().Length == 0)
            {
                strErr += "公告内容不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtA_DateTime.Text))
            {
                strErr += "公告时间格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtA_ResponsibilityUserID.Text))
            {
                strErr += "责任人格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtA_Type.Text))
            {
                strErr += "公告类型格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   A_Title                = this.txtA_Title.Text;
            string   A_Content              = this.txtA_Content.Text;
            DateTime A_DateTime             = DateTime.Parse(this.txtA_DateTime.Text);
            int      A_ResponsibilityUserID = int.Parse(this.txtA_ResponsibilityUserID.Text);
            int      A_Type = int.Parse(this.txtA_Type.Text);

            Maticsoft.Model.AR_Announcement model = new Maticsoft.Model.AR_Announcement();
            model.A_Title                = A_Title;
            model.A_Content              = A_Content;
            model.A_DateTime             = A_DateTime;
            model.A_ResponsibilityUserID = A_ResponsibilityUserID;
            model.A_Type = A_Type;

            Maticsoft.BLL.AR_Announcement bll = new Maticsoft.BLL.AR_Announcement();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Esempio n. 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtA_Title.Text.Trim().Length==0)
            {
                strErr+="公告标题不能为空!\\n";
            }
            if(this.txtA_Content.Text.Trim().Length==0)
            {
                strErr+="公告内容不能为空!\\n";
            }
            if(!PageValidate.IsDateTime(txtA_DateTime.Text))
            {
                strErr+="公告时间格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtA_ResponsibilityUserID.Text))
            {
                strErr+="责任人格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtA_Type.Text))
            {
                strErr+="公告类型格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            string A_Title=this.txtA_Title.Text;
            string A_Content=this.txtA_Content.Text;
            DateTime A_DateTime=DateTime.Parse(this.txtA_DateTime.Text);
            int A_ResponsibilityUserID=int.Parse(this.txtA_ResponsibilityUserID.Text);
            int A_Type=int.Parse(this.txtA_Type.Text);

            Maticsoft.Model.AR_Announcement model=new Maticsoft.Model.AR_Announcement();
            model.A_Title=A_Title;
            model.A_Content=A_Content;
            model.A_DateTime=A_DateTime;
            model.A_ResponsibilityUserID=A_ResponsibilityUserID;
            model.A_Type=A_Type;

            Maticsoft.BLL.AR_Announcement bll=new Maticsoft.BLL.AR_Announcement();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","add.aspx");
        }