sync
This commit is contained in:
@ -6,6 +6,7 @@ using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using Foresight.Data;
|
||||
using Foresight.Fleet.Services.User;
|
||||
using Foresight.Fleet.Services.AssetHealth;
|
||||
|
||||
namespace IronIntel.Contractor.Users
|
||||
{
|
||||
@ -83,7 +84,7 @@ namespace IronIntel.Contractor.Users
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<NavigateItem> GetMaintenanceNavigateItems(Tuple<Feature, Permissions>[] pmss)
|
||||
public List<NavigateItem> GetMaintenanceNavigateItems(Tuple<Feature, Permissions>[] pmss, UserInfo user)
|
||||
{
|
||||
List<NavigateItem> list = new List<NavigateItem>();
|
||||
|
||||
@ -117,6 +118,19 @@ namespace IronIntel.Contractor.Users
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.ALERTS_MANAGEMENT) != null)
|
||||
list.Add(item);
|
||||
|
||||
if (user.UserType == UserTypes.SupperAdmin)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_alertsmappings";
|
||||
item.FeatureID = Feature.ALERTS_MANAGEMENT;
|
||||
item.Title = "Alert Mappings";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "AlertsMapping.aspx";
|
||||
item.IconPath = "img/alert.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.ALERTS_MANAGEMENT) != null)
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_maintenanceschedule";
|
||||
item.FeatureID = Feature.PREVENTATIVE_MAINTENANCE;
|
||||
@ -249,7 +263,7 @@ namespace IronIntel.Contractor.Users
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.CURFEW_CONFIG) != null)
|
||||
list.Add(item);
|
||||
|
||||
if (user.UserType == UserTypes.SupperAdmin)
|
||||
if (!IronIntel.Contractor.SystemParams.IsDealer && user.UserType == UserTypes.SupperAdmin)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_curfewmt";
|
||||
@ -279,6 +293,16 @@ namespace IronIntel.Contractor.Users
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_ASSETS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_assethistory";
|
||||
item.FeatureID = Feature.MANAGE_ASSETS;
|
||||
item.Title = "Asset History";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "AssetHistory.aspx";
|
||||
item.IconPath = "img/workorderhis.png";
|
||||
if (pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_ASSETS) != null)
|
||||
list.Add(item);
|
||||
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_managrentals";
|
||||
item.FeatureID = Feature.MANAGE_ASSETS;
|
||||
@ -318,6 +342,18 @@ namespace IronIntel.Contractor.Users
|
||||
if (user.UserType >= UserTypes.Admin)
|
||||
list.Add(item);
|
||||
|
||||
bool license = SystemParams.HasLicense("ShareAsset");
|
||||
if (license && !SystemParams.IsDealer && pmss.FirstOrDefault(m => m.Item1.Id == Feature.MANAGE_DEVICES) != null)
|
||||
{
|
||||
item = new NavigateItem();
|
||||
item.ID = "nav_shareasset";
|
||||
item.Title = "Share Assets";
|
||||
item.Url = Url + "#" + item.ID;
|
||||
item.PageUrl = "ShareMachines.aspx";
|
||||
//item.IconPath = "img/model.png";
|
||||
list.Add(item);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ namespace IronIntel.Contractor.Users
|
||||
if (m.Id == FeatureModule.MODULE_JOBSITES)
|
||||
ami.SubItems = ami.GetJobsiteNavigateItems(pmss);
|
||||
else if (m.Id == FeatureModule.MODULE_ASSETHEALTH)
|
||||
ami.SubItems = ami.GetMaintenanceNavigateItems(pmss);
|
||||
ami.SubItems = ami.GetMaintenanceNavigateItems(pmss, user);
|
||||
else if (m.Id == FeatureModule.MODULE_SECURITY)
|
||||
ami.SubItems = ami.GetSecurityNavigateItems(pmss, user);
|
||||
else if (m.Id == FeatureModule.MODULE_MANAGEASSETS)
|
||||
@ -103,7 +103,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
string SQL = @"select w.IID,isnull(l.WorkSpaceName,w.WSPNAME) as WSPNAME,w.WSPDESCRIPTION from WORKSPACE w
|
||||
left join WorkSpaceLanguage l on w.IID=l.WorkspaceIID and l.LanguageCode='en-us'
|
||||
where (ISPUBLIC=1 or ISPUBLIC>10)";
|
||||
where (ISPUBLIC=1 or ISPUBLIC>10) or (ISPUBLIC=0 AND CREATER={0})";
|
||||
|
||||
FISqlConnection db = new FISqlConnection(SystemParams.FICDbConnectionString);
|
||||
if (user.UserType == UserTypes.Readonly)
|
||||
@ -114,7 +114,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
|
||||
|
||||
DataTable tb = db.GetDataTableBySQL(SQL);
|
||||
DataTable tb = db.GetDataTableBySQL(SQL, user.IID);
|
||||
List<AppModuleInfo> ls = new List<AppModuleInfo>();
|
||||
foreach (DataRow dr in tb.Rows)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
using FI.FIC;
|
||||
using FI.FIC.Contracts.DataObjects.BaseObject;
|
||||
using Foresight.Fleet.Services;
|
||||
using Foresight.Fleet.Services.Asset;
|
||||
using Foresight.Fleet.Services.JobSite;
|
||||
using Foresight.Fleet.Services.User;
|
||||
@ -15,16 +16,17 @@ namespace IronIntel.Contractor.Users
|
||||
{
|
||||
public class UserInfo
|
||||
{
|
||||
private static string[] ContactTypeNames = { "Foreman", "Driver", "Inventory Manager", "Rental Manager", "Service Manager", "Fleet Manager", "Technician", "Advisor", "Other" };
|
||||
public string IID { get; set; }
|
||||
public string ID { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public string TextAddress { get; set; }
|
||||
public string TextAddressDisplayText { get; set; }
|
||||
public bool IsUser { get; set; }
|
||||
public ContactTypes ContactType { get; set; }
|
||||
public string Mobile { get; set; }
|
||||
public string MobilePhoneDisplayText { get; set; }
|
||||
public string BusinessPhone { get; set; }
|
||||
public string BusinessPhoneDisplayText { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public bool Active { get; set; }
|
||||
public UserTypes UserType { get; set; }
|
||||
@ -58,15 +60,31 @@ namespace IronIntel.Contractor.Users
|
||||
public bool ExcelExports { get; set; }
|
||||
public LoginVerifyTypes LoginVerifyType { get; set; } = LoginVerifyTypes.OrganizationSetting;
|
||||
public UserInfo[] Managers { get; set; }
|
||||
public string ContactTypeName
|
||||
public string ContactTypeName { get; private set; }
|
||||
public void SetContactTypeName(string lang)
|
||||
{
|
||||
get
|
||||
{
|
||||
int cType = (int)ContactType;
|
||||
if (cType > 8)
|
||||
cType = 8;
|
||||
return ContactTypeNames[cType];
|
||||
}
|
||||
string cname = "";
|
||||
int cType = (int)ContactType;
|
||||
if (cType == 0)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_FOREMAN", "Foreman");
|
||||
else if (cType == 1)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_DRIVER", "Driver");
|
||||
else if (cType == 2)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_INVENTORYMANAGER", "Inventory Manager");
|
||||
else if (cType ==3)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_RENTALMANAGER", "Rental Manager");
|
||||
else if (cType == 4)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_SERVICEMANAGER", "Service Manager");
|
||||
else if (cType == 5)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_FLEETMANAGER", "Fleet Manager");
|
||||
else if (cType == 6)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_TECHNICIAN", "Technician");
|
||||
else if (cType == 7)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_ADVISOR", "Advisor");
|
||||
else if (cType > 8)
|
||||
cname = SystemParams.GetTextByKey(lang, "P_UM_OTHER", "Other");
|
||||
|
||||
ContactTypeName = cname;
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,7 +97,7 @@ namespace IronIntel.Contractor.Users
|
||||
public string UserAlertFilter { get; set; }
|
||||
|
||||
public EmailSchedule Schedule { get; set; }
|
||||
public StringKeyValue[] MessageTypes { get; set; }
|
||||
public MessageRestrictInfo[] MessageTypes { get; set; }
|
||||
public UserFilterTemplateItem[] FilterTemplates { get; set; }
|
||||
public int[] DeleteFilterTemplates { get; set; }
|
||||
}
|
||||
|
@ -17,7 +17,14 @@ namespace IronIntel.Contractor.Users
|
||||
{
|
||||
public static class UserManagement
|
||||
{
|
||||
public static UserInfo[] GetUsers(string companyid = null, string filter = null)
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="companyid"></param>
|
||||
/// <param name="filter"></param>
|
||||
/// <param name="lang">ContactTypeName需根据用户语言获取</param>
|
||||
/// <returns></returns>
|
||||
public static UserInfo[] GetUsers(string companyid = null, string filter = null, string lang = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -29,7 +36,7 @@ namespace IronIntel.Contractor.Users
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
UserInfo u = ConvertUserItem(user);
|
||||
UserInfo u = ConvertUserItem(user, lang);
|
||||
if (maps.ContainsKey(u.IID))
|
||||
u.GroupNames = maps[u.IID].ToArray();
|
||||
list.Add(u);
|
||||
@ -62,7 +69,7 @@ namespace IronIntel.Contractor.Users
|
||||
return result;
|
||||
}
|
||||
|
||||
public static UserInfo[] GetActiveUsers(string sessionid, string companyid = null)
|
||||
public static UserInfo[] GetActiveUsers(string lang, string sessionid, string companyid = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -71,12 +78,29 @@ namespace IronIntel.Contractor.Users
|
||||
foreach (var user in users)
|
||||
{
|
||||
if (user.Active)
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetSalespersons(string sessionid, string companyid = null, string filter = "")
|
||||
public static UserInfo[] GetAllFollowers(string lang, string sessionid, string companyid = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
var client = FleetServiceClientHelper.CreateClient<UserQueryClient>(companyid, sessionid);
|
||||
var users = client.GetUsersByCustomerID(companyid, "");
|
||||
var userattrs = client.GetUserAdditionalAttributeByCustomer(companyid);
|
||||
var followers = userattrs.Where(x => x.WorkOrderFollower).Select(x => x.UserIID);
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
if (user.Active && user.IsUser && followers.Contains(user.UID, StringComparer.OrdinalIgnoreCase))
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetSalespersons(string sessionid, string lang, string companyid = null, string filter = "")
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -87,20 +111,27 @@ namespace IronIntel.Contractor.Users
|
||||
if (user.Active)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filter))
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
else
|
||||
{
|
||||
if (user.ID.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0
|
||||
|| user.Name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0
|
||||
|| user.FOB.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static UserInfo ConvertUserItem(Foresight.Fleet.Services.User.UserInfo user)
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="lang">ContactTypeName需根据用户语言获取</param>
|
||||
/// <returns></returns>
|
||||
private static UserInfo ConvertUserItem(Foresight.Fleet.Services.User.UserInfo user, string lang = null)
|
||||
{
|
||||
if (user == null)
|
||||
return null;
|
||||
@ -111,9 +142,11 @@ namespace IronIntel.Contractor.Users
|
||||
u.UserType = (UserTypes)user.UserType;
|
||||
u.Active = user.Active;
|
||||
u.TextAddress = user.TextAddress;
|
||||
u.TextAddressDisplayText = user.TextAddressDisplayText;
|
||||
u.Mobile = user.Mobile;
|
||||
u.MobilePhoneDisplayText = user.MobilePhoneDisplayText;
|
||||
u.BusinessPhone = user.BusinessPhone;
|
||||
u.BusinessPhoneDisplayText = user.BusinessPhoneDisplayText;
|
||||
u.Notes = user.Remark;
|
||||
u.IsUser = user.IsUser;
|
||||
u.ContactType = (ContactTypes)user.ContactType;
|
||||
@ -135,6 +168,7 @@ namespace IronIntel.Contractor.Users
|
||||
if (!string.IsNullOrWhiteSpace(u.ManagerIID))
|
||||
u.Managers = new UserInfo[] { new UserInfo() { IID = u.ManagerIID, DisplayName = u.ManagerName } };
|
||||
|
||||
u.SetContactTypeName(string.IsNullOrWhiteSpace(lang) ? "en" : lang);
|
||||
return u;
|
||||
}
|
||||
|
||||
@ -172,7 +206,7 @@ namespace IronIntel.Contractor.Users
|
||||
return u;
|
||||
}
|
||||
|
||||
public static UserInfo[] GetUnmanagementUsers()
|
||||
public static UserInfo[] GetUnmanagementUsers(string lang)
|
||||
{
|
||||
var users = FleetServiceClientHelper.CreateClient<UserQueryClient>(SystemParams.CompanyID).GetUsersByCustomerID(SystemParams.CompanyID, "");
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
@ -180,7 +214,7 @@ namespace IronIntel.Contractor.Users
|
||||
{
|
||||
if (user.IsUser && user.UserType < Foresight.Fleet.Services.User.UserTypes.Admin)
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
}
|
||||
return list.ToArray();
|
||||
@ -522,7 +556,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
#region User Machines/Jobsite/MachineType/Department/Location
|
||||
|
||||
public static UserInfo[] GetUsersByAssetID(string sessionid, long assetid, string companyid)
|
||||
public static UserInfo[] GetUsersByAssetID(string sessionid, long assetid, string companyid, string lang)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -530,12 +564,12 @@ namespace IronIntel.Contractor.Users
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetWorkOrderAssignToUsers(string sessionid, string companyid, long assetid, int locid, int depid)
|
||||
public static UserInfo[] GetWorkOrderAssignToUsers(string sessionid, string companyid, long assetid, int locid, int depid, string lang)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -561,14 +595,14 @@ namespace IronIntel.Contractor.Users
|
||||
if (!user.AssignedWorkOrders && user.ContactType != Foresight.Fleet.Services.User.ContactTypes.Advisor) continue;
|
||||
if (depandlocusers == null || depandlocusers.Contains(user.UID, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
uids.Add(user.UID);
|
||||
}
|
||||
}
|
||||
return list.OrderBy(u => u.DisplayName).ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetUsersByAssets(string sessionid, long[] assetids, string companyid)
|
||||
public static UserInfo[] GetUsersByAssets(string sessionid, long[] assetids, string companyid, string lang)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -576,12 +610,12 @@ namespace IronIntel.Contractor.Users
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
public static UserInfo[] GetUsersByJobsiteID(string sessionid, long jsid, string companyid)
|
||||
public static UserInfo[] GetUsersByJobsiteID(string sessionid, string lang, long jsid, string companyid)
|
||||
{
|
||||
if (string.IsNullOrEmpty(companyid))
|
||||
companyid = SystemParams.CompanyID;
|
||||
@ -589,7 +623,7 @@ namespace IronIntel.Contractor.Users
|
||||
List<UserInfo> list = new List<UserInfo>();
|
||||
foreach (var user in users)
|
||||
{
|
||||
list.Add(ConvertUserItem(user));
|
||||
list.Add(ConvertUserItem(user, lang));
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ namespace IronIntel.Contractor.Users
|
||||
|
||||
private const string _MapViewSearches = "MapViewSearches";
|
||||
private const string _LandingPage = "LandingPage";
|
||||
private const string _BreadcrumbLocationSource = "BreadcrumbLocationSource";
|
||||
|
||||
public static UserParamInfo GetUserParams(string sessionid, string useriid)
|
||||
{
|
||||
@ -94,6 +95,9 @@ namespace IronIntel.Contractor.Users
|
||||
case _LandingPage:
|
||||
userParams.LandingPage = value;
|
||||
break;
|
||||
case _BreadcrumbLocationSource:
|
||||
userParams.BreadcrumbLocationSource = int.Parse(value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
userParams.MapViewSearches = GetMapViewSearches(sessionid, useriid);
|
||||
@ -110,10 +114,20 @@ namespace IronIntel.Contractor.Users
|
||||
else
|
||||
userParams.MapRefreshInterval = 60;
|
||||
userParams.MachineIconURL = SystemParams.MachineTypeMapViewIconUrl;
|
||||
userParams.MachineMovingIconURL = SystemParams.MachineMovingIconUrl;
|
||||
|
||||
var uc = FleetServiceClientHelper.CreateClient<UserQueryClient>();
|
||||
userParams.PreferredLanguage = uc.GetUserPreferredLanguageByIID(useriid);
|
||||
userParams.TimeZone = uc.GetUserTimeZoneByIID(useriid);
|
||||
if (userParams.BreadcrumbLocationSource < 0)//用户参数未设置,取系统参数
|
||||
{
|
||||
string locsourcestr = SystemParams.GetStringParam(_BreadcrumbLocationSource);
|
||||
int locsource = 0;
|
||||
int.TryParse(locsourcestr, out locsource);
|
||||
userParams.BreadcrumbLocationSource = locsource;
|
||||
}
|
||||
if (userParams.BreadcrumbLocationSource < 0)
|
||||
userParams.BreadcrumbLocationSource = 0;
|
||||
|
||||
return userParams;
|
||||
}
|
||||
@ -196,6 +210,10 @@ namespace IronIntel.Contractor.Users
|
||||
else
|
||||
db.ExecSQL(SQL_Delete, useriid, _LandingPage);
|
||||
|
||||
if (userParams.BreadcrumbLocationSource >= 0)
|
||||
db.ExecSQL(SQL, useriid, _BreadcrumbLocationSource, userParams.BreadcrumbLocationSource);
|
||||
else
|
||||
db.ExecSQL(SQL_Delete, useriid, _BreadcrumbLocationSource);
|
||||
}
|
||||
|
||||
public static string GetStringParameter(string useriid, string paramname)
|
||||
@ -251,7 +269,7 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
}
|
||||
|
||||
public static MapViewSearchItem[] SaveMapViewSearch(string sessionid, string useriid, MapViewSearchItem search)
|
||||
public static MapViewSearchItem[] SaveMapViewSearch(string sessionid, string useriid, MapViewSearchItem search, string lang)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<UserProfileProvider>(sessionid);
|
||||
string xmlstr = client.GetUserParams(SystemParams.CompanyID, useriid, _MapViewSearches);
|
||||
@ -269,8 +287,7 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
}
|
||||
searches.Add(search);
|
||||
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches).InnerXml);
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches, lang).InnerXml);
|
||||
return searches.OrderByDescending(s => s.IsDefault).ThenBy(s => s.Name).ToArray();
|
||||
}
|
||||
|
||||
@ -297,7 +314,7 @@ namespace IronIntel.Contractor.Users
|
||||
return result.ToArray();
|
||||
}
|
||||
|
||||
public static MapViewSearchItem[] DeleteMapViewSearch(string sessionid, string useriid, string searchName)
|
||||
public static MapViewSearchItem[] DeleteMapViewSearch(string sessionid, string useriid, string searchName, string lang)
|
||||
{
|
||||
var client = FleetServiceClientHelper.CreateClient<UserProfileProvider>(sessionid);
|
||||
string xmlstr = client.GetUserParams(SystemParams.CompanyID, useriid, _MapViewSearches);
|
||||
@ -306,7 +323,7 @@ namespace IronIntel.Contractor.Users
|
||||
if (item != null)// remove it
|
||||
searches.Remove(item);
|
||||
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches).InnerXml);
|
||||
client.SetUserParam(SystemParams.CompanyID, useriid, _MapViewSearches, MapViewSearcheHelper.ToXml(searches, lang).InnerXml);
|
||||
return searches.OrderByDescending(s => s.IsDefault).ThenBy(s => s.Name).ToArray();
|
||||
}
|
||||
|
||||
@ -330,6 +347,7 @@ namespace IronIntel.Contractor.Users
|
||||
public string SystemStyleID { get; set; }
|
||||
public int MapRefreshInterval { get; set; }
|
||||
public string MachineIconURL { get; set; }
|
||||
public string MachineMovingIconURL { get; set; }
|
||||
public string AssetDefaultSearch { get; set; }
|
||||
public string JobSiteDefaultSearch { get; set; }
|
||||
public string AssetGroupDefaultSearch { get; set; }
|
||||
@ -344,6 +362,7 @@ namespace IronIntel.Contractor.Users
|
||||
public string LandingPage { get; set; }
|
||||
public string PreferredLanguage { get; set; }
|
||||
public string TimeZone { get; set; }
|
||||
public int BreadcrumbLocationSource { get; set; } = -1;
|
||||
}
|
||||
|
||||
public class MapViewSearcheHelper
|
||||
@ -398,7 +417,7 @@ namespace IronIntel.Contractor.Users
|
||||
}
|
||||
return item;
|
||||
}
|
||||
public static XmlDocument ToXml(List<MapViewSearchItem> searches)
|
||||
public static XmlDocument ToXml(List<MapViewSearchItem> searches, string lang)
|
||||
{
|
||||
XmlDocument doc = XmlHelper.CreateXmlDocument();
|
||||
XmlNode node = XmlHelper.AppendChildNode(doc.DocumentElement, "Searches", "");
|
||||
@ -409,7 +428,7 @@ namespace IronIntel.Contractor.Users
|
||||
var sn = AddSubNode(node, "Search", "");
|
||||
|
||||
AddSubNode(sn, "Name", search.Name);
|
||||
AddSubNode(sn, "IsDefault", search.IsDefault ? "Yes" : "No");
|
||||
AddSubNode(sn, "IsDefault", search.IsDefault ? SystemParams.GetTextByKey(lang, "P_UTILITY_YES", "Yes") : SystemParams.GetTextByKey(lang, "P_UTILITY_NO", "No"));
|
||||
if (!string.IsNullOrEmpty(search.AssetDefaultSearch))
|
||||
AddSubNode(sn, "AssetDefaultSearch", search.AssetDefaultSearch);
|
||||
if (!string.IsNullOrEmpty(search.JobSiteDefaultSearch))
|
||||
|
Reference in New Issue
Block a user