Esempio n. 1
0
        protected void btnDelete_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton Delete = (ImageButton)sender;
            string IDVal = Delete.CommandArgument;
            int id = int.Parse(IDVal);

            HEWDataContext context = new HEWDataContext();
            Model.New nNew = context.News.SingleOrDefault(i => i.ID == id);
            context.News.DeleteOnSubmit(nNew);
            context.SubmitChanges();
            gvNews.DataBind();
        }
Esempio n. 2
0
        private void EditProject(int projectId)
        {
            HEWDataContext context = new HEWDataContext();
            var projectObj = context.Projects.SingleOrDefault(i => i.ID == projectId);
            projectObj.Name = txtName.Text.Trim();
            projectObj.Description = txtDescription.Text.Trim();
            projectObj.IsHome = cbIsHome.Checked;
            projectObj.IsSide = cbIsSideMenu.Checked;
            projectObj.CategoryID = Int16.Parse(ddlCategories.SelectedValue);
            context.SubmitChanges();

            Response.Redirect(Request.RawUrl);
        }
Esempio n. 3
0
        public void btnRegister_Click(object sender, EventArgs e)
        {
            HEWDataContext context = new HEWDataContext();
            if (context.Newsletters.Any(i => i.Email == txtMail.Text.Trim()))
            {
                return;
            }

            Newsletter newsletter = new Newsletter{Email = txtMail.Text.Trim()};
            context.Newsletters.InsertOnSubmit(newsletter);
            context.SubmitChanges();

            txtMail.Text = string.Empty;
        }
Esempio n. 4
0
        private void AddNews()
        {
            HEWDataContext context = new HEWDataContext();
            Model.New newsObj = new Model.New();
            newsObj.Title = txtTitle.Text.Trim();
            newsObj.Body = txtBody.Text.Trim();
            newsObj.IsPublished = cbIsPublished.Checked;
            newsObj.PublishDate = Convert.ToDateTime(txtPublishDate.Text);
            newsObj.ImgPublicID = UploadImg("");
            context.News.InsertOnSubmit(newsObj);
            context.SubmitChanges();

            Response.Redirect("Default.aspx");
        }
Esempio n. 5
0
        private void AddProject()
        {
            HEWDataContext context = new HEWDataContext();
            Project projectObj = new Project();
            projectObj.Name = txtName.Text.Trim();
            projectObj.Description = txtDescription.Text.Trim();
            projectObj.IsHome = cbIsHome.Checked;
            projectObj.IsSide = cbIsSideMenu.Checked;
            projectObj.CategoryID = Int16.Parse(ddlCategories.SelectedValue);
            context.Projects.InsertOnSubmit(projectObj);
            context.SubmitChanges();

            Response.Redirect("Default.aspx");
        }
Esempio n. 6
0
        private void EditNews(int newsId)
        {
            HEWDataContext context = new HEWDataContext();
            var newsObj = context.News.SingleOrDefault(i => i.ID == newsId);
            newsObj.Title = txtTitle.Text.Trim();
            newsObj.Body = txtBody.Text.Trim();
            newsObj.IsPublished = cbIsPublished.Checked;
            newsObj.PublishDate = Convert.ToDateTime(txtPublishDate.Text);

            if (hdnImage.Value != "")
                newsObj.ImgPublicID = UploadImg("");

            context.SubmitChanges();
            Response.Redirect(Request.RawUrl);
        }
Esempio n. 7
0
        private void EditVacancy(int vacancyId)
        {
            HEWDataContext context = new HEWDataContext();
            var vacancyObj = context.Vacancies.SingleOrDefault(i => i.ID == vacancyId);
            vacancyObj.Vacancy1 = txtVacancy.Text.Trim();
            vacancyObj.Location = txtLocation.Text.Trim();
            vacancyObj.IsPublished = cbIsPublished.Checked;
            vacancyObj.OpeningDate = Convert.ToDateTime(txtOpeningDate.Text);
            vacancyObj.JobDescription = txtDescription.Text.Trim();
            vacancyObj.RequiredSkills = txtSkills.Text.Trim();
            vacancyObj.Openings = Int16.Parse(txtOpenings.Text.Trim());
            vacancyObj.CategoryID = int.Parse(ddlCategories.SelectedValue);
            context.SubmitChanges();

            Response.Redirect(Request.RawUrl);
        }
Esempio n. 8
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            LinkButton Delete = (LinkButton)sender;
            string imageID = Delete.CommandArgument;

            HEWDataContext context = new HEWDataContext();
            ProjectsImage image = context.ProjectsImages.SingleOrDefault(i=>i.ID == int.Parse(imageID));

            Account account = new Account("dlyvxs7of", "634626974285569", "FtB_0jhcmFypFS7QTwCBKcPRGzE");
            Cloudinary cloudinary = new Cloudinary(account);
            cloudinary.DeleteResources(new [] {image.ImgPublicID});

            context.ProjectsImages.DeleteOnSubmit(image);
            context.SubmitChanges();

            rptImages.DataBind();
        }
Esempio n. 9
0
        private void AddVacany()
        {
            HEWDataContext context = new HEWDataContext();
            Vacancy vacancyObj = new Vacancy();
            vacancyObj.Vacancy1 = txtVacancy.Text.Trim();
            vacancyObj.Location = txtLocation.Text.Trim();
            vacancyObj.IsPublished = cbIsPublished.Checked;
            vacancyObj.OpeningDate = Convert.ToDateTime(txtOpeningDate.Text);
            vacancyObj.JobDescription = txtDescription.Text.Trim();
            vacancyObj.RequiredSkills = txtSkills.Text.Trim();
            vacancyObj.Openings = Int16.Parse(txtOpenings.Text.Trim());
            vacancyObj.CategoryID = int.Parse(ddlCategories.SelectedValue);
            context.Vacancies.InsertOnSubmit(vacancyObj);
            context.SubmitChanges();

            Response.Redirect("Default.aspx");
        }
Esempio n. 10
0
        protected void btnDelete_Click(object sender, ImageClickEventArgs e)
        {
            ImageButton Delete = (ImageButton)sender;
            string IDVal = Delete.CommandArgument;
            int id = int.Parse(IDVal);

            HEWDataContext context = new HEWDataContext();
            Project project = context.Projects.SingleOrDefault(i => i.ID == id);
            IEnumerable<ProjectsImage> images = context.ProjectsImages.Where(i => i.ProjectID == id);

            CloudinaryDotNet.Account account = new CloudinaryDotNet.Account("dlyvxs7of", "634626974285569",
                                                                            "FtB_0jhcmFypFS7QTwCBKcPRGzE");
            CloudinaryDotNet.Cloudinary cloudinary = new CloudinaryDotNet.Cloudinary(account);
            cloudinary.DeleteResources(images.Select(i => i.ImgPublicID).ToArray());

            context.ProjectsImages.DeleteAllOnSubmit(images);
            context.Projects.DeleteOnSubmit(project);
            context.SubmitChanges();
            gvProjects.DataBind();
        }
Esempio n. 11
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            bool isInsert = false;
            HEWDataContext context = new HEWDataContext();
            var cpabilitiesObj = context.Capabilities.SingleOrDefault();
            if (cpabilitiesObj == null)
            {
                cpabilitiesObj = new Capability();
                isInsert = true;
            }
            cpabilitiesObj.CapitalDevelopment = txtCapitalDev.Text.Trim();
            cpabilitiesObj.NetAssestsDevelopment = txtAssetsDev.Text.Trim();
            cpabilitiesObj.TotalEmployees = txtStaff.Text.Trim();

            if(isInsert)
                context.Capabilities.InsertOnSubmit(cpabilitiesObj);

            context.SubmitChanges();
            Response.Redirect(Request.RawUrl);
        }
Esempio n. 12
0
        protected void UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
        {
            try
            {
                Account account = new Account("dlyvxs7of", "634626974285569", "FtB_0jhcmFypFS7QTwCBKcPRGzE");

                Cloudinary cloudinary = new Cloudinary(account);
                ImageUploadParams uploadParams = new ImageUploadParams()
                    {
                        File = new FileDescription("file", new MemoryStream(e.GetContents()))
                    };

                ImageUploadResult uploadResult = cloudinary.Upload(uploadParams);

                HEWDataContext context = new HEWDataContext();
                context.ProjectsImages.InsertOnSubmit(new ProjectsImage
                    {ImgPublicID = uploadResult.PublicId, ProjectID = int.Parse(Request.QueryString["ProjectID"])});
                context.SubmitChanges();
            }
            catch (Exception)
            {
            }
        }