protected void Page_Load(object sender, EventArgs e) { var json = Request.Form["json"]; if (json == null) { return; } if (json == "]") json = ""; var periodo = Request.Form["periodo"]; Newtonsoft.Json.Linq.JArray gastosArray = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(json); if (gastosArray == null) gastosArray = new Newtonsoft.Json.Linq.JArray(); Data.edificio ed = new Data.edificio(); ed.direccion = Request.Params["edificio"]; List<Data.Recargo> gastos = new List<Data.Recargo>(); foreach (var r in gastosArray) { Data.Recargo rec = new Data.Recargo(); //['1','1/12/2015','Reparacion piso','00-01','Exclusivos','1.525,20','No'] rec.Edificio = ed.direccion; rec.Fecha = DateTime.Parse(r[1].ToString()); rec.Concepto = r[2].ToString(); rec.Unidad = r[3].ToString(); rec.Tipo = r[4].ToString(); double importe = Math.Abs(double.Parse(r[5].ToString())); rec.Importe = importe; rec.Pagado = r[6].ToString(); gastos.Add(rec); } var per = DateTime.Parse(periodo); Business.ControladorGastosExclusivos.addGastos(ed, per, gastos); Response.Redirect("GastosExclusivos.aspx?edificio=" + ed.direccion + "&periodo=" + per.Month + "/" + per.Year); }
public int uploadScore(String name, Int32 score) { String sqlCommand = "insert into gamerecord values (null, @Name, @Score, now())"; List<MySqlParameter> paramList = new List<MySqlParameter>(); paramList.Add(new MySqlParameter("@Name", name)); paramList.Add(new MySqlParameter("@Score", score)); return executeSqlCommandNoQuery(sqlCommand, paramList); }
/// <summary> /// Ordena os scripts por funcao: Modules, Services e Controllers /// </summary> /// <param name="context"></param> /// <param name="files"></param> /// <returns></returns> public IEnumerable<BundleFile> OrderFiles(BundleContext context, IEnumerable<BundleFile> files) { var modules = new List<BundleFile>(); var services = new List<BundleFile>(); var controllers = new List<BundleFile>(); foreach (var item in files) { if (item.VirtualFile.Name.Contains("service")) { services.Add(item); } else if (item.VirtualFile.Name.Contains("controller")) { controllers.Add(item); } else { modules.Add(item); } } var allFiles = new List<BundleFile>(); allFiles.AddRange(modules); allFiles.AddRange(services); allFiles.AddRange(controllers); return allFiles; }
protected void Page_Load(object sender, EventArgs e) { List<Data.edificio> edificios = new List<Data.edificio>(); Data.edificio edi = new Data.edificio(); edi.direccion = Request.Params["edificio"]; edificios.Add(edi); if (edi.direccion == null || edi.direccion == "") return; string path = ""; Business.ControladorInformes.Ruta = Server.MapPath("/"); string serverPath = Server.MapPath("includes/"); Business.ControladorInformes.IncludesPath = serverPath; path = Business.ControladorInformes.generarInformeUnidadesEdificio(edificios); Logger.Log.write(path); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Content-Disposition", "attachment; filename=Listado unidad: " + edi.direccion + ".pdf"); Response.ContentType = "text/plain"; //Response.Flush(); Response.TransmitFile(path); Response.Flush(); //Response.End(); }
protected void btnGridParameters_OnClick(object sender, EventArgs e) { _knapsacks = new List<Knapsack>(); _items = new List<Item>(); int knapCount = Convert.ToInt32(KnapsacksCount.Text); int itemCount = Convert.ToInt32(ItemsCount.Text); for (int i = 0; i < knapCount; i++) { _knapsacks.Add(new Knapsack {Id = i}); } for (int i = 0; i < itemCount; i++) { _items.Add(new Item {Id = i}); } Session["kn"] = _knapsacks; Session["it"] = _items; Session["ce"] = Convert.ToDouble(CalculateError.Text); KnapsacksGrid.DataSource = _knapsacks; KnapsacksGrid.DataBind(); ItemsGrid.DataSource = _items; ItemsGrid.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { _exampleModel = new List<ExampleModel>(); var exManager = new ExampleManager(); var knManager = new KnapsackManager(); var itManager = new ItemManager(); var idEx = exManager.GetAllExamplesId(); foreach (var id in idEx) { string knapsacks = string.Empty; string items = string.Empty; knManager.GetKnapsacks(id).ForEach(k => knapsacks+=","+k.Capacity); itManager.GetItems(id).ForEach(i => items+=","+i.Weight); _exampleModel.Add(new ExampleModel { Id = id, Error = exManager.GetCalculateError(id), Knapsacks = knapsacks.TrimStart(','), Items = items.TrimStart(',') }); } ExamplesGrid.DataSource = _exampleModel; ExamplesGrid.DataBind(); }
/// 修改:李东峰 日期:2014-2-28 /// 修改内容:增加根据visible属性判断是否显示该菜单 public void GetLeftTree(string id) { string userId = Request.Cookies["T_USERID"].Value.ToString(); string roleId = bl.GetRoleId(userId); dt = new DataTable(); GetTreeList(); DataRow[] _dr = dt.Select("PID='" + id + "'"); IList<Hashtable> list = new List<Hashtable>(); for (int i = 0; i < _dr.Length; i++) { string[] nodeRoleId = _dr[i][5].ToString().TrimStart(',').TrimEnd(',').Split(','); if (nodeRoleId.Contains(roleId) && _dr[i][4].ToString() == "1") { Hashtable ht = new Hashtable(); ht.Add("ID", _dr[i][0].ToString()); ht.Add("NAME", _dr[i][1].ToString()); DataRow[] _dr_judge = dt.Select("PID='" + _dr[i][0].ToString() + "'"); if (_dr_judge.Length > 0) ht.Add("JUDGE", "1"); else ht.Add("JUDGE", "0"); list.Add(ht); } } object obj = new { list = list }; string result = Newtonsoft.Json.JsonConvert.SerializeObject(obj); Response.Write(result); Response.End(); }
public List<string> GetProductNames(string prefixText, int count) { using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = ConfigurationManager .ConnectionStrings["constr"].ConnectionString; using (SqlCommand cmd = new SqlCommand()) { cmd.CommandText = "select Name from Product where " + "Name like @SearchText + '%'"; cmd.Parameters.AddWithValue("@SearchText", prefixText); cmd.Connection = conn; conn.Open(); List<string> prodNames = new List<string>(); using (SqlDataReader sdr = cmd.ExecuteReader()) { while (sdr.Read()) { prodNames.Add(sdr["Name"].ToString()); } } conn.Close(); return prodNames; } } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { var json = Request.Form["json"]; if (json == null || json == "") { //Sectores Data.edificio edificio = new Data.edificio(); edificio.direccion = Request.Params["edificio"]; List<Data.sector> sectores = new List<Data.sector>(); foreach (String i in Request.Form) { if (i.Contains("edi_")) { Data.sector s = new Data.sector(); s.descripcion = i.Replace("edi_", ""); sectores.Add(s); } } Business.ControladorSectores.setSectoresEdificio(edificio, sectores); Response.Redirect("asignarSectores.aspx?edificio=" + edificio.direccion + "&cambios=1"); } else //Coeficientes { Data.edificio edificio = new Data.edificio(); edificio.direccion = Request.Params["edificio"]; List<Data.sector> sectores = Business.ControladorSectores.getAllSectoresEdificio(edificio); //Buscar los sectores del edificio y parsear json para esos. El json trae valores para todos los sectores if (json == "]") json = ""; Newtonsoft.Json.Linq.JArray coeficientesArray = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(json); if (coeficientesArray == null) coeficientesArray = new Newtonsoft.Json.Linq.JArray(); List<Entidades.Coeficientes> coeficientes = new List<Entidades.Coeficientes>(); foreach (var c in coeficientesArray) { //['00-01','5,05','0,00','0,00','0,00','0,00','0,00'] Entidades.Coeficientes coef = new Entidades.Coeficientes(); coef.Unidad = c[0].ToString(); coef.Rubro1 = Double.Parse(c[1].ToString()); coef.Rubro2 = Double.Parse(c[2].ToString()); coef.Rubro3 = Double.Parse(c[3].ToString()); coef.Rubro4 = Double.Parse(c[4].ToString()); coef.Rubro5 = Double.Parse(c[5].ToString()); coef.Rubro6 = Double.Parse(c[6].ToString()); coeficientes.Add(coef); } Business.ControladorExpensas.ActualizarCoeficientes(edificio, coeficientes); Response.Redirect("asignarSectores.aspx?edificio=" + edificio.direccion + "&cambios=1"); } } }
protected void Page_Load(object sender, EventArgs e) { var json = Request.Form["json"]; if (json == null) { return; } if (json == "]") json = ""; var periodo = Request.Form["periodo"]; Newtonsoft.Json.Linq.JArray facturasArray = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(json); if (facturasArray == null) facturasArray = new Newtonsoft.Json.Linq.JArray(); Data.edificio ed = new Data.edificio(); ed.direccion = Request.Params["edificio"]; List<Data.sector> sectores = Business.ControladorSectores.getAllSectoresEdificio(ed); List<Data.tipo_gasto> gastos = Business.ControladorTiposDeGasto.getAllTiposDeGasto(); List<Data.factura> facturas = new List<Data.factura>(); foreach (var f in facturasArray) { //['16/11/2015','EficientLimp','828','Limpieza Edificio','','3.500,00','Generales'] Data.factura fact = new Data.factura(); if (!f[0].ToString().Contains("agregado")) fact.idfactura = int.Parse(f[0].ToString()); fact.dir_edificio = ed.direccion; fact.fecha = DateTime.Parse(f[1].ToString()); if (!f[2].ToString().Contains("Ninguno")) fact.razon_provedor = f[2].ToString(); fact.numero_factura = f[3].ToString(); foreach (var g in gastos) if (g.descripcion == f[4].ToString()) fact.id_tipogasto = g.idtipo_gasto; fact.detalle = f[5].ToString(); fact.importe = parsearDoubleNulleable(f[6].ToString()); foreach (var s in sectores) if (s.descripcion == f[7].ToString()) fact.id_sector = s.idsector; facturas.Add(fact); } Business.ControladorFacturas.agregarFacturasWeb(facturas, ed, DateTime.Parse(periodo)); Response.Redirect("Facturas.aspx?edificio=" + ed.direccion + "&periodo=" + DateTime.Parse(periodo).Month + "/" + DateTime.Parse(periodo).Year); }
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { var files = controllerContext.HttpContext.Request.Files; var list = new List<UploadedFileInfo>(); for (int i = 0; i < files.Count; i++) { var file = files[i]; var name = files.AllKeys[i]; var fileInfo = new UploadedFileInfo(name, file); list.Add(fileInfo); } return list; }
public bool InportBiochemistryData(byte[] buffer) { bool resoult = false; if (buffer != null) { DataSet ds = DataSetZip.Decompress(buffer); if (ds.Tables.Count > 0) { List<Biochemistry> list = new List<Biochemistry>(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { Biochemistry entity = new Biochemistry(); entity.UPDATE_DATETIME = ds.Tables[0].Rows[i]["UPDATE_DATETIME"].ToString(); entity.EmployeeID = ds.Tables[0].Rows[i]["EmployeeID"].ToString(); entity.YearMonth = ds.Tables[0].Rows[i]["YearMoth"].ToString(); entity.HYNo = ds.Tables[0].Rows[i]["HYNo"].ToString(); entity.HYTC = ConvertFloat(ds.Tables[0].Rows[i]["HYTC"].ToString()); entity.HYTG = ConvertFloat(ds.Tables[0].Rows[i]["HYTG"].ToString()); entity.HYHDLC = ConvertFloat(ds.Tables[0].Rows[i]["HYHDLC"].ToString()); entity.HYLDLC = ConvertFloat(ds.Tables[0].Rows[i]["HYLDLC"].ToString()); entity.HYAPOAI = ConvertFloat(ds.Tables[0].Rows[i]["HYAPOAI"].ToString()); entity.HYAPOB = ConvertFloat(ds.Tables[0].Rows[i]["HYAPOB"].ToString()); entity.HYTBIL = ConvertFloat(ds.Tables[0].Rows[i]["HYTBIL"].ToString()); entity.HYDBIL = ConvertFloat(ds.Tables[0].Rows[i]["HYDBIL"].ToString()); entity.HYTP = ConvertFloat(ds.Tables[0].Rows[i]["HYTP"].ToString()); entity.HYALB = ConvertFloat(ds.Tables[0].Rows[i]["HYALB"].ToString()); entity.HYALT = ConvertFloat(ds.Tables[0].Rows[i]["HYALT"].ToString()); entity.HYAST = ConvertFloat(ds.Tables[0].Rows[i]["HYAST"].ToString()); entity.HYGT = ConvertFloat(ds.Tables[0].Rows[i]["HYGT"].ToString()); entity.HYALP = ConvertFloat(ds.Tables[0].Rows[i]["HYALP"].ToString()); entity.HYHBsAg = ds.Tables[0].Rows[i]["HYHBsAg"].ToString(); entity.HYHBsAb = ds.Tables[0].Rows[i]["HYHBsAb"].ToString(); entity.HYHBeAg = ds.Tables[0].Rows[i]["HYHBeAg"].ToString(); entity.HYHBeAb = ds.Tables[0].Rows[i]["HYHBeAb"].ToString(); entity.HYHBcAb = ds.Tables[0].Rows[i]["HYHBcAb"].ToString(); entity.HY_GLU = ConvertFloat(ds.Tables[0].Rows[i]["HY_GLU"].ToString()); entity.HY_UREA = ConvertFloat(ds.Tables[0].Rows[i]["HY_UREA"].ToString()); entity.HY_CR = ConvertFloat(ds.Tables[0].Rows[i]["HY_CR"].ToString()); entity.HYUA = ConvertFloat(ds.Tables[0].Rows[i]["HYUA"].ToString()); entity.HY_AFP = ConvertFloat(ds.Tables[0].Rows[i]["HY_AFP"].ToString()); entity.HY_CEA = ConvertFloat(ds.Tables[0].Rows[i]["HY_CEA"].ToString()); list.Add(entity); } resoult = ZYSoft.ORM.Operation.BiochemistryOP.SaveData(list); } } return resoult; }
protected void Page_Load(object sender, EventArgs e) { XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath("~/config/map.config")); XmlNode shortCuts = doc.SelectSingleNode("/Map/ShartCuts"); if (shortCuts!=null && shortCuts.HasChildNodes) { IList<XmlNode> nodes = new List<XmlNode>(); for (int i = 0; i < shortCuts.ChildNodes.Count;++i ) { string purview = WebUtility.GetXmlNodeAttribute(shortCuts.ChildNodes[i], "purview"); if (string.IsNullOrEmpty(purview) || !RequestContext.Current.User.HasPurview(purview)) { continue; } nodes.Add(shortCuts.ChildNodes[i]); } RptShortCuts.DataSource = nodes; RptShortCuts.DataBind(); } if (RequestContext.Current.User.HasPurview(task1.Attributes["purview"])) { task1.Visible = true; HyperLink2.NavigateUrl = WebUtility.AppendSecurityCode("/task/taskmanage.aspx?status=0"); Literal2.Text = TaskBll.Count(m => m.Status == Model.TaskState.New).ToString(); } if (RequestContext.Current.User.HasPurview(task2.Attributes["purview"])) { task2.Visible = true; Literal3.Text = TaskBll.Count(m => m.Status == Model.TaskState.CanDevelop).ToString(); } if (RequestContext.Current.User.HasPurview(task3.Attributes["purview"])) { task3.Visible = true; Literal4.Text = OrderBll.Count(m => m.Status == Model.OrderStatus.New).ToString(); } if (RequestContext.Current.User.HasPurview(task4.Attributes["purview"])) { task4.Visible = true; HyperLink3.NavigateUrl = WebUtility.AppendSecurityCode("/task/taskmanage.aspx?status=13"); Literal5.Text = TaskBll.Count(m => m.Status == Model.TaskState.Stocking).ToString(); } }
protected void Page_Load(object sender, EventArgs e) { var json = Request.Form["json"]; if (json == null) { return; } if (json == "]") json = ""; var periodo = Request.Form["periodo"]; Newtonsoft.Json.Linq.JArray movimientosArray = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(json); if (movimientosArray == null) movimientosArray = new Newtonsoft.Json.Linq.JArray(); Data.edificio ed = new Data.edificio(); ed.direccion = Request.Params["edificio"]; List<Data.movimiento_caja> movimientos = new List<Data.movimiento_caja>(); foreach (var m in movimientosArray) { Data.movimiento_caja mov = new Data.movimiento_caja(); // ['1','1/11/2015','Aporte fondo','Ingreso','500,00'] if (!m[0].ToString().Contains("agregado")) mov.id_movimiento = int.Parse(m[0].ToString()); mov.dir_edificio = ed.direccion; mov.fecha = DateTime.Parse(m[1].ToString()); mov.periodo = mov.fecha; mov.concepto = m[2].ToString(); double importe = Math.Abs(double.Parse(m[4].ToString())); if (m[3].ToString().Contains("Ingreso")) mov.importe = importe; else mov.importe = importe * -1; movimientos.Add(mov); } var per = DateTime.Parse(periodo); Business.ControladorEdificios.setMovimientosCaja(ed, per, movimientos); Response.Redirect("MovimientoCaja.aspx?edificio=" + ed.direccion + "&periodo=" + per.Month + "/" + per.Year); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { List<Data.provedor> proveedores = new List<Data.provedor>(); foreach (String i in Request.Form) { if (i.Contains("edi_")) { Data.provedor p = new Data.provedor(); p.razon_social = i.Replace("edi_", ""); proveedores.Add(p); } } Data.edificio ed = new Data.edificio(); ed.direccion = Request.Params["edificio"]; Business.ControladorEdificios.setProveedoresEdificio(ed, proveedores); } }
protected void Page_Load(object sender, EventArgs e) { WebConfig config = ConfigFactory.GetWebConfig(); if (config!=null) { Title = config.Title; } XmlDocument doc = new XmlDocument(); doc.Load(Server.MapPath("~/config/map.config")); XmlNode menu = doc.SelectSingleNode("/Map/Menus"); if (menu!=null && menu.HasChildNodes) { IList<XmlElement> els = new List<XmlElement>(); foreach (XmlElement item in menu.ChildNodes) { if (RequestContext.Current.User.HasPurview(WebUtility.GetXmlNodeAttribute(item, "purview"))) { els.Add(item); } } if (els.Count > 0) { firstMenu = WebUtility.GetXmlNodeAttribute(els[0], "alias"); Repeater1.DataSource = els; Repeater1.DataBind(); } } PageSecuritySection section = (PageSecuritySection)WebConfigurationManager.GetSection("PageSecurity"); IList<ResourceElement> list = new List<ResourceElement>(); foreach (ResourceElement item in section.Resources.Resources) { if (RequestContext.Current.User.HasPurview(item.Value)) { list.Add(item); } } }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { List<Data.edificio> edificios = new List<Data.edificio>(); foreach (String i in Request.Form) { if (i.Contains("edi_")) { Data.edificio ed = new Data.edificio(); ed.direccion = i.Replace("edi_", ""); edificios.Add(ed); } } var vto1 = DateTime.Parse(Request.Form["vto1"]); var vto2 = DateTime.Parse(Request.Form["vto2"]); var periodo = DateTime.Parse("1/" + Request.Form["periodo"]); var pie = Request.Form["pie"]; string path = ""; Business.ControladorInformes.Ruta = Server.MapPath("/"); string serverPath = Server.MapPath("includes/"); Business.ControladorInformes.IncludesPath = serverPath; path = Business.ControladorInformes.generarAllLiquidacionesWeb(edificios, periodo, vto1, vto2, pie, new System.Drawing.Bitmap(System.Drawing.Image.FromFile(serverPath + "emergencias.png")), new System.Drawing.Bitmap(System.Drawing.Image.FromFile(serverPath + "qr.png")), new System.Drawing.Bitmap(System.Drawing.Image.FromFile(serverPath + "tijera.png"))); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Content-Disposition", "attachment; filename=Liquidaciones " + DateTime.Now.ToShortDateString() + ".zip"); Response.ContentType = "text/plain"; // Response.Flush(); Response.TransmitFile(path); Response.Flush(); Response.End(); } }
protected void Calculate_OnClick(object sender, EventArgs e) { var calculateModel = new List<CalculateModel>(); double calcError = 0; double.TryParse(CalculateError.Text, out calcError); int knapsackCount = Convert.ToInt32(KnapsacksCountSelect.SelectedValue); for (int i = 1; i <= IterationCount; i++) { calculateModel.Add(new CalculateModel() { CalculateError = calcError, Items = GetRandomItems(i), Knapsacks = GetRandomKnapsacks(knapsackCount) }); } foreach (var model in calculateModel) { var proxy = new Service1(); proxy.CalculateCompleted += OnCalculateCompleted; proxy.CalculateAsync(TransportConverter.CalculateModelConverter(model)); } }
public static IList<Claim> RemoveUserIdentityClaims(IEnumerable<Claim> claims) { List<Claim> filteredClaims = new List<Claim>(); foreach (var c in claims) { // Strip out any existing name/nameid claims if (c.Type != ClaimTypes.Name && c.Type != ClaimTypes.NameIdentifier) { filteredClaims.Add(c); } } return filteredClaims; }
private IEnumerable<WeatherData<Int32>> ProcessValues(WeatherValue<Int32> data, IEnumerable<TimeLayout> timeLayouts) { var list = new List<WeatherData<Int32>>(); if (data != null) { var timeLayout = timeLayouts.FirstOrDefault(t => t.Key.Equals(data.TimeLayoutKey)); if (timeLayout != null) { for (var index = 0; index < data.Values.Length; index++) { var startTime = timeLayout.StartTimes[index]; var endTime = new DateTime?(); if (timeLayout.EndTimes != null) { endTime = timeLayout.EndTimes[index]; } list.Add(new WeatherData<Int32> { Value = data.Values[index], Start = startTime, End = endTime }); } } } return list; }
protected void Page_Load(object sender, EventArgs e) { var edificio = Request.Params["edificio"]; var unidad = Request.Params["unidad"]; var titular = Request.Params["Titular"]; var buscar = Request.Params["buscar"]; var comprobante = Request.Params["comprobante"]; var descuentoStr = Request.Params["descuento"]; double descuento; //if (descuentoStr == null && descuentoStr != "") descuento = 0; else descuento = double.Parse(descuentoStr); if (!double.TryParse(descuentoStr, out descuento)) descuento = 0; if (IsPostBack) { char[] separador = { '$' }; Data.unidad u = new Data.unidad(); u.id_unidad = Request.Params["unidad"]; u.dir_edificio = Request.Params["edificio"]; var detalles = Business.ControladorExpensas.getDetalleDeudaUnidad(u); var detallesACobrar = new List<Data.CatalogoDeudores.DetalleDeuda>(); foreach (var cobro in Request.Form) { if (cobro.ToString().Contains("cobro:")) { string txt = cobro.ToString().Replace("cobro:", ""); var cadenas = txt.Split(separador); var periodo = cadenas[0]; var tipo = cadenas[1]; foreach (Data.CatalogoDeudores.DetalleDeuda d in detalles) { if (d.Periodo.ToShortDateString() == periodo && d.Tipo == tipo) detallesACobrar.Add(d); } } } foreach (var d in detallesACobrar) Business.ControladorExpensas.registrarPago(d, descuento); if (comprobante != null && detallesACobrar.Count > 0) { Business.ControladorInformes.Ruta = Server.MapPath("/"); string serverPath = Server.MapPath("includes/"); string ruta = Business.ControladorExpensas.emitirRecibo(new System.Drawing.Bitmap(System.Drawing.Image.FromFile(serverPath + "qr.png")), detallesACobrar, descuento); string nombre = "Recibo " + System.IO.Path.GetFileName(ruta); Response.Clear(); Response.ClearHeaders(); Response.ClearContent(); Response.AddHeader("Content-Disposition", "attachment; filename=" + nombre); Response.ContentType = "text/plain"; Response.TransmitFile(ruta); Response.Flush(); } return; } if (edificio != null && edificio.ToString() != "" && (unidad == null || unidad == "")) { Response.Write("<option>Seleccione</option>"); foreach (var u in Business.ControladorUnidades.getAllUnidades(edificio)) Response.Write("<option>" + u.id_unidad + "</option>"); Response.End(); } if (edificio != null && edificio.ToString() != "" && unidad != null && unidad.ToString() != "" && titular != null && titular.ToString() == "1") { String nombreTitular = ""; if (unidad != "Seleccione") nombreTitular = Business.ControladorUnidades.getUnidad(edificio, unidad).titular?.nombre; Response.Write(nombreTitular); Response.End(); } if (edificio != null && edificio.ToString() != "" && unidad != null && unidad.ToString() != "") { Data.unidad u = new Data.unidad(); u.id_unidad = Request.Params["unidad"]; u.dir_edificio = Request.Params["edificio"]; int i = 0; string response = ""; foreach (Data.CatalogoDeudores.DetalleDeuda d in Business.ControladorExpensas.getDetalleDeudaUnidad(u)) { i++; response += "<tr>"; response += "<td style='text-align: center; width: 1px;' onchange='calcularTotales()'>"; response += "<input name ='cobro:" + d.Periodo.ToShortDateString() + "$" + d.Tipo + "' type = 'checkbox' class= 'minimal checkboxfede' style='position: absolute; opacity: 0; width: 1px; '/>"; response += "</td>"; response += "<td style = 'line -height: 30px; width: 1px;'>" + d.Periodo.Month + "/" + d.Periodo.Year + "</td>"; response += "<td style='line -height: 30px; width: 1px; '>" + d.Tipo + "</td>"; response += "<td style = 'line -height: 30px; width: 1px;'>" + d.Importe.ToString("n2") + "</ td >"; response += "<td style='line -height: 30px; width: 1px;'>" + d.Recargo.ToString("n2") + "</td>"; response += "</tr>\n\r"; } if (i == 0) { response += "<tr>"; response += "<td style='text-align:center'>-</td>"; response += "<td>-</td>"; response += "<td>-</td>"; response += "<td>-</td>"; response += "<td>-</td>"; response += "<td>-</td>"; response += "</tr>\n\r"; } Response.Write(response); Response.End(); } }
public IEnumerable<CollaborateurModel> GetAllCollaborators() { IEnumerable<ajt_collaborator> ajt_col = repo.GetAllCollaborators().Where(x=>!x.deletion_date.HasValue); if (User.IsInRole("admin") ) { ajt_col = repo.GetCollaboratorsForAdmins(ajt_col); } List<CollaborateurModel> model = new List<CollaborateurModel>(); List<ajt_collaborator> lstCol = ajt_col.ToList(); foreach (ajt_collaborator item in lstCol) { try { CollaborateurModel temp = Mapper.Map<ajt_collaborator, CollaborateurModel>(item); model.Add(temp); } catch (Exception ex) { Debug.Print(ex.InnerException.ToString()); } } foreach (CollaborateurModel item in model) { ajt_collaborator temp_coll = Mapper.Map<CollaborateurModel, ajt_collaborator>(item); item.Role = repo.GetRoleFromCollaborator(temp_coll); } return model; }
private List<Item> GetItemsFromGrid(GridView itemsGrid) { var items = new List<Item>(); foreach (GridViewRow row in itemsGrid.Rows) { if (row.RowType == DataControlRowType.DataRow) { items.Add(new Item { Id = Convert.ToInt32((row.Cells[0].Controls[0] as Label).Text), Weight = Convert.ToDouble((row.Cells[1].Controls[0] as TextBox).Text) }); } } return items; }
private List<Knapsack> GetKnapsacksFromGrid(GridView knapsacksGrid) { var knaps = new List<Knapsack>(); foreach (GridViewRow row in knapsacksGrid.Rows) { if (row.RowType == DataControlRowType.DataRow) { knaps.Add(new Knapsack { Id = Convert.ToInt32((row.Cells[0].Controls[0] as Label).Text), Capacity = Convert.ToDouble((row.Cells[1].Controls[0] as TextBox).Text) }); } } return knaps; }
private void _proxy_CalculateCompleted(object sender, CalculateCompletedEventArgs e) { Result result = e.Result; var allowable = new List<ResultViewModel>(); var optimal = new List<ResultViewModel>(); foreach (Variation acceptable in result.Acceptables) { allowable.Add(new ResultViewModel { G = Math.Round(acceptable.G,3), Knapsacks = getLineKnapsacks(acceptable.Knapsacks), Items = getLineItems(acceptable.Knapsacks) }); } optimal.Add(new ResultViewModel { G = Math.Round(result.Optimal.G, 3), Knapsacks = getLineKnapsacks(result.Optimal.Knapsacks), Items = getLineItems(result.Optimal.Knapsacks) }); OptimalGrid.DataSource = optimal; OptimalGrid.DataBind(); AllowableGrid.DataSource = allowable; AllowableGrid.DataBind(); new ExampleManager().UpdateExecuteTime(Convert.ToInt32(Request.QueryString["idExp"]), Math.Round(result.RunTime)); info.Text = "Время рассчета: " + Math.Round(result.RunTime) + " мс"; }
protected DataSet executeSqlCommandDataSet(String sqlCommandStr, MySqlParameter param) { List<MySqlParameter> paramList = new List<MySqlParameter>(); paramList.Add(param); return executeSqlCommandDataSet(sqlCommandStr, paramList); }
protected int executeSqlCommandNoQuery(String sqlCommandStr, MySqlParameter param) { List<MySqlParameter> paramList = new List<MySqlParameter>(); paramList.Add(param); return executeSqlCommandNoQuery(sqlCommandStr, paramList); }
private List<Knapsack> GetRandomKnapsacks(int knapsackCount) { var knapsacks = new List<Knapsack>(); for (int i = 0; i < knapsackCount; i++) { knapsacks.Add(new Knapsack { Capacity = _rnd.NextDouble()*6, Id = i }); } return knapsacks; }
private List<Item> GetRandomItems(int itemsCount) { var items = new List<Item>(); for (int i = 0; i < itemsCount; i++) { items.Add(new Item { Id = i, Weight = _rnd.NextDouble()*2 }); } return items; }