Exemplo n.º 1
0
        protected void BtnCargaUnoaUno_Click(object sender, EventArgs e)
        {
            string mensaje = "";

            if (dllPeridoObjetivosSODMAY.SelectedValue == "" || ddlProducto.SelectedValue == "0" || ddlPtoVenta.SelectedValue == "0" || txtPrecio.Text == "")
            {//genera mensaje de alerta al faltar ingresar compo requerido
                if (dllPeridoObjetivosSODMAY.SelectedValue == "")
                {
                    mensaje = ". " + "Seleccione un perido.";
                }
                if (ddlProducto.SelectedValue == "0")
                {
                    mensaje = mensaje + "Seleccione un perido.";
                }
                if (ddlPtoVenta.SelectedValue == "0")
                {
                    mensaje = mensaje + "Seleccione un Pto de Venta.";
                }
                if (txtPrecio.Text == "")
                {
                    mensaje = mensaje + "Ingrese un Precio.";
                }
                lblencabezado.Text     = "INFORMACION";
                lblmensajegeneral.Text = mensaje;
                ImgMensaje.ImageUrl    = "~/Pages/images/Mensajes/warning_blue.png";
                divMensaje.Style.Value = "border-width:10px;border-style:solid;border-color:#53A2FF; height:169px;background-color:#9FCBFF";
                ModalPopupMensaje.Show();
                return;
            }

            try
            {
                string usuario = this.Session["sUser"].ToString().Trim();

                DataSet dsCargar = oCoon.ejecutarDataSet("UP_WEBXPLORA_PLA_INSERTAR_PRECIO_PLANNING",
                                                         Convert.ToInt32(dllPeridoObjetivosSODMAY.SelectedValue),
                                                         Convert.ToInt32(ddlPtoVenta.SelectedValue),
                                                         Convert.ToInt32(ddlProducto.SelectedValue),
                                                         Convert.ToDouble(txtPrecio.Text),
                                                         true,
                                                         usuario, DateTime.Now,
                                                         usuario, DateTime.Now);

                lblencabezado.Text              = "INFORMACION";
                lblmensajegeneral.Text          = "Se registro correctamente";
                PmensajeCargaMasiva.Style.Value = "background-color: Green;";
                ModalPopupMensaje.Show();
            }
            catch
            {
                lblencabezado.Text     = "INFORMACION";
                lblmensajegeneral.Text = "ya existe ese registro";
                ImgMensaje.ImageUrl    = "~/Pages/images/Mensajes/warning_blue.png";
                divMensaje.Style.Value = "border-width:10px;border-style:solid;border-color:#53A2FF; height:169px;background-color:#9FCBFF";
                ModalPopupMensaje.Show();

                // Response.Write("<script>prompt('" + mensaje + "');</script>");
            }
        }
Exemplo n.º 2
0
 private void Mensajes_Usuario()
 {
     ModalPopupMensaje.Show();
 }
Exemplo n.º 3
0
        protected void BtnCargaArchivo_Click(object sender, EventArgs e)
        {
            string mensaje = "";

            if (dllPeridoObjetivosSODMAY.SelectedValue == "")
            {//genera mensaje de alerta al faltar ingresar compo requerido
                if (dllPeridoObjetivosSODMAY.SelectedValue == "")
                {
                    mensaje = ". " + "Seleccione un perido.";
                }

                lblencabezado.Text     = "INFORMACION";
                lblmensajegeneral.Text = mensaje;
                ImgMensaje.ImageUrl    = "~/Pages/images/Mensajes/warning_blue.png";
                divMensaje.Style.Value = "border-width:10px;border-style:solid;border-color:#53A2FF; height:169px;background-color:#9FCBFF";
                ModalPopupMensaje.Show();
                return;
            }


            if ((FileUpPrecio.PostedFile != null) && (FileUpPrecio.PostedFile.ContentLength > 0))
            {
                string fn           = System.IO.Path.GetFileName(FileUpPrecio.PostedFile.FileName);
                string SaveLocation = Server.MapPath("PDV_Planning") + "\\" + fn;

                if (SaveLocation != string.Empty)
                {
                    if (FileUpPrecio.FileName.ToLower().EndsWith(".xls"))
                    {
                        // string Destino = Server.MapPath(null) + "\\PDV_Planning\\" + Path.GetFileName(FileUpPDV.PostedFile.FileName);
                        OleDbConnection  oConn1 = new OleDbConnection();
                        OleDbCommand     oCmd   = new OleDbCommand();
                        OleDbDataAdapter oDa    = new OleDbDataAdapter();
                        DataSet          oDs    = new DataSet();
                        DataTable        dt     = new DataTable();

                        FileUpPrecio.PostedFile.SaveAs(SaveLocation);

                        // oConn1.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + SaveLocation + ";Extended Properties=\"Excel 12.0 Xml;HDR=YES\"";
                        oConn1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + SaveLocation + ";Extended Properties=\"Excel 8.0; HDR=YES;\"";
                        oConn1.Open();
                        oCmd.CommandText  = ConfigurationManager.AppSettings["CargaMasiva_Pla_ObjetivosMay"];
                        oCmd.Connection   = oConn1;
                        oDa.SelectCommand = oCmd;

                        try
                        {
                            //if (this.Session["scountry"].ToString() != null)
                            //{
                            oDa.Fill(oDs);

                            //DataTable dtdivpol = oCoon.ejecutarDataTable("UP_WEBSIGE_DIVISIONCOUNTRY", this.Session["scountry"].ToString());
                            //ECountry oescountry = new ECountry();
                            //if (dtdivpol != null)
                            //{
                            //    if (dtdivpol.Rows.Count > 0)
                            //    {
                            //        oescountry.CountryDpto = Convert.ToBoolean(dtdivpol.Rows[0]["Country_Dpto"].ToString().Trim());
                            //        oescountry.CountryCiudad = Convert.ToBoolean(dtdivpol.Rows[0]["Country_Ciudad"].ToString().Trim());
                            //        oescountry.CountryDistrito = Convert.ToBoolean(dtdivpol.Rows[0]["Country_Distrito"].ToString().Trim());
                            //        oescountry.CountryBarrio = Convert.ToBoolean(dtdivpol.Rows[0]["Country_Barrio"].ToString().Trim());
                            //    }
                            //}

                            dt = oDs.Tables[0];
                            int numcol = 5; //determina el número de columnas para el datatable
                            if (dt.Columns.Count == numcol)
                            {
                                dt.Columns[0].ColumnName = "Region";
                                dt.Columns[1].ColumnName = "Categoria";
                                dt.Columns[2].ColumnName = "Marca";
                                dt.Columns[3].ColumnName = "Obj. Marca";
                                dt.Columns[4].ColumnName = "Obj. Categoria";

                                ConnectionStringSettings settingconection;
                                settingconection = ConfigurationManager.ConnectionStrings["ConectaDBLucky"];
                                string oSqlConnIN = settingconection.ConnectionString;

                                using (SqlBulkCopy bulkCopy = new SqlBulkCopy(oSqlConnIN))
                                {
                                    bulkCopy.DestinationTableName = "SUPE_OBJETIVOS_SOD_MAY_TMP";
                                    //carga los SKU's temporalmente para hacer el procedimiento a través de un SP
                                    bulkCopy.WriteToServer(dt);
                                }


                                string idPlanning         = LblPlanning.Text;
                                string id_ReportsPlanning = dllPeridoObjetivosSODMAY.SelectedValue;
                                string usuario            = this.Session["sUser"].ToString().Trim();

                                //realiza las validaciones y carga los productos a planning.
                                DataSet dsCargar = oCoon.ejecutarDataSet("UP_WEBXPLORA_PLA_CARGAMASIVA_ObjetivosMay_PLANNING_TMP",
                                                                         Convert.ToInt32(lblCompany.Text), LblCanal.Text,
                                                                         Convert.ToInt32(id_ReportsPlanning),
                                                                         usuario, DateTime.Now,
                                                                         usuario, DateTime.Now);

                                //for (int i = 0; i <= dt.Rows.Count - 1; i++)
                                //{
                                //    string id_ClientPDV = dt.Rows[i]["id_ClientPDV"].ToString();
                                //    string cod_Product = dt.Rows[i]["cod_Product"].ToString();
                                //    string id_report = Session["id_report"].ToString();
                                //    string idPlanning = Session["idPlanning"].ToString();
                                //    string id_ReportsPlanning = ddlPeriodo.SelectedValue;
                                //    string Precio = dt.Rows[i]["Precio"].ToString();

                                //}
                            }

                            lblencabezado.Text     = "INFORMACION";
                            lblmensajegeneral.Text = "Los Objetivos Fueron Cargados Correctamente";
                            ImgMensaje.ImageUrl    = "~/Pages/images/Mensajes/Correct_1.png";
                            divMensaje.Style.Value = "border-width:10px;border-style:solid;border-color:#83D447; height:169px;background-color:#FFFFFF";
                            ModalPopupMensaje.Show();
                            //}
                        }
                        catch
                        {
                            lblencabezado.Text     = "INFORMACION";
                            lblmensajegeneral.Text = "Tiene que seleccionar un archivo";
                            ImgMensaje.ImageUrl    = "~/Pages/images/Mensajes/warning_blue.png";
                            divMensaje.Style.Value = "border-width:10px;border-style:solid;border-color:#53A2FF; height:169px;background-color:#9FCBFF";
                            ModalPopupMensaje.Show();
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        protected void gv_incidencias_ItemCommand(object source, GridCommandEventArgs e)
        {
            try
            {
                panelEdit.DataBind();
                RadBinaryImage_fotoBig.DataBind();
                RadBinaryImage_fotoBig.Visible = false;
                //GridItem item = gv_Foto.Items[e.Item.ItemIndex];
                int a = e.Item.ItemIndex;
                if (a == -1)
                {
                    return;
                }
                GridItem item = gv_incidencias.Items[e.Item.ItemIndex];



                Label lbl_id_reg_foto = (Label)item.FindControl("lbl_id_reg_foto");

                Label lbl_Id_Reg_Fotogr = (Label)item.FindControl("Id_incidencia");
                if (e.CommandName == "VERFOTO")
                {
                    Session["iidregft"] = Convert.ToInt32(lbl_id_reg_foto.Text);
                    Session["Id_repft"] = Convert.ToInt32(lbl_Id_Reg_Fotogr.Text);

                    DataTable dt    = null;
                    Conexion  Ocoon = new Conexion();
                    //string sidregft = ((LinkButton)sender).CommandArgument;
                    int iidregft = Convert.ToInt32(lbl_id_reg_foto.Text);

                    dt = Ocoon.ejecutarDataTable("UP_WEBXPLORA_OPE_CONSULTA_REG_FOTO", iidregft);
                    if (dt.Rows.Count == 0)
                    {
                        lblencabezado.Text     = "INFORMACION";
                        lblmensajegeneral.Text = "La Foto Seleccionada no existe";
                        ImgMensaje.ImageUrl    = "~/Pages/images/Mensajes/warning_blue.png";
                        divMensaje.Style.Value = "border-width:10px;border-style:solid;border-color:#53A2FF; height:169px;background-color:#9FCBFF";
                        ModalPopupMensaje.Show();
                        return;
                    }
                    byte[] byteArrayIn = (byte[])dt.Rows[0]["foto"];

                    Session["array"] = byteArrayIn;
                    RadBinaryImage_viewFoto.DataValue = byteArrayIn;
                    ModalPopupExtender_viewfoto.Show();

                    //Response.Redirect("verFoto.aspx?iidregft=" + iidregft, true);
                }
                else if (e.CommandName == "EDITFOTO")
                {
                    //string sidregft = ((LinkButton)senser).CommandArgument;
                    int iidregft = Convert.ToInt32(lbl_id_reg_foto.Text);
                    int Id_repft = Convert.ToInt32(lbl_Id_Reg_Fotogr.Text);
                    if (iidregft == 0)
                    {
                        lblencabezado.Text     = "INFORMACION";
                        lblmensajegeneral.Text = "La Foto Seleccionada no existe";
                        ImgMensaje.ImageUrl    = "~/Pages/images/Mensajes/warning_blue.png";
                        divMensaje.Style.Value = "border-width:10px;border-style:solid;border-color:#53A2FF; height:169px;background-color:#9FCBFF";
                        ModalPopupMensaje.Show();

                        return;
                    }
                    else
                    {
                        RadBinaryImage imageBinary = (RadBinaryImage)item.FindControl("RadBinaryImage_foto");

                        RadBinaryImage_fotoBig.DataValue = imageBinary.DataValue;
                        RadBinaryImage_fotoBig.Visible   = false;
                        Session["iidregft"] = iidregft;
                        Session["Id_repft"] = Id_repft;
                    }
                    ModalPopup_Edit.Show();
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
                Response.Redirect("~/err_mensaje_seccion.aspx", true);
            }
        }