Beispiel #1
0
 private void MapReturnItem(RMAReturnItemInfo info, DataRow row)
 {
     info.SysNo = Util.TrimIntNull(row["SysNo"]);
     info.ReturnSysNo = Util.TrimIntNull(row["ReturnSysNo"]);
     info.RegisterSysNo = Util.TrimIntNull(row["RegisterSysNo"]);
     info.TargetProductSysNo = Util.TrimIntNull(row["TargetProductSysNo"]);
     info.Cost = Util.TrimDecimalNull(row["Cost"]);
     info.ReturnProductType = Util.TrimIntNull(row["ReturnProductType"]);
     info.AuditStatus = Util.TrimIntNull(row["AuditStatus"]);
     info.AuditUserSysNo = Util.TrimIntNull(row["AuditUserSysNo"]);
     info.AuditTime = Util.TrimDateNull(row["AuditTime"]);
     info.AuditMemo = Util.TrimNull(row["AuditMemo"]);
 }
Beispiel #2
0
        public void Create(RMAReturnInfo returnInfo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {

                returnInfo.SysNo = SequenceDac.GetInstance().Create("RMA_Return_Sequence");
                returnInfo.ReturnID = getRevertID(returnInfo.SysNo);

                new RMAReturnDac().Insert(returnInfo);
                foreach (int registerSysNo in returnInfo.ItemHash.Keys)
                {
                    RMAReturnItemInfo oReturnItem = new RMAReturnItemInfo();
                    oReturnItem.RegisterSysNo = registerSysNo;
                    oReturnItem.ReturnSysNo = returnInfo.SysNo;

                    this.InsertReturnItem(oReturnItem);
                }

                scope.Complete();
            }
        }
Beispiel #3
0
 public void InsertReturnItem(RMAReturnItemInfo oInfo)
 {
     new RMAReturnDac().InsertReturnItem(oInfo);
 }
Beispiel #4
0
        public int InsertReturnItem(RMAReturnItemInfo oParam)
        {
            string sql = @"INSERT INTO RMA_Return_Item
                            (
                            ReturnSysNo, RegisterSysNo, TargetProductSysNo , Cost
                            ,ReturnProductType,AuditStatus,AuditUserSysNo,AuditTime,AuditMemo
                            )
                            VALUES (
                            @ReturnSysNo, @RegisterSysNo, @TargetProductSysNo , @Cost
                            ,@ReturnProductType,@AuditStatus,@AuditUserSysNo,@AuditTime,@AuditMemo
                            );set @SysNo = SCOPE_IDENTITY();";

            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramReturnSysNo = new SqlParameter("@ReturnSysNo", SqlDbType.Int, 4);
            SqlParameter paramRegisterSysNo = new SqlParameter("@RegisterSysNo", SqlDbType.Int, 4);
            SqlParameter paramTargetProductSysNo = new SqlParameter("@TargetProductSysNo", SqlDbType.Int, 4);
            SqlParameter paramCost = new SqlParameter("@Cost", SqlDbType.Decimal, 9);
            SqlParameter paramReturnProductType = new SqlParameter("@ReturnProductType", SqlDbType.Int, 4);
            SqlParameter paramAuditStatus = new SqlParameter("@AuditStatus", SqlDbType.Int, 4);
            SqlParameter paramAuditUserSysNo = new SqlParameter("@AuditUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramAuditTime = new SqlParameter("@AuditTime", SqlDbType.DateTime);
            SqlParameter paramAuditMemo = new SqlParameter("@AuditMemo", SqlDbType.NVarChar, 200);

            paramSysNo.Direction = ParameterDirection.Output;

            if (oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if (oParam.ReturnSysNo != AppConst.IntNull)
                paramReturnSysNo.Value = oParam.ReturnSysNo;
            else
                paramReturnSysNo.Value = System.DBNull.Value;
            if (oParam.RegisterSysNo != AppConst.IntNull)
                paramRegisterSysNo.Value = oParam.RegisterSysNo;
            else
                paramRegisterSysNo.Value = System.DBNull.Value;
            if (oParam.TargetProductSysNo != AppConst.IntNull)
                paramTargetProductSysNo.Value = oParam.TargetProductSysNo;
            else
                paramTargetProductSysNo.Value = System.DBNull.Value;

            if (oParam.Cost != AppConst.DecimalNull)
                paramCost.Value = oParam.Cost;
            else
                paramCost.Value = System.DBNull.Value;

            if (oParam.ReturnProductType != AppConst.IntNull) paramReturnProductType.Value = oParam.ReturnProductType;
            else paramReturnProductType.Value = System.DBNull.Value;

            if (oParam.AuditStatus != AppConst.IntNull) paramAuditStatus.Value = oParam.AuditStatus;
            else paramAuditStatus.Value = System.DBNull.Value;

            if (oParam.AuditUserSysNo != AppConst.IntNull) paramAuditUserSysNo.Value = oParam.AuditUserSysNo;
            else paramAuditUserSysNo.Value = System.DBNull.Value;

            if (oParam.AuditTime != AppConst.DateTimeNull) paramAuditTime.Value = oParam.AuditTime;
            else paramAuditTime.Value = System.DBNull.Value;

            if (oParam.AuditMemo != AppConst.StringNull) paramAuditMemo.Value = oParam.AuditMemo;
            else paramAuditMemo.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramReturnSysNo);
            cmd.Parameters.Add(paramRegisterSysNo);
            cmd.Parameters.Add(paramTargetProductSysNo);
            cmd.Parameters.Add(paramCost);

            cmd.Parameters.Add(paramReturnProductType);
            cmd.Parameters.Add(paramAuditStatus);
            cmd.Parameters.Add(paramAuditUserSysNo);
            cmd.Parameters.Add(paramAuditTime);
            cmd.Parameters.Add(paramAuditMemo);

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