Example #1
0
        /// <summary>
        /// ����rma��
        /// </summary>
        /// <param name="rmaInfo"></param>
        public void AddRMA(RMARequestInfo rmaInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                rmaInfo.SysNo = SequenceDac.GetInstance().Create("RMA_Request_Sequence");
                rmaInfo.RequestID = this.BuildRMAID(rmaInfo.SysNo);
                rmaInfo.Status = (int)AppEnum.RMAStatus.Origin;
                this.InsertRequest(rmaInfo);
                foreach (RMARegisterInfo rmaItem in rmaInfo.ItemHash.Values)
                {
                    rmaItem.SysNo = SequenceDac.GetInstance().Create("RMA_Register_Sequence");
                    rmaItem.Status = (int)AppEnum.RMARequestStatus.Orgin;
                    rmaItem.OwnBy = (int)AppEnum.RMAOwnBy.Origin;
                    rmaItem.Location = (int)AppEnum.RMALocation.Origin;
                    RMARegisterManager.GetInstance().InsertRegister(rmaItem);
                    RMARequestItemInfo rmaiteminfo = new RMARequestItemInfo();
                    rmaiteminfo.RegisterSysNo = rmaItem.SysNo;
                    rmaiteminfo.RequestSysNo = rmaInfo.SysNo;
                    this.InsertRequestItem(rmaiteminfo);
                }

                scope.Complete();
            }
            //SendMail(rmaInfo);
        }
Example #2
0
 /// <summary>
 /// Insert Request_Item
 /// </summary>
 /// <param name="oInfo"></param>
 public void InsertRequestItem(RMARequestItemInfo oInfo)
 {
     new RMARequestDac().InsertRequestItem(oInfo);
 }
Example #3
0
        public int InsertRequestItem(RMARequestItemInfo oParam)
        {
            string sql = @"INSERT INTO RMA_Request_Item
                            (
                             RequestSysNo, RegisterSysNo
                            )
                            VALUES (
                            @RequestSysNo, @RegisterSysNo
                            );set @SysNo = SCOPE_IDENTITY();";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int,4);
            SqlParameter paramRequestSysNo = new SqlParameter("@RequestSysNo", SqlDbType.Int,4);
            SqlParameter paramRegisterSysNo = new SqlParameter("@RegisterSysNo", SqlDbType.Int,4);

            paramSysNo.Direction = ParameterDirection.Output;

            if ( oParam.RequestSysNo != AppConst.IntNull)
                paramRequestSysNo.Value = oParam.RequestSysNo;
            else
                paramRequestSysNo.Value = System.DBNull.Value;
            if ( oParam.RegisterSysNo != AppConst.IntNull)
                paramRegisterSysNo.Value = oParam.RegisterSysNo;
            else
                paramRegisterSysNo.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramRequestSysNo);
            cmd.Parameters.Add(paramRegisterSysNo);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }