protected void Page_Load(object sender, EventArgs e) { Controller_Tarifa controlTar = new Controller_Tarifa(); if (controlTar.ValorUF() == 0) { string FechaHoy = DateTime.Now.ToString("dd-MM-yyyy"); string apiUrl = "http://www.mindicador.cl/api"; string jsonString = "{}"; WebClient http = new WebClient(); JavaScriptSerializer jss = new JavaScriptSerializer(); http.Headers.Add(HttpRequestHeader.Accept, "application/json"); jsonString = http.DownloadString(apiUrl); var indicatorsObject = jss.Deserialize <Dictionary <string, object> >(jsonString); Dictionary <string, Dictionary <string, string> > dailyIndicators = new Dictionary <string, Dictionary <string, string> >(); int i = 0; foreach (var key in indicatorsObject.Keys.ToArray()) { var item = indicatorsObject[key]; if (item.GetType().FullName.Contains("System.Collections.Generic.Dictionary")) { Dictionary <string, object> itemObject = (Dictionary <string, object>)item; Dictionary <string, string> indicatorProp = new Dictionary <string, string>(); int j = 0; foreach (var key2 in itemObject.Keys.ToArray()) { indicatorProp.Add(key2, itemObject[key2].ToString()); j++; } dailyIndicators.Add(key, indicatorProp); } i++; } if (controlTar.IngresoValorUfDelDia(Convert.ToDouble(dailyIndicators["uf"]["valor"]))) { Response.Redirect("ModuloUsuario/View/Login.aspx"); } else { Response.Redirect("index.aspx"); } } else { Response.Redirect("ModuloUsuario/View/Login.aspx"); } }
public static string[] GuardarPresupuesto(int PagInterior, int Pagtapa, int EntradasxFormato, string Formato, string GramajeInt1, string GramajeTapa1, string Papelinterior, string PapelTapa, string Encuadernacion, string Tiraje, string QuintoColor, string UV, string Laminado, string BarnizAcuosoTapa, string NombrePres, string usuario, double ValorUF, string Embolsado, string AlzadoElementoPlano, string EmbolsadoMailaRev, string DesembolsadoSimple, string Alzado, string InsercionManual, string Pegado, string Fajado, string Adhesivo, string SuministroCajas, string InsercionElemCajaSellado, string Enzunchado, string PegadoSticker) { Controller_Cotizador controlpres = new Controller_Cotizador(); //string Tabla1 =""; string PrecioTotal1 = ""; string PrecioUnit1 = ""; string MaquinaInt = ""; string MaquinaTap = ""; Controller_Tarifa preControl = new Controller_Tarifa(); double ValorUFs = preControl.ValorUF(); if (Tiraje != "") { string[] PrecioPrensa1 = CreacionTablaDetalle(CalcularPreciosPrensa(PagInterior, Pagtapa, EntradasxFormato, Formato, GramajeInt1, GramajeTapa1, Papelinterior, PapelTapa, Encuadernacion, Tiraje, QuintoColor, UV, Laminado, BarnizAcuosoTapa, ValorUFs, Embolsado, AlzadoElementoPlano, EmbolsadoMailaRev, DesembolsadoSimple, Alzado, InsercionManual, Pegado, Fajado, Adhesivo, SuministroCajas, InsercionElemCajaSellado, Enzunchado, PegadoSticker), Tiraje); PrecioTotal1 = PrecioPrensa1[1]; PrecioUnit1 = PrecioPrensa1[2]; MaquinaInt = PrecioPrensa1[3]; MaquinaTap = PrecioPrensa1[3]; } int idpres = controlpres.GuardarPresupuesto(NombrePres, PagInterior, Pagtapa, Formato, GramajeInt1.Replace(" grs", ""), GramajeTapa1.Replace(" grs", ""), Papelinterior, PapelTapa, Encuadernacion, MaquinaInt, MaquinaTap, usuario, "Copesa", Tiraje, PrecioTotal1, PrecioUnit1, BarnizAcuosoTapa, QuintoColor, UV, Laminado, Embolsado); if (idpres > 0) { return(new[] { "OK", idpres.ToString() }); } else { return(new[] { "Error al crear el registro, intentelo mas tarde" }); } }
public static string[] PrePrensa(int PagInterior, int Pagtapa, int EntradasxFormato, string Formato, string GramajeInt1, string GramajeTapa1, string Papelinterior, string PapelTapa, string Encuadernacion, string Tiraje, string QuintoColor, string UV, string Laminado, string BarnizAcuosoTapa, string ValorUF, string Embolsado, string AlzadoElementoPlano, string EmbolsadoMailaRev, string DesembolsadoSimple, string Alzado, string InsercionManual, string Pegado, string Fajado, string Adhesivo, string SuministroCajas, string InsercionElemCajaSellado, string Enzunchado, string PegadoSticker) { string Tabla1 = ""; string PrecioTotal1 = ""; string PrecioUnit1 = ""; Controller_Tarifa preControl = new Controller_Tarifa(); double ValorUFs = preControl.ValorUF(); if (Tiraje != "") { string[] Detalle1 = CreacionTablaDetalle(CalcularPreciosPrensa(PagInterior, Pagtapa, EntradasxFormato, Formato, GramajeInt1, GramajeTapa1, Papelinterior, PapelTapa, Encuadernacion, Tiraje, QuintoColor, UV, Laminado, BarnizAcuosoTapa, ValorUFs, Embolsado, AlzadoElementoPlano, EmbolsadoMailaRev, DesembolsadoSimple, Alzado, InsercionManual, Pegado, Fajado, Adhesivo, SuministroCajas, InsercionElemCajaSellado, Enzunchado, PegadoSticker), Tiraje); Tabla1 = Detalle1[0]; PrecioTotal1 = Math.Ceiling(Convert.ToDouble(Detalle1[1])).ToString("N0"); PrecioUnit1 = Detalle1[2]; } return(new[] { Tabla1, PrecioTotal1, PrecioUnit1, "" }); }
public void ValorUF() { Controller_Tarifa preControl = new Controller_Tarifa(); lblCostoQ.Text = preControl.ValorUF().ToString("N2"); }