internal Bus() { _services.Add <IPublisher>(this); _services.Add(new ObservableRelay(this)); _publishChainCasing = new PublishChainCasing(this); _subscriber = new Subscriber(_services); _disposer = new DisposeContainer { _publishChainCasing, _subscriber, (IDisposable)_services }; }
public HttpResponseMessage AddCategory([FromBody] Category c) { try { if (!ModelState.IsValid) { return(this.Request.CreateResponse(HttpStatusCode.BadRequest, "your fields are not valid")); } IEnumerable <Category> categories = categoryservice.GetAll(); var checkCategory = categories.FirstOrDefault(m => m.Name == c.Name); if (checkCategory != null) { return(this.Request.CreateResponse(HttpStatusCode.Conflict, "Category Already Exist")); } categoryservice.Add(c); return(this.Request.CreateResponse(HttpStatusCode.Created, "Added Successful")); } catch (Exception ex) { return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public HttpResponseMessage AddStaff([FromBody] Staff s) { try { if (!ModelState.IsValid) { return(this.Request.CreateResponse(HttpStatusCode.BadRequest, "your fields are not valid")); } IEnumerable <Staff> staff = staffservice.GetAll(); var checkStaffNum = staff.FirstOrDefault(m => m.StaffNum == s.StaffNum); if (checkStaffNum != null) { return(this.Request.CreateResponse(HttpStatusCode.Conflict, "Staff Number Already Exist")); } staffservice.Add(s); return(this.Request.CreateResponse(HttpStatusCode.Created, "Successful")); } catch (Exception ex) { return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
public JsonResult PostTask(Smart.Core.Domain.Tasks.Task task, int id) { List <Object> Adicionado = new List <Object>(); task.BusinessEntityId = _currentUser.GetCurrentBusinessEntityId(); task.ContactId = id; task.DueDate = task.DueDate + task.Time; try { _taskServices.Add(task); Adicionado.Add(new { Sucesso = true, Msg = task.Name }); } catch (Exception e) { Adicionado.Add(new { Erro = true, Msg = e.InnerException.Message }); } return(Json(Adicionado)); }
public IActionResult Follow(int id, bool follow) { var _id = _currentUser.Id(); var dealuser = _dealUserServices.Get(a => a.DealId == id && a.UserSettingId == _id); if (dealuser == null) { if (follow) { var newData = new DealUser() { DealId = id, UserSettingId = _id, BusinessEntityId = _currentUser.GetCurrentBusinessEntityId() }; _dealUserServices.Add(newData); } } else { if (!follow) { _dealUserServices.Delete(dealuser); } } return(RedirectToAction("Edit", new { id = id })); }
public IActionResult FollowStage(int dealid, int id, bool follow) { var _id = _currentUser.Id(); var stageuser = _stageUserServices.Get(a => a.StageId == id && a.UserSettingId == _id); if (stageuser == null) { if (follow) { var newData = new StageUser() { StageId = id, UserSettingId = _id, BusinessEntityId = _currentUser.GetCurrentBusinessEntityId() }; _stageUserServices.Add(newData); } } else { if (!follow) { _stageUserServices.Delete(stageuser); } } return(RedirectToAction("Edit", new { id = dealid })); }
public JsonResult PostContact(int id, string name, string phone, string email) { List <Object> Adicionado = new List <Object>(); var company = _companyServices.Find(id); var contact = new Contact() { FirstName = name, Phone = phone, Email = email, Company = company }; try { _contactervices.Add(contact); Adicionado.Add(new { Sucesso = true, Msg = name, Phone = phone }); } catch (Exception e) { Adicionado.Add(new { Erro = true, Msg = e.InnerException.Message }); } return(Json(Adicionado)); }
private void AddNewStage(int dealId, int stageId) { DateTime datanow = System.DateTime.Now; //update if exists try { var updateDeal = _dealStageServices.Query(a => a.Dealid == dealId && a.ExitDate == null).ToList(); updateDeal.ForEach(a => a.ExitDate = datanow); updateDeal.ForEach(a => _dealStageServices.Update(a)); } catch (Exception) { ; } //add control steage deal var dealstage = new DealStage() { BusinessEntityId = _currentUser.GetCurrentBusinessEntityId(), Dealid = dealId, StageId = stageId, UserSettingId = _currentUser.Id(), CreateDate = datanow, ModifiedDate = datanow, ExitDate = null }; _dealStageServices.Add(dealstage); }
public JsonResult PostComment(Note note, int id, string Comments) { List <Object> Adicionado = new List <Object>(); var contact = _contactServices.Find(id); var contactNote = new ContactNote() { Contact = contact, Note = note }; note.UserSettingId = _currentUser.Id(); note.BusinessEntityId = _currentUser.GetCurrentBusinessEntityId(); try { _contactNoteServices.Add(contactNote); Adicionado.Add(new { Sucesso = true, Msg = Comments }); } catch (Exception e) { Adicionado.Add(new { Erro = true, Msg = e.InnerException.Message }); } return(Json(Adicionado)); }
public HttpResponseMessage AddVendor([FromBody] Vendor v) { try { if (!ModelState.IsValid) { return(this.Request.CreateResponse(HttpStatusCode.BadRequest, "your fields are not valid")); } IEnumerable <Vendor> vendors = vendorservice.GetAll(); var checkVendor = vendors.FirstOrDefault(m => m.Name == v.Name); if (checkVendor != null) { return(this.Request.CreateResponse(HttpStatusCode.Conflict, "Vendor Already Exist")); } vendorservice.Add(v); return(this.Request.CreateResponse(HttpStatusCode.Created, "Added Successfully")); } catch (Exception ex) { return(this.Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }
void worker_DoWork(object sender, DoWorkEventArgs e) { try { Total = _objEntity.Count(); IServices service = null; //Fix Since 2.5.5.0 for (int i = 0; i < _objEntity.Count(); i++) { ThumbItem item = _objEntity.ElementAt(i); if (_isCancelationPending == true) { break; } if (service == null) { service = Util.GetService(item.EType); } IMyCollectionsData currentItem = service.Get(item.Id); service.GetInfoFromWeb(currentItem); service.Add(currentItem); Current++; } } catch (Exception ex) { Util.LogException(ex); } }
public IActionResult Add([Bind("TerritoryId,Name,MiddleName,CountryRegionCode,SpecialCodeRegion,CreateDate,ModifiedDate,Rowguid,BusinessEntityId")] Territory territory, bool continueAdd) { if (!ModelState.IsValid) { return(View(territory)); } _territoryServices.Add(territory); return(continueAdd ? RedirectToAction("Add") : RedirectToAction("List")); }
public IActionResult Add([Bind("TaskGroupId,Name,CreateDate,ModifiedDate,Rowguid,Deleted,BusinessEntityId")] TaskGroup taskGroup, bool continueAdd) { if (!ModelState.IsValid) { return(View(taskGroup)); } _taskGroupServices.Add(taskGroup); return(continueAdd ? RedirectToAction("Add") : RedirectToAction("List")); }
public IActionResult Add([Bind("CityId,Name,MiddleName,SpecialCodeRegion,StateProvinceId,CreateDate,ModifiedDate,Rowguid,BusinessEntityId")] City city, bool continueAdd) { ViewData["StateProvinceId"] = new SelectList(_stateProvinceServices.GetAll(), "StateProvinceId", "CountryRegionCode"); if (!ModelState.IsValid) { return(View(city)); } _cityServices.Add(city); return(continueAdd ? RedirectToAction("Add") : RedirectToAction("List")); }
public static Task Add <T>() where T : IService, new() { if (services == null) { throw new Exception("No services provider registered"); } return(services.Add <T>()); }
public IActionResult Add([Bind("StateProvinceId,StateProvinceCode,CountryRegionCode,IsOnlyStateProvinceFlag,Name,TerritoryId,CreateDate,ModifiedDate,Rowguid,BusinessEntityId")] StateProvince stateProvince, bool continueAdd) { ViewData["TerritoryId"] = new SelectList(_territoryServices.GetAll(), "TerritoryId", "Name"); if (!ModelState.IsValid) { return(View(stateProvince)); } _stateProvinceServices.Add(stateProvince); return(continueAdd ? RedirectToAction("Add") : RedirectToAction("List", new { territoryid = _currentTerritoryId })); }
public async Task <IActionResult> PostNote([FromBody] Note note) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var todo = await _noteService.Add(note); return(CreatedAtAction("GetNote", new { id = todo.Id }, todo)); }
public async Task <ActionResult> Add(People people) { if (!ModelState.IsValid) { return(CustomResponse(ModelState)); } await _service.Add(people); return(CustomResponse(people)); }
public ActionResult AddRecord(Student std) { ViewBagData(); if (!ModelState.IsValid) { return(View()); } studentservice.Add(std); return(RedirectToAction("RecordList", "Student")); }
public IActionResult AddStage(Stage data) { data.OrderStage = (_stagesServices.Query(a => a.PipelineId == data.PipelineId).ToList().Select(x => (int?)x.OrderStage).Max() ?? 0) + 1; if (!ModelState.IsValid) { return(RedirectToAction("Configure", new { id = data.PipelineId })); } _stagesServices.Add(data); return(RedirectToAction("Configure", new { id = data.PipelineId })); }
public static T GetOrAdd <T>(this IServices services, T key, Func <T> addCallback) { var service = services.Get <T>(); if (service == null) { service = addCallback(); services.Add(service); } return(service); }
public IActionResult Add(Pipeline data, bool continueAdd) { ViewData["stages"] = _stagesServices.GetAll(a => a.Active == true); data.UserSettingId = _currentUser.Id(); if (!ModelState.IsValid) { return(View(data)); } _pipelineServices.Add(data); return(continueAdd ? RedirectToAction("Configure", new { id = data.PipelineId }) : RedirectToAction("List")); }
public IActionResult Add([Bind("AddressId,AddressLine1,AddressLine2,AddressLine3,AddressNumber,CityId,PostalCode,SpatialLocation,BusinessEntityId")] Address address, int companyId, string returnUrl, int contactId = 0) { if (companyId > 0) { var companyAdress = new CompanyAddress(); var company = _companyServices.Find(companyId); if (company == null) { return(NotFound()); } address.BusinessEntityId = _currentUser.GetCurrentBusinessEntityId(); companyAdress.Address = address; companyAdress.Company = company; companyAdress.BusinessEntityId = _currentUser.GetCurrentBusinessEntityId(); try { _companyAddressServices.Add(companyAdress); } catch (Exception) { return(BadRequest()); } } if (contactId > 0) { var contactAdress = new ContactAddress(); var contact = _contactServices.Find(contactId); if (contact == null) { return(NotFound()); } address.BusinessEntityId = _currentUser.GetCurrentBusinessEntityId(); contactAdress.Address = address; contactAdress.Contact = contact; contactAdress.BusinessEntityId = _currentUser.GetCurrentBusinessEntityId(); try { _contactAddressServices.Add(contactAdress); } catch (Exception) { return(BadRequest()); } } return(RedirectToLocal(returnUrl)); }
public ActionResult Score([FromBody] DTOStream stream) { int result = _services.Add(stream.Input); if (result != -1) { return(Ok(result)); } else { return(BadRequest("")); } }
public IActionResult Add([Bind("Id,Name,UserSettingId,PipelineId,StageId,Period,Value,CreateDate,ModifiedDate,Rowguid,Active,Deleted,BusinessEntityId,Measure")] Goal goal, bool continueAdd) { ViewData["PipelineId"] = new SelectList(_pipelineServices.GetAll(), "PipelineId", "Name"); ViewData["StageId"] = new SelectList(_stageServices.GetAll(), "StageId", "Name"); goal.UserSettingId = _currentUser.Id(); if (!ModelState.IsValid) { return(View(goal)); } _goalServices.Add(goal); return(continueAdd ? RedirectToAction("Add") : RedirectToAction("List")); }
public IActionResult BusinessEntity() { var data = _businessEntityConfig.Get(); if (data == null) { data = new BusinessEntityConfig(_currentUser.Email(), _currentUser.Email(), "", "", "", 0, 0) { BusinessEntityId = _currentUser.GetCurrentBusinessEntityId() }; _businessEntityConfig.Add(data); } return(View(data)); }
public static T GetOrAdd <T>(this IServices services, Func <T> create) { var service = services.Get <T>(); if (service == null) { service = create(); if (service == null) { throw new AppRunnerException($"'{create}' returned null"); } services.Add(service); } return(service); }
public IActionResult Add([Bind("CompanyId,FirstName,LastName,Email,Phone,Image,CreateDate,ModifiedDate,rowguid,Active,Deleted,BusinessEntityId,avatarImage")] Company company, bool continueAdd, IFormFile files) { if (!ModelState.IsValid) { return(View(company)); } try { using (var memoryStream = new MemoryStream()) { company.avatarImage.CopyTo(memoryStream); company.Image = memoryStream.ToArray(); } } catch {; } _companyServices.Add(company); return(continueAdd ? RedirectToAction("Add") : RedirectToAction("List")); }
public IActionResult Add([Bind("TaskId,TaskGroupId,Name,DueDate,Time,Duration,Comments,UserSettingId,DealId,CompanyId,ContactId,Done,CreateDate,ModifiedDate,Rowguid,Active,Deleted,BusinessEntityId,Required")] Smart.Core.Domain.Tasks.Task task, bool continueAdd) { ViewData["ContactName"] = task.Contact != null ? task.Contact.FirstName : ""; ViewData["CompanyName"] = task.Company != null ? task.Company.FirstName : ""; ViewData["DealName"] = task.Deal != null ? task.Deal.Name : ""; ViewBag.TaskGroupId = _taskGroupServices.GetAll(a => a.Deleted == false); ViewData["UserSettingId"] = new SelectList(_userSettingServices.GetAll(), "UserSettingId", "FirstName", task.UserSettingId); ViewData["Tempo"] = new SelectList(Smart.Core.Domain.Tasks.Task.TimeSpansInRange(TimeSpan.Parse("00:00"), TimeSpan.Parse("23:45"), TimeSpan.Parse("00:15")), task.Time); task.DueDate = task.DueDate + task.Time; task.UserSettingId = _currentUser.Id(); if (!ModelState.IsValid) { return(View(task)); } _taskServices.Add(task); return(continueAdd ? RedirectToAction("Add") : RedirectToAction("List")); }
public HttpResponseMessage AddCheckin(CheckinViewModel cvm) { try { var checkin = new CheckIn { Name = cvm.Name, StaffId = cvm.Id, IsChecked = true, VendorId = 1 }; _checkinservice.Add(checkin); return(Request.CreateResponse(HttpStatusCode.OK, "checked")); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message)); } }