Esempio n. 1
0
        /// <summary>
        /// InsertarCompetidores
        /// </summary>
        /// <param name="entCliente"></param>
        /// <param name="msg">string</param>
        /// <returns>bool</returns>
        public static bool InsertarCompetidores(ProyectoOportunidadMercadoCompetidore entCompetidor, out string msg)
        {
            try
            {
                using (Datos.FonadeDBDataContext db = new Datos.FonadeDBDataContext(System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString))
                {
                    if ((from row in db.ProyectoOportunidadMercadoCompetidores where row.IdProyecto == entCompetidor.IdProyecto select row).Count() > 9)
                    {
                        msg = Mensajes.Mensajes.GetMensaje(13);
                        return(false);
                    }
                    if ((from row in db.ProyectoOportunidadMercadoCompetidores
                         where row.Nombre == entCompetidor.Nombre
                         where row.IdProyecto == entCompetidor.IdProyecto
                         select row).Count() > 0)
                    {
                        msg = Mensajes.Mensajes.GetMensaje(5);
                        return(false);
                    }

                    db.ProyectoOportunidadMercadoCompetidores.InsertOnSubmit(entCompetidor);
                    db.SubmitChanges();
                    msg = null;
                    return(true);
                }
            }
            catch (Exception ex)
            {
                //todo guardar log
                msg = Mensajes.Mensajes.GetMensaje(7);
                return(false);
            }
        }
Esempio n. 2
0
        void ConsultarCompetidor()
        {
            ProyectoOportunidadMercadoCompetidore entCompetidor = new ProyectoOportunidadMercadoCompetidore();

            entCompetidor            = Negocio.PlanDeNegocioV2.Formulacion.OportunidadMercado.Competidores.GetCompetidor(IdCompetidor);
            txtNombreCompetidor.Text = entCompetidor.Nombre;
            txtLocalizacion.Text     = entCompetidor.Localizacion;
            TxtLogistica.Text        = entCompetidor.LogisticaDistribucion;
            txtOtroCual.Text         = entCompetidor.OtroCual;
            txtPrecios.Text          = entCompetidor.Precios;
            txtProductos.Text        = entCompetidor.ProductosServicios;

            LabelTitulo.Text = "EDITAR COMPETIDOR";
        }
Esempio n. 3
0
        protected void btnGuardarCompetidor_Click(object sender, EventArgs e)
        {
            try
            {
                string msg;
                bool   resul;

                ProyectoOportunidadMercadoCompetidore entCompetidor = new ProyectoOportunidadMercadoCompetidore()
                {
                    IdProyecto            = IdProyecto,
                    Localizacion          = txtLocalizacion.Text.Trim(),
                    LogisticaDistribucion = TxtLogistica.Text.Trim(),
                    Nombre             = txtNombreCompetidor.Text.Trim(),
                    OtroCual           = txtOtroCual.Text.Trim(),
                    Precios            = txtPrecios.Text.Trim(),
                    ProductosServicios = txtProductos.Text.Trim()
                };

                //idcliente > 0 editar
                if (IdCompetidor > 0)
                {
                    entCompetidor.IdCompetidor = IdCompetidor;
                    resul = Negocio.PlanDeNegocioV2.Formulacion.OportunidadMercado.Competidores.EditarCompetidor(entCompetidor, out msg);
                }
                else//insertar
                {
                    entCompetidor.IdProyecto = IdProyecto;
                    resul = Negocio.PlanDeNegocioV2.Formulacion.OportunidadMercado.Competidores.InsertarCompetidores(entCompetidor, out msg);
                }
                //actualizar la grilla de la pagina principal
                ScriptManager.RegisterStartupScript(Page, typeof(Page), "upd", "window.opener.__doPostBack('', 'updGrillaCompetidores');", true);

                if (resul)
                {
                    FonadeUser usuario = (FonadeUser)Session["usuarioLogged"];
                    ClientScript.RegisterStartupScript(this.GetType(), "Close", "<script>window.close();</script> ");
                    ProyectoGeneral.UpdateTab(Datos.Constantes.CONST_OportunidadMercado, IdProyecto, usuario.IdContacto, usuario.CodGrupo, false);
                }
                else
                {
                    Alert(msg);
                }
            }
            catch (Exception ex)
            {
                //todo guardar log
                Alert(ex.Message);
            }
        }
Esempio n. 4
0
        public static bool EditarCompetidor(ProyectoOportunidadMercadoCompetidore entCompetidor, out string msg)
        {
            try
            {
                using (Datos.FonadeDBDataContext db = new Datos.FonadeDBDataContext(System.Configuration.ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString))
                {
                    if ((from row in db.ProyectoOportunidadMercadoCompetidores
                         where row.Nombre == entCompetidor.Nombre
                         where row.IdCompetidor != entCompetidor.IdCompetidor
                         where row.IdProyecto == entCompetidor.IdProyecto
                         select row).Count() > 0)
                    {
                        msg = Mensajes.Mensajes.GetMensaje(5);
                        return(false);
                    }

                    var entCompetidordb = (from row in db.ProyectoOportunidadMercadoCompetidores
                                           where row.IdCompetidor == entCompetidor.IdCompetidor
                                           select row).First();

                    entCompetidordb.Nombre                = entCompetidor.Nombre;
                    entCompetidordb.IdCompetidor          = entCompetidor.IdCompetidor;
                    entCompetidordb.Localizacion          = entCompetidor.Localizacion;
                    entCompetidordb.LogisticaDistribucion = entCompetidor.LogisticaDistribucion;
                    entCompetidordb.OtroCual              = entCompetidor.OtroCual;
                    entCompetidordb.Precios               = entCompetidor.Precios;
                    entCompetidordb.ProductosServicios    = entCompetidor.ProductosServicios;

                    db.SubmitChanges();

                    msg = Mensajes.Mensajes.GetMensaje(8);
                    return(true);
                }
            }
            catch (Exception ex)
            {
                //todo guardar log
                msg = Mensajes.Mensajes.GetMensaje(7);
                return(false);
            }
        }