public GitHubApiMock(ICache settingsCache)
            : base(settingsCache)
        {
            // Log in
            Login("test", "test", null);

            // Set up a repository
            var repository = new Repository(null, null, null, null, null, null, null, 1, null, "test", "test\\test",
                "Test repository",
                null, null, false, false, 1, 1, 1, "master", 1, DateTimeOffset.Now.AddDays(-1),
                DateTimeOffset.Now.AddDays(-2), DateTimeOffset.Now.AddDays(-1),
                null,
                new User(null, null, null, 1, null, DateTimeOffset.Now, 1, "*****@*****.**", 1, 1, true, null, 1, 1,
                    null, "test", "test", 1, null, 0, 0, 0, null, false),
                null, null, true, false, true);
            var wrapper = new RepositoryWrapper(repository);
            Repository = wrapper;
            Repositories.Add(wrapper);

            GetLabels();
            GetMilestones();
        }
Ejemplo n.º 2
0
        public ActionResult GridGastosViewPartial()
        {
            int empresaId  = -1;
            int sucursalId = -1;

            if (Request.Params["Clave_Empresa"] != null)
            {
                int.TryParse("0" + Request.Params["Clave_Empresa"], out empresaId);
            }
            if (Request.Params["Clave_Sucursal"] != null)
            {
                int.TryParse("0" + Request.Params["Clave_Sucursal"], out sucursalId);
            }

            int verPptoId = FTPresupuestoProvider.getVersionPresupuestoIdByTipo(enumTipoDePresupuesto.GASTOS);

            //_unitOfWork.GetRepositoryInstance<VersionPresupuesto>().GetAllRecordsMax(v => v.VersionPresupuestoId);

            var model = _unitOfWork.GetRepositoryInstance <Pre_GastosBase>().GetAllRecordsIQueryable()
                        .Where(g => g.Clave_Empresa == empresaId && g.Clave_CCostos == sucursalId && g.VersionPresupuestoId == verPptoId).ToList();

            ejercicioCerrado    = FTPresupuestoProvider.getVersionPresupuestoEstatus(enumTipoDePresupuesto.GASTOS);
            ViewData["cerrado"] = (ejercicioCerrado ? "S" : "N");
            // SE OBTIENE LA CONFIGURACION PARA SABER CUALES DEBEN CONSULTAR EN DETALLE POR DEPARTAMENTO
            IRepositoryWrapper _REPO = new RepositoryWrapper();
            var deptos = _unitOfWork.GetRepositoryInstance <Pre_Configuracion>()
                         .GetFirstOrDefaultByParameter(c => c.Clave == "CTASDETGTOS");

            if (deptos != null)
            {
                if (!string.IsNullOrWhiteSpace(deptos.Valor))
                {
                    var      totalGastosDetalle = _REPO.GastoDetalle.GetMontoDetalleByBaseId(verPptoId, empresaId, sucursalId);
                    string[] ctas = deptos.Valor.Split(',');
                    foreach (var item in model)
                    {
                        item.EsPorDepartamento = false;
                        string subCuenta = (item.SubCuenta ?? 0).ToString();
                        if (ctas.Contains(subCuenta))
                        {
                            item.EsPorDepartamento = true;
                            item.DiferenciaDeptos  = true;
                            var montoDetalle = totalGastosDetalle.Where(x => x.BaseId == item.Oid).FirstOrDefault();
                            if (montoDetalle != null)
                            {
                                if (montoDetalle.Monto == (item.Monto ?? 0m))
                                {
                                    item.DiferenciaDeptos = false;
                                }
                            }
                        }
                        //foreach (string cta in ctas)
                        //{
                        //    if (cta == subCuenta)
                        //        item.EsPorDepartamento = true;
                        //}
                    }
                }
            }
            //foreach (var item in totalGastosDetalle)
            //{
            //    var baseTotal = model.FirstOrDefault(x => x.Oid == item.BaseId);
            //    if (baseTotal != null)
            //    {
            //        baseTotal.DiferenciaDeptos = false;
            //        if (baseTotal.Monto != item.Monto)
            //            baseTotal.DiferenciaDeptos = true;
            //    }
            //}

            //var model = db.Pre_GastosBase.Where(g => g.Clave_Empresa == empresaId && g.Clave_CCostos == sucursalId);
            return(PartialView("_GridGastosViewPartial", model.OrderBy(x => x.Desc_Area).ThenBy(x => x.NSubcuenta).ToList()));
        }
 public EquipmentTypeService(IEquipmentTypeRepository equipmentTypeRepository)
 {
     this.equipmentTypeRepository = new RepositoryWrapper <IEquipmentTypeRepository>(equipmentTypeRepository);
 }
 public PatientAccountService(
     IPatientAccountRepository patientAccountRepository)
 {
     this.patientAccountRepository = new RepositoryWrapper <IPatientAccountRepository>(patientAccountRepository);
 }
 public SurveyService(ISurveyRepository repository)
 {
     surveyRepository = new RepositoryWrapper <ISurveyRepository>(repository);
 }
 public StatisticsController(RepositoryWrapper repositoryWrapper)
 {
     _repositoryWrapper = repositoryWrapper;
 }
Ejemplo n.º 7
0
 public TeacherManager(RepositoryWrapper repositoryWrapper)
     : base(repositoryWrapper)
 {
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Get the Repositories for a user login
        /// </summary>
        /// <param name="username"></param>
        /// <returns></returns>
        public IList <IRepository> GetRepositoriesForUser(string username)
        {
            var repositoryWrapper = new RepositoryWrapper(AcceptHeader, UserAgent);

            return(repositoryWrapper.GetRepositoriesForUser(username));
        }
Ejemplo n.º 9
0
 public SurveyResponseService(ISurveyResponseRepository surveyResponseRepository)
 {
     _surveyResponseWrapper = new RepositoryWrapper <ISurveyResponseRepository>(surveyResponseRepository);
 }
        public JsonResult GenerarNuevaBaseEjercicioFertilizantes(NuevaBaseEjercicioModel model)
        {
            IRepositoryWrapper _repo = new RepositoryWrapper();

            if (ModelState.IsValid)
            {
                try
                {
                    string[] selectedItems   = CheckBoxListExtension.GetSelectedValues <string>("chkEmpresasMesesList");
                    int      versionActualID = FTPresupuestoProvider.getVersionPresupuestoIdByTipo(enumTipoDePresupuesto.FERTILIZANTES);
                    int      versionPptoID   = model.VersionId;

                    // SE VALIDA QUE NO SE HAYA EJECUTADO DOS VECES EL MISMO PROCESO
                    if (versionPptoID > 0)
                    {
                        if (versionActualID != versionPptoID)
                        {
                            return(Json("Proceso Duplicado"));
                        }
                    }
                    var resultaTotal = _repo.Fertilizantes.ActualizarBase(model, selectedItems, User.Identity.Name);
                    if (!resultaTotal.Item1)
                    {
                        throw new Exception(string.Join(Environment.NewLine, resultaTotal.Item2));
                    }

                    //// SE CREA NUEVA VERSION DE PRESUPUESTO
                    //if (model.VersionId == 0)
                    //{
                    //    VersionPresupuesto versionPpto = new VersionPresupuesto
                    //    {
                    //        Consecutivo = model.Consecutivo,
                    //        Ejercicio = model.Ejercicio,
                    //        FechaCreacion = _unitOfWork.getDateOnlyFromServer(),
                    //        Observaciones = model.Observaciones,
                    //        TipoPresupuesto = (int)enumTipoDePresupuesto.FERTILIZANTES,
                    //        UsuarioCreacion = User.Identity.Name,
                    //        EstaCerrado = false
                    //    };
                    //    var result = await _repo.VersionesPresupuesto.CreateAsync(versionPpto);
                    //    if (!result.Item1)
                    //    {
                    //        throw new Exception(string.Join(Environment.NewLine, result.Item2));
                    //    }
                    //    versionPptoID = versionPpto.VersionPresupuestoId;
                    //}
                    //// PROCESO PARA COPIAR VERSION DE PRESUPUESTO A NUEVA VERSION
                    //var resultNuevaVersion = _repo.Fertilizantes
                    //    .GenerarVersion(model.VersionId, true, model.Observaciones, model.Ejercicio, model.Consecutivo, User.Identity.Name);
                    //if (!resultNuevaVersion.Item1)
                    //{
                    //    throw new Exception(string.Join(Environment.NewLine, resultNuevaVersion.Item2));
                    //}

                    //// SE INICIALIZA LA CONEXION Y CONTEXTO DE BASE DE DATOS


                    //using (FTPresupuestoEntities _db = new FTPresupuestoEntities())
                    //{
                    //    // CONFIGURAMOS PARA QUE EL TIEMMPO DE RESPUESTA SEA INDEFINIDO
                    //    _db.Database.CommandTimeout = 0;


                    //    // VALIDAMOS LA VERSION DE PRESUPUESTO A PROCESAR, DEBE SER LA ULTIMA
                    //    int versionProcesarID = FTPresupuestoProvider.getVersionPresupuestoIdByTipo(enumTipoDePresupuesto.FERTILIZANTES);

                    //    // SE EJECUTA LA CARGA DE PRESUPUESTO BASE
                    //    _db.ActualizarBase_Ppto_Fert(0, model.EmpresaId, model.Ejercicio, versionProcesarID,"");
                    //    //_db.temp_Ppto_Agroq_G(0, model.EmpresaId, model.Ejercicio, versionProcesarID);
                    //}

                    return(Json($"El Proceso finalizo de manera correcta a las {DateTime.Now.ToLongTimeString()} el {DateTime.Now.ToShortDateString()}"));
                }
                catch (Exception ex)
                {
                    string    errorMensaje = ex.Message;
                    Exception _ex          = ex.InnerException;
                    while (_ex != null)
                    {
                        errorMensaje = _ex.Message;
                        _ex          = _ex.InnerException;
                    }
                    return(Json(errorMensaje)); //Json(ex.InnerException.Message);
                }
            }
            return(Json("La Informacion esta Incompleta para procesar el nuevo ejercicio"));
        }
        public ActionResult AgregarProductoFertilizantes([ModelBinder(typeof(DevExpressEditorsBinder))] PresupuestoProductoViewModel producto)
        {
            IRepositoryWrapper _repo = new RepositoryWrapper();

            if (ModelState.IsValid)
            {
                int   divisionId = -1;
                short regionId   = -1;
                if (!string.IsNullOrWhiteSpace(producto.RegionDivisionID))
                {
                    string[] divisionRegion = producto.RegionDivisionID.Split(';');
                    divisionId = Convert.ToInt32(divisionRegion[0]);
                    regionId   = Convert.ToInt16(divisionRegion[1]);
                }
                bool existeProducto = _unitOfWork.GetRepositoryInstance <PreFertilizanteBaseTotal>()
                                      .GetExists(a => a.Ejercicio == producto.Ejercicio && a.VersionPresupuestoId == producto.VersionId &&
                                                 a.Clave_Empresa == producto.EmpresaID &&
                                                 a.Clave_Sucursal == producto.SucursalID &&
                                                 a.Clave_Grupo == producto.GrupoID &&
                                                 a.Clave_Familia == producto.FamiliaID &&
                                                 a.Tipocliente.Trim() == producto.TipoClienteID.Trim());

                if (existeProducto)
                {
                    ViewBag.ErrorMessage = "* EL PRODUCTO SELECCIONADO YA EXISTE EN EL PRESUPUESTO ACTUAL";
                    return(View(producto));
                }

                // CUANDO NO EXISTA SE DEBE AGREGAR AL PRESUPUESTO ACTUAL
                string descFamilia = _repo.Catalogos.GetNombreFamilia(producto.FamiliaID, producto.EmpresaID);  //string.Empty;
                //var familia = _unitOfWork.GetRepositoryInstance<Cat_Familias>()
                //    .GetFirstOrDefaultByParameter(f => f.Clave_Familia == producto.FamiliaID);
                //if (familia != null)
                //    descFamilia = familia.Desc_Familia;

                string descGrupo = string.Empty;
                var    grupo     = _unitOfWork.GetRepositoryInstance <Cat_Grupos>()
                                   .GetFirstOrDefaultByParameter(g => g.Clave_Grupo == producto.GrupoID);
                if (grupo != null)
                {
                    descGrupo = grupo.Desc_Grupo;
                }

                //string descProducto = string.Empty;
                //var prod = _unitOfWork.GetRepositoryInstance<Cat_Productos>()
                //        .GetFirstOrDefaultByParameter(p => p.Clave_Empresa == producto.EmpresaID && p.Clave_Producto == producto.ProductoID);
                //if (prod != null)//&& producto.FamiliaID == 101)
                //    descProducto = prod.Desc_Producto;

                string descRegion = string.Empty;
                var    reg        = _unitOfWork.GetRepositoryInstance <Cat_Regiones>()
                                    .GetFirstOrDefaultByParameter(r => r.Clave_Empresa == producto.EmpresaID && r.Clave_Region == regionId);
                if (reg != null)
                {
                    descRegion = reg.Desc_Region;
                }
                string descSucursal = string.Empty;
                var    suc          = _unitOfWork.GetRepositoryInstance <Cat_Sucursales>()
                                      .GetFirstOrDefaultByParameter(s => s.Clave_Empresa == producto.EmpresaID && s.Clave_Sucursal == producto.SucursalID);
                if (suc != null)
                {
                    descSucursal = suc.Desc_Sucursal;
                }

                decimal porcentajeMargen = 0m;
                if (producto.Toneladas == 0m)
                {
                    producto.PrecioVenta = 0m;
                }
                else
                {
                    producto.PrecioVenta = producto.Venta / producto.Toneladas;
                }
                if (producto.Venta == 0m)
                {
                    porcentajeMargen = 0m;
                }
                else
                {
                    porcentajeMargen = producto.UtilidadBruta / producto.Venta;
                }

                PreFertilizanteBaseTotal pbt = new PreFertilizanteBaseTotal
                {
                    AbrImporte                = 0m,
                    AbrMargen                 = 0m,
                    AbrTons                   = 0m,
                    AgoImporte                = 0m,
                    AgoMargen                 = 0m,
                    AgoTons                   = 0m,
                    Cantidad                  = producto.Toneladas,
                    Clave_Empresa             = producto.EmpresaID,
                    Clave_Familia             = producto.FamiliaID,
                    Clave_Grupo               = producto.GrupoID,
                    Clave_Producto            = producto.ProductoID,
                    Clave_Sucursal            = producto.SucursalID,
                    Costo_Importe             = 0m,
                    Costo_Unitario            = 0m,
                    Descuento_Importe         = 0m,
                    Desc_Familia              = descFamilia,
                    Desc_Marca                = string.Empty,
                    Desc_Sucursal             = descSucursal,
                    DicImporte                = producto.Venta,
                    DicMargen                 = producto.UtilidadBruta,
                    DicTons                   = producto.Toneladas,
                    Ejercicio                 = (short)producto.Ejercicio,
                    EneImporte                = 0m,
                    EneMargen                 = 0m,
                    EneTons                   = 0m,
                    FebImporte                = 0m,
                    FebMargen                 = 0m,
                    FebTons                   = 0m,
                    JulImporte                = 0m,
                    JulMargen                 = 0m,
                    JulTons                   = 0m,
                    JunImporte                = 0m,
                    JunMargen                 = 0m,
                    JunTons                   = 0m,
                    MargenBruto               = producto.UtilidadBruta,
                    MarImporte                = 0m,
                    MarMargen                 = 0m,
                    MarTons                   = 0m,
                    MayImporte                = 0m,
                    MayMargen                 = 0m,
                    MayTons                   = 0m,
                    NovImporte                = 0m,
                    NovMargen                 = 0m,
                    NovTons                   = 0m,
                    OctImporte                = 0m,
                    OctMargen                 = 0m,
                    OctTons                   = 0m,
                    PorcentajeMargen          = (double)porcentajeMargen,
                    PrecioVenta               = producto.PrecioVenta,
                    Precio_Importe            = producto.Venta,
                    Precio_Unitario           = 0m,
                    PresupuestoMargen         = producto.UtilidadBruta,
                    PresupuestoTons           = producto.Toneladas,
                    PresupuestoVentas         = producto.Venta,
                    PtjeIncEspecificoMG       = 0d,
                    PtjeIncEspecificoTons     = 0d,
                    PtjeIncGeneralPrecioVenta = 0d,
                    PtjeIncGeneralTons        = 0d,
                    SepImporte                = 0m,
                    SepMargen                 = 0m,
                    SepTons                   = 0m,
                    Tipocliente               = producto.TipoClienteID,
                    VersionPresupuestoId      = producto.VersionId,
                    Clave_Region              = regionId,
                    Desc_Grupo                = descGrupo,
                    Desc_Region               = descRegion
                };
                _unitOfWork.GetRepositoryInstance <PreFertilizanteBaseTotal>().Add(pbt);
                long     pbtID       = pbt.Oid;
                string[] nombreMeses = new string[] { "TODOS", "ENERO", "FEBRERO", "MARZO", "ABRIL", "MAYO", "JUNIO", "JULIO", "AGOSTO", "SEPTIEMBRE", "OCTUBRE", "NOVIEMBRE", "DICIEMBRE" };
                // SE AGREGAN LOS MESES
                for (short i = 0; i < 12; i++)
                {
                    short mes = i;
                    mes += 1;
                    PreFertilizanteMensual pm = new PreFertilizanteMensual
                    {
                        BaseTotalId          = pbtID,
                        DescuentoBase        = 0m,
                        Importe              = (mes == 12) ? producto.Venta : 0m,
                        ImporteBase          = (mes == 12) ? producto.Venta : 0m,
                        Margen               = (mes == 12) ? producto.UtilidadBruta : 0m,
                        MargenBase           = (mes == 12) ? producto.UtilidadBruta : 0m,
                        Mes                  = mes,
                        MesNombre            = nombreMeses[mes],
                        Orden                = mes,
                        PrecioVenta          = producto.PrecioVenta,
                        PrecioVentaBase      = producto.PrecioVenta,
                        PrecioVentaManual    = false,
                        PtjeMargen           = (double)porcentajeMargen * 100d,
                        PtjeMargenBase       = (double)porcentajeMargen * 100d,
                        PtjeMargenManual     = false,
                        ToneladaManual       = false,
                        Toneladas            = (mes == 12) ? producto.Toneladas : 0m,
                        ToneladasBase        = (mes == 12) ? producto.Toneladas : 0m,
                        VersionPresupuestoId = producto.VersionId
                    };
                    _unitOfWork.GetRepositoryInstance <PreFertilizanteMensual>().Add(pm);
                }
                return(RedirectToAction("Fertilizantes", "Versiones"));
            }
            ViewBag.ErrorMessage = "* LOS DATOS PARA AGREGAR EL PRODUCTO AL PRESUPUESTO TIENE ERRORES O ESTA INCOMPLETA";
            return(View(producto));
        }
Ejemplo n.º 12
0
 public HttpRequestsController(RepositoryWrapper repositoryWrapper, ILogger <HttpRequestsController> logger)
 {
     _repositoryWrapper = repositoryWrapper;
     _logger            = logger;
 }
Ejemplo n.º 13
0
 public GeofenceManagerDelegate()
 {
     this.repository   = ShinyHost.Resolve <IRepository>().Wrap();
     this.stateSubject = new Subject <GeofenceCurrentStatus>();
 }
Ejemplo n.º 14
0
 public AccountManager(RepositoryWrapper repositoryWrapper)
     : base(repositoryWrapper)
 {
 }
Ejemplo n.º 15
0
 public MedicationLookupActionEventService(IMedicationLookupActionEventRepository medicationLookupActionEventRepository)
 {
     _medicationLookupActionEventRepository = new RepositoryWrapper <IMedicationLookupActionEventRepository>(medicationLookupActionEventRepository);
 }
 public void FixtureSetUp()
 {
     _one = CreateWrapper(1, "test");
     _two = CreateWrapper(1, "test");
     _three = CreateWrapper(3, "three");
 }
 public SpecialtyService(ISpecialtyRepository specialtyRepository)
 {
     this.specialtyRepository = new RepositoryWrapper <ISpecialtyRepository>(specialtyRepository);
 }
Ejemplo n.º 18
0
 public EaProvider(RepositoryWrapper repository, RenderSettings renderSettings)
 {
     _repository = repository;
     _folder     = renderSettings.GetExtensionFolder(FileNames.ENTERPRISE_ARCHITECT);
 }
Ejemplo n.º 19
0
 public OfficeController(RepositoryWrapper repository, IMapper mapper)
 {
     _repository = repository;
     _mapper     = mapper;
 }
Ejemplo n.º 20
0
 public BaseService(BaseDbContext db, RepositoryWrapper repository, IMapper mapper)
 {
     this._db         = db;
     this._repository = repository;
     this._mapper     = mapper;
 }
Ejemplo n.º 21
0
 public RatingManager(RepositoryWrapper repositoryWrapper, SubjectManager subjectManager, StudentManager studentManager)
     : base(repositoryWrapper)
 {
     StudentManager = studentManager;
 }
 public SchedulingEventService(ISchedulingEventRepository schedulingEventRepository)
 {
     _schedulingEventRepository = new RepositoryWrapper <ISchedulingEventRepository>(schedulingEventRepository);
 }
Ejemplo n.º 23
0
 public DeaneryManager(RepositoryWrapper repositoryWrapper, FacultyManager facultyManager)
     : base(repositoryWrapper)
 {
     FacultyManager = facultyManager;
 }
 public ExaminationSchedulingService(IExaminationRepository examinationRepository, IShiftRepository shiftRepository)
 {
     this._examinationWrapper = new RepositoryWrapper <IExaminationRepository>(examinationRepository);
     this._shiftsWrapper      = new RepositoryWrapper <IShiftRepository>(shiftRepository);
 }