Beispiel #1
0
        // GET: Model/Details/5
        public async Task <ActionResult> Details(string id)
        {
            List <GetBrandForm> getbrandList = await BrandController.GetBrandList();

            Model        ModelGlobal = default(Model);
            GetModelForm ModelLocal  = default(GetModelForm);

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync($"Model/Get/{id}");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;
                    ModelGlobal = JsonConvert.DeserializeObject <Model>(EmpResponse);
                    ModelLocal  = AutoMapper <Model, GetModelForm> .AutoMap(ModelGlobal);
                }
            }

            ModelLocal.BrandName = (from b in getbrandList
                                    where b.IdBrand == ModelLocal.IdBrand
                                    select b.Name).FirstOrDefault();

            return(View(ModelLocal));
        }
Beispiel #2
0
 private IEnumerable <SoinModel> GetSoinsPatient(int id)
 {
     foreach (var entity in UOW.SoinRepository.GetEntities().Where(e => e.PATIENT_ID.Equals(id)))
     {
         yield return(AutoMapper <SoinEntity, SoinModel> .AutoMap(entity));
     }
 }
Beispiel #3
0
        public static async Task <List <GetSellerForm> > GetSellerList()
        {
            //chargement de la liste des vendeurs dans une liste pour linq
            IEnumerable <Seller> sellerList        = null;
            List <GetSellerForm> getSellerformList = new List <GetSellerForm>();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync("Seller/Get");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;
                    sellerList = JsonConvert.DeserializeObject <List <Seller> >(EmpResponse);
                }

                foreach (Seller Seller in sellerList)
                {
                    getSellerformList.Add(AutoMapper <Seller, GetSellerForm> .AutoMap(Seller));
                }
            }
            return(getSellerformList);
        }
        public static async Task <List <GetHistoryForm> > GetHistoryList()
        {
            //chargement de la liste des marques dans une liste pour linq
            List <History>        HistoryList        = new List <History>();
            IEnumerable <History> histroryList       = null;
            List <GetHistoryForm> gethistoryformList = new List <GetHistoryForm>();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync("History/Get");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;
                    histroryList = JsonConvert.DeserializeObject <List <History> >(EmpResponse);
                }

                foreach (History history in histroryList)
                {
                    gethistoryformList.Add(AutoMapper <History, GetHistoryForm> .AutoMap(history));
                }
            }
            return(gethistoryformList);
        }
        // GET: Buyer
        public async Task <ActionResult> Index()
        {
            IEnumerable <Buyer> buyerList        = null;
            List <GetBuyerForm> getbuyerformList = new List <GetBuyerForm>();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync("Buyer/Get");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;
                    buyerList = JsonConvert.DeserializeObject <List <Buyer> >(EmpResponse);
                }

                foreach (Buyer buyer in buyerList)
                {
                    getbuyerformList.Add(AutoMapper <Buyer, GetBuyerForm> .AutoMap(buyer));
                }
            }
            return(View(getbuyerformList));
        }
Beispiel #6
0
        // GET: Charge/Details/5
        public async Task <ActionResult> Details(string id)
        {
            Charge        ModelGlobal = default(Charge);
            GetChargeForm ModelLocal  = default(GetChargeForm);

            List <GetProviderForm> getproviderformList = await ProviderController.GetProviderList();

            List <GetHistoryForm> gethistoryformList = await HistoryController.GetHistoryList();

            List <GetCarForm> getCarformList = await CarController.GetCarList();

            foreach (var item in gethistoryformList)
            {
                item.CarName = (from b in getCarformList
                                where b.IdCar == item.IdCar
                                select b.ChassisNumber).FirstOrDefault();

                item.CarName = item.CarName + " - " + (from b in getCarformList
                                                       where b.IdCar == item.IdCar
                                                       select b.ModelName).FirstOrDefault();
            }

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync($"Charge/Get/{id}");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;

                    ModelGlobal = JsonConvert.DeserializeObject <Charge>(EmpResponse);
                    ModelLocal  = AutoMapper <Charge, GetChargeForm> .AutoMap(ModelGlobal);
                }
            }


            ModelLocal.ProviderName = (from b in getproviderformList
                                       orderby b.Name
                                       where b.IdProvider == ModelLocal.IdProvider
                                       select b.Name).FirstOrDefault();

            ModelLocal.Carname = (from b in gethistoryformList
                                  orderby b.IdHistory
                                  where b.IdHistory == ModelLocal.IdHistory
                                  select b.CarName).FirstOrDefault();


            //ModelLocal.ProviderName = (from b in getproviderformList
            //                        orderby b.Text
            //                        where b.Value == ModelLocal.IdProvider.ToString()
            //                        select b.Text).FirstOrDefault();


            return(View(ModelLocal));
        }
// GET: History/Delete/5
public async Task <ActionResult> Delete(int id)
{
    History           ModelGlobal = default(History);
    DeleteHistoryForm ModelLocal  = default(DeleteHistoryForm);

    using (var client = new HttpClient())
    {
        client.BaseAddress = new Uri(Baseurl);
        client.DefaultRequestHeaders.Clear();
        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        HttpResponseMessage Res = await client.GetAsync($"History/Get/{id}");

        if (Res.IsSuccessStatusCode)
        {
            var EmpResponse = Res.Content.ReadAsStringAsync().Result;
            ModelGlobal = JsonConvert.DeserializeObject <History>(EmpResponse);
            ModelLocal  = AutoMapper <History, DeleteHistoryForm> .AutoMap(ModelGlobal);
        }
    }


    List <GetCarForm> getcarformList = await CarController.GetCarList();

    List <GetSellerForm> getsellerformList = await SellerController.GetSellerList();

    List <GetBuyerForm> getbuyerformList = await BuyerController.GetBuyerList();

    var data = (from b in getcarformList
                where b.IdCar == ModelLocal.IdCar
                select b.ModelName).FirstOrDefault();

    var data2 = (from b in getcarformList
                 where b.IdCar == ModelLocal.IdCar
                 select b.ChassisNumber).FirstOrDefault();

    ModelLocal.CarName = data + " - " + data2;

    data = (from b in getsellerformList
            where b.IdSeller == ModelLocal.IdSeller
            select b.Name).FirstOrDefault();

    ModelLocal.SellerName = data;

    data = (from b in getbuyerformList
            where b.IdBuyer == ModelLocal.IdBuyer
            select b.FirstName).FirstOrDefault();
    data2 = (from b in getbuyerformList
             where b.IdBuyer == ModelLocal.IdBuyer
             select b.LastName).FirstOrDefault();

    ModelLocal.BuyerName = data + ' ' + data2;

    return(View(ModelLocal));
}
Beispiel #8
0
        // GET: Charge
        public async Task <ActionResult> Index()
        {
            IEnumerable <Charge> chargeList        = null;
            List <GetChargeForm> getChargeformList = new List <GetChargeForm>();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync("Charge/Get");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;
                    chargeList = JsonConvert.DeserializeObject <List <Charge> >(EmpResponse);
                }
                foreach (Charge charge in chargeList)
                {
                    getChargeformList.Add(AutoMapper <Charge, GetChargeForm> .AutoMap(charge));
                }
            }

            List <GetProviderForm> getproviderformList = await ProviderController.GetProviderList();

            List <GetHistoryForm> gethistoryformList = await HistoryController.GetHistoryList();

            List <GetCarForm> getCarformList = await CarController.GetCarList();

            foreach (var item in gethistoryformList)
            {
                item.CarName = (from b in getCarformList
                                where b.IdCar == item.IdCar
                                select b.ChassisNumber).FirstOrDefault();

                item.CarName = item.CarName + " - " + (from b in getCarformList
                                                       where b.IdCar == item.IdCar
                                                       select b.ModelName).FirstOrDefault();
            }

            foreach (var item in getChargeformList)
            {
                item.ProviderName = (from b in getproviderformList
                                     orderby b.Name
                                     where b.IdProvider == item.IdProvider
                                     select b.Name).FirstOrDefault();

                item.Carname = (from b in gethistoryformList
                                orderby b.IdHistory
                                where b.IdHistory == item.IdHistory
                                select b.CarName).FirstOrDefault();
            }
            return(View(getChargeformList));
        }
Beispiel #9
0
        public ActionResult Index(string sortOrder, string currentFilter, string searchString, int?page)
        {
            ViewBag.CurrentSort  = sortOrder;
            ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
            ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date";

            if (searchString != null)
            {
                page = 1;
            }
            else
            {
                searchString = currentFilter;
            }

            ViewBag.CurrentFilter = searchString;

            List <PatientModel> models = new List <PatientModel>();

            foreach (var entity in UOW.PatientRepository.GetEntities().Where(e => e.STATUTENREGISTREMENT))
            {
                models.Add(AutoMapper <PatientEntity, PatientModel> .AutoMap(entity));
            }

            if (!String.IsNullOrEmpty(searchString))
            {
                models = models.Where(s => s.PRENOM.ToLower().Contains(searchString.ToLower()) ||
                                      s.NOM_FAMILLE.ToLower().Contains(searchString.ToLower())).ToList();
            }
            switch (sortOrder)
            {
            case "name_desc":
                models = models.OrderByDescending(s => s.NOM_FAMILLE).ToList();
                break;

            case "Date":
                models = models.OrderBy(s => s.DATE_NAISSANCE).ToList();
                break;

            case "date_desc":
                models = models.OrderByDescending(s => s.DATE_NAISSANCE).ToList();
                break;

            default:
                models = models.OrderBy(s => s.NOM_FAMILLE).ToList();
                break;
            }

            int pageSize   = PAGE_SIZE;
            int pageNumber = (page ?? 1);

            return(View(models.ToPagedList(pageNumber, pageSize)));
        }
 public ActionResult Create(SoinModel model)
 {
     try
     {
         UOW.SoinRepository.AddEntity(AutoMapper <SoinModel, SoinEntity> .AutoMap(model));
         return(RedirectToAction("Details", "Patient", new { @id = model.PATIENT_ID }));
     }
     catch (Exception ex)
     {
         return(View());
     }
 }
Beispiel #11
0
        private PatientViewModel MapPatient(int id)
        {
            PatientViewModel viewModel = new PatientViewModel();

            viewModel.patient = AutoMapper <PatientEntity, PatientModel> .AutoMap(UOW.PatientRepository.GetEntity(id));

            viewModel.etatSante = AutoMapper <EtatSanteEntity, EtatSanteModel> .AutoMap(UOW.EtatSanteRepository.GetEntities()
                                                                                        .FirstOrDefault(e => e.ID.Equals(viewModel.patient.ETAT_SANTE_ID)));

            viewModel.soins = GetSoinsPatient(id);

            return(viewModel);
        }
Beispiel #12
0
        public ActionResult Create(PatientViewModel viewModel)
        {
            try
            {
                viewModel.patient.ETAT_SANTE_ID        = UOW.EtatSanteRepository.AddEntity(AutoMapper <EtatSanteModel, EtatSanteEntity> .AutoMap(viewModel.etatSante));
                viewModel.patient.STATUTENREGISTREMENT = true;

                UOW.PatientRepository.AddEntity(AutoMapper <PatientModel, PatientEntity> .AutoMap(viewModel.patient));

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                return(View());
            }
        }
        public static async Task <List <GetCarForm> > GetCarList()
        {
            //chargement de la liste des voitures dans une liste pour linq
            IEnumerable <Car> CarList        = null;
            List <GetCarForm> getcarformList = new List <GetCarForm>();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync("Car/Get");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;
                    CarList = JsonConvert.DeserializeObject <List <Car> >(EmpResponse);
                }

                foreach (Car car in CarList)
                {
                    getcarformList.Add(AutoMapper <Car, GetCarForm> .AutoMap(car));
                }
            }
            List <GetModelForm> getmodelformList = await ModelController.GetModelList();

            List <GetBrandForm> getBrandformList = await BrandController.GetBrandList();

            foreach (var item in getmodelformList)
            {
                var data = (from b in getBrandformList
                            where b.IdBrand == item.IdBrand
                            select b.Name).FirstOrDefault();
                item.Name = data + " - " + item.Name;
            }

            foreach (var item in getcarformList)
            {
                var data = (from b in getmodelformList
                            where b.IdModel == item.IdModel
                            select b.Name).FirstOrDefault();

                item.ModelName = data;
            }

            return(getcarformList);
        }
        // GET: Equipement/Details/5
        public async Task <ActionResult> Details(int id)
        {
            InstalledEquipement        ModelGlobal = default(InstalledEquipement);
            GetInstalledEquipementForm ModelLocal  = default(GetInstalledEquipementForm);

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync($"InstalledEquipment/Get/{id}");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;
                    ModelGlobal = JsonConvert.DeserializeObject <InstalledEquipement>(EmpResponse);
                    ModelLocal  = AutoMapper <InstalledEquipement, GetInstalledEquipementForm> .AutoMap(ModelGlobal);
                }
            }
            return(View(ModelLocal));
        }
Beispiel #15
0
        public ActionResult Edit(PatientViewModel viewModel)
        {
            try
            {
                EtatSanteEntity etatSante = AutoMapper <EtatSanteModel, EtatSanteEntity> .AutoMap(viewModel.etatSante);

                PatientEntity patient = AutoMapper <PatientModel, PatientEntity> .AutoMap(viewModel.patient);

                patient.ETAT_SANTE_ID        = etatSante.ID;
                patient.STATUTENREGISTREMENT = true;

                bool ok1 = UOW.EtatSanteRepository.UpdateEntity(etatSante);
                bool ok2 = UOW.PatientRepository.UpdateEntity(patient);

                return(RedirectToAction("Details", new { id = viewModel.patient.ID }));
            }
            catch
            {
                return(View());
            }
        }
        public async Task <EditHistoryForm> GetDetails(string id)
        {
            History         ModelGlobal = default(History);
            EditHistoryForm ModelLocal  = default(EditHistoryForm);

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync($"History/Get/{id}");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;
                    ModelGlobal = JsonConvert.DeserializeObject <History>(EmpResponse);
                    ModelLocal  = AutoMapper <History, EditHistoryForm> .AutoMap(ModelGlobal);
                }
            }
            return(ModelLocal);
        }
        public async Task <ActionResult> Login([Bind] LoginForm formulaire)
        {
            Login     ModelGlobal = default(Login);
            LoginForm ModelLocal  = default(LoginForm);

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync($"Login/CheckLogin/{formulaire.Email},{formulaire.Passwd}");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;
                    ModelGlobal = JsonConvert.DeserializeObject <Login>(EmpResponse);
                    ModelLocal  = AutoMapper <Login, LoginForm> .AutoMap(ModelGlobal);
                }
            }
            if (ModelLocal.Authentified == true)
            {
                //Session["users"] = formulaire.Email;
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(View(ModelLocal));
            }
            //return View(ModelLocal);

            //if (Lf.CheckLogin(formulaire.Email,formulaire.Passwd) )
            //{
            //    Session["users"] = formulaire.Email;
            //    return RedirectToAction("Home", "Index");

            //}
            // return View(formulaire);
        }
        // GET: History
        public async Task <ActionResult> Index()
        {
            IEnumerable <History> historyList        = null;
            List <GetHistoryForm> getHistoryformList = new List <GetHistoryForm>();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Baseurl);
                client.DefaultRequestHeaders.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage Res = await client.GetAsync("History/Get");

                if (Res.IsSuccessStatusCode)
                {
                    var EmpResponse = Res.Content.ReadAsStringAsync().Result;
                    historyList = JsonConvert.DeserializeObject <List <History> >(EmpResponse);
                }
                foreach (History History in historyList)
                {
                    getHistoryformList.Add(AutoMapper <History, GetHistoryForm> .AutoMap(History));
                }
            }

            List <GetCarForm> getcarformList = await CarController.GetCarList();

            List <GetSellerForm> getsellerformList = await SellerController.GetSellerList();

            List <GetBuyerForm> getbuyerformList = await BuyerController.GetBuyerList();


            foreach (var item in getHistoryformList)
            {
                var data = (from b in getcarformList
                            where b.IdCar == item.IdCar
                            select b.ModelName).FirstOrDefault();

                var data2 = (from b in getcarformList
                             where b.IdCar == item.IdCar
                             select b.ChassisNumber).FirstOrDefault();

                item.CarName = data + " - " + data2;
            }

            foreach (var item in getHistoryformList)
            {
                var data = (from b in getsellerformList
                            where b.IdSeller == item.IdSeller
                            select b.Name).FirstOrDefault();

                item.SellerName = data;
            }

            foreach (var item in getHistoryformList)
            {
                var data1 = (from b in getbuyerformList
                             where b.IdBuyer == item.IdBuyer
                             select b.FirstName).FirstOrDefault();
                var data2 = (from b in getbuyerformList
                             where b.IdBuyer == item.IdBuyer
                             select b.LastName).FirstOrDefault();

                item.BuyerName = data1 + ' ' + data2;
            }



            return(View(getHistoryformList));
        }
Beispiel #19
0
// GET: Charge/Delete/5
public async Task <ActionResult> Delete(int id)
{
    Charge           ModelGlobal = default(Charge);
    DeleteChargeForm ModelLocal  = default(DeleteChargeForm);

    using (var client = new HttpClient())
    {
        client.BaseAddress = new Uri(Baseurl);
        client.DefaultRequestHeaders.Clear();
        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        HttpResponseMessage Res = await client.GetAsync($"Charge/Get/{id}");

        if (Res.IsSuccessStatusCode)
        {
            var EmpResponse = Res.Content.ReadAsStringAsync().Result;
            ModelGlobal = JsonConvert.DeserializeObject <Charge>(EmpResponse);
            ModelLocal  = AutoMapper <Charge, DeleteChargeForm> .AutoMap(ModelGlobal);
        }
    }

    List <GetCarForm> carList = await CarController.GetCarList();

    List <SelectListItem> getcarformList = new List <SelectListItem>();

    foreach (GetCarForm Car in carList)
    {
        getcarformList.Add(new SelectListItem {
                    Text = Car.ChassisNumber + " - " + Car.ModelName, Value = Car.IdCar.ToString()
                }
                           );
    }

    List <GetProviderForm> providerList = await ProviderController.GetProviderList();

    List <SelectListItem> getproviderformList = new List <SelectListItem>();

    foreach (GetProviderForm Provider in providerList)
    {
        getproviderformList.Add(new SelectListItem {
                    Text = Provider.Name, Value = Provider.IdProvider.ToString()
                });
    }

    List <GetHistoryForm> historyList = await HistoryController.GetHistoryList();

    List <SelectListItem> gethistoryformList = new List <SelectListItem>();

    foreach (GetHistoryForm History in historyList)
    {
        var data = (from b in carList
                    where b.IdCar == History.IdCar
                    select b.ChassisNumber).FirstOrDefault();
        var data2 = (from b in carList
                     where b.IdCar == History.IdCar
                     select b.ModelName).FirstOrDefault();

        gethistoryformList.Add(new SelectListItem
                {
                    Selected = (History.IdHistory == ModelLocal.IdHistory),
                    Text     = data + " - " + data2,
                    Value    = History.IdHistory.ToString()
                });
    }



    ModelLocal.HistoryName = (from b in gethistoryformList
                              where b.Value == ModelLocal.IdHistory.ToString()
                              select b.Text).FirstOrDefault();

    ModelLocal.ProviderName = (from b in getproviderformList
                               where b.Value == ModelLocal.IdProvider.ToString()
                               select b.Text).FirstOrDefault();

    return(View(ModelLocal));
}