Esempio n. 1
0
        public SigmaResultType AddSigmaJob(TypeSigmaJob objSigmaJob)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(new SqlParameter("@SigmaJobName", objSigmaJob.SigmaJobName));
            paramList.Add(new SqlParameter("@JobCategoryCode", objSigmaJob.JobCategoryCode));
            paramList.Add(new SqlParameter("@CreatedBy", objSigmaJob.CreatedBy));
            SqlParameter outParam = new SqlParameter("@NewId", SqlDbType.Int);
            outParam.Direction = ParameterDirection.Output;
            paramList.Add(outParam);

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, CommandType.StoredProcedure, "usp_AddSigmaJob", paramList.ToArray());
                result.IsSuccessful = true;
                result.ScalarValue = (int)outParam.Value;
                scope.Complete();

            }

            return result;
        }
Esempio n. 2
0
        public SigmaResultType UpdateSigmaJob(TypeSigmaJob objSigmaJob)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(new SqlParameter("@SigmaJobId", objSigmaJob.SigmaJobId));
            paramList.Add(new SqlParameter("@SigmaJobName", objSigmaJob.SigmaJobName));
            paramList.Add(new SqlParameter("@JobCategoryCode", objSigmaJob.JobCategoryCode));
            paramList.Add(new SqlParameter("@UpdatedBy", objSigmaJob.UpdatedBy));

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_UpdateSigmaJob", paramList.ToArray());
                result.IsSuccessful = true;
                scope.Complete();

            }

            return result;
        }
Esempio n. 3
0
        public SigmaResultType RemoveSigmaJob(TypeSigmaJob objSigmaJob)
        {
            SigmaResultType result = new SigmaResultType();
            TransactionScope scope = null;

            // Get connection string
            string connStr = ConnStrHelper.getDbConnString();

            // Compose parameters
            List<SqlParameter> paramList = new List<SqlParameter>();

            paramList.Add(new SqlParameter("@SigmaJobId", objSigmaJob.SigmaJobId));

            using (scope = new TransactionScope(TransactionScopeOption.Required))
            {
                result.AffectedRow = SqlHelper.ExecuteNonQuery(connStr, "usp_RemoveSigmaJob", paramList.ToArray());
                result.IsSuccessful = true;
                scope.Complete();
            }

            return result;
        }
 public SigmaResultType AddSigmaJob(TypeSigmaJob objSigmaJob)
 {
     SigmaResultType result = new SigmaResultType();
     try
     {
         SigmaJobMgr sigmaJobMgr = new SigmaJobMgr();
         result = sigmaJobMgr.AddSigmaJob(objSigmaJob);
         return result;
     }
     catch (Exception ex)
     {
         // Log Exception
         ExceptionHelper.logException(ex);
         result.IsSuccessful = false;
         result.ErrorMessage = ex.Message;
         return result;
     }
 }