示例#1
0
        public virtual void Update()
        {
            IRepository <Call> repo = new CallRepository();

            this.updated_at = DateTime.Now;
            repo.Update(this);
        }
示例#2
0
        public Call Add(Call call)
        {
            var repo = new CallRepository(_connectionString);

            repo.Add(call);
            return(call);
        }
示例#3
0
    public UnitOfWork(string connectionString)
    {
        _context = new DataContext(new SqlConnection());

        using (new Impersonation("domain", "user", "password"))
            _context.Connection.ConnectionString = connectionString;

        Orders   = new OrderRepository(_context);
        OutCalls = new CallRepository(_context);
        Login    = new LoginRepository(_context);
    }
        public void CreateAdd()
        {
            var patient  = new Patient("Ivan", "Ivanov", "KI55000", "+375152996");
            var patient1 = new Patient("Petr", "Sergeev", "KH1234311", "+375291545");

            var doctor = new Doctor("Platon", "Sidorov", "Therapist");

            var car = new MedicalCar("Mercedes Benz Sprinter 412", "12.05.2009", "VBGTF48483D6");

            var call  = new Call(new DateTime(2015, 3, 15));
            var call1 = new Call(new DateTime(2015, 3, 16));

            var waybill = new Waybill(new DateTime(2015, 3, 16));

            doctor.Patients.Add(patient);
            doctor.Patients.Add(patient1);
            doctor.Car.Add(car);

            car.Doctors.Add(doctor);
            car.Waybills.Add(waybill);

            call.Patient.Add(patient);
            call.Waybill = waybill;

            call1.Patient.Add(patient1);
            call1.Waybill = waybill;

            waybill.Car = car;
            waybill.Calls.Add(call);
            waybill.Calls.Add(call1);

            patient.Call   = call;
            patient.Doctor = doctor;

            patient1.Call   = call1;
            patient1.Doctor = doctor;

            using (var context = new DataContext())
            {
                context.Database.CreateIfNotExists();

                // context.Database.Delete();
                BaseRepository <Call>       calls       = new CallRepository(context);
                BaseRepository <Doctor>     doctors     = new DoctorRepository(context);
                BaseRepository <MedicalCar> medicalCars = new MedicalCarRepository(context);
                BaseRepository <Patient>    patients    = new PatientRepository(context);
                BaseRepository <Waybill>    waybills    = new WaybillRepository(context);

                patients.Add(patient1);
                patients.Save();
            }
        }
示例#5
0
        public UnitOfWork()
        {
            _context = new TContext();

            Customer = new CustomerRepository(_context);
            Line     = new LineRepository(_context);
            Sms      = new SmsRepository(_context);
            Call     = new CallRepository(_context);
            Payment  = new PaymentRepository(_context);
            Package  = new PackageRepository(_context);
            Friends  = new FriendsRepository(_context);
            Employee = new EmployeeRepository(_context);
        }
示例#6
0
        static void ShowAllCalls()
        {
            string connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;

            var callRepository = new CallRepository(connectionString);
            var calls          = callRepository.GetAll();

            var callsDescId = calls.OrderByDescending(c => c.Id);

            foreach (var c in callsDescId)
            {
                Console.WriteLine($"Id: {c.Id}\tUserName: {c.UserName}\tIDepartment: {c.DepartmentName}" +
                                  $"\tOperatorName: {c.OperatorName}\tState: {c.State}");
            }
        }
示例#7
0
        static void Main(string[] args)
        {
            string         connectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString;
            CallRepository callRepository   = new CallRepository(connectionString);

            IList <IOperator> operators = new List <IOperator>
            {
                new Operator("Liza", callRepository),
                new Operator("Homer", callRepository),
                new Operator("Bart", callRepository)
            };

            Dictionary <DepartmentType, IDepartment> departments =
                new Dictionary <DepartmentType, IDepartment>();

            var fire    = new FireDepartment();
            var police  = new PoliceDepartment();
            var medical = new MedicalDepartment();

            departments.Add(DepartmentType.Fire, fire);
            departments.Add(DepartmentType.Police, police);
            departments.Add(DepartmentType.Medical, medical);

            var emergencyService = new EmergencyService(operators, departments);

            var users = CreateUsers(40, emergencyService);

            MakeRandomCall(users);

            while (true)
            {
                Thread.Sleep(3000);
                Console.Clear();

                var calls = callRepository.GetAll();

                foreach (var c in calls)
                {
                    Console.WriteLine($"Id: {c.Id}\tUserName: {c.UserName}\tIDepartment: {c.DepartmentName}" +
                                      $"\tOperatorName: {c.OperatorName}\tState: {c.State}");
                }
            }
        }
示例#8
0
 public MainRepository(AppContext context)
 {
     _context = context;
     Calls = new CallRepository(_context);
     Users = new UserRepository(_context);
     Locations = new LocationRepository(_context);
     Groups = new GroupRepository(_context);
     Operations = new OperationRepository(_context);
     Roles = new RoleRepository(_context);
     Debits = new DebitRepository(_context);
     PenaltyTypes = new PenaltyTypeRepository(_context);
     Employees = new EmployeeRepository(_context);
     Extras = new ExtraRepository(_context);
     PayRolls = new PayRollRepository(_context);
     Salaries = new SalaryRepository(_context);
     DebitTypes = new DebitTypeRepository(_context);
     Penalties = new PenaltyRepository(_context);
     DebitPayments = new DebitPaymentRepository(_context);
     Administrators = new AdministratorRepository(_context);
     Savings = new SavingRepository(_context);
     Vacations = new VacationRepository(_context);
     RoleOperations = new RoleOperationRepository(_context);
 }
示例#9
0
 public CallService(DataContext context, IMapper mapper)
 {
     this._callRepository = new CallRepository(context);
     this._mapper         = mapper;
 }
示例#10
0
        public virtual void Delete()
        {
            IRepository <Call> repo = new CallRepository();

            repo.Delete(this);
        }
示例#11
0
        public static List <Call> GetAll()
        {
            IRepository <Call> repo = new CallRepository();

            return((List <Call>)(repo.GetAll()));
        }
示例#12
0
        public void Update(Call call)
        {
            var repo = new CallRepository(_connectionString);

            repo.Update(call);
        }
示例#13
0
        public Call GetById(int id)
        {
            var repo = new CallRepository(_connectionString);

            return(repo.GetById(id));
        }
示例#14
0
        public void DeleteMany(DeleteViewModel dvm)
        {
            var repo = new CallRepository(_connectionString);

            repo.DeleteMany(dvm.CallIds);
        }
示例#15
0
        public IEnumerable <Call> GetCalls()
        {
            var repo = new CallRepository(_connectionString);

            return(repo.GetCalls());
        }
示例#16
0
 public CallService()
 {
     callRepo = new CallRepository(AppSetting.SQL_DIAD);
 }