protected void Page_Load(object sender, EventArgs e) { user = (Users)Session["USER"]; lblUserName.Text = user.UserName.ToString().Clean(); lblNameSurname.Text = user.NameSurname.ToString().Clean(); lblNameSurname2.Text = user.NameSurname.ToString().Clean(); lblNameSurname3.Text = user.NameSurname.ToString().Clean(); lblemail.Text = user.Email.ToString().Clean(); ImgContact.ImageUrl = "Content\\img\\ImgContact.jpg"; ImgProfilePhoto1.ImageUrl = user.ProfilePhoto.Clean(); ImgProfilePhoto2.ImageUrl = user.ProfilePhoto.Clean(); ImgProfilePhoto3.ImageUrl = user.ProfilePhoto.Clean(); if (ImgProfilePhoto1.ImageUrl == "") { ImgProfilePhoto1.ImageUrl = "Content\\img\\user2-160x160.jpg"; } if (ImgProfilePhoto2.ImageUrl == "") { ImgProfilePhoto2.ImageUrl = "Content\\img\\user2-160x160.jpg"; } if (ImgProfilePhoto3.ImageUrl == "") { ImgProfilePhoto3.ImageUrl = "Content\\img\\user2-160x160.jpg"; } languagess = jobs.Languages(); contacts = jobs.Contact(); pages = jobs.Pages(); productcategories = jobs.Productcategory(); products = jobs.Products(); notifications = jobs.NotificationTop5(); // Top 5 }
protected void Page_Load(object sender, EventArgs e) { btnUpdate.ServerClick += BtnUpdate_ServerClick; btnClear.ServerClick += BtnClear_ServerClick; BtnUpload.Text = Resources.Index.Upload; btnClear.Value = Resources.Index.Clean; if (Request.QueryString["Process"] != null) { string Processs = Request.QueryString["Process"]; if (Processs == "EditPage") { Prcs = AddNews.Process.EditPage; id = Request.QueryString["id"].Clean(); Dictionary <string, string> condition = new Dictionary <string, string>(); condition.Add("id", id); pages = jobs.Pages(condition); btnUpdate.Value = Resources.Index.Update; if (pages.Count > 0) { PageTitle = Resources.Index.EditPage; { if (!Page.IsPostBack) { lblturkish.Text = Resources.Index.Turkish; lblenglish.Text = Resources.Index.English; txtTurkishTitle.Value = pages[0].PageTitleTR.ToString().Clean(); txtEnglishTitle.Value = pages[0].PageTitleEN.ToString().Clean(); txtturkish.Value = pages[0].PageContentTR.ToString().Clean(); txtenglish.Value = pages[0].PageContentEN.ToString().Clean(); txtPageUrl.Value = pages[0].PageUrl.ToString().Clean(); image1.ImageUrl = pages[0].SmallPicture.ToString().Clean(); image2.ImageUrl = pages[0].ContentPicture.ToString().Clean(); imageuploading.Visible = false; } } } else { PageTitle = Resources.Index.DataNotFound; Prcs = AddNews.Process.DataNotFound; } } else if (Processs == "DeletePage") { PageTitle = Resources.Index.DeletePage; Prcs = AddNews.Process.DeletePage; id = Request.QueryString["id"].Clean(); int result = jobs.query("Delete pages where id='" + id + "'"); if (result > 0) { Response.Redirect("/PagesList.aspx"); } else { Response.Write("Error1"); } } else { Title = Resources.Index.WrongParameter; } } else { btnUpdate.Value = Resources.Index.AddPage; PageTitle = Resources.Index.AddPage; Prcs = Process.AddPage; Viewingimages.Visible = false; uploadbuttondiv.Visible = false; } if (FileUpload1.HasFile) { if (Path.GetExtension(FileUpload1.PostedFile.FileName) == ".jpg" || Path.GetExtension(FileUpload1.PostedFile.FileName) == ".png") { Random rndm = new Random(); string PhotoExtensions = Path.GetExtension(FileUpload1.PostedFile.FileName); string PhotoName = FileUpload1.PostedFile.FileName /*+ rndm.Next(99999999, 999999999) + PhotoExtensions*/; //Firstly we will save chosen images to \\images\\ folder as temporary FileUpload1.SaveAs(Server.MapPath("~\\Content\\img\\uploads\\temp\\") + PhotoName); //After we are converting as bitmap Bitmap Photo = new Bitmap(Server.MapPath("~\\Content\\img\\uploads\\temp\\") + PhotoName); int Width = 215; int Height = 215; //Resizing the photo Size Size = new Size(Width, Height); //Resmi boyutlandırıyoruz. Bitmap ResizedPhoto = new Bitmap(Photo, Size); string Resizedandsavedphoto = "~\\Content\\img\\uploads\\" + PhotoName; //We are saving resized photo to \\images\\userphotos\\ folder ResizedPhoto.Save(Server.MapPath(Resizedandsavedphoto), ImageFormat.Jpeg); Photo.Dispose(); ResizedPhoto.Dispose(); //we delete the photo we saved as temporary FileInfo Firstuploadedphoto = new FileInfo(Server.MapPath("~\\Content\\img\\uploads\\temp\\") + PhotoName); Firstuploadedphoto.Delete(); image1.ImageUrl = Resizedandsavedphoto.Clean(); } } if (FileUpload2.HasFile) { if (Path.GetExtension(FileUpload2.PostedFile.FileName) == ".jpg" || Path.GetExtension(FileUpload2.PostedFile.FileName) == ".png") { Random rndm = new Random(); string PhotoExtensions = Path.GetExtension(FileUpload2.PostedFile.FileName); string PhotoName = FileUpload1.PostedFile.FileName /*+ rndm.Next(99999999, 999999999) + PhotoExtensions*/; //Firstly we will save chosen images to \\images\\ folder as temporary FileUpload2.SaveAs(Server.MapPath("~\\Content\\img\\uploads\\temp\\") + PhotoName); //After we are converting as bitmap Bitmap Photo = new Bitmap(Server.MapPath("~\\Content\\img\\uploads\\temp\\") + PhotoName); int Width = 215; int Height = 215; //Resizing the photo Size Size = new Size(Width, Height); //Resmi boyutlandırıyoruz. Bitmap ResizedPhoto = new Bitmap(Photo, Size); string Resizedandsavedphoto = "~\\Content\\img\\uploads\\" + PhotoName; //We are saving resized photo to \\images\\userphotos\\ folder ResizedPhoto.Save(Server.MapPath(Resizedandsavedphoto), ImageFormat.Jpeg); Photo.Dispose(); ResizedPhoto.Dispose(); //we delete the photo we saved as temporary FileInfo Firstuploadedphoto = new FileInfo(Server.MapPath("~\\Content\\img\\uploads\\temp\\") + PhotoName); Firstuploadedphoto.Delete(); image2.ImageUrl = Resizedandsavedphoto.Clean(); } } }
protected void Page_Load(object sender, EventArgs e) { pages = jobs.Pages(); languagess = jobs.Languages(); BtnAddNew.Text = Resources.Index.AddServices; }