public HttpResponseMessage PostAddImageManager(int id)
        {
            String filename            = "";
            HttpResponseMessage result = null;
            var httpRequest            = HttpContext.Current.Request;

            if (httpRequest.Files.Count > 0)
            {
                var docfiles = new List <string>();
                for (int i = 0; i < httpRequest.Files.Count; i++)
                {
                    var postedFile = httpRequest.Files[i];

                    var filePath = HttpContext.Current.Server.MapPath("~/content/image/" + postedFile.FileName);
                    filename += postedFile.FileName;
                    postedFile.SaveAs(filePath);

                    docfiles.Add(filePath);
                }
                Manager manager = mrepo.Get(id);
                manager.ImageFIle = filename;
                mrepo.Update(manager);
                result = Request.CreateResponse(HttpStatusCode.Created, manager);
            }

            return(result);
        }
        public ManagerView Get(int?id)
        {
            using var managerRepository = new ManagerRepository();
            var manager = managerRepository.Get(id);

            return(_mapper.Map <ManagerView>(manager));
        }
        public void DataFromFileToDb(string filePath)
        {
            using var dbContext = new AppDbContext();
            using IRepository <Client> clientRepository   = new ClientRepository(dbContext, SyncObjContainer.ClientsLocker);
            using IRepository <Manager> managerRepository = new ManagerRepository(dbContext, SyncObjContainer.ManagersLocker);
            using IRepository <Product> productRepository = new ProductRepository(dbContext, SyncObjContainer.ProductsLocker);
            ISalesRepository salesRepository = new SalesRepository(dbContext, SyncObjContainer.SalesLocker);
            var csvDataContainer             = CsvParcer.GetDataFromCsv(filePath);
            var manager = managerRepository.Get(CsvParcer.GetManagerSurname(filePath));
            var sales   = new List <Sales>();

            foreach (var item in csvDataContainer)
            {
                var sale = new Sales()
                {
                    Product  = productRepository.Get(item.Product),
                    Client   = clientRepository.Get(item.Client),
                    Manager  = manager,
                    SaleCost = item.SaleSum,
                    SaleDate = item.SaleDate
                };
                sales.Add(sale);
            }
            salesRepository.AddSales(sales);
        }
Exemple #4
0
        public async Task <string> login(string user_name, string password, string code, string returnUrl)
        {
            ManagerRepository dal = new ManagerRepository();
            var model             = dal.Get(m => m.UserName == user_name && m.Password == password && m.Status == 1);

            return("777");
        }
Exemple #5
0
        static void Main(string[] args)
        {
            for (int i = 0; i < 100000; i++)
            {
                ManagerRepository dal = new ManagerRepository();
                var model             = dal.Get(m => m.UserName == "111222" && m.Password == "111222" && m.Status == 1);
            }

            Console.Read();
        }
Exemple #6
0
        public ManagerDTO GetManager(int id)
        {
            var manager = _managerRepository.Get(id);

            if (manager == null)
            {
                throw new Exception("Manager not found.");
            }

            return(new ManagerDTO {
                Id = manager.Id, SecondName = manager.SecondName
            });
        }
        internal Report Add(int id, string text)
        {
            Manager manager = _managerRepository.Get(id);

            if (manager != null)
            {
                Report report = new Report();
                report.DateCreated = DateTime.Now;
                report.Text        = text;
                manager.Report.Add(report.Id);
                _managerRepository.Update(manager);
                return(Add(report));
            }
            return(null);
        }
Exemple #8
0
        private void managerRepositoryTest()
        {
            var     _managerRepository = new ManagerRepository();
            Manager manager            = new Manager();

            manager.Name    = "Nolo";
            manager.Surname = "Djokovic";
            manager.Email   = "*****@*****.**";
            var a = _managerRepository.Add(manager);
            var b = _managerRepository.Add(manager);

            var man = _managerRepository.Get();

            man.Name = "Novak";

            man = _managerRepository.Update(man);
        }
        internal Employee FindByEmail(string email)
        {
            Employee employee = (Employee)_managerRepository.Get();

            if (employee != null && employee.Email.Equals(email))
            {
                return(employee);
            }

            employee = (Employee)_secretaryRepository.Get();
            if (employee != null && employee.Email.Equals(email))
            {
                return(employee);
            }

            return((Employee)_doctorService.FindByEmail(email));
        }
 public ActionResult ManagerProfile()
 {
     return(View(managerRepository.Get((int)Session["managerLoginID"])));
 }