/// <summary> Sets status to appropriate status column based upon status type </summary> /// <param name="statusType">Status Type</param> /// <returns>Column index being set</returns> public int SetStatus(StatusTypeEnum statusType) { _status = GetIcon(statusType); _statusType = statusType; return(StatusColumnNo); }
public IEnumerable <Order> RetrieveOrdersByStatusTypeAndCompanyId(StatusTypeEnum statusType, int companyId) { //Have to no 'AsNoTracking()' so that entities doesn't track the entity and throw an error //if we decided to push back changes after we've mapped it back and forth from domain to dao. var daoOrders = (from o in _iandpOrderEntities.Orders join comp in _iandpOrderEntities.Companies on o.ExternalCompanyId equals comp.ExternalCompanyId where o.StatusTypeId == (int)statusType && comp.Id == companyId select o).ToList(); return(daoOrders); }
public Item UpdateItemStatus(int itemId, StatusTypeEnum statusType, int priority, string resultMessage, string log, DateTime?startDate, DateTime?compleDateTime, string updatingUserId) { var daoItem = _iandpOrderEntities.Items.FirstOrDefault(x => x.Id == itemId); try { if (daoItem == null) { throw new Exception("Item not found."); } daoItem.StatusTypeId = (int)statusType; daoItem.ResultMessage = resultMessage; daoItem.Log = log; if (priority > 0) { daoItem.Priority = priority; } daoItem.StartDate = startDate; daoItem.CompletionDate = compleDateTime; daoItem.ModifiedByUser = updatingUserId; daoItem.DateModified = DateTime.Now; _iandpOrderEntities.AttachEntity(null, daoItem, new[] { "Id" }, updatingUserId); _iandpOrderEntities.SaveChanges(); _iandpOrderEntities.RefreshEntity(daoItem); } catch (DbUpdateConcurrencyException) { //Due to multiply threads running at the same time for each service, and the service is responsible for updating the orders status //we must handle the scenarios were a different thread has changed the status in a different entity context //and the current context on a different thread is not aware of the changes. //So in layman's terms: //We are trying to update a row when the version has changed and we do not have the most update to date information. //So we just need to retry updating. But why? //Because when we call this again we will get an updated version of the data and then apply our new changes to this. //Eventually this will go through. UpdateItemStatus(itemId, statusType, priority, resultMessage, log, startDate, compleDateTime, updatingUserId); } return(daoItem); }
/// <summary> Get icon based upon status type </summary> /// <param name="statusType">Status Type</param> /// <returns>Icon</returns> private Icon GetIcon(StatusTypeEnum statusType) { var retVal = Properties.Resources.Blank; switch (statusType) { case StatusTypeEnum.None: retVal = Properties.Resources.Blank; break; case StatusTypeEnum.Success: retVal = Properties.Resources.Success; break; case StatusTypeEnum.Error: retVal = Properties.Resources.Error; break; } return(retVal); }
private void SetStatus(string v, StatusTypeEnum type) { switch (type) { case StatusTypeEnum.Information: toolStripStatusLabel1.BackColor = Color.LightGreen; toolStripStatusLabel1.ForeColor = Color.Black; break; case StatusTypeEnum.Warning: toolStripStatusLabel1.BackColor = Color.Yellow; toolStripStatusLabel1.ForeColor = Color.Blue; break; case StatusTypeEnum.Error: toolStripStatusLabel1.BackColor = Color.Red; toolStripStatusLabel1.ForeColor = Color.White; break; default: break; } toolStripStatusLabel1.Text = v; }
public static StatusType ToStatusType(this StatusTypeEnum statusTypeEnum) { return((StatusType)((int)statusTypeEnum)); }
protected virtual void SetStatus(StatusTypeEnum status) { Status = status; }
public Equipment UpdateEquipmentStatus(int itemId, int equipmentId, int equipmentItemId, StatusTypeEnum statusType, string resultMessage, string log, string name, DateTime?startDate, DateTime?compleDateTime, string updatingUserId) { var daoEquipment = _iandpOrderEntities.Equipments.FirstOrDefault(x => x.EquipmentSetupId == equipmentId && x.ItemId == itemId && x.EquipmentItemId == equipmentItemId); try { //If we ever do equipment level provisioning this will need to be implemented differently. if (daoEquipment != null) { daoEquipment.StatusTypeId = (int)statusType; daoEquipment.ResultMessage = resultMessage; daoEquipment.Log = log; daoEquipment.EquipmentItemDescription = name; daoEquipment.StartDate = startDate; daoEquipment.CompletionDate = compleDateTime; daoEquipment.ModifiedByUser = updatingUserId; daoEquipment.DateModified = DateTime.Now; _iandpOrderEntities.AttachEntity(null, daoEquipment, new[] { "Id" }, updatingUserId); _iandpOrderEntities.SaveChanges(); _iandpOrderEntities.RefreshEntity(daoEquipment); } else { var daoItem = _iandpOrderEntities.Items.FirstOrDefault(x => x.Id == itemId); if (daoItem != null) { daoEquipment = new Equipment { ExternalEquipmentId = "0", EquipmentSetupId = equipmentId, EquipmentItemId = equipmentItemId, ActionTypeId = daoItem.ActionTypeId, CreatedByUser = updatingUserId, ModifiedByUser = updatingUserId, ItemId = itemId, ProvisionDate = daoItem.ProvisionDate, StatusTypeId = (int)statusType, ResultMessage = resultMessage, EquipmentItemDescription = name, Log = log, Xml = "", StartDate = startDate, CompletionDate = compleDateTime }; _iandpOrderEntities.AttachEntity(null, daoEquipment, new[] { "Id" }, updatingUserId); _iandpOrderEntities.SaveChanges(); _iandpOrderEntities.RefreshEntity(daoEquipment); } } } catch (DbUpdateConcurrencyException) { //Due to multiply threads running at the same time for each service, and the service is responsible for updating the orders status //we must handle the scenarios were a different thread has changed the status in a different entity context //and the current context on a different thread is not aware of the changes. //So in layman's terms: //We are trying to update a row when the version has changed and we do not have the most update to date information. //So we just need to retry updating. But why? //Because when we call this again we will get an updated version of the data and then apply our new changes to this. //Eventually this will go through. UpdateEquipmentStatus(itemId, equipmentId, equipmentItemId, statusType, resultMessage, log, name, startDate, compleDateTime, updatingUserId); } return(daoEquipment); }
public void GetDescription(StatusTypeEnum type) { }
private Status(StatusTypeEnum statusTypeEnum) { Id = (int)statusTypeEnum; Name = statusTypeEnum.ToString(); }
private void SetStatus(StatusTypeEnum statusTypeEnum, float position = default(float)) { StatusType = statusTypeEnum; switch (statusTypeEnum) { case StatusTypeEnum.Buffering: Status = "Buffering..."; break; case StatusTypeEnum.Playing: Status = string.Format("Position: {0}", position); break; case StatusTypeEnum.Stopped: Status = "Stopped"; break; default: throw new ArgumentOutOfRangeException("statusTypeEnum"); } }