예제 #1
0
        public int UpdatePartnerTransDetailByTransID(PartnerTransDetail obj)
        {
            string     sql = @"UPDATE [BE_PartnerTransDetail] SET [OrderID]=@OrderID
				, [PartnerID]=@PartnerID
				, [TransDate]=@TransDate
				, [Amount]=@Amount
				, [VoucherNo]=@VoucherNo
				, [Payee]=@Payee
				, [Created]=@Created
				, [CreatedBy]=@CreatedBy
                WHERE [TransID]=@TransID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pOrderID = new SqlParameter("OrderID", Convert2DBnull(obj.OrderID));

            pOrderID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pOrderID);

            SqlParameter pPartnerID = new SqlParameter("PartnerID", Convert2DBnull(obj.PartnerID));

            pPartnerID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pPartnerID);

            SqlParameter pTransDate = new SqlParameter("TransDate", Convert2DBnull(obj.TransDate));

            pTransDate.SqlDbType = SqlDbType.DateTime;
            cmd.Parameters.Add(pTransDate);

            SqlParameter pAmount = new SqlParameter("Amount", Convert2DBnull(obj.Amount));

            pAmount.SqlDbType = SqlDbType.Decimal;
            cmd.Parameters.Add(pAmount);

            SqlParameter pVoucherNo = new SqlParameter("VoucherNo", Convert2DBnull(obj.VoucherNo));

            pVoucherNo.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pVoucherNo);

            SqlParameter pPayee = new SqlParameter("Payee", Convert2DBnull(obj.Payee));

            pPayee.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pPayee);

            SqlParameter pCreated = new SqlParameter("Created", Convert2DBnull(obj.Created));

            pCreated.SqlDbType = SqlDbType.DateTime;
            cmd.Parameters.Add(pCreated);

            SqlParameter pCreatedBy = new SqlParameter("CreatedBy", Convert2DBnull(obj.CreatedBy));

            pCreatedBy.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pCreatedBy);

            SqlParameter pTransID = new SqlParameter("TransID", Convert2DBnull(obj.TransID));

            pTransID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pTransID);

            return(cmd.ExecuteNonQuery());
        }
예제 #2
0
        public List <PartnerTransDetail> LoadPartnerTransDetails()
        {
            string     sql = @"SELECT [TransID]
				, [OrderID]
				, [PartnerID]
				, [TransDate]
				, [Amount]
				, [VoucherNo]
				, [Payee]
				, [Created]
				, [CreatedBy]
				 FROM [BE_PartnerTransDetail]"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            List <PartnerTransDetail> ret = new List <PartnerTransDetail>();
            SqlDataReader             dr  = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    PartnerTransDetail iret = new PartnerTransDetail();
                    if (!Convert.IsDBNull(dr["TransID"]))
                    {
                        iret.TransID = (Guid)dr["TransID"];
                    }
                    if (!Convert.IsDBNull(dr["OrderID"]))
                    {
                        iret.OrderID = (Guid)dr["OrderID"];
                    }
                    if (!Convert.IsDBNull(dr["PartnerID"]))
                    {
                        iret.PartnerID = (Guid)dr["PartnerID"];
                    }
                    if (!Convert.IsDBNull(dr["TransDate"]))
                    {
                        iret.TransDate = (DateTime)dr["TransDate"];
                    }
                    if (!Convert.IsDBNull(dr["Amount"]))
                    {
                        iret.Amount = (decimal)dr["Amount"];
                    }
                    iret.VoucherNo = dr["VoucherNo"].ToString();
                    iret.Payee     = dr["Payee"].ToString();
                    if (!Convert.IsDBNull(dr["Created"]))
                    {
                        iret.Created = (DateTime)dr["Created"];
                    }
                    iret.CreatedBy = dr["CreatedBy"].ToString();
                    ret.Add(iret);
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
예제 #3
0
        public int LoadPartnerTransDetailByTransID(PartnerTransDetail obj)
        {
            string     sql = @"SELECT [TransID]
				, [OrderID]
				, [PartnerID]
				, [TransDate]
				, [Amount]
				, [VoucherNo]
				, [Payee]
				, [Created]
				, [CreatedBy]
                FROM [BE_PartnerTransDetail] WITH(NOLOCK) WHERE [TransID]=@TransID"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pTransID = new SqlParameter("TransID", Convert2DBnull(obj.TransID));

            pTransID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pTransID);

            int           ret = 0;
            SqlDataReader dr  = cmd.ExecuteReader();

            try
            {
                while (dr.Read())
                {
                    if (!Convert.IsDBNull(dr["TransID"]))
                    {
                        obj.TransID = (Guid)dr["TransID"];
                    }
                    if (!Convert.IsDBNull(dr["OrderID"]))
                    {
                        obj.OrderID = (Guid)dr["OrderID"];
                    }
                    if (!Convert.IsDBNull(dr["PartnerID"]))
                    {
                        obj.PartnerID = (Guid)dr["PartnerID"];
                    }
                    if (!Convert.IsDBNull(dr["TransDate"]))
                    {
                        obj.TransDate = (DateTime)dr["TransDate"];
                    }
                    if (!Convert.IsDBNull(dr["Amount"]))
                    {
                        obj.Amount = (decimal)dr["Amount"];
                    }
                    obj.VoucherNo = dr["VoucherNo"].ToString();
                    obj.Payee     = dr["Payee"].ToString();
                    if (!Convert.IsDBNull(dr["Created"]))
                    {
                        obj.Created = (DateTime)dr["Created"];
                    }
                    obj.CreatedBy = dr["CreatedBy"].ToString();
                    ret          += 1;
                }
            }
            finally
            {
                dr.Close();
            }
            return(ret);
        }
예제 #4
0
        public int InsertPartnerTransDetail(PartnerTransDetail obj)
        {
            string     sql = @"INSERT INTO[BE_PartnerTransDetail]([TransID]
				, [OrderID]
				, [PartnerID]
				, [TransDate]
				, [Amount]
				, [VoucherNo]
				, [Payee]
				, [Created]
				, [CreatedBy]
				) VALUES(@TransID
				, @OrderID
				, @PartnerID
				, @TransDate
				, @Amount
				, @VoucherNo
				, @Payee
				, @Created
				, @CreatedBy
				)"                ;
            SqlCommand cmd = new SqlCommand(sql, this.conn, this.trans);

            SqlParameter pTransID = new SqlParameter("TransID", Convert2DBnull(obj.TransID));

            pTransID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pTransID);

            SqlParameter pOrderID = new SqlParameter("OrderID", Convert2DBnull(obj.OrderID));

            pOrderID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pOrderID);

            SqlParameter pPartnerID = new SqlParameter("PartnerID", Convert2DBnull(obj.PartnerID));

            pPartnerID.SqlDbType = SqlDbType.UniqueIdentifier;
            cmd.Parameters.Add(pPartnerID);

            SqlParameter pTransDate = new SqlParameter("TransDate", Convert2DBnull(obj.TransDate));

            pTransDate.SqlDbType = SqlDbType.DateTime;
            cmd.Parameters.Add(pTransDate);

            SqlParameter pAmount = new SqlParameter("Amount", Convert2DBnull(obj.Amount));

            pAmount.SqlDbType = SqlDbType.Decimal;
            cmd.Parameters.Add(pAmount);

            SqlParameter pVoucherNo = new SqlParameter("VoucherNo", Convert2DBnull(obj.VoucherNo));

            pVoucherNo.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pVoucherNo);

            SqlParameter pPayee = new SqlParameter("Payee", Convert2DBnull(obj.Payee));

            pPayee.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pPayee);

            SqlParameter pCreated = new SqlParameter("Created", Convert2DBnull(obj.Created));

            pCreated.SqlDbType = SqlDbType.DateTime;
            cmd.Parameters.Add(pCreated);

            SqlParameter pCreatedBy = new SqlParameter("CreatedBy", Convert2DBnull(obj.CreatedBy));

            pCreatedBy.SqlDbType = SqlDbType.NVarChar;
            cmd.Parameters.Add(pCreatedBy);

            return(cmd.ExecuteNonQuery());
        }