Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.NewPort.Table_annualPlan model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Table_annualPlan set ");
            strSql.Append("project_id=@project_id,");
            strSql.Append("plan_id=@plan_id,");
            strSql.Append("annualPlan_targetCompletion=@annualPlan_targetCompletion,");
            strSql.Append("annualPlan_targetDescription=@annualPlan_targetDescription,");
            strSql.Append("annualPlan_earlyProgress=@annualPlan_earlyProgress,");
            strSql.Append("annualPlan_checkState=@annualPlan_checkState");
            strSql.Append(" where annualPlan_sn=@annualPlan_sn ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@project_id",                   SqlDbType.Char,    8),
                new SqlParameter("@plan_id",                      SqlDbType.Char,    6),
                new SqlParameter("@annualPlan_targetCompletion",  SqlDbType.Float,   8),
                new SqlParameter("@annualPlan_targetDescription", SqlDbType.NText),
                new SqlParameter("@annualPlan_earlyProgress",     SqlDbType.NText),
                new SqlParameter("@annualPlan_checkState",        SqlDbType.NChar,  10),
                new SqlParameter("@annualPlan_sn",                SqlDbType.Char, 10)
            };
            parameters[0].Value = model.project_id;
            parameters[1].Value = model.plan_id;
            parameters[2].Value = model.annualPlan_targetCompletion;
            parameters[3].Value = model.annualPlan_targetDescription;
            parameters[4].Value = model.annualPlan_earlyProgress;
            parameters[5].Value = model.annualPlan_checkState;
            parameters[6].Value = model.annualPlan_sn;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.NewPort.Table_annualPlan DataRowToModel(DataRow row)
 {
     Maticsoft.Model.NewPort.Table_annualPlan model = new Maticsoft.Model.NewPort.Table_annualPlan();
     if (row != null)
     {
         if (row["annualPlan_sn"] != null)
         {
             model.annualPlan_sn = row["annualPlan_sn"].ToString();
         }
         if (row["project_id"] != null)
         {
             model.project_id = row["project_id"].ToString();
         }
         if (row["plan_id"] != null)
         {
             model.plan_id = row["plan_id"].ToString();
         }
         if (row["annualPlan_targetCompletion"] != null && row["annualPlan_targetCompletion"].ToString() != "")
         {
             model.annualPlan_targetCompletion = decimal.Parse(row["annualPlan_targetCompletion"].ToString());
         }
         if (row["annualPlan_targetDescription"] != null)
         {
             model.annualPlan_targetDescription = row["annualPlan_targetDescription"].ToString();
         }
         if (row["annualPlan_earlyProgress"] != null)
         {
             model.annualPlan_earlyProgress = row["annualPlan_earlyProgress"].ToString();
         }
         if (row["annualPlan_checkState"] != null)
         {
             model.annualPlan_checkState = row["annualPlan_checkState"].ToString();
         }
     }
     return(model);
 }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.NewPort.Table_annualPlan GetModel(string annualPlan_sn)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 annualPlan_sn,project_id,plan_id,annualPlan_targetCompletion,annualPlan_targetDescription,annualPlan_earlyProgress,annualPlan_checkState from Table_annualPlan ");
            strSql.Append(" where annualPlan_sn=@annualPlan_sn ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@annualPlan_sn", SqlDbType.Char, 10)
            };
            parameters[0].Value = annualPlan_sn;

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

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