Exemple #1
0
        public int Insert(RMAShiftInfo oParam)
        {
            string sql = @"INSERT INTO RMA_Shift
                            (
                            RegisterSysNo, RMAShiftType, ShiftSysNo
                            )
                            VALUES (
                            @RegisterSysNo, @RMAShiftType, @ShiftSysNo
                            );set @SysNo = SCOPE_IDENTITY();";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramRegisterSysNo = new SqlParameter("@RegisterSysNo", SqlDbType.Int, 4);
            SqlParameter paramRMAShiftType = new SqlParameter("@RMAShiftType", SqlDbType.Int, 4);
            SqlParameter paramShiftSysNo = new SqlParameter("@ShiftSysNo", SqlDbType.Int, 4);
            paramSysNo.Direction = ParameterDirection.Output;
            if (oParam.RegisterSysNo != AppConst.IntNull)
                paramRegisterSysNo.Value = oParam.RegisterSysNo;
            else
                paramRegisterSysNo.Value = System.DBNull.Value;
            if (oParam.RMAShiftType != AppConst.IntNull)
                paramRMAShiftType.Value = oParam.RMAShiftType;
            else
                paramRMAShiftType.Value = System.DBNull.Value;
            if (oParam.ShiftSysNo != AppConst.IntNull)
                paramShiftSysNo.Value = oParam.ShiftSysNo;
            else
                paramShiftSysNo.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramRegisterSysNo);
            cmd.Parameters.Add(paramRMAShiftType);
            cmd.Parameters.Add(paramShiftSysNo);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }
Exemple #2
0
        public void UpdateRegisterShift(string RegisterSysNo, int RMAShiftType, int ShiftSysNo)
        {
            TransactionOptions options = new TransactionOptions();
            options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
            options.Timeout = TransactionManager.DefaultTimeout;

            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options))
            {
                string sql = @"update RMA_Register set ShiftStatus=" + (int)AppEnum.ShiftStatus.Origin + "where sysno in (" + RegisterSysNo + ")";
                SqlHelper.ExecuteNonQuery(sql);

                string[] registerSysno = RegisterSysNo.Split(',');
                for (int i = 0; i < registerSysno.Length; i++)
                {
                    RMAShiftInfo oInfo = new RMAShiftInfo();
                    oInfo.RegisterSysNo = Int32.Parse(registerSysno[i]);
                    oInfo.RMAShiftType = RMAShiftType;
                    oInfo.ShiftSysNo = ShiftSysNo;
                    RMARegisterManager.GetInstance().InsertRMAShift(oInfo);
                }
                scope.Complete();
            }
        }
Exemple #3
0
 public void InsertRMAShift(RMAShiftInfo oParam)
 {
     new RMAShiftDac().Insert(oParam);
 }