protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["WebNestle"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     try
     {
         if (Page.IsPostBack == false)
         {
             if (Request.Cookies["WebNestle"] == null)
             {
                 Response.Redirect("Login.aspx");
             }
             Panel_Listar.Visible = true;
             PanelAgregar.Visible = false;
             DateTime thisDay = DateTime.Today;
             TxtFecha.Value     = thisDay.ToString("MM/yyyy");
             TxtMesBuscar.Value = thisDay.ToString("MM/yyyy");
             listarMeta();
             busar(); DataTable dt = new DataTable();
             GvSubir.DataSource = dt;
             GvSubir.DataBind();
         }
     }
     catch (Exception ex) { }
 }
Example #2
0
        protected void UploadDocument(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("IdPedidoMarket");
            dt.Columns.Add("IdProducto");
            dt.Columns.Add("Cantidad");
            dt.Columns.Add("Precio");
            try
            {
                string csvPath = Server.MapPath("~/Archivos/") + Path.GetFileName(FileUpload1.PostedFile.FileName);
                FileUpload1.SaveAs(csvPath);
                string[] allLines = File.ReadAllLines(csvPath);
                {
                    for (int i = 0; i < allLines.Length; i++)
                    {
                        string[] items = allLines[i].Split(new char[] { '|' });
                        DataRow  row   = dt.NewRow();
                        row["IdPedidoMarket"] = items[0].ToString();
                        row["IdProducto"]     = items[1].ToString();
                        row["Cantidad"]       = Int32.Parse(items[2].ToString());
                        row["Precio"]         = Decimal.Parse(items[3].ToString().Replace(".", ","));
                        dt.Rows.Add(row);
                    }
                }
            }
            catch (Exception ex)
            {
                StackTrace st    = new StackTrace(ex, true);
                StackFrame frame = st.GetFrames().Where(f => !String.IsNullOrEmpty(f.GetFileName()) &&
                                                        f.GetILOffset() != StackFrame.OFFSET_UNKNOWN &&
                                                        f.GetNativeOffset() != StackFrame.OFFSET_UNKNOWN &&
                                                        !f.GetMethod().Module.Assembly.GetName().Name.Contains("mscorlib")).First();

                string        MachineName = System.Environment.MachineName;
                string        UserName    = System.Environment.UserName.ToUpper();
                string        Mensaje     = ex.Message;
                StringBuilder builder     = new StringBuilder(Mensaje);
                builder.Replace("'", "");
                int    LineaError     = frame.GetFileLineNumber();
                string Proyecto       = frame.GetMethod().Module.Assembly.GetName().Name;
                string Clase          = frame.GetMethod().DeclaringType.Name;
                string metodo         = frame.GetMethod().Name;
                string menssajeScript = "<script type='text/javascript'>"
                                        + " swal({" +

                                        "title: '" + "Error en el Txt: " + builder.ToString() + "'," +
                                        " icon: 'warning'," +
                                        "  dangerMode: false," +
                                        "   })  </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", menssajeScript, false);
                return;
            }



            GvSubir.DataSource = dt;
            GvSubir.DataBind();
            LblTotal.Text = "Total : " + GvSubir.Rows.Count.ToString();
        }
Example #3
0
        protected void BtnNuevo_Click(object sender, EventArgs e)
        {
            PanelListar.Visible = false;
            PanelSubir.Visible  = true;
            DataTable dt = new DataTable();

            GvSubir.DataSource = dt;
            GvSubir.DataBind();
            LblTotal.Text = "";;
        }
Example #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["WebNestle"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     if (Page.IsPostBack == false)
     {
         if (Request.Cookies["WebNestle"] == null)
         {
             Response.Redirect("Login.aspx");
         }
         DataTable dt = new DataTable();
         GvSubir.DataSource = dt;
         GvSubir.DataBind();
     }
 }
Example #5
0
        public void subir()
        {
            if (GvSubir.Rows.Count < 1)
            {
                String mensajeScriptnm = @"<script type='text/javascript'>
                swal({
                title: ""Seleccione  Txt"",
                icon: ""warning"",
                dangerMode: false,
                })
                </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", mensajeScriptnm, false);
                FileUpload1.Focus();
                return;
            }

            Int32  IdUsuario = Convert.ToInt32(Request.Cookies["WebNestle"]["DLIdUsuario"]);
            String Msj       = "";

            try {
                foreach (GridViewRow row in GvSubir.Rows)
                {
                    Msj = obj.SubirPedidoSugeridoCliente(row.Cells[0].Text.ToString(), Convert.ToDouble(row.Cells[1].Text.ToString()), IdUsuario);
                }
            }
            catch (Exception ex)
            {
                StackTrace st    = new StackTrace(ex, true);
                StackFrame frame = st.GetFrames().Where(f => !String.IsNullOrEmpty(f.GetFileName()) &&
                                                        f.GetILOffset() != StackFrame.OFFSET_UNKNOWN &&
                                                        f.GetNativeOffset() != StackFrame.OFFSET_UNKNOWN &&
                                                        !f.GetMethod().Module.Assembly.GetName().Name.Contains("mscorlib")).First();

                string        MachineName = System.Environment.MachineName;
                string        UserName    = System.Environment.UserName.ToUpper();
                string        Mensaje     = ex.Message;
                StringBuilder builder     = new StringBuilder(Mensaje);
                builder.Replace("'", "");
                int    LineaError     = frame.GetFileLineNumber();
                string Proyecto       = frame.GetMethod().Module.Assembly.GetName().Name;
                string Clase          = frame.GetMethod().DeclaringType.Name;
                string metodo         = frame.GetMethod().Name;
                String M              = "Formato Incorrecto";
                string menssajeScript = "<script type='text/javascript'>"
                                        + " swal({" +

                                        "title: '" + M.ToString() + "'," +
                                        " icon: 'warning'," +
                                        "  dangerMode: false," +
                                        "   })  </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", menssajeScript, false);
                return;
            }
            if (Msj != "")
            {
                string menssajeScript = "<script type='text/javascript'>"
                                        + " swal({" +

                                        "title: '" + Msj + "'," +
                                        " icon: 'success'," +
                                        "  dangerMode: false," +
                                        "   })  </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", menssajeScript, false);
                PanelListar.Visible = true;
                PanelSubir.Visible  = false;
                ListarClienteSugerido();
                LblTotal.Text = "";
            }
            else
            {
                string menssajeScript = "<script type='text/javascript'>"
                                        + " swal({" +

                                        "title: 'ocurrio un error'," +
                                        " icon: 'warning'," +
                                        "  dangerMode: true," +
                                        "   })  </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", menssajeScript, false);
            }
            DataTable dt = new DataTable();

            GvSubir.DataSource = dt;
            GvSubir.DataBind();
            ListarClienteSugerido();
        }
        protected void BtnGuardar_Click(object sender, EventArgs e)
        {
            if (GvSubir.Rows.Count < 1)
            {
                String mensajeScriptnm = @"<script type='text/javascript'>
                swal({
                title: ""Seleccione  Txt"",
                icon: ""warning"",
                dangerMode: false,
                })
                </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", mensajeScriptnm, false);
                FileUpload1.Focus();
                return;
            }
            String Msj = "";

            if (DDTipoUusario.SelectedValue == "0")
            {
                string msj3 = @"<script type='text/javascript'>
                       swal({
                title: ""Seleccione Tipo Usuario"",
                icon: ""warning"",
                dangerMode: true,
            })
                  </script>";
                ScriptManager.RegisterStartupScript(this, typeof(System.Web.UI.Page), "mensaje", msj3, false);
                return;
            }

            if (TxtFecha.Value == "")
            {
                string msj3 = @"<script type='text/javascript'>
                       swal({
                title: ""Seleccione Fecha"",
                icon: ""warning"",
                dangerMode: true,
            })
                  </script>";
                ScriptManager.RegisterStartupScript(this, typeof(System.Web.UI.Page), "mensaje", msj3, false);

                return;
            }
            DateTime dttim = DateTime.ParseExact("01/" + TxtFecha.Value.ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);

            String fecha = dttim.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);

            Int32 IdDistribuidor = Convert.ToInt32(Request.Cookies["WebNestle"]["DLIdEmpresaMaster"]);
            Int32 usuario        = Convert.ToInt32(Request.Cookies["WebNestle"]["DLIdUsuario"]);

            try {
                foreach (GridViewRow row in GvSubir.Rows)
                {
                    Msj = obj.InsertMetaUsuario(IdDistribuidor, row.Cells[0].Text.ToString(),
                                                Convert.ToInt32(DDTipoUusario.SelectedValue), fecha,
                                                float.Parse(row.Cells[1].Text.ToString()), usuario);
                }

                //Msj = obj.InsertMetaUsuario(IdDistribuidor, Convert.ToInt32(DDTipoUusario.SelectedValue),
                //    "01/"+TxtFecha.Value.ToString(),float.Parse(TxtMonto.Value.ToString()), usuario);

                if (Msj == "Exito")
                {
                    string error = @"<script type='text/javascript'>
                       swal({
                title: ""Operacion Exitosa"",
              icon: ""success"",
                dangerMode: false,
            })
                  </script>";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", error, false);
                    listarMeta();
                    busar();
                    Panel_Listar.Visible = true;
                    PanelAgregar.Visible = false;
                    DataTable dt = new DataTable();
                    GvSubir.DataSource = dt;
                    GvSubir.DataBind();
                    listarMeta();
                    LblTotal.Text = "";
                }
                else
                {
                    string menssajeScript = "<script type='text/javascript'>"
                                            + " swal({" +

                                            "title: '" + DDTipoUusario.SelectedItem.ToString() + " " + Msj.ToString() + "'," +
                                            " icon: 'warning'," +
                                            "  dangerMode: true," +
                                            "   })  </script>";
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", menssajeScript, false);
                }
                listarMeta();
            }
            catch (Exception ex)
            {
                StackTrace st    = new StackTrace(ex, true);
                StackFrame frame = st.GetFrames().Where(f => !String.IsNullOrEmpty(f.GetFileName()) &&
                                                        f.GetILOffset() != StackFrame.OFFSET_UNKNOWN &&
                                                        f.GetNativeOffset() != StackFrame.OFFSET_UNKNOWN &&
                                                        !f.GetMethod().Module.Assembly.GetName().Name.Contains("mscorlib")).First();

                string        MachineName = System.Environment.MachineName;
                string        UserName    = System.Environment.UserName.ToUpper();
                string        Mensaje     = ex.Message;
                StringBuilder builder     = new StringBuilder(Mensaje);
                builder.Replace("'", "");
                int    LineaError     = frame.GetFileLineNumber();
                string Proyecto       = frame.GetMethod().Module.Assembly.GetName().Name;
                string Clase          = frame.GetMethod().DeclaringType.Name;
                string metodo         = frame.GetMethod().Name;
                string menssajeScript = "<script type='text/javascript'>"
                                        + " swal({" +

                                        "title: '" + builder.ToString() + "'," +
                                        " icon: 'warning'," +
                                        "  dangerMode: true," +
                                        "   })  </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", menssajeScript, false);


                return;
            }
            busar();
        }
Example #7
0
        public void subir()
        {
            if (GvSubir.Rows.Count < 1)
            {
                String mensajeScriptnm = @"<script type='text/javascript'>
                swal({
                title: ""Seleccione  Txt"",
                icon: ""warning"",
                dangerMode: false,
                })
                </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", mensajeScriptnm, false);
                FileUpload1.Focus();
                return;
            }

            Int32  IdUsuario = Convert.ToInt32(Request.Cookies["WebNestle"]["DLIdUsuario"]);
            String Msj       = "";

            try
            {
                DataTable DtLis = new DataTable();
                DtLis.Columns.Add("idPedido", typeof(Int32));
                DtLis.Columns.Add("Producto", typeof(String));
                DtLis.Columns.Add("cantidad", typeof(Int32));
                DtLis.Columns.Add("Precio", typeof(Decimal));
                DtLis.Columns.Add("Usuario", typeof(Int32));

                foreach (GridViewRow row in GvSubir.Rows)
                {
                    DataRow drog = DtLis.NewRow();

                    drog["idPedido"] = Convert.ToInt32(row.Cells[0].Text.ToString());
                    drog["Producto"] = row.Cells[1].Text.ToString().ToString();
                    drog["cantidad"] = Convert.ToInt32(row.Cells[2].Text.ToString());
                    drog["Precio"]   = Decimal.Parse(row.Cells[3].Text.ToString());
                    drog["Usuario"]  = IdUsuario;
                    DtLis.Rows.Add(drog);
                }
                Msj = obj.subiconciliacion(DtLis);
                //foreach (GridViewRow row in GvSubir.Rows)
                //{
                //    Msj = obj.SubirConciliacion(Convert.ToInt32(row.Cells[0].Text.ToString()),
                //     row.Cells[1].Text.ToString(),
                //       Convert.ToInt32(row.Cells[2].Text.ToString()), Decimal.Parse(row.Cells[3].Text.ToString()),
                //       IdUsuario);
                //}
            }
            catch (Exception ex)
            {
                StackTrace st    = new StackTrace(ex, true);
                StackFrame frame = st.GetFrames().Where(f => !String.IsNullOrEmpty(f.GetFileName()) &&
                                                        f.GetILOffset() != StackFrame.OFFSET_UNKNOWN &&
                                                        f.GetNativeOffset() != StackFrame.OFFSET_UNKNOWN &&
                                                        !f.GetMethod().Module.Assembly.GetName().Name.Contains("mscorlib")).First();

                string        MachineName = System.Environment.MachineName;
                string        UserName    = System.Environment.UserName.ToUpper();
                string        Mensaje     = ex.Message;
                StringBuilder builder     = new StringBuilder(Mensaje);
                builder.Replace("'", "");
                int    LineaError     = frame.GetFileLineNumber();
                string Proyecto       = frame.GetMethod().Module.Assembly.GetName().Name;
                string Clase          = frame.GetMethod().DeclaringType.Name;
                string metodo         = frame.GetMethod().Name;
                string menssajeScript = "<script type='text/javascript'>"
                                        + " swal({" +

                                        "title: '" + builder.ToString() + "'," +
                                        " icon: 'warning'," +
                                        "  dangerMode: false," +
                                        "   })  </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", menssajeScript, false);
                return;
            }
            if (Msj != "")
            {
                string menssajeScript = "<script type='text/javascript'>"
                                        + " swal({" +

                                        "title: '" + Msj + "'," +
                                        " icon: 'success'," +
                                        "  dangerMode: false," +
                                        "   })  </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", menssajeScript, false);

                LblTotal.Text = "";
            }
            else
            {
                string menssajeScript = "<script type='text/javascript'>"
                                        + " swal({" +

                                        "title: '" + Msj + "'," +
                                        " icon: 'warning'," +
                                        "  dangerMode: true," +
                                        "   })  </script>";
                ScriptManager.RegisterStartupScript(this, typeof(Page), "mensaje", menssajeScript, false);
            }
            DataTable dt = new DataTable();

            GvSubir.DataSource = dt;
            GvSubir.DataBind();
        }