Example #1
0
        /// <summary>
        /// 点击确定按钮执行的方法
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.AR_Report AR_Report_bll = new Maticsoft.BLL.AR_Report();
            Maticsoft.Model.AR_Report AR_Report_model = AR_Report_bll.GetModel(ReportID);
            if (AR_Report_model == null)
            {
                AR_Report_model = new Maticsoft.Model.AR_Report();
            }

            AR_Report_model.R_Type = 2;
            AR_Report_model.R_Title = R_Title.Text;
            AR_Report_model.R_Content = R_Content.Text;
            AR_Report_model.R_DateTime = DateTime.Now;
            AR_Report_model.R_ResponsibilityUserID = UserData.GetUserDate.UserID;  //获取当前用户ID
            AR_Report_model.R_GroupID = UserData.GetUserDate.U_GroupID;
            switch (CMD)
            {
                case "New":
                    CMD_Txt = "增加";
                    //如果是增加操作,就调用Add方法
                    AR_Report_model.ReportID = AR_Report_bll.Add(AR_Report_model);
                    break;
                case "Edit":
                    CMD_Txt = "修改";
                    //如果是修改操作,就调用Update方法
                    AR_Report_bll.Update(AR_Report_model);
                    break;
            }
            All_Title_Txt = CMD_Txt + App_Txt;
            EventMessage.MessageBox(1, "操作成功", string.Format("{1}ID({0})成功!", AR_Report_model.ReportID, All_Title_Txt), Icon_Type.OK, Common.GetHomeBaseUrl("default.aspx"));
        }
Example #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.AR_Report DataRowToModel(DataRow row)
 {
     Maticsoft.Model.AR_Report model=new Maticsoft.Model.AR_Report();
     if (row != null)
     {
         if(row["ReportID"]!=null && row["ReportID"].ToString()!="")
         {
             model.ReportID=int.Parse(row["ReportID"].ToString());
         }
         if(row["R_Title"]!=null)
         {
             model.R_Title=row["R_Title"].ToString();
         }
         if(row["R_Content"]!=null)
         {
             model.R_Content=row["R_Content"].ToString();
         }
         if(row["R_DateTime"]!=null && row["R_DateTime"].ToString()!="")
         {
             model.R_DateTime=DateTime.Parse(row["R_DateTime"].ToString());
         }
         if(row["R_ResponsibilityUserID"]!=null && row["R_ResponsibilityUserID"].ToString()!="")
         {
             model.R_ResponsibilityUserID=int.Parse(row["R_ResponsibilityUserID"].ToString());
         }
     }
     return model;
 }
Example #3
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr="";
            if(this.txtR_Title.Text.Trim().Length==0)
            {
                strErr+="报告标题不能为空!\\n";
            }
            if(this.txtR_Content.Text.Trim().Length==0)
            {
                strErr+="报告内容不能为空!\\n";
            }
            if(!PageValidate.IsDateTime(txtR_DateTime.Text))
            {
                strErr+="报告时间格式错误!\\n";
            }
            if(!PageValidate.IsNumber(txtR_ResponsibilityUserID.Text))
            {
                strErr+="责任人格式错误!\\n";
            }

            if(strErr!="")
            {
                MessageBox.Show(this,strErr);
                return;
            }
            int ReportID=int.Parse(this.lblReportID.Text);
            string R_Title=this.txtR_Title.Text;
            string R_Content=this.txtR_Content.Text;
            DateTime R_DateTime=DateTime.Parse(this.txtR_DateTime.Text);
            int R_ResponsibilityUserID=int.Parse(this.txtR_ResponsibilityUserID.Text);

            Maticsoft.Model.AR_Report model=new Maticsoft.Model.AR_Report();
            model.ReportID=ReportID;
            model.R_Title=R_Title;
            model.R_Content=R_Content;
            model.R_DateTime=R_DateTime;
            model.R_ResponsibilityUserID=R_ResponsibilityUserID;

            Maticsoft.BLL.AR_Report bll=new Maticsoft.BLL.AR_Report();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!","list.aspx");
        }
Example #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.AR_Report GetModel(int ReportID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 ReportID,R_Title,R_Content,R_DateTime,R_ResponsibilityUserID from AR_Report ");
            strSql.Append(" where ReportID=@ReportID");
            SqlParameter[] parameters = {
                    new SqlParameter("@ReportID", SqlDbType.Int,4)
            };
            parameters[0].Value = ReportID;

            Maticsoft.Model.AR_Report model=new Maticsoft.Model.AR_Report();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }