public SigmaResultType AddCostCodeMap(TypeCostCodeMap objCostCodeMap)
 {
     SigmaResultType result = new SigmaResultType();
     try
     {
         CostCodeMgr costCodeMgr = new CostCodeMgr();
         result = costCodeMgr.AddCostCodeMap(objCostCodeMap);
         return result;
     }
     catch (Exception ex)
     {
         // Log Exception
         ExceptionHelper.logException(ex);
         result.IsSuccessful = false;
         result.ErrorMessage = ex.Message;
         return result;
     }
 }
Exemplo n.º 2
0
        public SigmaResultType RemoveCostCodeMap(TypeCostCodeMap objCostCodeMap)
        {
            SigmaResultType result = new SigmaResultType();
            TransactionScope scope = null;

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

            // Compose parameters
            SqlParameter[] parameters = new SqlParameter[] {
                    new SqlParameter("@CostCodeMapId", objCostCodeMap.CostCodeMapId)
                };

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

            return result;
        }
Exemplo n.º 3
0
        public SigmaResultType AddCostCodeMap(TypeCostCodeMap objCostCodeMap)
        {
            TransactionScope scope = null;
            SigmaResultType result = new SigmaResultType();

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

            List<SqlParameter> paramList = new List<SqlParameter>();
            paramList.Add(new SqlParameter("@ClientCostCodeId", objCostCodeMap.ClientCostCodeId));
            paramList.Add(new SqlParameter("@ProjectCostCodeId", objCostCodeMap.ProjectCostCodeId));
            paramList.Add(new SqlParameter("@ProjectId", AuthMgr.GetUserInfo().CurrentProjectId));
            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_AddCostCodeMap", paramList.ToArray());
                result.IsSuccessful = true;
                result.ScalarValue = (int)outParam.Value;
                scope.Complete();

            }
            result.IsSuccessful = true;
            return result;
        }