コード例 #1
0
        public int InsertDetailsRecord(ref TransferLocationOutside Entity_Trans, out string strError)
        {
            int iInsert = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction      = new SqlParameter("@Action", SqlDbType.BigInt);
                SqlParameter pTransferId  = new SqlParameter(TransferLocationOutside._TransId, SqlDbType.BigInt);
                SqlParameter pCategoryId  = new SqlParameter(TransferLocationOutside._CategoryId, SqlDbType.BigInt);
                SqlParameter pItemId      = new SqlParameter(TransferLocationOutside._ItemId, SqlDbType.BigInt);
                SqlParameter pTransFrom   = new SqlParameter(TransferLocationOutside._TransFrom, SqlDbType.BigInt);
                SqlParameter pQtyAtSource = new SqlParameter(TransferLocationOutside._QtyAtSource, SqlDbType.Decimal);
                SqlParameter pTransTo     = new SqlParameter(TransferLocationOutside._TransTo, SqlDbType.BigInt);
                SqlParameter pQtyAtDest   = new SqlParameter(TransferLocationOutside._QtyAtDest, SqlDbType.Decimal);
                SqlParameter pTransferqTY = new SqlParameter(TransferLocationOutside._TransQty, SqlDbType.Decimal);
                SqlParameter prate        = new SqlParameter(TransferLocationOutside._rate, SqlDbType.Decimal);

                pAction.Value      = 8;
                pTransferId.Value  = Entity_Trans.TransId;
                pCategoryId.Value  = Entity_Trans.CategoryId;
                pTransFrom.Value   = Entity_Trans.TransFrom;
                pQtyAtSource.Value = Entity_Trans.QtyAtSource;
                pQtyAtDest.Value   = Entity_Trans.QtyAtDest;
                pTransTo.Value     = Entity_Trans.TransTo;
                pTransferqTY.Value = Entity_Trans.TransQty;
                pItemId.Value      = Entity_Trans.ItemId;
                prate.Value        = Entity_Trans.rate;
                SqlParameter[] Param = new SqlParameter[] { pAction, pTransferId, pCategoryId, pTransFrom, pQtyAtSource, pQtyAtDest, pTransTo, pTransferqTY, pItemId, prate };

                Open(CONNECTION_STRING);
                BeginTransaction();

                iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, TransferLocationOutside.SP_LocationTransferOutside, Param);

                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }
コード例 #2
0
        public int InsertRecord(ref TransferLocationOutside Entity_Trans, out string strError)
        {
            int iInsert = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction       = new SqlParameter(TransferLocationOutside._Action, SqlDbType.BigInt);
                SqlParameter pTransferNo   = new SqlParameter(TransferLocationOutside._TransNo, SqlDbType.NVarChar);
                SqlParameter pTransferDate = new SqlParameter(TransferLocationOutside._Date, SqlDbType.DateTime);
                SqlParameter pTransferBy   = new SqlParameter(TransferLocationOutside._TransBy, SqlDbType.BigInt);
                SqlParameter pNotes        = new SqlParameter(TransferLocationOutside._Notes, SqlDbType.NVarChar);
                SqlParameter pType         = new SqlParameter(TransferLocationOutside._Type, SqlDbType.NVarChar);
                SqlParameter pCreatedBy    = new SqlParameter(TransferLocationOutside._UserId, SqlDbType.BigInt);
                SqlParameter pCreatedDate  = new SqlParameter(TransferLocationOutside._LoginDate, SqlDbType.DateTime);

                pAction.Value       = 1;
                pTransferNo.Value   = Entity_Trans.TransNo;
                pTransferDate.Value = Entity_Trans.Date;
                pTransferBy.Value   = Entity_Trans.TransBy;
                pNotes.Value        = Entity_Trans.Notes;
                pType.Value         = Entity_Trans.Type;
                pCreatedBy.Value    = Entity_Trans.UserID;
                pCreatedDate.Value  = Entity_Trans.LoginDate;

                SqlParameter[] Param = new SqlParameter[] { pAction, pTransferNo, pTransferDate, pTransferBy, pNotes, pCreatedBy, pCreatedDate, pType };

                Open(CONNECTION_STRING);
                BeginTransaction();

                iInsert = SQLHelper.ExecuteScalar(_Connection, _Transaction, CommandType.StoredProcedure, TransferLocationOutside.SP_LocationTransferOutside, Param);

                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }
コード例 #3
0
        public int DeleteRecord(ref TransferLocationOutside Entity_Trans, out string strError)
        {
            int iDelete = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction  = new SqlParameter(TransferLocationOutside._Action, SqlDbType.BigInt);
                SqlParameter pTransId = new SqlParameter(TransferLocationOutside._TransId, SqlDbType.BigInt);

                SqlParameter pDeletedBy   = new SqlParameter(TransferLocationOutside._UserId, SqlDbType.BigInt);
                SqlParameter pDeletedDate = new SqlParameter(TransferLocationOutside._LoginDate, SqlDbType.DateTime);

                pAction.Value  = 3;
                pTransId.Value = Entity_Trans.TransId;

                pDeletedBy.Value   = Entity_Trans.UserID;
                pDeletedDate.Value = Entity_Trans.LoginDate;
                //    pIsDeleted.Value = Entity_damage.IsDeleted;

                SqlParameter[] Param = new SqlParameter[] { pAction, pTransId, pDeletedBy, pDeletedDate };

                Open(CONNECTION_STRING);
                BeginTransaction();

                iDelete = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, TransferLocationOutside.SP_LocationTransferOutside, Param);

                if (iDelete > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iDelete);
        }