protected void Page_Load(object sender, EventArgs e)
        {
            if (ddlCategory.Items.Count != 0)
            {
                gallerycategoriess = jobs.Gallerycategories();

                foreach (var item in gallerycategoriess)
                {
                    ddlCategory.Items.Add(item.GaleryCategoryNameEN.ToString());
                    ddlCategory.Items[ddlCategory.Items.Count - 1].Value = item.id.ToString().Clean();
                }
            }

            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 == "EditGallery")
                {
                    Prcs = AddNewGallery.Process.EditGallery;
                    id   = Request.QueryString["id"].Clean();
                    Dictionary <string, string> condition = new Dictionary <string, string>();
                    condition.Add("id", id);
                    galleriess      = jobs.Galleries(condition);
                    btnUpdate.Value = Resources.Index.Update;
                    if (galleriess.Count > 0)
                    {
                        PageTitle = Resources.Index.EditGallery;
                        {
                            if (!Page.IsPostBack)
                            {
                                string CategoryName = galleriess[0].id.ToString().Clean();
                                ddlCategory.SelectedValue = CategoryName;
                                lblturkish.Text           = Resources.Index.Turkish;
                                lblenglish.Text           = Resources.Index.English;
                                txtTurkishTitle.Value     = galleriess[0].GaleryNameTR.ToString().Clean();
                                txtEnglishTitle.Value     = galleriess[0].GaleryNameEN.ToString().Clean();
                                image1.ImageUrl           = galleriess[0].GaleryPhoto1.ToString().Clean();
                                image2.ImageUrl           = galleriess[0].GaleryPhoto2.ToString().Clean();
                                image3.ImageUrl           = galleriess[0].GaleryPhoto3.ToString().Clean();
                                image4.ImageUrl           = galleriess[0].GaleryPhoto4.ToString().Clean();
                                imageuploading.Visible    = false;
                            }
                        }
                    }
                    else
                    {
                        PageTitle = Resources.Index.DataNotFound;
                        Prcs      = AddNewGallery.Process.DataNotFound;
                    }
                }
                else if (Processs == "DeleteGallery")
                {
                    PageTitle = Resources.Index.DeleteServices;
                    Prcs      = AddNewGallery.Process.DeleteGallery;
                    id        = Request.QueryString["id"].Clean();
                    int result = jobs.query("Delete galleries where id='" + id + "'");
                    if (result > 0)
                    {
                        Response.Redirect("/GalleryList.aspx");
                    }
                    else
                    {
                        Response.Write("Error");
                    }
                }
                else
                {
                    Title = Resources.Index.WrongParameter;
                }
            }
            else
            {
                btnUpdate.Value         = Resources.Index.AddGallery;
                PageTitle               = Resources.Index.AddGallery;
                Prcs                    = Process.AddGallery;
                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  = 300;
                    int    Height = 285;
                    //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       = FileUpload2.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  = 300;
                    int    Height = 285;
                    //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();
                }
            }
            if (FileUpload3.HasFile)
            {
                if (Path.GetExtension(FileUpload3.PostedFile.FileName) == ".jpg" || Path.GetExtension(FileUpload3.PostedFile.FileName) == ".png")
                {
                    Random rndm            = new Random();
                    string PhotoExtensions = Path.GetExtension(FileUpload3.PostedFile.FileName);
                    string PhotoName       = FileUpload3.PostedFile.FileName /*+ rndm.Next(99999999, 999999999) + PhotoExtensions*/;
                    //Firstly we will save chosen images to \\images\\ folder as temporary
                    FileUpload3.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  = 300;
                    int    Height = 285;
                    //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();
                    image3.ImageUrl = Resizedandsavedphoto.Clean();
                }
            }
            if (FileUpload4.HasFile)
            {
                if (Path.GetExtension(FileUpload4.PostedFile.FileName) == ".jpg" || Path.GetExtension(FileUpload4.PostedFile.FileName) == ".png")
                {
                    Random rndm            = new Random();
                    string PhotoExtensions = Path.GetExtension(FileUpload4.PostedFile.FileName);
                    string PhotoName       = FileUpload4.PostedFile.FileName /*+ rndm.Next(99999999, 999999999) + PhotoExtensions*/;
                    //Firstly we will save chosen images to \\images\\ folder as temporary
                    FileUpload4.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  = 300;
                    int    Height = 285;
                    //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();
                    image4.ImageUrl = Resizedandsavedphoto.Clean();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            btnUpdate.ServerClick += BtnUpdate_ServerClick;
            btnClear.ServerClick  += BtnClear_ServerClick;
            btnClear.Value         = Resources.Index.Clean;
            btnUpdate.Value        = Resources.Index.Add;
            gallerycategoriess     = jobs.Gallerycategories();
            languagess             = jobs.Languages();

            if (Request.QueryString["Process"] != null)
            {
                string Processs = Request.QueryString["Process"];

                if (Processs == "EditCategoryName")
                {
                    Prcs = AddGalleryCategory.Process.EditCategoryName;
                    id   = Request.QueryString["id"].Clean();
                    Dictionary <string, string> condition = new Dictionary <string, string>();
                    condition.Add("id", id);
                    gallerycategoriess = jobs.Gallerycategories(condition);
                    btnUpdate.Value    = Resources.Index.Update;
                    if (gallerycategoriess.Count > 0)
                    {
                        PageTitle = Resources.Index.EditGalleryCategory;
                        {
                            if (!Page.IsPostBack)
                            {
                                txtCategoryNameTR.Value = gallerycategoriess[0].GaleryCategoryNameTR.ToString().Clean();
                                txtCategoryNameEN.Value = gallerycategoriess[0].GaleryCategoryNameEN.ToString().Clean();
                            }
                        }
                    }
                    else
                    {
                        PageTitle = Resources.Index.DataNotFound;
                        Prcs      = AddGalleryCategory.Process.DataNotFound;
                    }
                }
                else if (Processs == "DeleteCategoryName")
                {
                    PageTitle = Resources.Index.DeleteGalleryCategory;
                    Prcs      = AddGalleryCategory.Process.DeleteCategoryName;
                    id        = Request.QueryString["id"].Clean();
                    int result = jobs.query("Delete gallericategories where id='" + id + "'");
                    if (result > 0)
                    {
                        Response.Redirect("/AddGalleryCategory.aspx");
                    }
                    else
                    {
                        Response.Write("Error");
                    }
                }
                else
                {
                    PageTitle = Resources.Index.WrongParameter;
                }
            }
            else
            {
                btnUpdate.Value = Resources.Index.Add;
                PageTitle       = Resources.Index.AddGalleryCategory;
                Prcs            = Process.AddCategoryName;
            }
        }