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); }
/// 修改:李东峰 日期: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(); }
/// <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 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 DataSet executeSqlCommandDataSet(String sqlCommandStr, List<MySqlParameter> paramList) { MySqlConnection sqlCon = this.getMySqlConnection(); try { sqlCon.Open(); MySqlCommand sqlCommand = new MySqlCommand(sqlCommandStr, sqlCon); if (paramList != null && paramList.Count > 0) { foreach (MySqlParameter param in paramList) { sqlCommand.Parameters.Add(param); } } MySqlDataAdapter sqlAdapter = new MySqlDataAdapter(sqlCommand); DataSet ds = new DataSet(); sqlAdapter.Fill(ds); sqlAdapter.Dispose(); return ds; } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); sqlCon.Dispose(); } }
protected MySqlDataReader executeSqlCommandDataReader(String sqlCommandStr, List<MySqlParameter> paramList) { MySqlConnection sqlCon = this.getMySqlConnection(); try { sqlCon.Open(); MySqlCommand sqlCommand = new MySqlCommand(sqlCommandStr, sqlCon); if (paramList != null && paramList.Count > 0) { foreach (MySqlParameter param in paramList) { sqlCommand.Parameters.Add(param); } } MySqlDataReader sqlReader = sqlCommand.ExecuteReader(); sqlCommand.Dispose(); return sqlReader; } catch (Exception ex) { throw ex; } finally { sqlCon.Close(); sqlCon.Dispose(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { List<ListItem> list = null; list = new List<ListItem> { new ListItem { Text = "武將牌", Value = "260" }, new ListItem { Text = "基本牌", Value = "201" }, new ListItem { Text = "锦囊牌", Value = "65" }, new ListItem { Text = "装备牌", Value = "39" }, new ListItem { Text = "收藏牌", Value = "19" } }; } }
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) { 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 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(); }
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"); } } }
public void BuildChartData(List<ListItem> list) { string json, path; json = ToJson(list); path = "~/json/chartData.json"; path = Server.MapPath(path); StreamHelper.WriteData(path, false, System.Text.Encoding.UTF8, json); }
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); }
public TrainingSession AddDishes(int id, List<Dish> dishes) { var training = this.trainings.GetById(id); foreach (var dish in dishes) { training.Dishes.Add(dish); } this.trainings.Save(); return training; }
public Dish AddProducts(int id, List<int> products) { var dish = this.dishes.GetById(id); foreach (var productId in products) { var product = this.products.GetById(productId); dish.Products.Add(product); } this.dishes.Save(); return dish; }
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; }
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); }
protected void DrawChart() { _resaults = _resaults.OrderBy(r => r.ItemsCount).ToList(); foreach (var resault in _resaults) { PerformChart.Series[0].IsValueShownAsLabel = true; PerformChart.Series[0].Points.Add(new DataPoint { XValue = resault.ItemsCount, YValues = new[]{resault.RunTime}, Label = "[" + resault.ItemsCount + ":" + Math.Round(resault.RunTime) + "]", }); } }
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; }
protected void Page_Load(object sender, EventArgs e) { ZipFileHelp zip = new ZipFileHelp(); zip.PassWord = "******"; //根据文件夹目录,生成解压缩包文件 Action CreateZipAndSaveInDisk = () => { string zipResultPathAndName = Server.MapPath("File/ZipResult.zip"); string folderPath = Server.MapPath("File/WantToZipthis"); zip.CreateZipFile(folderPath, zipResultPathAndName); }; //根据文件夹目录,生成解压缩包字节流,硬盘上不会生成解压缩文件 Action CreateZipGetBytes = () => { string folderPath = Server.MapPath("File/WantToZipthis"); byte[] bytes = zip.CreateZipFile(folderPath); Response.ContentType = "stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".zip"); Response.BinaryWrite(bytes); Response.Flush(); Response.End(); }; //根据字节流,生成解压缩包 //例如我们的图片全部存在资源服务器,我们需要提供对用户图片进行打包下载的功能,就可以使用次方法。 //方法不会在服务器端生成任何文件 Action CreateZipByBytesSource = () => { WebClient client = new WebClient(); byte[] source = client.DownloadData("https://www.baidu.com/img/bdlogo.png"); string sourcePathAndName = "ThisisFolder/filename.png"; List<Tuple<string, byte[]>> result = new List<Tuple<string, byte[]>>() { Tuple.Create(sourcePathAndName,source) }; source = zip.CreateZipFile(result); Response.ContentType = "stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".zip"); Response.BinaryWrite(source); Response.Flush(); Response.End(); }; //CreateZipAndSaveInDisk(); //CreateZipGetBytes(); CreateZipByBytesSource(); }
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; }
/// <summary> /// 将 List<ListItem> 转换为 JSON 字符串 /// </summary> /// <param name="list"></param> /// <returns></returns> public string ToJson(List<ListItem> list) { string json; json = "{\"chartData\":["; foreach (ListItem item in list) { json += "{\"text\":\"" + item.Text + "\",\"value\":\"" + item.Value + "\"},"; } json = json.TrimEnd(','); json += "]}"; return json; }
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); } }
public void FlyThrough(Hd4 objHd) { var deviceModelList = new List<DeviceModel>(); TotalCount = 1; Stopwatch stopwatch = new Stopwatch(); stopwatch.Reset(); stopwatch.Start(); foreach (var header in _headers) { var result = objHd.DeviceDetect(header); TotalCount++; } stopwatch.Stop(); TotalMilliSec = stopwatch.ElapsedMilliseconds; grdDeviceModel.DataSource = deviceModelList; grdDeviceModel.DataBind(); }
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; }