Beispiel #1
0
 private void ChooseStudent_Activated(object sender, EventArgs e)
 {
     using (StudyContext db = new StudyContext())
     {
         List <Student> students = db.Students.ToList();
         comboBox1.DataSource    = students;
         comboBox1.ValueMember   = "Id";
         comboBox1.DisplayMember = "Surname";
     }
 }
Beispiel #2
0
 private void TeachSalary_Activated(object sender, EventArgs e)
 {
     using (StudyContext db = new StudyContext())
     {
         int    minSalary = db.Teachers.Min(t => t.Salary);
         int    maxSalary = db.Teachers.Max(t => t.Salary);
         int    sumSalary = db.Teachers.Sum(t => t.Salary);
         double avgSalary = db.Teachers.Average(t => t.Salary);
         richTextBox1.Text += "Минимальная зарплата: " + minSalary + Environment.NewLine + "Максимальная зарплата: " +
                              maxSalary + Environment.NewLine + "Средняя зарплата: " + avgSalary + Environment.NewLine + "Общая зарплата: " + sumSalary;
     }
 }
Beispiel #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     richTextBox1.Text = "";
     if (comboBox1.Text == "")
     {
         richTextBox1.Text = "Не получено данных";
     }
     else
     {
         using (StudyContext db = new StudyContext())
         {
             var marks = db.Marks.Where(m => m.Student.Surname == comboBox1.Text);
             foreach (Mark m in marks)
             {
                 richTextBox1.Text += m.Subject.ToString() + " " + m.Smark + Environment.NewLine;
             }
         }
         if (richTextBox1.Text == "")
         {
             richTextBox1.Text = "У этого студента пока нету оценок";
         }
     }
 }
Beispiel #4
0
        public ApiResult <T> Run()
        {
            var result = new ApiResult <T> {
                ResultStatus = ResultStatus.Successful
            };


            try
            {
                using (var scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    var context = new StudyContext();
                    Do(context, result);
                    scope.Complete();
                }
            }
            catch (Exception)
            {
                result.Messages.Clear();
                result.ResultStatus = ResultStatus.Thrown;
            }

            return(result);
        }
Beispiel #5
0
 public StudentDecorator(StudyContext database)
 {
     Database = database;
 }
Beispiel #6
0
 public CustomerRepository(StudyContext studyContext) : base(studyContext)
 {
 }
 public Repository(StudyContext context) => _context = context;
 public ChatsController(StudyContext context)
 {
     _context = context;
 }
 public GroupDecorator(StudyContext database)
 {
     Database = database;
 }
Beispiel #10
0
 public GradeController(StudyContext context)
 {
     this.context = context;
 }
Beispiel #11
0
 public ReportManager(StudyContext context, IMapper mapper)
 {
     _context = context;
     _mapper  = mapper;
 }
Beispiel #12
0
 public Repository(StudyContext context)
 {
     _context = context;
     _dbSet   = _context.Set <TEntity>();
 }
Beispiel #13
0
 public StudentRepository(StudyContext dbContext) : base(dbContext)
 {
 }
Beispiel #14
0
 public DatabaseController(StudyContext context)
 {
     this.context = context;
 }
Beispiel #15
0
 public ContatoRepository(StudyContext contexto)
 {
     _contexto = contexto;
 }
 public StudyYearController(StudyContext context)
 {
     this.context = context;
 }
Beispiel #17
0
 public UnitOfWork(StudyContext context)
 {
     _context     = context;
     _transaction = context.Database.BeginTransaction();
 }
Beispiel #18
0
 public AssignmentController(StudyContext context)
 {
     this.context = context;
 }
Beispiel #19
0
 public TeachFrm()
 {
     InitializeComponent();
     db = new StudyContext();
 }
Beispiel #20
0
 public OrderRepository(StudyContext context)
     : base(context)
 {
 }
Beispiel #21
0
 public StudentRepository(StudyContext context) : base(context)
 {
 }
Beispiel #22
0
 public SubjFrm()
 {
     InitializeComponent();
     db = new StudyContext();
 }
Beispiel #23
0
 public Repository(StudyContext dbContext)
 {
     _dbContext = dbContext;
 }
 // A constructor is necessary in order to get the context ready
 public StudentController(StudyContext context)
 {
     this.context = context;
 }
Beispiel #25
0
 public Repository(StudyContext studyContext)
 {
     _db   = studyContext;
     DbSet = _db.Set <Tentity>();
 }
Beispiel #26
0
 public Repository(StudyContext context)
 {
     Db    = context;
     DbSet = Db.Set <TEntity>();
 }
Beispiel #27
0
 public UnitOfWork(StudyContext studyContext)
 {
     _studyContext = studyContext;
 }
Beispiel #28
0
 //构造函数注入
 public UnitOfWork(StudyContext context)
 {
     _context = context;
 }
Beispiel #29
0
 public Repository(StudyContext dbContext)
 {
     this._dbContext = dbContext;
     _dbSet          = _dbContext.Set <TEntity>();
 }