mirror of
https://github.com/Sea-Haven-Industries/shoc-backend.git
synced 2026-09-30 17:43:12 +00:00
113 lines
3.4 KiB
C#
113 lines
3.4 KiB
C#
|
|
using Data.SeaHavenIndustries;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using SeaHavenIndustries.Data.IRepository;
|
|
using System.Globalization;
|
|
|
|
namespace SeaHavenIndustries
|
|
{
|
|
public class ChangeStepService
|
|
{
|
|
private readonly IWorkOrderRepository _service;
|
|
|
|
public ChangeStepService(IWorkOrderRepository service)
|
|
{
|
|
_service = service ?? throw new ArgumentNullException(nameof(service));
|
|
}
|
|
public List<WorkOrder>? _list { get; set; }
|
|
public ElementReference htmlContentReference { get; set; }
|
|
|
|
public int Step { get; set; } = 0;
|
|
public int eid { get; set; } = 0;
|
|
public bool isloading { get; set; } = false;
|
|
public int lasteid { get; set; } = 0;
|
|
// public string Currentstatus { get; set; } = "";
|
|
//public WorkOrder Activemodel =new WorkOrder();
|
|
public bool isCopying { get; set; } = false;
|
|
public bool iscreatetemplate { get; set; } = false;
|
|
|
|
public event Action OnStateChange;
|
|
public void SetValue(int value)
|
|
{
|
|
Step = value;
|
|
NotifyStateChanged();
|
|
}
|
|
public void setisloading(bool value)
|
|
{
|
|
isloading = isloading;
|
|
NotifyStateChanged();
|
|
}
|
|
public void SetValuelasteditid(int value)
|
|
{
|
|
lasteid = value;
|
|
NotifyStateChanged();
|
|
}
|
|
public void SetValueeditid(int value)
|
|
{
|
|
eid = value;
|
|
NotifyStateChanged();
|
|
}
|
|
//public void SetCurrentstatus(string value)
|
|
//{
|
|
// Currentstatus = value;
|
|
// NotifyStateChanged();
|
|
//}
|
|
//public void chnageactivemodel(WorkOrder model)
|
|
//{
|
|
// Activemodel = model;
|
|
// NotifyStateChanged();
|
|
//}
|
|
public async Task GetWorkerList()
|
|
{
|
|
// _context.Entry(model1).State = EntityState.Detached;
|
|
|
|
_list = await _service.Getworkorder();
|
|
NotifyStateChanged();
|
|
}
|
|
public async Task GetWorkerListbyfilter(string[] assignid, int[] locationid, string[] priorities, string[] statuses, string[] duedate, string search,string sort,string sortby)/*, string sortBy, string sortOrder*/
|
|
{
|
|
// _list = await _service.GetWorkOrderFilter(assignid, locationid, priorities,statuses, duedate,search,sort,sortby);/*, sortBy, sortOrder*/
|
|
//_list = _list.Where(w => assignid.Contains(w.AssignTo)).ToList();
|
|
NotifyStateChanged();
|
|
}
|
|
|
|
public void SetCopy(bool value)
|
|
{
|
|
isCopying = value;
|
|
NotifyStateChanged();
|
|
}
|
|
public void SetTemplatecreate(bool value)
|
|
{
|
|
iscreatetemplate = value;
|
|
NotifyStateChanged();
|
|
}
|
|
private void NotifyStateChanged() => OnStateChange?.Invoke();
|
|
}
|
|
// Assuming you have a caching service
|
|
public class CacheService
|
|
{
|
|
private Dictionary<string, object> _cache = new Dictionary<string, object>();
|
|
|
|
public void Set(string key, object value)
|
|
{
|
|
_cache[key] = value;
|
|
}
|
|
|
|
public T Get<T>(string key)
|
|
{
|
|
return _cache.TryGetValue(key, out var value) ? (T)value : default;
|
|
}
|
|
|
|
public void Remove(string key)
|
|
{
|
|
_cache.Remove(key);
|
|
}
|
|
|
|
public void Clear()
|
|
{
|
|
_cache.Clear();
|
|
}
|
|
}
|
|
|
|
}
|