Exemple #1
0
        private bool CreateEdu()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                Education_Proqrams edu = new Education_Proqrams
                {
                    Name   = EduNameTxt.Text,
                    Price  = Convert.ToDouble(EduPriceTxt.Text),
                    Status = true
                };

                db.Education_Proqrams.Add(edu);

                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        private void DgvEduCreate_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int eduID = (int)dgvEduCreate.Rows[e.RowIndex].Cells[0].Value;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                EdusCRUD = db.Education_Proqrams.Where(s => s.İd == eduID).FirstOrDefault();
                if (EdusCRUD != null)
                {
                    EduNameTxt.Text  = EdusCRUD.Name;
                    EduPriceTxt.Text = Convert.ToString(EdusCRUD.Price);
                }
            }
            EduCreateBtn.Enabled = false;
            EduDeleteBtn.Enabled = true;
            EduUpdateBtn.Enabled = true;
        }
Exemple #3
0
        private bool DeleteEdu()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                Education_Proqrams newEdu = db.Education_Proqrams.Where(s => s.İd == EdusCRUD.İd).FirstOrDefault();
                newEdu.Status = false;
                affectedRows  = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        private bool UpdateEdu()
        {
            int affectedRows = 0;

            using (AcademyEntities1 db = new AcademyEntities1())
            {
                Education_Proqrams newEdu = db.Education_Proqrams.Where(s => s.İd == EdusCRUD.İd).FirstOrDefault();

                newEdu.Name  = EduNameTxt.Text;
                newEdu.Price = Convert.ToDouble(EduPriceTxt.Text);
                affectedRows = db.SaveChanges();
            }
            if (affectedRows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }