protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         IfCargaMasivaGProductos.Attributes["src"] = "CargaMasivaLevantamiento.aspx";
         try
         {
             llenaConsultaplanningAASS();
             cargaruscarBRecogerPor();
             //comboDistribuidora();
         }
         catch (Exception ex)
         {
             string error   = "";
             string mensaje = "";
             error   = Convert.ToString(ex.Message);
             mensaje = ConfigurationManager.AppSettings["ErrorConection"];
             if (error == mensaje)
             {
                 Lucky.CFG.Exceptions.Exceptions exs = new Lucky.CFG.Exceptions.Exceptions(ex);
                 string errMessage = "";
                 errMessage = mensaje;
                 errMessage = new Lucky.CFG.Util.Functions().preparaMsgError(ex.Message);
                 this.Response.Redirect("../../../err_mensaje.aspx?msg=" + errMessage, true);
             }
             else
             {
                 this.Session.Abandon();
                 Response.Redirect("~/err_mensaje_seccion.aspx", true);
             }
         }
     }
 }
Beispiel #2
0
        protected void btnGuardarReport_Click(object sender, EventArgs e)
        {
            try
            {
                if (ddlCanal.Text == "0" || ddlCampana.Text == "0" ||
                    ddlNodeComercial.Text == "0" || ddlPuntoVenta.Text == "0" || ddlCategoria.Text == "0")
                {
                    return;
                }

                Lucky.Business.Common.Application.OPE_Reporte_SOD oOPE_Reporte_SOD = new Lucky.Business.Common.Application.OPE_Reporte_SOD();


                DataTable dt    = null;
                DataTable dtl   = null;
                Conexion  Ocoon = new Conexion();
                Conexion  con   = new Conexion(2);
                dt = Ocoon.ejecutarDataTable("UP_WEB_SEARCH_USER", "", Convert.ToInt32(this.Session["personid"].ToString()));
                string idperfil = dt.Rows[0]["Perfil_id"].ToString();

                dtl = con.ejecutarDataTable("STP_JVM_LISTAR_CANALES", ddlCanal.SelectedValue);
                string tipocanal = dtl.Rows[0]["CAN_TIPO"].ToString();


                Lucky.Entity.Common.Application.EOPE_Reporte_SOD oEOPE_Reporte_SOD = oOPE_Reporte_SOD.RegistrarReporteSOD(Convert.ToInt32(this.Session["personid"].ToString()),
                                                                                                                          idperfil, ddlCampana.SelectedValue, this.Session["companyid"].ToString(),
                                                                                                                          ddlPuntoVenta.SelectedValue, ddlCategoria.SelectedValue, DateTime.Now.ToShortDateString(), "0", "0", "0", txtObservacion.Text);



                oOPE_Reporte_SOD.RegistrarReporteStock_Detalle(Convert.ToInt32(oEOPE_Reporte_SOD.ID_REG_SOD), ddlMarca.SelectedValue, txtPrimaria.Text, txtSecundaria.Text, "");

                LimpiarControles();
                lblmensaje.Visible   = true;
                lblmensaje.Text      = "Fue registrado con exito el reporte de SOD";
                lblmensaje.ForeColor = System.Drawing.Color.Blue;
            }

            catch (Exception ex)
            {
                string error   = "";
                string mensaje = "";
                error = Convert.ToString(ex.Message);
                // mensaje = ConfigurationManager.AppSettings["ErrorConection"];
                if (error == mensaje)
                {
                    Lucky.CFG.Exceptions.Exceptions exs = new Lucky.CFG.Exceptions.Exceptions(ex);
                    string errMessage = "";
                    errMessage = mensaje;
                    errMessage = new Lucky.CFG.Util.Functions().preparaMsgError(ex.Message);
                    this.Response.Redirect("../../../err_mensaje.aspx?msg=" + errMessage, true);
                }
                else
                {
                    this.Session.Abandon();
                    Response.Redirect("~/err_mensaje_seccion.aspx", true);
                }
            }
        }
        protected void btn_guardarNew_Click(object sender, EventArgs e)
        {
            try
            {
                if (rcmb_newObj.SelectedIndex > 0 && rcmb_mesNewDesde.SelectedIndex > 0 && rcmb_mesNewHasta.SelectedIndex > 0)
                {
                    iservicio  = Convert.ToInt32(this.Session["Service"]);
                    Report     = Convert.ToInt32(this.Session["Reporte"]);
                    iidcompany = Convert.ToInt32(this.Session["companyid"].ToString());
                    sidcanal   = this.Session["Canal"].ToString();
                    siduser    = this.Session["sUser"].ToString();
                    for (int i = 0; i < RadGrid_newObjtives.Items.Count; i++)
                    {
                        GridDataItem ditem = RadGrid_newObjtives.Items[i];

                        string idElemento    = (ditem.FindControl("lbl_id_elemento") as Label).Text;
                        string cod_cobertura = (ditem.FindControl("lbl_id_cobertura") as Label).Text;

                        object objetivo = (ditem.FindControl("rtxt_objetive") as RadNumericTextBox).DbValue;

                        if ((ditem.FindControl("rtxt_objetive") as RadNumericTextBox).Text.Length != 0)
                        {
                            if (rcmb_newObj.SelectedValue == "1")
                            {
                                oCoon.ejecutarDataReader("UP_WEBXPLORA_CLIE_V2_INSERTAR_OBJETIVOS_DE_PRESENCIA_POR_TIPOCIUDAD", iservicio, sidcanal, iidcompany, Report, Convert.ToInt32(cod_cobertura), idElemento, rcmb_añoNew.SelectedValue, rcmb_mesNewDesde.SelectedValue, rcmb_mesNewHasta.SelectedValue, Convert.ToInt32(objetivo), siduser, DateTime.Now, siduser, DateTime.Now);
                            }
                            else if (rcmb_newObj.SelectedValue == "2")
                            {
                                oCoon.ejecutarDataReader("UP_WEBXPLORA_CLIE_V2_INSERTAR_OBJETIVOS_DE_PRESENCIA_POR_OFICINA", iservicio, sidcanal, iidcompany, Report, Convert.ToInt32(cod_cobertura), idElemento, rcmb_añoNew.SelectedValue, rcmb_mesNewDesde.SelectedValue, rcmb_mesNewHasta.SelectedValue, Convert.ToInt32(objetivo), siduser, DateTime.Now, siduser, DateTime.Now);
                            }
                        }
                    }
                    ModalPopupExtender_add.Show();

                    lbl_msj_validation.Text      = "Registro exitoso.";
                    lbl_msj_validation.ForeColor = System.Drawing.Color.Green;
                    ModalPopupExtender_validationMessage.Show();
                }
                else
                {
                    //ModalPopupExtender_add.Hide();

                    ModalPopupExtender_validationMessage.Show();
                    lbl_msj_validation.Text = "Por favor, termine de seleccionar las opciones.";
                    //UpdatePanel_validationMessage.Update();
                }
            }
            catch (Exception ex)
            {
                lbl_msj_validation.Text      = "Error, intentalo nuevamente.";
                lbl_msj_validation.ForeColor = System.Drawing.Color.Red;
                ModalPopupExtender_validationMessage.Show();

                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(System.Configuration.ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
        private void llenarreporteEvolucionSODMayxPDV()
        {
            icompany  = Convert.ToInt32(this.Session["companyid"]);
            iservicio = Convert.ToInt32(this.Session["Service"]);
            canal     = this.Session["Canal"].ToString().Trim();
            Report    = Convert.ToInt32(this.Session["Reporte"]);
            iservicio = Convert.ToInt32(this.Session["Service"]);

            try
            {
                rpesodxpdv         = (ReportViewer)(Reporte_v2_SOD_SODporPDVMayorista.FindControl("Reportevosodxpdv"));
                rpesodxpdv.Visible = true;
                //rpesodxpdv.ZoomMode = Microsoft.Reporting.WebForms.ZoomMode.Percent;
                rpesodxpdv.ServerReport.ReportPath = "/Reporte_Precios_V1/SOD_Por_PDV_Mayorista";

                String strConnection = ConfigurationManager.AppSettings["SERVIDOR_REPORTING_SERVICES"];

                rpesodxpdv.ServerReport.ReportServerUrl         = new Uri(strConnection);
                rpesodxpdv.ServerReport.ReportServerCredentials = new CFG.Tools.ReportServerNetCredentials();

                List <Microsoft.Reporting.WebForms.ReportParameter> parametros = new List <Microsoft.Reporting.WebForms.ReportParameter>();


                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("AÑO", sidaño));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("MES", sidmes));
                //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("PERIODO", cmb_periodo.SelectedValue));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("OFICINA", sidciudad));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CATEGORIA", sidcategoria));
                // parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("SUBCATEGO", sidsub_categoria));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("MARCA", sidmarca));
                //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("SUBMARCA", sidsub_marca));
                //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("PRODUCTOS", cmb_skuProducto.SelectedValue));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("PDV", sidpuntoventa));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CANAL", canal));

                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CLIENTE", Convert.ToString(icompany)));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("SERVICIO", Convert.ToString(iservicio)));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("ValidAnalyst", "0"));



                rpesodxpdv.ServerReport.SetParameters(parametros);
            }
            catch (Exception ex)
            {
                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
        protected void btn_guardarPSNew_Click(object sender, EventArgs e)
        {
            try
            {
                if (rcmb_añoNewPS.SelectedIndex > 0 && rcmb_mesNewDesdePS.SelectedIndex > 0 && rcmb_mesNewHastaPS.SelectedIndex > 0)
                {
                    iidcompany = Convert.ToInt32(this.Session["companyid"].ToString());
                    sidcanal   = this.Session["Canal"].ToString();
                    siduser    = this.Session["sUser"].ToString();
                    for (int i = 0; i < RadGrid_newPSugeridoPS.Items.Count; i++)
                    {
                        GridDataItem ditem = RadGrid_newPSugeridoPS.Items[i];

                        string cod_product  = ditem["cod_Product"].Text;
                        object PrecSugerido = (ditem.FindControl("rtxt_precio") as RadNumericTextBox).DbValue;


                        if (PrecSugerido != null)
                        {
                            oCoon.ejecutarDataReader("UP_WEBXPLORA_CLIE_V2_INSERTAR_PRECIO_SUGERIDO_SKU_MADATORIO", sidcanal, iidcompany, rcmb_añoNewPS.SelectedValue, rcmb_mesNewDesdePS.SelectedValue, rcmb_mesNewHastaPS.SelectedValue, cod_product, PrecSugerido, siduser, DateTime.Now, siduser, DateTime.Now);
                        }
                    }

                    ModalPopupExtender_addPS.Show();

                    lbl_msj_validation.Text      = "Registro exitoso.";
                    lbl_msj_validation.ForeColor = System.Drawing.Color.Green;
                    ModalPopupExtender_validationMessagePS.Show();
                }
                else
                {
                    //ModalPopupExtender_addPS.Hide();

                    ModalPopupExtender_validationMessagePS.Show();
                    lbl_msj_validation.Text = "Por favor, termine de seleccionar las opciones.";
                    //UpdatePanel_validationMessagePS.Update();
                }
            }
            catch (Exception ex)
            {
                lbl_msj_validation.Text      = "Error, intentalo nuevamente.";
                lbl_msj_validation.ForeColor = System.Drawing.Color.Red;
                ModalPopupExtender_validationMessagePS.Show();

                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(System.Configuration.ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
        protected void BtnActuUsuInfo_Click(object sender, EventArgs e)
        {
            try
            {
                for (int i = 0; i <= GvLPublicaciones.Rows.Count - 1; i++)
                {
                    if (((DropDownList)GvLPublicaciones.Rows[i].Cells[0].FindControl("cmbsku")).Text == "0" || ((DropDownList)GvLPublicaciones.Rows[i].Cells[1].FindControl("cmbFamilia")).Text == "0")
                    {
                    }
                    else
                    {
                        EOPE_REPORTE_PUBLICACION oeLevanPublicaciones = oreporPublicacion.Actualizar_levaPublicacion(Convert.ToInt32(((Label)GvLPublicaciones.Rows[i].Cells[0].FindControl("lblcodregistro")).Text), Convert.ToInt32(((DropDownList)GvLPublicaciones.Rows[i].Cells[8].FindControl("cmbCadena")).Text), ((DropDownList)GvLPublicaciones.Rows[i].Cells[2].FindControl("cmbFamilia")).Text, ((DropDownList)GvLPublicaciones.Rows[i].Cells[1].FindControl("cmbsku")).Text,
                                                                                                                     Convert.ToInt32(((DropDownList)GvLPublicaciones.Rows[i].Cells[9].FindControl("cmbTipo")).Text), Convert.ToDateTime(((TextBox)GvLPublicaciones.Rows[i].Cells[6].FindControl("txt_Inicio_Actividad")).Text), Convert.ToDateTime(((TextBox)GvLPublicaciones.Rows[i].Cells[7].FindControl("txt_Fin_Actividad")).Text), DateTime.Now, Convert.ToString(this.Session["sUser"]), DateTime.Now, true, ((TextBox)GvLPublicaciones.Rows[i].Cells[3].FindControl("TxtPP")).Text,
                                                                                                                     Convert.ToDecimal(((TextBox)GvLPublicaciones.Rows[i].Cells[4].FindControl("TxtPVP")).Text), Convert.ToDecimal(((TextBox)GvLPublicaciones.Rows[i].Cells[5].FindControl("TxtOferta")).Text));
                    }
                }


                SavelimpiarcontrolesLP();
                saveActivarbotonesLP();
                desactivarControleLP();
                Alertas.CssClass  = "MensajesCorrecto";
                LblFaltantes.Text = "Registros de Levantamiento de Publicaciones  fueron Actualizados con Exito";
                MensajeAlerta();
            }
            catch (Exception ex)
            {
                string error   = "";
                string mensaje = "";
                error   = Convert.ToString(ex.Message);
                mensaje = ConfigurationManager.AppSettings["ErrorConection"];
                if (error == mensaje)
                {
                    Lucky.CFG.Exceptions.Exceptions exs = new Lucky.CFG.Exceptions.Exceptions(ex);
                    string errMessage = "";
                    errMessage = mensaje;
                    errMessage = new Lucky.CFG.Util.Functions().preparaMsgError(ex.Message);
                    this.Response.Redirect("../../../err_mensaje.aspx?msg=" + errMessage, true);
                }
                else
                {
                    this.Session.Abandon();
                    Response.Redirect("~/err_mensaje_seccion.aspx", true);
                }
            }
        }
        protected void cargar_gv_newObjetivosPresenciaPorOficina()
        {
            try
            {
                iservicio  = Convert.ToInt32(this.Session["Service"]);
                sidcanal   = this.Session["Canal"].ToString();
                iidcompany = Convert.ToInt32(this.Session["companyid"].ToString());

                DataTable dt = oCoon.ejecutarDataTable("UP_WEBXPLORA_CLIE_V2_OBTENER_POP_Y_OFICINA", iservicio, sidcanal, iidcompany);
                RadGrid_newObjtives.DataSource = dt;
                RadGrid_newObjtives.DataBind();
            }
            catch (Exception ex)
            {
                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(System.Configuration.ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
        protected void btn_aceptar_Click(object sender, EventArgs e)
        {
            btn_aceptar2.Visible = true;
            btn_aceptar.Visible  = false;
            btn_cancelar.Visible = false;
            try
            {
                Report = Convert.ToInt32(this.Session["Reporte"]);
                oCoon.ejecutarDataReader("UP_WEBXPLORA_CLIE_V2_REPORT_PLANNING_ACTUALIZAR_VALIDACION", Report, lbl_año_value.Text.Trim(), lbl_mes_value.Text.Trim(), lbl_periodo_value.Text.Trim(), chkb_validar.Checked, Session["sUser"].ToString(), DateTime.Now);

                ModalPopupExtender_ValidationAnalyst.Show();
                lbl_msj_validar.Text = "El cambio se realizo con exito.";
            }
            catch (Exception ex)
            {
                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
        protected void cargar_gv_objetivosPresenciaPorOficina()
        {
            try
            {
                iidcompany = Convert.ToInt32(this.Session["companyid"].ToString());
                sidcanal   = this.Session["Canal"].ToString();

                DataTable dtObjPresencia = oCoon.ejecutarDataTable("UP_WEBXPLORA_CLIE_V2_OBTENER_OBJETIVOS_DE_PRESENCIA_POR_OFICINA", sidcanal, iidcompany, rcmb_año.SelectedValue, rcmb_mes.SelectedValue);


                RadGrid_objetivos.DataSource = dtObjPresencia;
                RadGrid_objetivos.DataBind();
            }
            catch (Exception ex)
            {
                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(System.Configuration.ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
        protected void btn_guardar_Click(object sender, EventArgs e)
        {
            try
            {
                iidcompany = Convert.ToInt32(this.Session["companyid"].ToString());
                sidcanal   = this.Session["Canal"].ToString();
                siduser    = this.Session["sUser"].ToString();
                for (int i = 0; i < RadGrid_objetivos.Items.Count; i++)
                {
                    GridDataItem ditem = RadGrid_objetivos.Items[i];

                    string idElemento    = (ditem.FindControl("lbl_id_elemento") as Label).Text;
                    string cod_cobertura = (ditem.FindControl("lbl_id_cobertura") as Label).Text;
                    string id_year       = (ditem.FindControl("lbl_id_year") as Label).Text;
                    string id_month      = (ditem.FindControl("lbl_id_month") as Label).Text;
                    object objetivo      = (ditem.FindControl("rtxt_objetive") as RadNumericTextBox).DbValue;

                    if (rcmb_tipoObjetivos.SelectedValue == "1")
                    {
                        oCoon.ejecutarDataReader("UP_WEBXPLORA_CLIE_V2_ACTUALIZAR_OBJETIVOS_DE_PRESENCIA_POR_TIPOCIUDAD", sidcanal, iidcompany, Convert.ToInt32(cod_cobertura), idElemento, id_year, id_month, Convert.ToInt32(objetivo), siduser, DateTime.Now);
                    }
                    else if (rcmb_tipoObjetivos.SelectedValue == "2")
                    {
                        oCoon.ejecutarDataReader("UP_WEBXPLORA_CLIE_V2_ACTUALIZAR_OBJETIVOS_DE_PRESENCIA_POR_CUIDAD", sidcanal, iidcompany, Convert.ToInt32(cod_cobertura), idElemento, id_year, id_month, Convert.ToInt32(objetivo), siduser, DateTime.Now);
                    }
                }

                lbl_msj_validation.Text      = "Registro exitoso.";
                lbl_msj_validation.ForeColor = System.Drawing.Color.Green;
                ModalPopupExtender_validationMessage.Show();
            }
            catch (Exception ex)
            {
                lbl_msj_validation.Text      = "Error, intentelo nuevamente.";
                lbl_msj_validation.ForeColor = System.Drawing.Color.Red;
                ModalPopupExtender_validationMessage.Show();

                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(System.Configuration.ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
        protected void RadGrid_newPSugeridoPS_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
        {
            try
            {
                iservicio  = Convert.ToInt32(this.Session["Service"]);
                sidcanal   = this.Session["Canal"].ToString();
                iidcompany = Convert.ToInt32(this.Session["companyid"].ToString());

                DataTable dt = oCoon.ejecutarDataTable("UP_WEBXPLORA_CLIE_V2_OBTENER_SKU_MANDATORIOS", iservicio, sidcanal, iidcompany);

                RadGrid_newPSugeridoPS.DataSource = dt;
                //En este evento no se nececita llamar el DataBind()

                //UpdatePanel_newPSugeridoPS.Update();
            }
            catch (Exception ex)
            {
                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(System.Configuration.ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
        private void llenarreporteCumpliIbjetivos()
        {
            icompany = Convert.ToInt32(this.Session["companyid"]);
            canal    = this.Session["Canal"].ToString().Trim();
            Report   = Convert.ToInt32(this.Session["Reporte"]);

            try
            {
                rpcuobje         = (ReportViewer)(Reporte_v2_SOD_CumplimientoDeObjetivosMayorista.FindControl("Reporcuobj"));
                rpcuobje.Visible = true;
                // rpcuobje.ZoomMode = Microsoft.Reporting.WebForms.ZoomMode.FullPage;
                rpcuobje.ServerReport.ReportPath = "/Reporte_Precios_V1/Objetivos_Marca_vs_SOD_RealizadoV2";

                String strConnection = ConfigurationManager.AppSettings["SERVIDOR_REPORTING_SERVICES"];

                rpcuobje.ServerReport.ReportServerUrl         = new Uri(strConnection);
                rpcuobje.ServerReport.ReportServerCredentials = new CFG.Tools.ReportServerNetCredentials();

                List <Microsoft.Reporting.WebForms.ReportParameter> parametros = new List <Microsoft.Reporting.WebForms.ReportParameter>();

                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CLIENTE", Convert.ToString(icompany)));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("CANAL", canal));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("AÑO", sidaño));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("NEGOCIO", "0"));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("MES", sidmes));
                parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("SERVICIO", Convert.ToString(iservicio)));

                //parametros.Add(new Microsoft.Reporting.WebForms.ReportParameter("PDV",sidpuntoventa));



                rpcuobje.ServerReport.SetParameters(parametros);
            }
            catch (Exception ex)
            {
                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
        protected void btn_guardarPS_Click(object sender, EventArgs e)
        {
            try
            {
                iidcompany = Convert.ToInt32(this.Session["companyid"].ToString());
                sidcanal   = this.Session["Canal"].ToString();
                siduser    = this.Session["sUser"].ToString();
                for (int i = 0; i < RadGrid_PSugeridosPS.Items.Count; i++)
                {
                    GridDataItem ditem = RadGrid_PSugeridosPS.Items[i];

                    string cod_product  = ditem["cod_Product"].Text;
                    object PrecSugerido = (ditem.FindControl("rtxt_precio") as RadNumericTextBox).DbValue;


                    string id_year  = (ditem.FindControl("lbl_id_año") as Label).Text;
                    string id_month = (ditem.FindControl("lbl_id_mes") as Label).Text;

                    if (PrecSugerido != null)
                    {
                        oCoon.ejecutarDataReader("UP_WEBXPLORA_CLIE_V2_ACTUALIZAR_PRECIO_SUGERIDO", sidcanal, iidcompany, cod_product, id_year, id_month, PrecSugerido, siduser, DateTime.Now);
                    }
                }

                lbl_msj_validation.Text      = "Registro exitoso.";
                lbl_msj_validation.ForeColor = System.Drawing.Color.Green;
                ModalPopupExtender_validationMessagePS.Show();
            }
            catch (Exception ex)
            {
                lbl_msj_validation.Text      = "Error, intentalo nuevamente.";
                lbl_msj_validation.ForeColor = System.Drawing.Color.Red;
                ModalPopupExtender_validationMessagePS.Show();

                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(System.Configuration.ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
        protected void btn_buscarPS_Click(object sender, EventArgs e)
        {
            try
            {
                lbl_info.Text           = "";
                lbl_msj_validation.Text = "";
                if (rcmb_añoPS.SelectedIndex > 0 && rcmb_mesPS.SelectedIndex > 0)
                {
                    iidcompany = Convert.ToInt32(this.Session["companyid"].ToString());
                    sidcanal   = this.Session["Canal"].ToString();

                    DataTable dtprec = oCoon.ejecutarDataTable("UP_WEBXPLORA_CLIE_V2_OBTENER_PRECIOS_SUGERIDOS_SKU_MANDATORIOS", sidcanal, iidcompany, rcmb_añoPS.SelectedValue, rcmb_mesPS.SelectedValue);


                    RadGrid_PSugeridosPS.DataSource = dtprec;
                    RadGrid_PSugeridosPS.DataBind();

                    if (RadGrid_PSugeridosPS.Items.Count > 0)
                    {
                        lbl_info.Text = "Precios del mes de: " + rcmb_mesPS.SelectedItem.Text + " del año : " + rcmb_añoPS.SelectedItem.Text;
                    }
                    //UpdatePanel_gridPSugeridoPS.Update();
                }
                else
                {
                    ModalPopupExtender_validationMessagePS.Show();
                    lbl_msj_validation.Text = "Por favor, termine de seleccionar las opciones.";
                    //UpdatePanel_validationMessagePS.Update();
                }
            }
            catch (Exception ex)
            {
                Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                mesjerror.errorWebsite(System.Configuration.ConfigurationManager.AppSettings["COUNTRY"]);
            }
        }
Beispiel #15
0
        protected void btningreso_Click(object sender, EventArgs e)
        {
            string sPagina = "~/";

            try
            {
                UpdateProg1.Visible    = true;
                PProgresso.Style.Value = "Display:block;";

                DateTime fFecha = Convert.ToDateTime(Session["fFecha"]);


                sUser = txtuser.Text.ToLower();

                sPassw = txtpassw.Text;
                //Se deshabilita la verificacion de sesion
                //DataTable dtsesionuser = null;
                //dtsesionuser = ProcesoAdmin.Get_User_Sesion_Conteo(sUser);

                //if (dtsesionuser.Rows.Count > 0)
                //{
                //    this.Session["encabemensa"] = "Error de Autenticacion";
                //    this.Session["mensaje"] = "El Usuario" + " " + sUser + " " + "ya tiene" + "<br>" + "una sesion SIGE Activa";
                //    this.Session["cssclass"] = "MensajesSupervisor";
                //    Mensajes_Usuario();
                //    return;


                //}


                //ProcesoAdmin.Get_Obtener_User_Sesion(sUser);

                //Guardar las variables de sesión

                this.Session["sUser"]  = sUser;
                this.Session["sPassw"] = sPassw;

                this.Session["fFecha"] = fFecha;
                //Session["Service"] = 254;
                //Session["Canal"]="1000";


                EUsuario oeUsuario = oUsuario.obtener(sUser, sPassw);


                sCoutry                    = oeUsuario.codCountry;
                sDepartament               = oeUsuario.coddepartam;
                scity                      = oeUsuario.codcity;
                smail                      = oeUsuario.PersonEmail;
                this.Session["smail"]      = smail;
                this.Session["companyid"]  = oeUsuario.companyid;
                this.Session["fotocomany"] = oeUsuario.fotocompany;

                sNombre = oeUsuario.companyName;



                this.Session["sNombre"] = sNombre;

                snameuser = oeUsuario.PersonFirtsname + " " + oeUsuario.PersonSurname;
                this.Session["nameuser"] = snameuser;

                smodul = oeUsuario.Moduloid;
                this.Session["scountry"] = sCoutry;
                this.Session["scity"]    = scity;
                this.Session["personid"] = oeUsuario.Personid;
                this.Session["smodul"]   = smodul;
                idnivel = oeUsuario.idlevel;
                this.Session["idnivel"] = idnivel;

                snamenivel = oeUsuario.leveldescription;
                this.Session["namenivel"]  = snamenivel;
                this.Session["Perfilid"]   = oeUsuario.Perfilid;
                this.Session["nameperfil"] = oeUsuario.NamePerfil;
                this.Session["Service"]    = 254;
                this.Session["Canal"]      = "0";
                this.Session["Nivel"]      = 0;

                Sesion_Users su = new Sesion_Users();
                //string HostName =System.Net.Dns.GetHostByAddress(Request.UserHostAddress).HostName;
                //string RemoteHost = HttpContext.Current.Request.UserHostAddress;
                //string RemoteHost = HttpContext.Current.Request.ServerVariables["HTTP_USER_ADDR"];


                string RemoteHost = Request.ServerVariables["REMOTE_ADDR"];



                su.Registrar_Auditoria(this.Session["sUser"].ToString(), Convert.ToInt32(this.Session["companyid"]), RemoteHost, DateTime.Now);


                ObtenerDatosEnvioMail();

                if (oeUsuario != null)
                {
                    UsuarioAcceso  oUsuarioAcceso  = new UsuarioAcceso();
                    EUsuarioAcceso oeUsuarioAcceso = new EUsuarioAcceso();
                    oeUsuarioAcceso = oUsuarioAcceso.obtenerAleatorioxUsuario(sUser, sPassw);
                    UniqueLogin(sUser);
                    AplicacionWeb  oAplicacionWeb  = new AplicacionWeb();
                    EAplicacionWeb oeAplicacionWeb = oAplicacionWeb.obtenerAplicacion(sCoutry, smodul);
                    this.Session["oeAplicacionWeb"] = oeAplicacionWeb;
                    this.Session["cod_applucky"]    = oeAplicacionWeb.codapplucky;
                    this.Session["abr_app"]         = oeAplicacionWeb.abrapp;
                    this.Session["app_url"]         = oeAplicacionWeb.appurl;
                    sPagina         = oeAplicacionWeb.HomePage;
                    oeUsuarioAcceso = null;
                    oeAplicacionWeb = null;
                    oAplicacionWeb  = null;
                }
                //PProgresso.Style.Value = "Display:none";
                //PProgresso_ModalPopupExtender.Hide();
            }



            catch (Exception ex)
            {
                Lucky.CFG.Exceptions.Exceptions exs = new Lucky.CFG.Exceptions.Exceptions(ex);
                string errMessage = "";
                if (ex.Message.Substring(0, 20) == "Error en la Autenticación de Usuario" ||
                    ex.Message.Substring(0, 20) == "La Clave es Errrada o Usuario no Existe")
                {
                    //errMessage = new Lucky.CFG.Util.Functions().preparaMsgError(ex.Message);


                    //this.Response.Redirect("~/err_mensaje.aspx?msg=" + errMessage, true);
                    this.Session["encabemensa"] = "Error de Autenticación";
                    this.Session["mensaje"]     = "Usuario y/o Clave Erradas";
                    this.Session["cssclass"]    = "MensajesSupervisor";
                    Mensajes_Usuario();
                    return;
                }
                else
                {
                    //Enviar error a fin de evitar que este se pierda con el redirect de página.

                    exs.Country = "SIGE(" + ConfigurationManager.AppSettings["COUNTRY"] + ") - Usuario " + this.Session["sUser"].ToString();
                    string sCountry = ConfigurationManager.AppSettings["COUNTRY"];
                    //exs.errorWebsite(sCountry);
                    //errMessage += new Lucky.CFG.Util.Functions().preparaMsgError(ex.Message);
                    errMessage = "Error de Autenticacion para " + ' ' + sUser + ' ' + "Clave errada o Usuario Inactivo";
                    this.Session["errMessage"] = errMessage;
                    //this.Response.Redirect("~/err_mensaje.aspx?msg=" + errMessage, true);
                    this.Session["encabemensa"] = "Error de Autenticacion";
                    this.Session["mensaje"]     = "Usuario y/o Clave Erradas";
                    this.Session["cssclass"]    = "MensajesSupervisor";
                    ProcesoAdmin.Get_Delete_Sesion_User(sUser);
                    Mensajes_Usuario();
                    return;
                }
            }

            EEntrySeccion oeSeccion = oSeccion.PrimerAcceso(sUser);

            if (oeSeccion.seccionname == "1")
            {
                Response.Redirect("Cambio_pswd.aspx", true);
            }
            //if (Request.Cookies["SIGE_URLRedirect"] == null)
            //{


            //    this.Response.Redirect("~/" + sPagina, true);



            //}
            else
            {
                //HttpCookie hcURLRedirect = Request.Cookies["SIGE_URLRedirect"];
                this.Response.Redirect("~/" + sPagina, true);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Session["Ciudad"]    = "0";
            this.Session["catego"]    = "0";
            this.Session["subcatego"] = "0";
            this.Session["pdv"]       = "0";
            this.Session["Año"]       = "0";
            this.Session["Mes"]       = "0";

            sUser     = this.Session["sUser"].ToString();
            sPassw    = this.Session["sPassw"].ToString();
            sNameUser = this.Session["nameuser"].ToString();
            icompany  = Convert.ToInt32(this.Session["companyid"]);
            Report    = Convert.ToInt32(this.Session["Reporte"]);
            canal     = this.Session["Canal"].ToString().Trim();
            MyAccordion.SelectedIndex           = 1;
            TabContainer_filtros.ActiveTabIndex = 0;
            //UpdateProgressContext2();
            if (!IsPostBack)
            {
                try
                {
                    cmb_año.DataBind();
                    cmb_año.Items.Insert(0, new RadComboBoxItem("--Todos--", "0"));
                    cmb_mes.DataBind();
                    cmb_mes.Items.Insert(0, new RadComboBoxItem("--Todos--", "0"));



                    cmb_categoria.DataBind();
                    cmb_categoria.Items.Insert(0, new RadComboBoxItem("--Todos--", "0"));
                    cmb_subCategoria.DataBind();
                    cmb_subCategoria.Items.Insert(0, new RadComboBoxItem("--Todos--", "0"));
                    cmb_ciudad.DataBind();
                    cmb_ciudad.Items.Insert(0, new RadComboBoxItem("--Todos--", "0"));
                    cmb_punto_de_venta.DataBind();
                    cmb_punto_de_venta.Items.Insert(0, new RadComboBoxItem("--Todos--", "0"));
                    cmb_marca.DataBind();
                    cmb_marca.Items.Insert(0, new RadComboBoxItem("--Todos--", "0"));
                    cmb_subMarca.DataBind();
                    cmb_subMarca.Items.Insert(0, new RadComboBoxItem("--Todos--", "0"));
                    cmb_skuProducto.DataBind();
                    cmb_skuProducto.Items.Insert(0, new RadComboBoxItem("--Todos--", "0"));

                    Años();
                    Llena_Meses();

                    Categorias();
                    Cargar_Region();
                    Cobertura();
                    //Productos();

                    _AsignarVariables();
                    llenarreporteEvolucionSODMay();
                    llenarreporteEvolucionSODMayxPDV();
                    llenarreporteCumpliIbjetivos();

                    cargarParametrosdeXml();
                }


                catch (Exception ex)
                {
                    Lucky.CFG.Exceptions.Exceptions mesjerror = new Lucky.CFG.Exceptions.Exceptions(ex);
                    mesjerror.errorWebsite(ConfigurationManager.AppSettings["COUNTRY"]);
                    this.Session.Abandon();
                    Response.Redirect("~/err_mensaje_seccion.aspx", true);
                }
            }
        }
        protected void BtnGuardarUsuInfo_Click(object sender, EventArgs e)
        {
            //bool continuar = false;
            LblFaltantes.Text = "";
            if (cmbplanning.Text == "0" || txt_fechaActual.Text == "")
            {
                if (cmbplanning.Text == "0" || cmbplanning.Text == "")
                {
                    LblFaltantes.Text = ". " + "seleccione Campaña";
                }

                Alertas.CssClass  = "MensajesError";
                LblFaltantes.Text = "Debe ingresar información ";
                MensajeAlerta();
                return;
            }



            try
            {
                for (int i = 0; i <= GvLPublicaciones.Rows.Count - 1; i++)
                {
                    if (((DropDownList)GvLPublicaciones.Rows[i].Cells[1].FindControl("cmbMarca")).Text == "0")
                    {
                    }
                    else
                    {
                        EOPE_REPORTE_MATERIAL_POP oeLevanPublicaciones = orepormaterialPOP.RegistrarINFOLevantaMaterialPOP(Convert.ToInt32(this.Session["personid"]), cmbplanning.Text, Convert.ToInt32(this.Session["companyid"]), ((DropDownList)GvLPublicaciones.Rows[i].Cells[6].FindControl("cmbCadena")).Text, Convert.ToInt32(((DropDownList)GvLPublicaciones.Rows[i].Cells[1].FindControl("cmbMarca")).Text), Convert.ToInt32(((DropDownList)GvLPublicaciones.Rows[i].Cells[3].FindControl("cmbtipoPOP")).Text),
                                                                                                                           ((DropDownList)GvLPublicaciones.Rows[i].Cells[2].FindControl("cmbPromocion")).Text, Convert.ToDateTime(((TextBox)GvLPublicaciones.Rows[i].Cells[3].FindControl("txt_Inicio_Actividad")).Text), Convert.ToDateTime(((TextBox)GvLPublicaciones.Rows[i].Cells[4].FindControl("txt_Fin_Actividad")).Text), DateTime.Now, Convert.ToDateTime(txt_fechaActual.Text), Convert.ToString(this.Session["sUser"]), DateTime.Now, Convert.ToString(this.Session["sUser"]), DateTime.Now, true);
                    }
                }

                //SavelimpiarcontrolesLP();
                saveActivarbotonesLP();
                desactivarControleLP();
                Alertas.CssClass  = "MensajesCorrecto";
                LblFaltantes.Text = "Registros de Levantamiento de Material POP  fueron creados  con Exito";
                MensajeAlerta();
            }
            catch (Exception ex)
            {
                string error   = "";
                string mensaje = "";
                error   = Convert.ToString(ex.Message);
                mensaje = ConfigurationManager.AppSettings["ErrorConection"];
                if (error == mensaje)
                {
                    Lucky.CFG.Exceptions.Exceptions exs = new Lucky.CFG.Exceptions.Exceptions(ex);
                    string errMessage = "";
                    errMessage = mensaje;
                    errMessage = new Lucky.CFG.Util.Functions().preparaMsgError(ex.Message);
                    this.Response.Redirect("../../../err_mensaje.aspx?msg=" + errMessage, true);
                }
                else
                {
                    this.Session.Abandon();
                    Response.Redirect("~/err_mensaje_seccion.aspx", true);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    try
                    {
                        planningADM = this.Session["AdmProd"].ToString().Trim();
                    }
                    catch
                    {
                    }
                    string sUser     = this.Session["sUser"].ToString();
                    string sPassw    = this.Session["sPassw"].ToString();
                    string sNameUser = this.Session["nameuser"].ToString();

                    //string sUser = "******";
                    //string sPassw = "sPassw";
                    //string sNameUser = "******";

                    planningADM = "NO";

                    if (sUser != null && sPassw != null)
                    {
                        lblUsuario.Text = sNameUser;
                        if (planningADM == "SI")
                        {
                            ImgBtnPais.Visible       = false;
                            ImgBtnUsuario.Visible    = false;
                            ImgBtnProducto.Visible   = false;
                            ImgBtnPdv.Visible        = false;
                            ImgBtnInformes.Visible   = false;
                            ImgBtnGeneral.Visible    = false;
                            Iframe.Attributes["src"] = "GestiónProducto.aspx";
                            //inicializa_botones();
                            //ImgBtnProducto.Enabled = false;
                        }
                        else
                        {
                            inicializa_botones();
                        }
                        // TxtSolicitante.Text = this.Session["smail"].ToString();
                        //TxtEmail.Text = "*****@*****.**";
                    }
                }
                catch (Exception ex)
                {
                    string error   = "";
                    string mensaje = "";
                    error   = Convert.ToString(ex.Message);
                    mensaje = ConfigurationManager.AppSettings["ErrorConection"];
                    if (error == mensaje)
                    {
                        Lucky.CFG.Exceptions.Exceptions exs = new Lucky.CFG.Exceptions.Exceptions(ex);
                        string errMessage = "";
                        errMessage = mensaje;
                        errMessage = new Lucky.CFG.Util.Functions().preparaMsgError(ex.Message);
                        this.Response.Redirect("../../../err_mensaje.aspx?msg=" + errMessage, true);
                    }
                    else
                    {
                        this.Session.Abandon();
                        Response.Redirect("~/err_mensaje_seccion.aspx", true);
                    }
                }
            }
        }
        protected void btnloadproduct0_Click(object sender, EventArgs e)
        {
            if ((FileUpProducto0.PostedFile != null) && (FileUpProducto0.PostedFile.ContentLength > 0))
            {
                string fn = System.IO.Path.GetFileName(FileUpProducto0.PostedFile.FileName);

                string SaveLocation = Server.MapPath("Busquedas") + "\\" + fn;
                try
                {
                    FileUpProducto0.PostedFile.SaveAs(SaveLocation);
                    DataSet   ds         = new DataSet();
                    DataTable sourceData = new DataTable();
                    if (SaveLocation != string.Empty)
                    {
                        ds.ReadXml(SaveLocation);
                        FileUpProducto0.PostedFile.SaveAs(MapPath("../../Modulos/Administrativo/Busquedas/" + FileUpProducto0.FileName));
                        sourceData = ds.Tables[0];
                        using (SqlBulkCopy bulkCopy = new SqlBulkCopy(oCoon.GetConnection()))
                        {
                            bulkCopy.ColumnMappings.Clear();
                            foreach (DataColumn dc in sourceData.Columns)
                            {
                                bulkCopy.ColumnMappings.Add(dc.ColumnName.Trim(), dc.ColumnName.Trim());
                            }
                            bulkCopy.DestinationTableName = "Product_Packing";
                            bulkCopy.WriteToServer(sourceData, DataRowState.Added);
                        }
                        LblVacio.Text             = "Los productos y empaquetamientos estan almacenados";
                        LblCargarArchivo.Visible  = true;
                        FileUpProducto.Visible    = true;
                        btnloadproduct.Visible    = true;
                        LblCargarArchivo0.Visible = false;
                        FileUpProducto0.Visible   = false;
                        btnloadproduct0.Visible   = false;
                    }
                    else
                    {
                        LblVacio.Text             = "Seleccione Archivo con EMPAQUETAMIENTO DE PRODUCTOS.";
                        LblCargarArchivo.Visible  = false;
                        FileUpProducto.Visible    = false;
                        btnloadproduct.Visible    = false;
                        LblCargarArchivo0.Visible = true;
                        FileUpProducto0.Visible   = true;
                        btnloadproduct0.Visible   = true;
                    }
                }

                catch (Exception ioex)
                {
                    string errMessage = "";
                    Lucky.CFG.Exceptions.Exceptions exs = new Lucky.CFG.Exceptions.Exceptions(ioex);
                    exs.Country = "SIGE(" + ConfigurationManager.AppSettings["COUNTRY"] + ") - Usuario " + this.Session["sUser"].ToString();
                    errMessage  = Convert.ToString(ioex);
                    exs.errorWebsite(this.Session["scountry"].ToString().Trim());
                    errMessage                = new Lucky.CFG.Util.Functions().preparaMsgError(ioex.Message);
                    LblVacio.Text             = "Se ha producido un error en la carga del Archivo.";
                    LblCargarArchivo.Visible  = false;
                    FileUpProducto.Visible    = false;
                    btnloadproduct.Visible    = false;
                    LblCargarArchivo0.Visible = true;
                    FileUpProducto0.Visible   = true;
                    btnloadproduct0.Visible   = true;
                }
                //}
                //catch (Exception ex)
                //{
                //    Response.Write("Error: " + ex.Message);
                //    //Nota: Exception.Message devuelve un mensaje detallado que describe la excepción actual.
                //    //Por motivos de seguridad, no se recomienda devolver Exception.Message a los usuarios finales de
                //    //entornos de producción. Sería más aconsejable poner un mensaje de error genérico.
                //}
            }
            else
            {
                LblVacio.Text             = "Seleccione Archivo con EMPAQUETAMIENTO DE PRODUCTOS.";
                LblCargarArchivo.Visible  = false;
                FileUpProducto.Visible    = false;
                btnloadproduct.Visible    = false;
                LblCargarArchivo0.Visible = true;
                FileUpProducto0.Visible   = true;
                btnloadproduct0.Visible   = true;
            }
        }