public void RetornoDWCanalSegmento()
        {
            List <OrcamentodaUnidade> lstOrcamentodaUnidade = RepositoryService.OrcamentodaUnidade.ListarOrcamentos(DateTime.Now.Date.Year);

            if (lstOrcamentodaUnidade.Count == 0)
            {
                return;
            }

            DataTable dtOrcamentoCanalSeg = RepositoryService.OrcamentodoCanalporSegmento.ListarCanalSegmentoDW(DateTime.Now.Date.Year, Helper.TrimestreAtual()[1], lstOrcamentodaUnidade);

            #region Atualiza Orçamentos Trimestre
            foreach (DataRow item in dtOrcamentoCanalSeg.Rows)
            {
                UnidadeNegocio mUnidadeNegocio = RepositoryService.UnidadeNegocio.ObterPorChaveIntegracao(item["CD_Unidade_Negocio"].ToString());
                Conta          mConta          = RepositoryService.Conta.ObterCanal(item["CD_Emitente"].ToString());
                Segmento       mSegmento       = RepositoryService.Segmento.ObterPor(item["cd_segmento"].ToString());

                if (mUnidadeNegocio != null && mConta != null && mSegmento != null)
                {
                    OrcamentodoCanalporSegmento mOrcamentodoCanalporSegmento = RepositoryService.OrcamentodoCanalporSegmento.ObterPor(mUnidadeNegocio.ID.Value, Convert.ToInt32(item["cd_ano"].ToString()), Helper.TrimestreAtual()[1], mConta.ID.Value, mSegmento.ID.Value);

                    if (mOrcamentodoCanalporSegmento != null)
                    {
                        mOrcamentodoCanalporSegmento.OrcamentoRealizado = decimal.Parse(item["vlr"].ToString());

                        RepositoryService.OrcamentodoCanalporSegmento.Update(mOrcamentodoCanalporSegmento);
                    }
                }
            }
            #endregion
        }
示例#2
0
        public void RetornoDWTrimestreFamilia(int ano, int trimestre)
        {
            List <OrcamentodaUnidade> lstOrcamentodaUnidade = RepositoryService.OrcamentodaUnidade.ListarOrcamentos(ano);

            if (lstOrcamentodaUnidade.Count == 0)
            {
                return;
            }

            DataTable dtOrcamentoTrimestreSeg = RepositoryService.OrcamentodaUnidadeporFamilia.ListarOrcamentoFamiliaDW(ano, trimestre, lstOrcamentodaUnidade);

            foreach (DataRow item in dtOrcamentoTrimestreSeg.Rows)
            {
                UnidadeNegocio mUnidadeNegocio = RepositoryService.UnidadeNegocio.ObterPorChaveIntegracao(item["CD_Unidade_Negocio"].ToString());
                Segmento       mSegmento       = RepositoryService.Segmento.ObterPor(item["cd_segmento"].ToString());
                FamiliaProduto mFamiliaProduto = RepositoryService.FamiliaProduto.ObterPor(item["CD_familia"].ToString());

                if (mUnidadeNegocio != null && mSegmento != null && mFamiliaProduto != null)
                {
                    OrcamentodaUnidadeporFamilia mOrcamentoCanalTrimetre = RepositoryService.OrcamentodaUnidadeporFamilia.ObterOrcamentoFamilia(mUnidadeNegocio.ID.Value, ano, trimestre, mSegmento.ID.Value, mFamiliaProduto.ID.Value);

                    if (mOrcamentoCanalTrimetre != null)
                    {
                        mOrcamentoCanalTrimetre.OrcamentoRealizado = item.Field <decimal>("vlr");
                        RepositoryService.OrcamentodaUnidadeporFamilia.Update(mOrcamentoCanalTrimetre);
                    }
                }
            }
        }
        public void RetornoDWProduto(int ano, int trimestre)
        {
            List <MetadaUnidade> lstMetadaUnidade = RepositoryService.MetadaUnidade.ListarMetas(ano);

            if (lstMetadaUnidade.Count == 0)
            {
                return;
            }

            DataTable dtMetaCanal = RepositoryService.PotencialdoSupervisorporProduto.ListarMetaTrimestreDW(ano, trimestre, lstMetadaUnidade);

            foreach (DataRow item in dtMetaCanal.Rows)
            {
                UnidadeNegocio    mUnidadeNegocio    = RepositoryService.UnidadeNegocio.ObterPorChaveIntegracao(item["CD_Unidade_Negocio"].ToString());
                Usuario           mUsuario           = RepositoryService.Usuario.ObterPor(item["CD_representante"].ToString());
                Segmento          mSegmento          = RepositoryService.Segmento.ObterPor(item["cd_segmento"].ToString());
                FamiliaProduto    mFamiliaProduto    = RepositoryService.FamiliaProduto.ObterPor(item["CD_familia"].ToString());
                SubfamiliaProduto mSubfamiliaProduto = RepositoryService.SubfamiliaProduto.ObterPor(item["CD_subfamilia"].ToString());
                Product           mProduto           = RepositoryService.Produto.ObterPor(item["cd_item"].ToString());

                if (mUnidadeNegocio != null && mUsuario != null && mSegmento != null && mFamiliaProduto != null && mSubfamiliaProduto != null && mProduto != null)
                {
                    PotencialdoSupervisorporProduto mPotencialdoSupervisorporProduto = RepositoryService.PotencialdoSupervisorporProduto
                                                                                       .Obter(mUnidadeNegocio.ID.Value, mUsuario.ID.Value, Convert.ToInt32(item["cd_ano"].ToString()), trimestre, mSegmento.ID.Value, mFamiliaProduto.ID.Value, mSubfamiliaProduto.ID.Value, mProduto.ID.Value);

                    if (mPotencialdoSupervisorporProduto != null)
                    {
                        mPotencialdoSupervisorporProduto.PotencialRealizado = decimal.Parse(item["vlr"].ToString());
                        mPotencialdoSupervisorporProduto.QtdeRealizada      = decimal.Parse(item["qtde"].ToString());

                        RepositoryService.PotencialdoSupervisorporProduto.Update(mPotencialdoSupervisorporProduto);
                    }
                }
            }
        }
示例#4
0
        public ActionResult Edit(string[] ids, Segmento segmento)
        {
            if (!verificarPermiso(ROLES, (Usuario)Session["usuario"]))
            {
                return(View(@"~\Views\Shared\AccessDenied.cshtml"));
            }
            try
            {
                if (segmento.reglas == null)
                {
                    segmento.reglas = new List <Regla>();
                }

                if (ids != null && ids.Length > 0)
                {
                    foreach (var id in ids)
                    {
                        var r = new Regla();
                        r.id = int.Parse(id);
                        segmento.reglas.Add(r);
                    }
                }

                segmentoBll.Grabar(segmento);

                return(RedirectToAction("Index"));
            }
            catch
            {
                ViewBag.mensaje = "Error";
                return(View());
            }
        }
        //Algoritmo de asignación de Peor ajuste
        public void PeorAjuste(Segmento Proceso)
        {
            int  peorPos        = tamannoMemoria;         // variable que almacena la peor posición
            int  peorDiferencia = 0;
            bool encontroPos    = false;                  // variable para controlar si encontro un espacio
            int  tam            = Proceso.TamannoProceso; // almacena el tamaño del proceso a almacenar

            // Recorremos la lista de espacios vacios desde el inicio
            foreach (Segmento espaciosVacios in memoria.ListaEspaciosVacios())
            {
                // En el momento que encuentre un espacio, evalua si es el mas grande encontrado
                if (espaciosVacios.TamannoProceso >= tam)
                {
                    int diferencia = espaciosVacios.TamannoProceso - tam; // Diferencia entre el espacio vacio en memoria y el proceso al almacenar

                    // si el espacio en memoria que se evalua es mayor que el anterior entonces se almacena el actual
                    if (diferencia >= peorDiferencia)
                    {
                        peorDiferencia = diferencia;
                        peorPos        = espaciosVacios.PosicionInicio;
                        encontroPos    = true;
                    }
                }
            }
            if (encontroPos == true)
            {
                memoria.AlmacenarProceso(peorPos, tam, Proceso.NombreProceso);
                LlenarControles();
            }
            // Sino existe espacio entonces se notifica al usuario.
            else
            {
                MessageBox.Show("No es posible encontrar un espacio para el proceso", "Memoria Llena", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#6
0
 public Cliente(long idCliente, string nomeCliente, string cpfCnpj, Segmento segmento)
 {
     IdCliente   = idCliente;
     NomeCliente = nomeCliente;
     CpfCnpj     = cpfCnpj;
     Segmento    = segmento;
 }
        public HttpResponseMessage Inserir(HttpRequestMessage request, SegmentoViewModel segmentoVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest,
                                                      ModelState.Keys.SelectMany(k => ModelState[k].Errors)
                                                      .Select(m => m.ErrorMessage).ToArray());
                }
                else
                {
                    Usuario usuario = _usuarioRep.GetSingle(int.Parse(HttpContext.Current.User.Identity.GetUserId()));

                    Segmento novasegmento = new Segmento()
                    {
                        UsuarioCriacao = usuario,
                        DtCriacao = DateTime.Now,
                        DescSegmento = segmentoVM.DescSegmento,
                        Ativo = segmentoVM.Ativo
                    };
                    _segmentoRep.Add(novasegmento);

                    _unitOfWork.Commit();

                    // Update view model
                    segmentoVM = Mapper.Map <Segmento, SegmentoViewModel>(novasegmento);
                    response = request.CreateResponse(HttpStatusCode.Created, segmentoVM);
                }

                return response;
            }));
        }
        public HttpResponseMessage Atualizar(HttpRequestMessage request, SegmentoViewModel segmentoVM)
        {
            return(CreateHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                if (!ModelState.IsValid)
                {
                    response = request.CreateResponse(HttpStatusCode.BadRequest,
                                                      ModelState.Keys.SelectMany(k => ModelState[k].Errors)
                                                      .Select(m => m.ErrorMessage).ToArray());
                }
                else
                {
                    Segmento novasegmento = _segmentoRep.GetSingle(segmentoVM.Id);

                    Usuario usuario = _usuarioRep.GetSingle(int.Parse(HttpContext.Current.User.Identity.GetUserId()));
                    //if (novasegmento.Produtos.Count > 0 && segmentoVM.Ativo == false)
                    //   return request.CreateErrorResponse(HttpStatusCode.PreconditionFailed, "Não é possível ser desativado");
                    //else
                    novasegmento.AtualizarSegmento(segmentoVM, usuario);

                    _unitOfWork.Commit();

                    // Update view model
                    segmentoVM = Mapper.Map <Segmento, SegmentoViewModel>(novasegmento);
                    response = request.CreateResponse(HttpStatusCode.OK, segmentoVM);
                }

                return response;
            }));
        }
示例#9
0
        public Segmento Persistir(Segmento ObjSegmento, ref bool MudancaProprietario)
        {
            Segmento TmpSegmento = null;

            if (!String.IsNullOrEmpty(ObjSegmento.CodigoSegmento))
            {
                TmpSegmento = RepositoryService.Segmento.ObterPor(ObjSegmento.CodigoSegmento);
                if (TmpSegmento != null)
                {
                    ObjSegmento.ID = TmpSegmento.ID;

                    RepositoryService.Segmento.Update(ObjSegmento);

                    if (!TmpSegmento.Status.Equals(ObjSegmento.Status) && ObjSegmento.Status != null)
                    {
                        this.MudarStatus(TmpSegmento.ID.Value, ObjSegmento.Status.Value);
                    }

                    return(TmpSegmento);
                }
                else
                {
                    ObjSegmento.ID = RepositoryService.Segmento.Create(ObjSegmento);
                    return(ObjSegmento);
                }
            }
            else
            {
                return(null);
            }
        }
示例#10
0
        public Segmento soyPD1(string[] segmento, Segmento PD1)
        {
            /* Campo[] auxobligadosPD1 = new Campo[0];
             * Campo[] auxPD1 = new Campo[segmento.Length];*/
            List <Campo> auxPD1          = new List <Campo>();
            List <Campo> auxobligadosPD1 = new List <Campo>();

            String[] nombresPID = new String[] { "Segmento", "Living Dependency", "Living Arrangement", "Patient Primary Facility", "Patient Primary Care Provider Name & ID No.", "Student Indicator", "Handicap", "Living Will", "Organ Donor", "Separate Bill", "Duplicate Patient",
                                                 "Publicity Indicator", "Protection Indicator" };

            for (int i = 0; i < segmento.Length; i++)
            {
                Campo campo1 = new Campo();
                campo1.data    = segmento[i];
                campo1.isEmpty = estavacio(campo1.data);
                campo1.nombre  = nombresPID[i];
                auxPD1.Add(campo1);
            }

            /* for (int i = 0; i < auxPD1.Length; i++)
             * {
             *   PD1.campos.Add(auxPD1[i]);
             * }
             * for (int i = 0; i < auxobligadosPD1.Length; i++)
             * {
             *   PD1.camposobligados.Add(auxobligadosPD1[i]);
             * }*/

            PD1.campos          = auxPD1;
            PD1.camposobligados = auxobligadosPD1;

            return(PD1);
        }
        public void RetornoDWKaSubFamilia(int ano, int trimestre)
        {
            List <MetadaUnidade> lstMetadaUnidade = RepositoryService.MetadaUnidade.ListarMetas(ano);

            if (lstMetadaUnidade.Count == 0)
            {
                return;
            }

            DataTable dtMetaCanal = RepositoryService.PotencialdoKAporSubfamilia.ListarMetaTrimestreDW(ano, trimestre, lstMetadaUnidade);

            foreach (DataRow item in dtMetaCanal.Rows)
            {
                UnidadeNegocio    mUnidadeNegocio    = RepositoryService.UnidadeNegocio.ObterPorChaveIntegracao(item["CD_Unidade_Negocio"].ToString());
                Contato           mContato           = RepositoryService.Contato.ObterPor(item["CD_representante"].ToString());
                Segmento          mSegmento          = RepositoryService.Segmento.ObterPor(item["cd_segmento"].ToString());
                FamiliaProduto    mFamiliaProduto    = RepositoryService.FamiliaProduto.ObterPor(item["CD_familia"].ToString());
                SubfamiliaProduto mSubfamiliaProduto = RepositoryService.SubfamiliaProduto.ObterPor(item["CD_subfamilia"].ToString());

                if (mUnidadeNegocio != null && mContato != null && mSegmento != null && mFamiliaProduto != null && mSubfamiliaProduto != null)
                {
                    PotencialdoKAporSubfamilia mPotencialdoKAporSubfamilia = RepositoryService.PotencialdoKAporSubfamilia
                                                                             .Obter(mUnidadeNegocio.ID.Value, mContato.ID.Value, ano, trimestre, mSegmento.ID.Value, mFamiliaProduto.ID.Value, mSubfamiliaProduto.ID.Value);

                    if (mPotencialdoKAporSubfamilia != null)
                    {
                        mPotencialdoKAporSubfamilia.PotencialRealizado = decimal.Parse(item["vlr"].ToString());
                        RepositoryService.PotencialdoKAporSubfamilia.Update(mPotencialdoKAporSubfamilia);
                    }
                }
            }
        }
        public void AtualizarFaturamentoDoSegmento(int ano, int trimestre)
        {
            List <OrcamentodaUnidade> lstOrcamentodaUnidade = RepositoryService.OrcamentodaUnidade.ListarOrcamentos(ano);

            if (lstOrcamentodaUnidade.Count == 0)
            {
                return;
            }

            DataTable dtOrcamentoTrimestreSeg = RepositoryService.OrcamentodaUnidadeporSegmento.ListarOrcamentoSegmentoDW(ano, trimestre, lstOrcamentodaUnidade);

            foreach (DataRow item in dtOrcamentoTrimestreSeg.Rows)
            {
                UnidadeNegocio mUnidadeNegocio = RepositoryService.UnidadeNegocio.ObterPorChaveIntegracao(item["CD_Unidade_Negocio"].ToString());
                Segmento       mSegmento       = RepositoryService.Segmento.ObterPor(item["cd_segmento"].ToString());

                if (mUnidadeNegocio != null && mSegmento != null)
                {
                    OrcamentodaUnidadeporSegmento orcamentoUnidadePorSegmento = RepositoryService.OrcamentodaUnidadeporSegmento
                                                                                .ObterOrcamentoSegmento(mUnidadeNegocio.ID.Value, ano, trimestre, mSegmento.ID.Value, "itbc_orcamentoporsegmentoid");

                    if (orcamentoUnidadePorSegmento != null)
                    {
                        orcamentoUnidadePorSegmento.OrcamentoRealizado = item.Field <decimal>("vlr");
                        RepositoryService.OrcamentodaUnidadeporSegmento.Update(orcamentoUnidadePorSegmento);
                    }
                }
            }
        }
示例#13
0
        public Segmento soyBLG(string[] segmento, Segmento BLG)
        {
            /*Campo[] auxobligadosBLG = new Campo[0];
             * Campo[] auxBLG = new Campo[segmento.Length];*/
            List <Campo> auxBLG          = new List <Campo>();
            List <Campo> auxobligadosBLG = new List <Campo>();

            String[] nombresBLG = new String[] { "Segmento", "When to Charge", "Charge Type", "Account ID" };

            for (int i = 0; i < segmento.Length; i++)
            {
                Campo campo1 = new Campo();
                campo1.data    = segmento[i];
                campo1.isEmpty = estavacio(campo1.data);
                campo1.nombre  = nombresBLG[i];
                auxBLG.Add(campo1);
            }

            /*for (int i = 0; i < auxBLG.Length; i++)
             * {
             *  BLG.campos.Add(auxBLG[i]);
             * }
             * for (int i = 0; i < auxobligadosBLG.Length; i++)
             * {
             *  BLG.camposobligados.Add(auxobligadosBLG[i]);
             * }*/

            BLG.campos          = auxBLG;
            BLG.camposobligados = auxobligadosBLG;

            return(BLG);
        }
示例#14
0
        public Segmento soyNTE(string[] segmento, Segmento NTE)
        {
            /* Campo[] auxobligadosNTE = new Campo[0];
             * Campo[] auxNTE = new Campo[segmento.Length];*/

            List <Campo> auxNTE = new List <Campo>();

            List <Campo> auxobligadosNTE = new List <Campo>();

            string[] nombresNTE = new string[] { "Segmento", "Set ID - Notes and Comments", "Source of Comment", "Comment" };
            for (int i = 0; i < segmento.Length; i++)
            {
                Campo campo1 = new Campo();
                campo1.data    = segmento[i];
                campo1.isEmpty = estavacio(campo1.data);
                campo1.nombre  = nombresNTE[i];
                auxNTE.Add(campo1);
                // auxNTE[i] = campo1;
            }

            /*for (int i = 0; i < auxNTE.Length; i++)
             * {
             *  NTE.campos.Add(auxNTE[i]);
             * }
             * for (int i = 0; i < auxobligadosNTE.Length; i++)
             * {
             *  NTE.camposobligados.Add(auxobligadosNTE[i]);
             * }
             */
            NTE.campos          = auxNTE;
            NTE.camposobligados = auxobligadosNTE;

            return(NTE);
        }
示例#15
0
        public void RetornoDWCanalFamilia(int ano, int trimestre)
        {
            List <OrcamentodaUnidade> lstOrcamentodaUnidade = RepositoryService.OrcamentodaUnidade.ListarOrcamentos(ano);

            if (lstOrcamentodaUnidade.Count == 0)
            {
                return;
            }

            DataTable dtOrcamentoCanalFamilia = RepositoryService.OrcamentodoCanalporFamilia.ListarCanalFamiliaDW(ano, trimestre, lstOrcamentodaUnidade);

            foreach (DataRow item in dtOrcamentoCanalFamilia.Rows)
            {
                UnidadeNegocio mUnidadeNegocio = RepositoryService.UnidadeNegocio.ObterPorChaveIntegracao(item["cd_unidade_negocio"].ToString());
                Segmento       mSegmento       = RepositoryService.Segmento.ObterPor(item["cd_segmento"].ToString());
                FamiliaProduto mFamiliaProduto = RepositoryService.FamiliaProduto.ObterPor(item["CD_familia"].ToString());
                Conta          mConta          = RepositoryService.Conta.ObterCanal(item["CD_Emitente"].ToString());

                if (mUnidadeNegocio != null && mSegmento != null && mFamiliaProduto != null && mConta != null)
                {
                    OrcamentodoCanalporFamilia mOrcamentodoCanalporFamilia = RepositoryService.OrcamentodoCanalporFamilia.Obter(mUnidadeNegocio.ID.Value, ano, trimestre, mConta.ID.Value, mSegmento.ID.Value, mFamiliaProduto.ID.Value);

                    if (mOrcamentodoCanalporFamilia != null)
                    {
                        mOrcamentodoCanalporFamilia.OrcamentoRealizado = decimal.Parse(item["vlr"].ToString());
                        RepositoryService.OrcamentodoCanalporFamilia.Update(mOrcamentodoCanalporFamilia);
                    }
                }
            }
        }
 public static void AtualizarSegmento(this Segmento marca, SegmentoViewModel marcaVM, Usuario usuario)
 {
     marca.UsuarioAlteracao = usuario;
     marca.Ativo            = marcaVM.Ativo;
     marca.DescSegmento     = marcaVM.DescSegmento;
     marca.DtAlteracao      = DateTime.Now;
 }
示例#17
0
        public void AtualizarFaturamentoDoSegmentoRepresentante(int ano, int trimestre)
        {
            List <MetadaUnidade> lstMetadaUnidade = RepositoryService.MetadaUnidade.ListarMetas(ano);

            if (lstMetadaUnidade.Count == 0)
            {
                return;
            }

            DataTable dtMetaCanal = RepositoryService.PotencialdoKAporSegmento.ListarMetaTrimestreDW(ano, trimestre, lstMetadaUnidade);

            foreach (DataRow item in dtMetaCanal.Rows)
            {
                UnidadeNegocio mUnidadeNegocio = RepositoryService.UnidadeNegocio.ObterPorChaveIntegracao(item["CD_Unidade_Negocio"].ToString());
                Contato        mContato        = RepositoryService.Contato.ObterPor(item["CD_representante"].ToString());
                Segmento       mSegmento       = RepositoryService.Segmento.ObterPor(item["cd_segmento"].ToString());

                if (mUnidadeNegocio != null && mContato != null && mSegmento != null)
                {
                    PotencialdoKAporSegmento mPotencialdoKAporSegmento = RepositoryService.PotencialdoKAporSegmento.Obter(mUnidadeNegocio.ID.Value, mContato.ID.Value, ano, trimestre, mSegmento.ID.Value);
                    if (mPotencialdoKAporSegmento != null)
                    {
                        mPotencialdoKAporSegmento.PotencialRealizado = item.Field <decimal>("vlr");
                        RepositoryService.PotencialdoKAporSegmento.Update(mPotencialdoKAporSegmento);
                    }
                }
            }
        }
        public void AtualizarFaturamentoDoSegmento(int ano, int trimestre)
        {
            List <MetadaUnidade> lstMetas = RepositoryService.MetadaUnidade.ListarMetas(ano);

            if (lstMetas.Count != 0)
            {
                DataTable dtMetasSegmento = RepositoryService.MetadaUnidadeporSegmento.ListarMetasSegmentoDW(ano, trimestre, lstMetas);

                foreach (DataRow item in dtMetasSegmento.Rows)
                {
                    UnidadeNegocio mUnidadeNegocio = RepositoryService.UnidadeNegocio.ObterPorChaveIntegracao(item["CD_Unidade_Negocio"].ToString());
                    Segmento       mSegmento       = RepositoryService.Segmento.ObterPor(item["cd_segmento"].ToString());

                    if (mUnidadeNegocio != null && mSegmento != null)
                    {
                        MetadaUnidadeporSegmento itemcapa = RepositoryService.MetadaUnidadeporSegmento.ObterMetasSegmento(mUnidadeNegocio.ID.Value, mSegmento.ID.Value, ano, trimestre, "itbc_metaporsegmentoid");
                        if (itemcapa != null)
                        {
                            itemcapa.MetaRealizada = item.Field <decimal>("vlr");
                            RepositoryService.MetadaUnidadeporSegmento.Update(itemcapa);
                        }
                    }
                }
            }
        }
示例#19
0
文件: Recta.cs 项目: JBPKII/PRUSA3D
        //intersección ficticia o real
        public bool Interseccion2D(Segmento Segm, out Punto Int)
        {
            Int = new Punto();

            double resX, resY, resZ;
            double ma, mb;

            //calculo la pendiente de this, ma
            if (this.Inicio.X == this.Final.X)
            {
                ma = double.PositiveInfinity;
            }
            else
            {
                ma = (this.Final.Y - this.Inicio.Y) / (this.Final.X - this.Inicio.X);
            }

            //calculo la pendiente de Segm, mb
            if (Segm.Inicio.X == Segm.Final.X)
            {
                mb = double.PositiveInfinity;
            }
            else
            {
                mb = (Segm.Final.Y - Segm.Inicio.Y) / (Segm.Final.X - Segm.Inicio.X);
            }

            if (ma == mb)
            {
                //paralelas o coincidentes
                return(false);
            }
            else
            {
                if (double.IsPositiveInfinity(ma))
                {
                    //this es vertical
                    resX = this.Inicio.X;
                    resY = mb * (resX - Segm.Inicio.X) + Segm.Inicio.Y;
                }
                else if (double.IsPositiveInfinity(mb))
                {
                    //Segm es vertical
                    resX = Segm.Inicio.X;
                    resY = ma * (resX - this.Inicio.X) + this.Inicio.Y;
                }
                else
                {
                    //se cortan
                    resX = (ma * this.Inicio.X - mb * Segm.Inicio.X + Segm.Inicio.Y - this.Inicio.Y) / (ma - mb);
                    resY = ma * (resX - this.Inicio.X) + this.Inicio.Y;
                }

                //calculo resZ
                resZ = this.Inicio.Z;

                Int = new Punto(resX, resY, resZ);
                return(true);
            }
        }
示例#20
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Descricao")] Segmento segmento)
        {
            if (id != segmento.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(segmento);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SegmentoExists(segmento.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(segmento));
        }
        // Metodos de asignacion de memoria

        //Algoritmo de asignación de Primer ajuste
        public void PrimerAjuste(Segmento Proceso)
        {
            int  pos         = -1;                     // variable para asignar la posición donde se almacenará el proceso
            bool encontroPos = false;                  // variable para controlar si encontro un espacio
            int  tam         = Proceso.TamannoProceso; // almacena el tamaño del proceso a almacenar

            // Recorremos la lista de espacios vacios desde el inicio
            foreach (Segmento espaciosVacios in memoria.ListaEspaciosVacios())
            {
                // en el momento que encuentre un espacio, almacena la posicion de este
                if (espaciosVacios.TamannoProceso >= tam)
                {
                    pos         = espaciosVacios.PosicionInicio;
                    encontroPos = true;
                    break;
                }
            }
            // verificamos que haya encontrado un espacio y se envia a almacenar en memoria
            if (encontroPos == true)
            {
                memoria.AlmacenarProceso(pos, tam, Proceso.NombreProceso);
                LlenarControles();
            }
            // Sino existe espacio entonces se notifica al usuario.
            else
            {
                MessageBox.Show("No es posible encontrar un espacio para el proceso", "Memoria Llena", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
示例#22
0
        public void AtualizarFaturamentoDoSegmentoCanal(int ano, int trimestre)
        {
            List <MetadaUnidade> lstMetadaUnidade = RepositoryService.MetadaUnidade.ListarMetas(ano);

            if (lstMetadaUnidade.Count == 0)
            {
                return;
            }

            DataTable dtMetaCanalSegmento = RepositoryService.MetadoCanalporSegmento.ListarMetaCanalSegmentoDW(ano, trimestre, lstMetadaUnidade);

            foreach (DataRow item in dtMetaCanalSegmento.Rows)
            {
                UnidadeNegocio mUnidadeNegocio = RepositoryService.UnidadeNegocio.ObterPorChaveIntegracao(item["CD_Unidade_Negocio"].ToString());
                Conta          mConta          = RepositoryService.Conta.ObterCanal(item["CD_Emitente"].ToString());
                Segmento       mSegmento       = RepositoryService.Segmento.ObterPor(item["cd_segmento"].ToString());

                if (mUnidadeNegocio != null && mConta != null && mSegmento != null)
                {
                    MetadoCanalporSegmento mMetadoCanalporSegmento = RepositoryService.MetadoCanalporSegmento.Obter(mUnidadeNegocio.ID.Value, mConta.ID.Value, ano, trimestre, mSegmento.ID.Value, "itbc_metadocanalporsegmentoid");
                    if (mMetadoCanalporSegmento != null)
                    {
                        mMetadoCanalporSegmento.MetaRealizada = item.Field <decimal>("vlr");
                        RepositoryService.MetadoCanalporSegmento.Update(mMetadoCanalporSegmento);
                    }
                }
            }
        }
示例#23
0
        public List <Segmento> GetSegmentos()
        {
            List <Segmento> result = new List <Segmento>();

            using (BancoDeDados bd = BancoDeDados.ObterInstancia())
            {
                string queryStr = @"select t.id, t.texto from lov_empreendimento_segmento t";

                Comando comando = bd.CriarComando(queryStr);

                using (DbDataReader reader = bd.ExecutarReader(comando))
                {
                    while (reader.Read())
                    {
                        Segmento segmento = new Segmento();
                        segmento.id    = Convert.ToInt32(reader["id"]);
                        segmento.texto = Convert.ToString(reader["texto"]);
                        result.Add(segmento);
                    }
                    reader.Close();
                }
            }

            return(result);
        }
        public void RetornoDWMetaSubFamilia(int ano, int trimestre)
        {
            List <MetadaUnidade> lstMetadaUnidade = RepositoryService.MetadaUnidade.ListarMetas(ano);

            if (lstMetadaUnidade.Count == 0)
            {
                return;
            }

            DataTable dtOrcamentoSubFamilia = RepositoryService.MetadaUnidadeporSubfamilia.ListarMetaSubFamiliaDW(ano, trimestre, lstMetadaUnidade);

            foreach (DataRow item in dtOrcamentoSubFamilia.Rows)
            {
                UnidadeNegocio    mUnidadeNegocio    = RepositoryService.UnidadeNegocio.ObterPorChaveIntegracao(item["CD_Unidade_Negocio"].ToString());
                Segmento          mSegmento          = RepositoryService.Segmento.ObterPor(item["cd_segmento"].ToString());
                FamiliaProduto    mFamiliaProduto    = RepositoryService.FamiliaProduto.ObterPor(item["CD_familia"].ToString());
                SubfamiliaProduto mSubfamiliaProduto = RepositoryService.SubfamiliaProduto.ObterPor(item["CD_subfamilia"].ToString());

                if (mUnidadeNegocio != null && mSegmento != null && mFamiliaProduto != null && mSubfamiliaProduto != null)
                {
                    var itemcapa = RepositoryService.MetadaUnidadeporSubfamilia
                                   .ObterMetaSubFamilia(mUnidadeNegocio.ID.Value, mSegmento.ID.Value, mFamiliaProduto.ID.Value, mSubfamiliaProduto.ID.Value, ano, trimestre);

                    if (itemcapa != null)
                    {
                        itemcapa.MetaRealizada = decimal.Parse(item["vlr"].ToString());
                        RepositoryService.MetadaUnidadeporSubfamilia.Update(itemcapa);
                    }
                }
            }
        }
示例#25
0
        public TaxaCambio ObterTaxaCambioPorSegmento(Segmento segmento)
        {
            var sql = $"SELECT IdTaxaCambio, IdSegmento, ValorTaxa FROM dbo.TaxaCambio WHERE IdSegmento = @segmento";

            var parametros = new { @segmento = (int)segmento };

            return(ObterObjeto(sql, parametros, GerarTaxa()));
        }
示例#26
0
 public static string ToDescriptionString(this Segmento val)
 {
     DescriptionAttribute[] attributes = (DescriptionAttribute[])val
                                         .GetType()
                                         .GetField(val.ToString())
                                         .GetCustomAttributes(typeof(DescriptionAttribute), false);
     return(attributes.Length > 0 ? attributes[0].Description : string.Empty);
 }
示例#27
0
 public IActionResult Insertar([FromBody] Segmento datos)
 {
     if (repositorio.Insertar(datos))
     {
         return(Accepted());
     }
     return(BadRequest());
 }
示例#28
0
        //public SegmentoModel(SegmentoModel obj) : base(obj) { }


        public static new SegmentoModel Create(Segmento obj)
        {
            if (obj == null)
            {
                return(null);
            }
            return(new SegmentoModel(obj) as SegmentoModel);
        }
示例#29
0
 public void Insere(Segmento obj)
 {
     if (obj.Id == Guid.Empty)
     {
         obj.Id = Guid.NewGuid();
     }
     this.bd.Add(obj);
 }
示例#30
0
        public ActionResult DeleteConfirmed(int id)
        {
            Segmento segmento = db.Segmentoes.Find(id);

            db.Segmentoes.Remove(segmento);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }