public void CatalogViewAction(string catalogName) { Catalog currentCatalog = ModelStorage.GetBookStorage(catalogName); if (currentCatalog.GetBooks().Count == 0) { _view.Show(new string[] { "This catalog doesn't have any books.", "Press 'Enter' to return" }); Console.ReadLine(); Route nextController = _routes.FirstOrDefault(b => b.Id == "index"); redirect(nextController.Action, nextController.Controller, null); } else { _view.Show("Catalog have following books:"); foreach (IBook book in currentCatalog.GetBooks()) { _view.Show(book.Name); } _view.Show(new string[] { "Type name of the book, to collect it into tablestand", "Type 'menu' to return to the menu" }); string bookName = Console.ReadLine(); Book removeBook = currentCatalog.GetByName(bookName); TableStand wastepaper = ModelStorage.GetTablestand(); _view.Show(wastepaper.AddBook(removeBook)); currentCatalog.DeleteBook(removeBook); _view.Show("Press 'Enter' to return"); Console.ReadLine(); Route nextController = _routes.FirstOrDefault(b => b.Id == "index"); redirect(nextController.Action, nextController.Controller, null); } }
public void ViewCatalogsAction() { _view.Show("Following catalogs was been created:"); IList <Catalog> catalogs = ModelStorage.GetCatalogs(); if (catalogs.Count != 0) { string[] viewString = new string[catalogs.Count]; string[] catalogsName = new string[catalogs.Count]; int lines = 0; foreach (Catalog catalog in catalogs) { viewString[lines] = lines.ToString() + ". " + catalog.Name; catalogsName[lines] = catalog.Name; lines++; } _view.Show("Choose following catalogs"); _view.Show(viewString); string chooseCatalog = Console.ReadLine(); Route nextController = _routes.FirstOrDefault(b => b.Id == "5"); redirect(nextController.Action, nextController.Controller, new object[] { catalogsName[Int32.Parse(chooseCatalog)] }); } else { _view.Show(new string[] { "Catalogs doesnt exists", "Press 'Enter' to return" }); Console.ReadLine(); Route nextController = _routes.FirstOrDefault(b => b.Id == "back"); redirect(nextController.Action, nextController.Controller, null); } }
public ActionResult ShowAddress(long root, Address address, bool isCountryFieldVisible = false, bool needFillRegionOnCountryChanged = true) { ViewBag.IsCountryFieldVisible = isCountryFieldVisible; address.blnReadOnlyRegion = !needFillRegionOnCountryChanged; ModelStorage.Put(Session.SessionID, root, address.idfGeoLocation, null, address); return(PartialView(address)); }
public Action(ModelStorage db, ModelListener lis, ModelFactory f) { storage = db; listener = lis; factory = f; Actions = new LinkedList <Transactional>(); }
public RailLine(ModelStorage db, ModelListener lis) { storage = db; listener = lis; storage.Add(this); listener.Fire(EventType.CREATED, this); }
public ActionResult ContactDetails(long rootKey, long contactedCasePersonId, bool getFromSession = true) { HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null); ViewBag.CanUpdate = humanCaseAccessor.CanUpdate; ViewBag.RootKey = rootKey; if (getFromSession) { var contactedCasePerson = (ContactedCasePerson)ModelStorage.Get(Session.SessionID, contactedCasePersonId, null); return(View(contactedCasePerson)); } var humanCase = (HumanCase)ModelStorage.GetRoot(Session.SessionID, rootKey, null); EditableList <ContactedCasePerson> list = humanCase.ContactedPerson; var root = (long)((HumanCase)ModelStorage.GetRoot(Session.SessionID, rootKey, null)).Key; ContactedCasePerson item; if (contactedCasePersonId == 0) { using (DbManagerProxy manager = DbManagerFactory.Factory.Create(ModelUserContext.Instance)) { var accessor = ContactedCasePerson.Accessor.Instance(null); item = accessor.Create(manager, humanCase, rootKey); item.NewObject = true; ModelStorage.Put(Session.SessionID, root, item.idfContactedCasePerson, null, item); return(View(item)); } } item = list.SingleOrDefault(c => c.idfContactedCasePerson == contactedCasePersonId); ModelStorage.Put(Session.SessionID, root, item.idfContactedCasePerson, null, item); return(View(item)); }
public ActionResult SetSelectedFarm(string root, string selectedId) { long key = long.Parse(root); long rootKey = (long)((IObject)ModelStorage.GetRoot(Session.SessionID, key, null)).Key; var vetCase = ModelStorage.Get(Session.SessionID, rootKey, null) as VetCase; using (DbManagerProxy manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance)) { var cloneVetCase = (VetCase)vetCase.CloneWithSetup(manager, true); long idfFarm = string.IsNullOrEmpty(selectedId) ? 0 : long.Parse(selectedId); if (idfFarm == 0) { var accessor = FarmPanel.Accessor.Instance(null); vetCase.Farm = accessor.CreateByCase(manager, vetCase, vetCase); } else { vetCase.Farm.idfRootFarm = idfFarm; } CompareModel data = vetCase.Compare(cloneVetCase); return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = data }); } }
public ActionResult SaveLocationOfExposure(FormCollection form) { long key = long.Parse(Session["IdfCase"].ToString()); var humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, key, null); Int64 originalIdfGeoLocation = humanCase.PointGeoLocation.idfGeoLocation; var originalGeoLocation = (GeoLocation)ModelStorage.Get(Session.SessionID, originalIdfGeoLocation, null); Int64 cloneIdfGeoLocation = originalIdfGeoLocation + 1; var cloneGeoLocation = (GeoLocation)ModelStorage.Get(Session.SessionID, cloneIdfGeoLocation, null); var data = new CompareModel(); ValidateGeoLocation(originalGeoLocation, cloneGeoLocation, form); if (m_Validation != null) { string errorMessage = Translator.GetErrorMessage(m_Validation); data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false); } else { using (GeoLocation tempGeoLocation = originalGeoLocation.CloneWithSetup()) { ModifyOriginalGeoLocation(originalGeoLocation, cloneGeoLocation, form); ModelStorage.Remove(Session.SessionID, cloneIdfGeoLocation, null); data = originalGeoLocation.Compare(tempGeoLocation); } } return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = data }); }
public ActionResult SectionTemplateTableNodeRender(string idfsSection, long key, string ffpresenterId) { var ff = ModelStorage.Get(Session.SessionID, key, ffpresenterId) as FFPresenterModel; var flexNode = ff != null?ff.TemplateFlexNode.FindChildNodeSection(Convert.ToInt64(idfsSection)) : null; return(PartialView("SectionTemplateTableRender", flexNode)); }
public ActionResult Notification(long id, bool getFromSession = true) { HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null); ViewBag.CanUpdate = humanCaseAccessor.CanUpdate; if (getFromSession) { var humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, id, null); Session["IdfCase"] = humanCase.idfCase; return(View(humanCase)); } using (DbManagerProxy manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance)) { var acc = HumanCase.Accessor.Instance(null); var humanCase = id.Equals(0) ? acc.CreateNewT(manager, null) : acc.SelectByKey(manager, id); //TODO extender helper для проверки if (id.Equals(0)) { humanCase.datNotificationDate = humanCase.datEnteredDate; humanCase.RegistrationAddress.Country = null; } ModelStorage.Put(Session.SessionID, humanCase.idfCase, humanCase.idfCase, null, humanCase); ModelStorage.Put(Session.SessionID, humanCase.idfCase, humanCase.Patient.idfHuman, null, humanCase.Patient); Session["IdfCase"] = humanCase.idfCase; return(View(humanCase)); } }
public void ViewCatalogAction(string catalogName) { _view.Show("Current catalog: " + catalogName); Catalog currentCatalog = ModelStorage.GetBookStorage(catalogName); if (currentCatalog.GetBooks().Count == 0) { _view.Show("Catalog doesnt have any books"); } else { _view.Show("Catalog have following books:"); foreach (IBook book in currentCatalog.GetBooks()) { _view.Show(book.Name); } } _view.Show(new string[] { "Type book name to show the info", "Type 'add' for adding book into catalog" }); string command = Console.ReadLine(); if (command == "add") { Route nextController = _routes.FirstOrDefault(b => b.Id == "add"); redirect(nextController.Action, nextController.Controller, new object[] { currentCatalog }); } else { Route nextController = _routes.FirstOrDefault(b => b.Id == "book"); redirect(nextController.Action, nextController.Controller, new object[] { command, currentCatalog }); } }
public DeptTask(ModelStorage db, ModelListener lis, RailLine l, Platform p, LineTask lt) : base(db, lis, l, lt) { Stay = p; Stay.Depts.AddLast(this); db.Add(this); Queue = new LinkedList <Human>(); router = new RouterImpl(this); listener.Fire(EventType.CREATED, this); }
public ActionResult Investigation(long id) { HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null); ViewBag.CanUpdate = humanCaseAccessor.CanUpdate; var humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, id, null); Session["IdfCase"] = humanCase.idfCase; return(View(humanCase)); }
public ActionResult Details(FormCollection form) { string errorMessage; form.AllKeys.ToList().ForEach(k => form[k] = EidssWebHelper.UnescapeHtml(form[k])); bool isDatesValid = DateTimeHelper.TryParseCustomDates(form, out errorMessage) && DateTimeHelper.TryParseMobileSafariDates(form, out errorMessage); var data = new CompareModel(); if (!isDatesValid) { data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false); return(new JsonResult { Data = data, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } long key = long.Parse(Session["IdfCase"].ToString()); var humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, key, null); var cloneHumanCase = (HumanCase)humanCase.Clone(); m_Validation = null; humanCase.Validation += hc_ValidationDetails; humanCase.ParseFormCollection(form); if (m_Validation != null) { humanCase.Validation -= hc_ValidationDetails; errorMessage = Translator.GetErrorMessage(m_Validation); data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false); return(new JsonResult { Data = data, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); } using (DbManagerProxy manager = DbManagerFactory.Factory.Create(EidssUserContext.Instance)) { HumanCase.Accessor acc = HumanCase.Accessor.Instance(null); acc.Validate(manager, humanCase, true, true, true); if (m_Validation == null) { acc.Post(manager, humanCase); } } humanCase.Validation -= hc_ValidationDetails; if (m_Validation != null) { errorMessage = Translator.GetErrorMessage(m_Validation); data.Add("ErrorMessage", "ErrorMessage", "ErrorMessage", errorMessage, false, false, false); } else { data = humanCase.Compare(cloneHumanCase); } return(new JsonResult { Data = data, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult SelectPostCode(long idfGeoLocation, long idfsSettlement) { var address = (Address)ModelStorage.Get(Session.SessionID, idfGeoLocation, null); address.Settlement = address.SettlementLookup.Where(x => x.idfsSettlement == idfsSettlement).FirstOrDefault(); return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new SelectList(address.PostCodeLookup, "strPostCode", "strPostCode") }); }
public ActionResult SelectRayon(long idfGeoLocation, long idfsRegion) { var address = (Address)ModelStorage.Get(Session.SessionID, idfGeoLocation, null); address.Region = address.RegionLookup.Where(x => x.idfsRegion == idfsRegion).FirstOrDefault(); return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new SelectList(address.RayonLookup, "idfsRayon", "strRayonName") }); }
public ActionResult SelectSettlement(long idfGeoLocation, long idfsRayon) { var geoLocation = (GeoLocation)ModelStorage.Get(Session.SessionID, idfGeoLocation, null); geoLocation.Rayon = geoLocation.RayonLookup.Where(x => x.idfsRayon == idfsRayon).FirstOrDefault(); return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = new SelectList(geoLocation.SettlementLookup, "idfsSettlement", "strSettlementName") }); }
public ActionResult ContactList(long id) { HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null); ViewBag.CanUpdate = humanCaseAccessor.CanUpdate; var humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, id, null); ViewBag.IsHiddenPersonalData = humanCase.IsHiddenPersonalData("ContactedPersonList"); Session["IdfCase"] = humanCase.idfCase; return(View(humanCase)); }
public ActionResult LocationOfExposure(HumanCase humanCase) { long root = humanCase.idfCase; ViewBag.IdfCase = root; GeoLocation geoLocation = humanCase.PointGeoLocation; ModelStorage.Put(Session.SessionID, root, geoLocation.idfGeoLocation, null, geoLocation); return(PartialView(geoLocation)); }
public ActionResult FarmDetails(long id) { VetCase.Accessor vetCaseAccessor = VetCase.Accessor.Instance(null); ViewBag.CanUpdate = vetCaseAccessor.CanUpdate; var vetCase = (VetCase)ModelStorage.Get(Session.SessionID, id, null); AddTitleData(vetCase._HACode); Session["IdfCase"] = vetCase.idfCase; return(View(vetCase)); }
public ActionResult RemoveContactedCasePerson(long rootKey, long contactedCasePersonId) { var humanCase = (HumanCase)ModelStorage.GetRoot(Session.SessionID, rootKey, null); EditableList <ContactedCasePerson> list = humanCase.ContactedPerson; ContactedCasePerson item = list.Where(c => c.idfContactedCasePerson == contactedCasePersonId).SingleOrDefault(); list.Remove(item); return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = null }); }
public void IndexAction() { Sales sales = ModelStorage.GetSales(); _view.Show(new string[] { $"Total sallary = {sales.GetTotalSallary()}", $"type 'view' to watch all saled books", $"type 'menu' to back to the menu" }); string command = Console.ReadLine(); Route nextController = _routes.FirstOrDefault(b => b.Id == command); redirect(nextController.Action, nextController.Controller, null); }
public ActionResult FarmsList(long rootKey, long farmId) { ViewBag.IdfCase = rootKey; ViewBag.FarmId = farmId; var farmPanel = (FarmPanel)ModelStorage.Get(Session.SessionID, farmId, null); List <FarmListItem> farms = GetFarmsList(farmPanel); ViewBag.ItemsCount = farms == null ? 0 : farms.Count; List <FarmListItem> resultList = farms == null ? farms : farms.Take(100).ToList(); return(View(resultList)); }
public ActionResult CopyTableRow(string idfsSection, long idfRow, long key, string ffpresenterId) { var ff = ModelStorage.Get(Session.SessionID, key, ffpresenterId) as FFPresenterModel; if ((ff != null) && (idfsSection.Length > 0)) { ff.CopyRow(Convert.ToInt64(idfsSection), idfRow); } return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult RemoveTableRow(string idfsSection, long idfRow, long key, string ffpresenterId) { var ff = ModelStorage.Get(Session.SessionID, key, ffpresenterId) as FFPresenterModel; if (ff != null) { ff.RemoveRow(idfRow); } return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }
public ActionResult LocationDetails(long rootKey) { HumanCase.Accessor humanCaseAccessor = HumanCase.Accessor.Instance(null); ViewBag.CanUpdate = humanCaseAccessor.CanUpdate; ViewBag.RootKey = rootKey; var humanCase = (HumanCase)ModelStorage.Get(Session.SessionID, rootKey, null); GeoLocation cloneGeoLocation = GetCloneOfOriginalGeoLocation(humanCase); cloneGeoLocation.idfGeoLocation = cloneGeoLocation.idfGeoLocation + 1; ModelStorage.Put(Session.SessionID, rootKey, cloneGeoLocation.idfGeoLocation, null, cloneGeoLocation); return(PartialView(cloneGeoLocation)); }
public ActionResult PatientsList(long rootKey, long contactedCasePersonId) { ViewBag.IdfCase = rootKey; ViewBag.ContactedCasePersonId = contactedCasePersonId; var contactedPerson = (ContactedCasePerson)ModelStorage.Get(Session.SessionID, contactedCasePersonId, null); List <PatientListItem> patients = GetPatientsList(contactedPerson.Person); ViewBag.ItemsCount = patients == null ? 0 : patients.Count; List <PatientListItem> resultList = patients == null ? patients : patients.Take(100).ToList(); return(View(resultList)); }
public ActionResult ShowFlexibleForm(long root, long key, long ffpresenterId, bool canUpdate = true) { var ff = ModelStorage.Get(Session.SessionID, key, ffpresenterId.ToString()) as FFPresenterModel; if ((ff != null) && (ff.CurrentTemplate != null)) { ViewBag.FFKey = key; ViewBag.FFpresenterId = ffpresenterId; ViewBag.CanUpdate = canUpdate; return(PartialView("ShowFlexibleForm", ff)); } return(PartialView("Empty")); }
private void SetOrganizationInRootObject(long organizationId) { var rootId = (Int64)Session["RootId"]; var root = (IObject)ModelStorage.Get(Session.SessionID, rootId, null); string idfsOrganizationPropertyName = Session["IdfsOrganizationPropertyName"].ToString(); root.SetValue(idfsOrganizationPropertyName, organizationId.ToString()); string strOrganizationPropertyName = Session["StrOrganizationPropertyName"].ToString(); List <OrganizationListItem> organizations = GetOrganizationsList(); string organizationName = organizations.Where(x => x.idfInstitution == organizationId).FirstOrDefault().name; root.SetValue(strOrganizationPropertyName, organizationName); }
public ActionResult RemoveSpecies(long rootKey, long speciesId) { var vetCase = (VetCase)ModelStorage.Get(Session.SessionID, rootKey, null); VetFarmTree item = vetCase.Farm.FarmTree.Where(x => x.idfParty == speciesId).SingleOrDefault(); if (item != null) { vetCase.Farm.FarmTree.Remove(item); } return(new JsonResult { JsonRequestBehavior = JsonRequestBehavior.AllowGet, Data = null }); }