Exemple #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.T_FeeInWorkItem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_FeeInWorkItem(");
            strSql.Append("n_FeeID,g_WorkItemGuid,n_FeeType)");
            strSql.Append(" values (");
            strSql.Append("@n_FeeID,@g_WorkItemGuid,@n_FeeType)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_FeeID",        SqlDbType.Int,               4),
                new SqlParameter("@g_WorkItemGuid", SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@n_FeeType",      SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_FeeID;
            parameters[1].Value = Guid.NewGuid();
            parameters[2].Value = model.n_FeeType;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.T_FeeInWorkItem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_FeeInWorkItem set ");
            strSql.Append("g_WorkItemGuid=@g_WorkItemGuid,");
            strSql.Append("n_FeeType=@n_FeeType");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@g_WorkItemGuid", SqlDbType.UniqueIdentifier, 16),
                new SqlParameter("@n_FeeType",      SqlDbType.Int,               4),
                new SqlParameter("@n_ID",           SqlDbType.Int,               4),
                new SqlParameter("@n_FeeID",        SqlDbType.Int, 4)
            };
            parameters[0].Value = model.g_WorkItemGuid;
            parameters[1].Value = model.n_FeeType;
            parameters[2].Value = model.n_ID;
            parameters[3].Value = model.n_FeeID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.T_FeeInWorkItem DataRowToModel(DataRow row)
 {
     IPSP.Model.T_FeeInWorkItem model = new IPSP.Model.T_FeeInWorkItem();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_FeeID"] != null && row["n_FeeID"].ToString() != "")
         {
             model.n_FeeID = int.Parse(row["n_FeeID"].ToString());
         }
         if (row["g_WorkItemGuid"] != null && row["g_WorkItemGuid"].ToString() != "")
         {
             model.g_WorkItemGuid = new Guid(row["g_WorkItemGuid"].ToString());
         }
         if (row["n_FeeType"] != null && row["n_FeeType"].ToString() != "")
         {
             model.n_FeeType = int.Parse(row["n_FeeType"].ToString());
         }
     }
     return(model);
 }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.T_FeeInWorkItem GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_FeeID,g_WorkItemGuid,n_FeeType from T_FeeInWorkItem ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.T_FeeInWorkItem model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.T_FeeInWorkItem model)
 {
     return(dal.Add(model));
 }