コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.ProjectQuotationlujing model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ProjectQuotationlujing set ");
            strSql.Append("ProjectQuotationUrl=@ProjectQuotationUrl,");
            strSql.Append("ProjectId=@ProjectId");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProjectQuotationUrl", SqlDbType.NVarChar, 500),
                new SqlParameter("@ProjectId",           SqlDbType.Int,        4),
                new SqlParameter("@Id",                  SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ProjectQuotationUrl;
            parameters[1].Value = model.ProjectId;
            parameters[2].Value = model.Id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.ProjectQuotationlujing model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ProjectQuotationlujing(");
            strSql.Append("ProjectQuotationUrl,ProjectId)");
            strSql.Append(" values (");
            strSql.Append("@ProjectQuotationUrl,@ProjectId)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ProjectQuotationUrl", SqlDbType.NVarChar, 500),
                new SqlParameter("@ProjectId",           SqlDbType.Int, 4)
            };
            parameters[0].Value = model.ProjectQuotationUrl;
            parameters[1].Value = model.ProjectId;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.ProjectQuotationlujing DataRowToModel(DataRow row)
 {
     Model.ProjectQuotationlujing model = new  Model.ProjectQuotationlujing();
     if (row != null)
     {
         if (row["Id"] != null && row["Id"].ToString() != "")
         {
             model.Id = int.Parse(row["Id"].ToString());
         }
         if (row["ProjectQuotationUrl"] != null)
         {
             model.ProjectQuotationUrl = row["ProjectQuotationUrl"].ToString();
         }
         if (row["ProjectId"] != null && row["ProjectId"].ToString() != "")
         {
             model.ProjectId = int.Parse(row["ProjectId"].ToString());
         }
     }
     return(model);
 }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.ProjectQuotationlujing GetModels(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Id,ProjectQuotationUrl,ProjectId from ProjectQuotationlujing ");
            strSql.Append(" where ProjectId=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.ProjectQuotationlujing model)
 {
     return(dal.Update(model));
 }
コード例 #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(Model.ProjectQuotationlujing model)
 {
     return(dal.Add(model));
 }