Ejemplo n.º 1
0
        /// <summary>
        /// 新增一条Invtransaction记录
        /// </summary>
        /// <param name="invtransaction">Invtransaction对象</param>
        /// <param name="whLoginID">要查询的仓库的前缀</param>
        /// <returns>执行新增对数据库影响的行数</returns>
        public int InsertInvtransaction(InvtransactionInfo invtransactionInfo)
        {
            int result = 0;

            SqlParameter[] paras = Set_Invtransaction_Parameters(invtransactionInfo);
            if (paras != null)
            {
                result = DBHelper.ExecuteNonQuery(CommandType.Text, SQL_INSERT_INVTRANSACTION, paras);
            }
            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条Invtransaction记录
        /// </summary>
        /// <param name="db">DataBase对象</param>
        /// <param name="tran">一个有效的DbTransaction</param>
        /// <param name="invtransaction">Invtransaction对象</param>
        /// <param name="whLoginID">要查询的仓库的前缀</param>
        /// <returns>执行更新对数据库影响的行数</returns>
        public int UpdateInvtransaction(Database db, DbTransaction tran, InvtransactionInfo invtransactionInfo)
        {
            int result = 0;

            SqlParameter[] paras = Set_Invtransaction_Parameters(invtransactionInfo);
            if (paras != null)
            {
                result += DBHelper.ExecuteNonQuery(db, tran, CommandType.Text, SQL_UPDATE_INVTRANSACTION, paras);
            }
            return(result);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 设置SQL参数表
 /// </summary>
 /// <param name="Invtransaction">Invtransaction对象</param>
 /// <returns>Invtransaction参数数组</returns>
 private SqlParameter[] Set_Invtransaction_Parameters(InvtransactionInfo invtransactionInfo)
 {
     SqlParameter[] paramArray = new SqlParameter[] { new SqlParameter("@TransID", invtransactionInfo.TransID),
                                                      new SqlParameter("@ItemID", invtransactionInfo.ItemID),
                                                      new SqlParameter("@SupplierID", invtransactionInfo.SupplierID),
                                                      new SqlParameter("@TransType", string.IsNullOrEmpty(invtransactionInfo.TransType)?"":invtransactionInfo.TransType),
                                                      new SqlParameter("@Qty", invtransactionInfo.Qty),
                                                      new SqlParameter("@PoID", string.IsNullOrEmpty(invtransactionInfo.PoID)?"":invtransactionInfo.PoID),
                                                      new SqlParameter("@PoLineID", string.IsNullOrEmpty(invtransactionInfo.PoLineID)?"":invtransactionInfo.PoLineID),
                                                      new SqlParameter("@SoID", string.IsNullOrEmpty(invtransactionInfo.SoID)?"":invtransactionInfo.SoID),
                                                      new SqlParameter("@SoLineID", string.IsNullOrEmpty(invtransactionInfo.SoLineID)?"":invtransactionInfo.SoLineID),
                                                      new SqlParameter("@CreatedBy", string.IsNullOrEmpty(invtransactionInfo.CreatedBy)?"":invtransactionInfo.CreatedBy) };
     return(paramArray);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// 初始化InvtransactionInfo
 /// </summary>
 private InvtransactionInfo InitInvtransactionInfoByDataReader(InvtransactionInfo invtransactionInfo, IDataReader reader)
 {
     invtransactionInfo = new InvtransactionInfo(reader["TransID"].ToString() != "" ? Int32.Parse(reader["TransID"].ToString()) : 0,
                                                 reader["ItemID"].ToString() != "" ? Int32.Parse(reader["ItemID"].ToString()) : 0,
                                                 reader["SupplierID"].ToString() != "" ? Int32.Parse(reader["SupplierID"].ToString()) : 0,
                                                 reader["TransType"].ToString(),
                                                 reader["Qty"].ToString() != "" ? Int32.Parse(reader["Qty"].ToString()) : 0,
                                                 reader["PoID"].ToString(),
                                                 reader["PoLineID"].ToString(),
                                                 reader["SoID"].ToString(),
                                                 reader["SoLineID"].ToString(),
                                                 reader["CreatedBy"].ToString(),
                                                 reader["CreatedDate"].ToString() != "" ? DateTime.Parse(reader["CreatedDate"].ToString()) : new DateTime());
     return(invtransactionInfo);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 根据invtransactionID得到一条Invtransaction记录
        /// </summary>
        /// <param name="invtransactionID">invtransactionID</param>
        /// <param name="whLoginID">要查询的仓库的前缀</param>
        /// <returns>根据invtransactionID得到一条Invtransaction记录</returns>
        public InvtransactionInfo GetInvtransactionByID(string invtransactionID)
        {
            string sql = SQL_SELECT_ALL_INVTRANSACTION + " AND TRANSID = @TRANSID  ";

            SqlParameter[]     paras = new SqlParameter[] { new SqlParameter("@TRANSID", invtransactionID) };
            InvtransactionInfo invtransactionInfo = null;

            using (IDataReader reader = DBHelper.ExecuteReader(CommandType.Text, sql, paras))
            {
                if (reader.Read())
                {
                    invtransactionInfo = InitInvtransactionInfoByDataReader(invtransactionInfo, reader);
                }
            }

            return(invtransactionInfo);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 根据invtransactionID得到一条Invtransaction记录
        /// </summary>
        /// <param name="db">DataBase对象</param>
        /// <param name="tran">一个有效的DbTransaction</param>
        /// <param name="invtransactionID">invtransactionID</param>
        /// <param name="whLoginID">要查询的仓库的前缀</param>
        /// <returns>根据invtransactionID得到一条Invtransaction记录</returns>
        public InvtransactionInfo GetInvtransactionByID(Database db, DbTransaction tran, string invtransactionID)
        {
            string sql = SQL_SELECT_ALL_INVTRANSACTION + " AND TRANSID = @TRANSID  ";

            SqlParameter[]     paras = new SqlParameter[] { new SqlParameter("@TRANSID", invtransactionID) };
            InvtransactionInfo invtransactionInfo = null;

            IDataReader reader = DBHelper.ExecuteReader(db, tran, CommandType.Text, sql, paras);

            if (reader.Read())
            {
                invtransactionInfo = InitInvtransactionInfoByDataReader(invtransactionInfo, reader);
            }
            if (!reader.IsClosed)
            {
                reader.Close();
            }

            return(invtransactionInfo);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 新增一条Invtransaction记录
 /// </summary>
 /// <param name="invtransaction">Invtransaction对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行新增对数据库影响的行数</returns>
 public int InsertInvtransaction(InvtransactionInfo invtransactionInfo)
 {
     return(invtransactionDA.InsertInvtransaction(invtransactionInfo));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 更新一条Invtransaction记录
 /// </summary>
 /// <param name="invtransaction">Invtransaction对象</param>
 /// <param name="whLoginID">要查询的仓库的前缀</param>
 /// <returns>执行更新对数据库影响的行数</returns>
 public int UpdateInvtransaction(InvtransactionInfo invtransactionInfo)
 {
     return(invtransactionDA.UpdateInvtransaction(invtransactionInfo));
 }