Пример #1
0
 private void MapReturn(RMAReturnInfo oInfo, DataRow dr)
 {
     oInfo.CreateTime = Util.TrimDateNull(dr["CreateTime"]);
     oInfo.CreateUserSysNo = Util.TrimIntNull(dr["CreateUserSysNo"]);
     oInfo.Note = dr["Note"].ToString();
     oInfo.ReturnID = dr["ReturnID"].ToString();
     oInfo.ReturnTime = Util.TrimDateNull(dr["ReturnTime"]);
     oInfo.ReturnUserSysNo = Util.TrimIntNull(dr["ReturnUserSysNo"]);
     oInfo.Status = Util.TrimIntNull(dr["Status"]);
     oInfo.StockSysNo = Util.TrimIntNull(dr["StockSysNo"]);
     oInfo.SysNo = Util.TrimIntNull(dr["SysNo"]);
 }
Пример #2
0
 public RMAReturnInfo Load(int sysno)
 {
     RMAReturnInfo oReturn = new RMAReturnInfo();
     string sql = "select * from RMA_Return where sysno=" + sysno;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if (Util.HasMoreRow(ds))
     {
         DataRow dr = ds.Tables[0].Rows[0];
         MapReturn(oReturn, dr);
         string itemsql = @"select RMA_Register.* ,RMA_Return_Item.SysNo as ItemSysNo
                            from   RMA_Return_Item (NOLOCK)
                            inner  join  RMA_Register (NOLOCK) on RMA_Register.SysNo = RMA_Return_Item.RegisterSysNo
                            where  RMA_Return_Item.ReturnSysNo = " + sysno;
         DataSet itemds = SqlHelper.ExecuteDataSet(itemsql);
         if (Util.HasMoreRow(itemds))
         {
             foreach (DataRow itemdr in itemds.Tables[0].Rows)
             {
                 RMARegisterInfo oRegister = new RMARegisterInfo();
                 RMARequestManager.GetInstance().mapRegister(oRegister, itemdr);
                 oReturn.ItemHash.Add(itemdr["ItemSysNo"], oRegister);
             }
         }
     }
     return oReturn;
 }
Пример #3
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();
            }
        }
Пример #4
0
 public void InsertReturn(RMAReturnInfo oInfo)
 {
     new RMAReturnDac().Insert(oInfo);
 }
Пример #5
0
        public int Insert(RMAReturnInfo oParam)
        {
            string sql = @"INSERT INTO RMA_Return
                            (
                            SysNo, ReturnID, StockSysNo, CreateTime,
                            CreateUserSysNo, ReturnTime, ReturnUserSysNo, Note,
                            Status
                            )
                            VALUES (
                            @SysNo, @ReturnID, @StockSysNo, @CreateTime,
                            @CreateUserSysNo, @ReturnTime, @ReturnUserSysNo, @Note,
                            @Status
                            )";

            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramReturnID = new SqlParameter("@ReturnID", SqlDbType.NVarChar, 10);
            SqlParameter paramStockSysNo = new SqlParameter("@StockSysNo", SqlDbType.Int, 4);
            SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime);
            SqlParameter paramCreateUserSysNo = new SqlParameter("@CreateUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramReturnTime = new SqlParameter("@ReturnTime", SqlDbType.DateTime);
            SqlParameter paramReturnUserSysNo = new SqlParameter("@ReturnUserSysNo", SqlDbType.Int, 4);
            SqlParameter paramNote = new SqlParameter("@Note", SqlDbType.NVarChar, 500);
            SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4);

            if (oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if (oParam.ReturnID != AppConst.StringNull)
                paramReturnID.Value = oParam.ReturnID;
            else
                paramReturnID.Value = System.DBNull.Value;
            if (oParam.StockSysNo != AppConst.IntNull)
                paramStockSysNo.Value = oParam.StockSysNo;
            else
                paramStockSysNo.Value = System.DBNull.Value;
            if (oParam.CreateTime != AppConst.DateTimeNull)
                paramCreateTime.Value = oParam.CreateTime;
            else
                paramCreateTime.Value = System.DBNull.Value;
            if (oParam.CreateUserSysNo != AppConst.IntNull)
                paramCreateUserSysNo.Value = oParam.CreateUserSysNo;
            else
                paramCreateUserSysNo.Value = System.DBNull.Value;
            if (oParam.ReturnTime != AppConst.DateTimeNull)
                paramReturnTime.Value = oParam.ReturnTime;
            else
                paramReturnTime.Value = System.DBNull.Value;
            if (oParam.ReturnUserSysNo != AppConst.IntNull)
                paramReturnUserSysNo.Value = oParam.ReturnUserSysNo;
            else
                paramReturnUserSysNo.Value = System.DBNull.Value;
            if (oParam.Note != AppConst.StringNull)
                paramNote.Value = oParam.Note;
            else
                paramNote.Value = System.DBNull.Value;
            if (oParam.Status != AppConst.IntNull)
                paramStatus.Value = oParam.Status;
            else
                paramStatus.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramReturnID);
            cmd.Parameters.Add(paramStockSysNo);
            cmd.Parameters.Add(paramCreateTime);
            cmd.Parameters.Add(paramCreateUserSysNo);
            cmd.Parameters.Add(paramReturnTime);
            cmd.Parameters.Add(paramReturnUserSysNo);
            cmd.Parameters.Add(paramNote);
            cmd.Parameters.Add(paramStatus);

            return SqlHelper.ExecuteNonQuery(cmd);
        }