void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { GridView grid = sender as GridView; TableCellCollection tc = grid.Rows[(grid.PageSize - 1) * grid.PageIndex + Int32.Parse((String)e.CommandArgument)].Cells; switch (e.CommandName) { case "Enable": dbAccess.setStatus(Int32.Parse(tc[0].Text), dbAccess.getStatus("Active")); tc[6].Text = "2"; break; case "Disable": dbAccess.setStatus(Int32.Parse(tc[0].Text), dbAccess.getStatus("Disabled")); tc[6].Text = "3"; break; case "Download": Binary bin = dbAccess.getJournalist(tc[4].Text).File; if (bin != null) { String tmpFile = Path.GetTempFileName().Replace(".tmp", ".jpg"); FileStream fs = new FileStream(tmpFile, FileMode.OpenOrCreate); fs.Write(bin.ToArray(), 0, bin.Length); fs.Flush(); fs.Close(); Response.ContentType = "image/jpeg"; Response.AppendHeader("content-disposition", "attachment; filename=" + tmpFile); Response.TransmitFile(tmpFile); Response.End(); } break; default: break; } /* * string pdfPath = MapPath("mypdf.pdf"); * Response.ContentType = "Application/pdf"; * Response.AppendHeader("content-disposition", * "attachment; filename=" + pdfPath); * Response.TransmitFile(pdfPath); * Response.End();*/ }
void Wizard1_NextStep(object sender, WizardNavigationEventArgs e) { DAL_Library.User newUser = null; //Creation d'un nouveau user dans la session(temporaire) if (Session["CUser"] != null) { newUser = (DAL_Library.User)Session["CUser"]; } else { Session["CUser"] = new User(); } //3 different etats du Wizard if (e.CurrentStepIndex == 0) { if (Session["CUser.Type"] == null) { Session["CUser.Type"] = RadioButtonList1.SelectedValue; } } else if (e.CurrentStepIndex == 1) { if (TextBoxPassword.Text.Equals(TextBoxPasswordConfirm.Text)) { newUser.Password = TextBoxPassword.Text; } newUser.UserName = TextBoxUsername.Text; newUser.MailAddress = TextBoxMail.Text; } else if (e.CurrentStepIndex == 2 && e.NextStepIndex == 2) { file = FileUpload1.FileContent; if (!Session["CUser.Type"].Equals(String.Empty) && !newUser.UserName.Equals(String.Empty) && !newUser.Password.Equals(String.Empty) && !newUser.MailAddress.Equals(String.Empty) && file != null) { MemoryStream memStream = new MemoryStream(); file.CopyTo(memStream); Binary fileRep = new Binary(memStream.ToArray()); newUser.File = fileRep; newUser.Right1 = dbAccess.getRight((String)Session["CUser.Type"]); newUser.Status1 = dbAccess.getStatus("Pending"); dbAccess.addJournalist(newUser); Session["CUser.Type"] = null; Session["CUser"] = null; Response.Redirect(strUrl + "default.aspx"); } } }
private static void loadMenuThemeReader(MenuItem menu, String baseUrl) { BLL_Library.blAccess dbAccess = new BLL_Library.blAccess(); MenuItem addedItem = addChildMenu("Theme", menu, "", false); foreach (DAL_Library.Type theme in dbAccess.getThemes()) { if (theme.Status == dbAccess.getStatus("Active").Id) { addChildMenu(theme.Type1, addedItem, null); } } }
//News gridview event void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { GridView grid = sender as GridView; TableCellCollection tc = grid.Rows[(grid.PageSize - 1) * grid.PageIndex + Int32.Parse((String)e.CommandArgument)].Cells; switch (e.CommandName) { case "Enable": dbAccess.setNewsStatus(Int32.Parse(tc[0].Text), dbAccess.getStatus("Active")); tc[5].Text = "2"; break; case "Disable": dbAccess.setNewsStatus(Int32.Parse(tc[0].Text), dbAccess.getStatus("Disabled")); tc[5].Text = "3"; break; default: break; } }