/// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.NewPort.Table_monthlyFeedback model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Table_monthlyFeedback(");
            strSql.Append("monthlyFeedback_sn,monthlyFeedback_yyyyMM,project_id,monthlyFeedback_fulfilment,monthlyFeedback_fulfilmentDescription,monthlyFeedback_writer)");
            strSql.Append(" values (");
            strSql.Append("@monthlyFeedback_sn,@monthlyFeedback_yyyyMM,@project_id,@monthlyFeedback_fulfilment,@monthlyFeedback_fulfilmentDescription,@monthlyFeedback_writer)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@monthlyFeedback_sn",                    SqlDbType.Char,     10),
                new SqlParameter("@monthlyFeedback_yyyyMM",                SqlDbType.DateTime,  3),
                new SqlParameter("@project_id",                            SqlDbType.Char,      8),
                new SqlParameter("@monthlyFeedback_fulfilment",            SqlDbType.Float,     8),
                new SqlParameter("@monthlyFeedback_fulfilmentDescription", SqlDbType.NText),
                new SqlParameter("@monthlyFeedback_writer",                SqlDbType.NChar, 20)
            };
            parameters[0].Value = model.monthlyFeedback_sn;
            parameters[1].Value = model.monthlyFeedback_yyyyMM;
            parameters[2].Value = model.project_id;
            parameters[3].Value = model.monthlyFeedback_fulfilment;
            parameters[4].Value = model.monthlyFeedback_fulfilmentDescription;
            parameters[5].Value = model.monthlyFeedback_writer;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.NewPort.Table_monthlyFeedback DataRowToModel(DataRow row)
 {
     Maticsoft.Model.NewPort.Table_monthlyFeedback model = new Maticsoft.Model.NewPort.Table_monthlyFeedback();
     if (row != null)
     {
         if (row["monthlyFeedback_sn"] != null)
         {
             model.monthlyFeedback_sn = row["monthlyFeedback_sn"].ToString();
         }
         if (row["monthlyFeedback_yyyyMM"] != null && row["monthlyFeedback_yyyyMM"].ToString() != "")
         {
             model.monthlyFeedback_yyyyMM = DateTime.Parse(row["monthlyFeedback_yyyyMM"].ToString());
         }
         if (row["project_id"] != null)
         {
             model.project_id = row["project_id"].ToString();
         }
         if (row["monthlyFeedback_fulfilment"] != null && row["monthlyFeedback_fulfilment"].ToString() != "")
         {
             model.monthlyFeedback_fulfilment = decimal.Parse(row["monthlyFeedback_fulfilment"].ToString());
         }
         if (row["monthlyFeedback_fulfilmentDescription"] != null)
         {
             model.monthlyFeedback_fulfilmentDescription = row["monthlyFeedback_fulfilmentDescription"].ToString();
         }
         if (row["monthlyFeedback_writer"] != null)
         {
             model.monthlyFeedback_fulfilmentDescription = row["monthlyFeedback_writer"].ToString();
         }
     }
     return(model);
 }
        private void ShowInfo(string strid)
        {
            Maticsoft.BLL.NewPort.Table_monthlyFeedback   bll   = new Maticsoft.BLL.NewPort.Table_monthlyFeedback();
            Maticsoft.Model.NewPort.Table_monthlyFeedback model = bll.GetModel(strid);

            this.lbl_number.Text    = model.project_id.ToString();
            this.lbl_time.Text      = model.monthlyFeedback_yyyyMM.ToString();
            this.lbl_completed.Text = model.monthlyFeedback_fulfilment.ToString();
            this.lbl_process.Text   = model.monthlyFeedback_fulfilmentDescription.ToString();
        }
Example #4
0
        protected void btnmBack_Click(object sender, EventArgs e)
        {
            Maticsoft.Model.NewPort.Table_monthlyFeedback model = new Maticsoft.Model.NewPort.Table_monthlyFeedback();
            model.monthlyFeedback_sn     = monid;
            model.project_id             = DropDownList1.SelectedValue.ToString().Trim();
            model.monthlyFeedback_yyyyMM = DateTime.Now.ToUniversalTime();
            model.monthlyFeedback_fulfilmentDescription = this.txta.Value;
            model.monthlyFeedback_fulfilment            = Decimal.Parse(this.txtInvestment.Text.Trim());
            model.monthlyFeedback_writer = Session["UserName"].ToString();

            Maticsoft.BLL.NewPort.Table_monthlyFeedback bll = new Maticsoft.BLL.NewPort.Table_monthlyFeedback();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "monthlyFeedbackCheck.aspx");
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.NewPort.Table_monthlyFeedback model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Table_monthlyFeedback set ");
            strSql.Append("monthlyFeedback_yyyyMM=@monthlyFeedback_yyyyMM,");
            strSql.Append("project_id=@project_id,");
            strSql.Append("monthlyFeedback_fulfilment=@monthlyFeedback_fulfilment,");
            strSql.Append("monthlyFeedback_fulfilmentDescription=@monthlyFeedback_fulfilmentDescription");
            strSql.Append("monthlyFeedback_writer=@monthlyFeedback_writer");
            strSql.Append(" where monthlyFeedback_sn=@monthlyFeedback_sn ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@monthlyFeedback_yyyyMM",                SqlDbType.DateTime,  3),
                new SqlParameter("@project_id",                            SqlDbType.Char,      8),
                new SqlParameter("@monthlyFeedback_fulfilment",            SqlDbType.Float,     8),
                new SqlParameter("@monthlyFeedback_fulfilmentDescription", SqlDbType.NText),
                new SqlParameter("@monthlyFeedback_writer",                SqlDbType.NChar,    20),
                new SqlParameter("@monthlyFeedback_sn",                    SqlDbType.Char, 10)
            };
            parameters[0].Value = model.monthlyFeedback_yyyyMM;
            parameters[1].Value = model.project_id;
            parameters[2].Value = model.monthlyFeedback_fulfilment;
            parameters[3].Value = model.monthlyFeedback_fulfilmentDescription;
            parameters[4].Value = model.monthlyFeedback_sn;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.NewPort.Table_monthlyFeedback GetModel(string monthlyFeedback_sn)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 monthlyFeedback_sn,monthlyFeedback_yyyyMM,project_id,monthlyFeedback_fulfilment,monthlyFeedback_fulfilmentDescription,monthlyFeedback_writer from Table_monthlyFeedback ");
            strSql.Append(" where monthlyFeedback_sn=@monthlyFeedback_sn ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@monthlyFeedback_sn", SqlDbType.Char, 10)
            };
            parameters[0].Value = monthlyFeedback_sn;

            Maticsoft.Model.NewPort.Table_monthlyFeedback model = new Maticsoft.Model.NewPort.Table_monthlyFeedback();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }