Exemplo n.º 1
0
        public SigmaResultType AddSigmaCodeCategory(TypeSigmaCodeCategory objSigmaCodeCategory)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

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

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(new SqlParameter("@CategoryName", objSigmaCodeCategory.CategoryName));
            paramList.Add(new SqlParameter("@CategoryDescription", objSigmaCodeCategory.CategoryDescription));
            paramList.Add(new SqlParameter("@ParentCodeCategory", objSigmaCodeCategory.ParentCodeCategory));
            paramList.Add(new SqlParameter("@CreatedBy", objSigmaCodeCategory.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_AddSigmaCodeCategory", paramList.ToArray());
                result.IsSuccessful = true;
                result.ScalarValue = (int)outParam.Value;
                scope.Complete();

            }

            return result;
        }
Exemplo n.º 2
0
        public SigmaResultType RemoveSigmaCodeCategory(TypeSigmaCodeCategory objSigmaCodeCategory)
        {
            SigmaResultType result = new SigmaResultType();
            TransactionScope scope = null;

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

            // Compose parameters
            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@codeCategory", objSigmaCodeCategory.CodeCategory)
            };

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

            return result;
        }
Exemplo n.º 3
0
        public SigmaResultType UpdateSigmaCodeCategory(TypeSigmaCodeCategory objSigmaCodeCategory)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

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

            // Compose parameters
            SqlParameter[] parameters = new SqlParameter[] {
                    new SqlParameter("@CategoryName", objSigmaCodeCategory.CategoryName),
                    new SqlParameter("@CategoryDescription", objSigmaCodeCategory.CategoryDescription),
                    new SqlParameter("@ParentCodeCategory", objSigmaCodeCategory.ParentCodeCategory),
                    new SqlParameter("@CreatedBy", objSigmaCodeCategory.CreatedBy),
                    new SqlParameter("@UpdatedBy", objSigmaCodeCategory.UpdatedBy),
                };

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

            }

            return result;
        }
 public SigmaResultType AddSigmaCodeCategory(TypeSigmaCodeCategory objSigmaCodeCategory)
 {
     SigmaResultType result = new SigmaResultType();
     try
     {
         SigmaCodeMgr sigmaCodeMgr = new SigmaCodeMgr();
         result = sigmaCodeMgr.AddSigmaCodeCategory(objSigmaCodeCategory);
         return result;
     }
     catch (Exception ex)
     {
         // Log Exception
         ExceptionHelper.logException(ex);
         result.IsSuccessful = false;
         result.ErrorMessage = ex.Message;
         return result;
     }
 }