public CommonResponse ReadbyId(FSTI_Transactions e) { CommonResponse response = new CommonResponse(); if (e.id > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.FSTI_Transactions.FirstOrDefault(r => r.FSTI_Transaction_key == e.FSTI_Transaction_key); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("FSTI Transactions Id was not found.", null); return(response); } } } else { response.Error("User ID can not be 0.", null); return(response); } }
public CommonResponse Create(cat_UserRole e) { CommonResponse response = new Reusable.CommonResponse(); if (e.UserRole != "" && e.UserRoleDesc != "") { using (CAPA_INVContext context = new CAPA_INVContext()) { if (context.cat_UserRole.FirstOrDefault(r => r.UserRole == e.UserRole) == null) { context.cat_UserRole.Add(e); context.SaveChanges(); response.Success(e, "OK"); return(response); } else { response.Error("User Role already exist.", null); return(response); } } } else { response.Error("User Role or Description can not be empty.", null); return(response); } }
public CommonResponse ReadbyId(cat_UserRole e) { CommonResponse response = new Reusable.CommonResponse(); if (e.UserRoleKey > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.cat_UserRole.FirstOrDefault(r => r.UserRoleKey == e.id); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("User Role ID was not found.", null); return(response); } } } else { response.Error("User Role ID can not be 0.", null); return(response); } }
public CommonResponse Create(cat_TicketType e) { CommonResponse response = new Reusable.CommonResponse(); if (e.TicketType != "" && e.TicketTypeDescirption != "") { using (CAPA_INVContext context = new CAPA_INVContext()) { if (context.cat_TicketType.FirstOrDefault(r => r.TicketTypeKey == e.id) == null) { context.cat_TicketType.Add(e); context.SaveChanges(); response.Success(e, "OK"); return(response); } else { response.Error("Ticket Category already exist.", null); return(response); } } } else { response.Error("Ticket Category or Description can not be empty.", null); return(response); } }
public CommonResponse Delete(cat_TicketType e) { CommonResponse response = new Reusable.CommonResponse(); if (e.id > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { cat_TicketType entity = context.cat_TicketType.FirstOrDefault(r => r.TicketTypeKey == e.id); if (entity != null) { context.cat_TicketType.Remove(entity); context.SaveChanges(); response.Success(); return(response); } else { response.Error("Ticket Type ID can not be find.", null); return(response); } } } response.Error("Ticket Type ID can not be 0.", null); return(response); }
public Stadisticts EventStadistics(int EventId) { using (CAPA_INVContext context = new CAPA_INVContext()) { Stadisticts stats = new Stadisticts(); int TicketCounts = context.TicketCounts.Where(r => (r.Ticket.InventoryEventKey == EventId)).Count(); int MoTags = context.MOTagHeaders.Where(r => (r.Ticket.InventoryEventKey == EventId)).Count(); int VoidCleanBlanks = context.TicketCounts.Where(r => (r.Ticket.InventoryEventKey == EventId) && (r.VoidTag == true) && (r.CounterInitials == null)).Count(); stats.TicketCounts = TicketCounts; stats.MOTags = MoTags; stats.TicketBlank = context.TicketCounts.Where(r => (r.BlankTag == true) && (r.Ticket.InventoryEventKey == EventId)).Count(); stats.TicketVerified = context.TicketCounts.Where(r => (r.Verified == true) && (r.Ticket.InventoryEventKey == EventId)).Count(); stats.TicketVoid = context.TicketCounts.Where(r => (r.VoidTag == true) && (r.Ticket.InventoryEventKey == EventId)).Count(); int TicketCounted = context.TicketCounts.Where(r => (((r.CounterInitials != null)) && (r.Ticket.InventoryEventKey == EventId))).Count(); int MoTagCounted = context.MOTagHeaders.Where(r => (r.CounterInitials != null) && (r.Ticket.InventoryEventKey == EventId)).Count(); stats.MOTagsCounted = MoTagCounted; stats.TicketCounted = TicketCounted + VoidCleanBlanks; if (stats.TotalTickets > 0) { stats.TicketCountedPorcentage = (stats.TotalTicketsCounted * 100) / stats.TotalTickets; } //Where(r => (r.TicketKey == Ticket_Id && r.Ticket.cat_TicketTypeKey == 1)).ToList(); //return List; return(stats); } }
public CommonResponse ReadbyId(InventoryEvent e) { CommonResponse response = new CommonResponse(); if (e.id > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.InventoryEvents.FirstOrDefault(r => r.InventoryEventKey == e.id); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("Inventory Event Id was not found.", null); return(response); } } } else { response.Error("Inventory Event ID can not be 0.", null); return(response); } }
public CommonResponse Create(TicketCount e) { CommonResponse response = new Reusable.CommonResponse(); if (e.TicketKey != 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { if (context.TicketCounts.FirstOrDefault(r => (r.id == e.id)) == null) { context.TicketCounts.Add(e); context.SaveChanges(); response.Success(e, "OK"); return(response); } else { response.Error("Ticket Count already exist.", null); return(response); } } } else { response.Error("Ticket Id can not be empty.", null); return(response); } }
public CommonResponse ReadbyId(TicketCount e) { CommonResponse response = new Reusable.CommonResponse(); if (e.TicketKey > 0 && e.TagCountKey > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.TicketCounts.FirstOrDefault(r => (r.TagCountKey == e.TagCountKey && r.Ticket.cat_TicketType.TicketType == "TicketCount")); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("Ticket Count ID was not found.", null); return(response); } } } else { response.Error("Ticket Count ID can not be 0.", null); return(response); } }
public CommonResponse GetbyTagNo(Ticket e) { CommonResponse response = new Reusable.CommonResponse(); //e.TicketKey = ID; if (e.TicketCounter > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.Tickets.FirstOrDefault(r => (r.TicketCounter == e.TicketCounter && r.InventoryEventKey == e.InventoryEventKey)); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("Ticket ID was not found.", null); return(response); } } } else { response.Error("Ticket Type ID can not be 0.", null); return(response); } }
public CommonResponse GetLastTagID(Ticket e) { CommonResponse response = new CommonResponse(); using (CAPA_INVContext context = new CAPA_INVContext()) { int?TagCounter; try { TagCounter = context.Tickets.Where(q => q.InventoryEventKey == e.InventoryEventKey).Max(r => r.TicketCounter); } catch { TagCounter = 0; } //Ticket _ticket = context.Tickets.Max(r => r.TicketCounter); if (TagCounter != null && TagCounter > 0) { e.TicketCounter = Convert.ToInt32(TagCounter); e = (Ticket)GetbyTagNo(e).Result; response.Success(e, "OK"); return(response); } else { response.Error("Ticket ID was not found.", null); return(response); } } }
}//by COUNTER public CommonResponse Update(Ticket e) { CommonResponse response = new Reusable.CommonResponse(); if (e.TicketKey != 0 && e.InventoryEventKey != 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { Ticket entity = context.Tickets.FirstOrDefault(r => r.TicketKey == e.TicketKey); if (entity != null) { entity = e; context.SaveChanges(); response.Success(entity, "OK"); return(response); } else { response.Error("Ticket does not exist.", null); return(response); } } } else { response.Error("Ticket Type or Description can not be empty.", null); return(response); } }
}//by COUNTER public CommonResponse ReadbyName(int Counter, int Active_IE_Key)///by counter { Ticket e = new CAP_Inventory_System.Ticket { TicketCounter = Counter, InventoryEventKey = Active_IE_Key }; CommonResponse response = new CommonResponse(); if (e.TicketCounter != 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.Tickets.FirstOrDefault(r => (r.TicketCounter == e.TicketCounter && r.InventoryEventKey == e.InventoryEventKey)); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("Ticket Counter was not found.", null); return(response); } } } else { response.Error("Ticket Counter can not be 0.", null); return(response); } }//by COUNTER
public CommonResponse ReadbyId(int ID) { CommonResponse response = new Reusable.CommonResponse(); Ticket e = new Ticket { TicketKey = ID }; //e.TicketKey = ID; if (e.TicketKey > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.Tickets.FirstOrDefault(r => r.TicketKey == e.TicketKey); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("Ticket ID was not found.", null); return(response); } } } else { response.Error("Ticket Type ID can not be 0.", null); return(response); } }
public CommonResponse Update(InventoryEvent e) { CommonResponse response = new Reusable.CommonResponse(); if (e.InventoryEventKey > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { InventoryEvent entity = context.InventoryEvents.FirstOrDefault(r => r.InventoryEventKey == e.InventoryEventKey); if (entity != null) { entity.InventoryEventName = e.InventoryEventName; entity.InventoryEventDescription = e.InventoryEventDescription; entity.Status = e.Status; entity.TicketCountTags = e.TicketCountTags; entity.MOTags = e.MOTags; context.SaveChanges(); response.Success(entity, "OK"); return(response); } else { response.Error("Inventory Event does not exist.", null); return(response); } } } else { response.Error("Inventory Event Name or Description can not be empty.", null); return(response); } }
}//by PN public CommonResponse Update(TicketCount e) { CommonResponse response = new Reusable.CommonResponse(); if (e.TicketKey != 0 && e.TagCountKey != 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { TicketCount entity = context.TicketCounts.FirstOrDefault(r => (r.TicketKey == e.TicketKey && r.TagCountKey == e.TagCountKey)); if (entity != null) { UpdateEntity(ref entity, e); context.SaveChanges(); response.Success(entity, "OK"); return(response); } else { response.Error("Ticket does not exist.", null); return(response); } } } else { response.Error("Ticket can not be empty.", null); return(response); } }
public CommonResponse Delete(InventoryEvent e) { CommonResponse response = new Reusable.CommonResponse(); if (e.id > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { InventoryEvent entity = context.InventoryEvents.FirstOrDefault(r => r.InventoryEventKey == e.id); if (entity != null) { try { context.InventoryEvents.Remove(entity); context.SaveChanges(); response.Success(); return(response); }catch (Exception ex) { response.Error(ex.Message, null); return(response); } } else { response.Error("Inventory Event ID can not be find.", null); return(response); } } } response.Error("Inventory Event ID can not be 0.", null); return(response); }
public CommonResponse Delete(TicketCount e) { CommonResponse response = new Reusable.CommonResponse(); if (e.TicketKey > 0 && e.TagCountKey > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { TicketCount entity = context.TicketCounts.FirstOrDefault(r => (r.TicketKey == e.TicketKey && r.TagCountKey == e.TagCountKey)); if (entity != null) { context.TicketCounts.Remove(entity); context.SaveChanges(); response.Success(); return(response); } else { response.Error("Ticket ID can not be find.", null); return(response); } } } response.Error("Ticket ID can not be 0.", null); return(response); }
public CommonResponse ReadbyName(InventoryEvent e) { CommonResponse response = new CommonResponse(); if (e.InventoryEventName != "") { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.InventoryEvents.FirstOrDefault(r => r.InventoryEventName == e.InventoryEventName); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("Inventory Event Name was not found.", null); return(response); } } } else { response.Error("Inventory Event Name can not be empty.", null); return(response); } }
public List <TicketCount> ReadByProp(string Property, TicketCount T) { List <TicketCount> L = new List <TicketCount>(); using (CAPA_INVContext context = new CAPA_INVContext()) { switch (Property) { case "Verified": { List <TicketCount> List = new List <TicketCount>(); List = context.TicketCounts .Where(r => ( r.Ticket.InventoryEventKey == T.Ticket.InventoryEventKey && r.Ticket.cat_TicketTypeKey == 1) && r.Verified == T.Verified) .Include(t => t.Ticket) .ToList(); return(List); } default: { break; } } } return(L); }
public CommonResponse Create(InventoryEvent e) { CommonResponse response = new Reusable.CommonResponse(); if (e.InventoryEventName != "" && e.InventoryEventName != "") { using (CAPA_INVContext context = new CAPA_INVContext()) { if (context.InventoryEvents.FirstOrDefault(r => r.InventoryEventName == e.InventoryEventName) == null) { context.InventoryEvents.Add(e); context.SaveChanges(); response.Success(e, "OK"); return(response); } else { response.Error("Inventory Event already exist.", null); return(response); } } } else { response.Error("Inventory Event Name or Description can not be empty.", null); return(response); } }
public CommonResponse Update(FS_ItemMaster e) { CommonResponse response = new Reusable.CommonResponse(); if (e.ItemNumber_FSKey > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { FS_ItemMaster entity = context.FS_ItemMaster.FirstOrDefault(r => r.ItemNumber_FSKey == e.ItemNumber_FSKey); if (entity != null) { //entity.UserName = e.UserName; //entity.UserRoleKey = e.UserRoleKey; //entity.Password = e.Password; //context.SaveChanges(); response.Success(entity, "OK"); return(response); } else { response.Error("Item does not exist.", null); return(response); } } } else { response.Error("Item can not be empty.", null); return(response); } }
public CommonResponse Update(cat_TicketType e) { CommonResponse response = new Reusable.CommonResponse(); if (e.TicketType != "" && e.TicketTypeDescirption != "") { using (CAPA_INVContext context = new CAPA_INVContext()) { cat_TicketType entity = context.cat_TicketType.FirstOrDefault(r => r.TicketTypeKey == e.id); if (entity != null) { entity.TicketType = e.TicketType; entity.TicketTypeDescirption = e.TicketTypeDescirption; context.SaveChanges(); response.Success(entity, "OK"); return(response); } else { response.Error("Ticket Type does not exist.", null); return(response); } } } else { response.Error("Ticket Type or Description can not be empty.", null); return(response); } }
public CommonResponse Delete(FS_ItemMaster e) { CommonResponse response = new Reusable.CommonResponse(); if (e.ItemNumber_FSKey > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { FS_ItemMaster entity = context.FS_ItemMaster.FirstOrDefault(r => r.ItemNumber_FSKey == e.ItemNumber_FSKey); if (entity != null) { context.FS_ItemMaster.Remove(entity); context.SaveChanges(); response.Success(); return(response); } else { response.Error("Item ID can not be find.", null); return(response); } } } response.Error("Item ID can not be 0.", null); return(response); }
public CommonResponse AddCountTicket(Ticket e) { CommonResponse response = new Reusable.CommonResponse(); if (e.TicketCounter != 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { cat_TicketType _cat_TicketType = context.cat_TicketType.FirstOrDefault(r => r.TicketType == "TicketCount"); Ticket _Ticket = context.Tickets.FirstOrDefault(r => (r.TicketCounter == e.TicketCounter && r.InventoryEventKey == e.InventoryEventKey)); if (_Ticket == null) { _cat_TicketType.Tickets.Add(e); context.SaveChanges(); response.Success(e, "OK"); return(response); } else { response.Error("Ticket Category already exist.", null); return(response); } } } else { response.Error("Ticket Category or Description can not be empty.", null); return(response); } }
public CommonResponse ReadbyId(FS_ItemMaster e) // FS ID { CommonResponse response = new CommonResponse(); if (e.id > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.FS_ItemMaster.FirstOrDefault(r => r.ItemNumber_FSKey == e.ItemNumber_FSKey); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("Item Id was not found.", null); return(response); } } } else { response.Error("User ID can not be 0.", null); return(response); } }
public CommonResponse Update(cat_UserRole e) { CommonResponse response = new CommonResponse(); if (e.UserRole != "" && e.UserRoleDesc != "") { using (CAPA_INVContext context = new CAPA_INVContext()) { cat_UserRole entity = context.cat_UserRole.FirstOrDefault(r => r.UserRoleKey == e.UserRoleKey); if (entity != null) { entity.UserRole = e.UserRole; entity.UserRoleDesc = e.UserRole; context.SaveChanges(); response.Success(entity, "OK"); return(response); } else { response.Error("User Role does not exist.", null); return(response); } } } else { response.Error("User Role or Description can not be empty.", null); return(response); } }
public CommonResponse ReadbyName(FS_ItemMaster e) { CommonResponse response = new CommonResponse(); if (e.ItemNumber != "") { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.FS_ItemMaster.FirstOrDefault(r => r.ItemNumber == e.ItemNumber); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("ItemNumber was not found.", null); return(response); } } } else { response.Error("ItemNumber can not be empty.", null); return(response); } }
public CommonResponse ReadbyName(cat_UserRole e) { CommonResponse response = new CommonResponse(); if (e.UserRole != "") { using (CAPA_INVContext context = new CAPA_INVContext()) { e = context.cat_UserRole.FirstOrDefault(r => r.UserRole == e.UserRole); if (e != null) { response.Success(e, "OK"); return(response); } else { response.Error("User Role Name was not found.", null); return(response); } } } else { response.Error("User Role Name can not be empty.", null); return(response); } }
public CommonResponse Update(FSTI_Transactions e) { CommonResponse response = new Reusable.CommonResponse(); if (e.FSTI_Transaction_key > 0) { using (CAPA_INVContext context = new CAPA_INVContext()) { FSTI_Transactions entity = context.FSTI_Transactions.FirstOrDefault(r => r.FSTI_Transaction_key == e.FSTI_Transaction_key); if (entity != null) { entity.TransactionStringFields = e.TransactionStringFields; entity.TransactionProcessedYN = e.TransactionProcessedYN; entity.FSResponse = e.FSResponse; entity.FSError = e.FSError; entity.DateStampOut = e.DateStampOut; //entity.Password = e.Password; context.SaveChanges(); response.Success(entity, "OK"); return(response); } else { response.Error("FSTI Transaction does not exist.", null); return(response); } } } else { response.Error("FSTI Transaction key can not be empty.", null); return(response); } }