sync
This commit is contained in:
		| @@ -288,11 +288,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                         return new string[] { req.Assets[0].DispatchId.ToString(), "OK" }; | ||||
|                     } | ||||
|  | ||||
|                     return "Failed"; | ||||
|                     return FailedResult; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     return "Failed"; | ||||
|                     return FailedResult; | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
| @@ -316,11 +316,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                     long id = Convert.ToInt64(kv.Key); | ||||
|  | ||||
|                     CreateClient<JobSiteDispatchProvider>().DeleteRequirment(SystemParams.CompanyID, id, kv.Value); | ||||
|                     return "OK"; | ||||
|                     return OkResult; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     return "Failed"; | ||||
|                     return FailedResult; | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
| @@ -429,18 +429,22 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                 var session = GetCurrentLoginSession(); | ||||
|                 if (session != null) | ||||
|                 { | ||||
|                     var clientdata = Request.Form["ClientData"]; | ||||
|                     bool activeonly = clientdata == "1"; | ||||
|  | ||||
|                     JobSitesAndRegionsItem item = new JobSitesAndRegionsItem(); | ||||
|  | ||||
|                     MapViewJobSiteInfo[] jss = CreateClient<MapViewQueryClient>().GetAvailableJobSites(SystemParams.CompanyID, session.User.UID, string.Empty, false); | ||||
|                     //MapViewJobSiteInfo[] jss = CreateClient<MapViewQueryClient>().GetAvailableJobSites(SystemParams.CompanyID, session.User.UID, string.Empty, false); | ||||
|                     JobSiteItem[] jss = CreateClient<JobSiteProvider>().GetJobSiteItems(SystemParams.CompanyID, "", null, activeonly); | ||||
|                     List<StringKeyValue> list = new List<StringKeyValue>(); | ||||
|                     foreach (MapViewJobSiteInfo js in jss) | ||||
|                     foreach (JobSiteItem js in jss) | ||||
|                     { | ||||
|                         StringKeyValue kv = new StringKeyValue(); | ||||
|                         kv.Key = js.ID.ToString(); | ||||
|                         kv.Value = js.Name; | ||||
|                         kv.Tag1 = js.StartDate == null ? "" : js.StartDate.Value.ToShortDateString(); | ||||
|                         kv.Tag2 = js.EndDate == null ? "" : js.EndDate.Value.ToShortDateString(); | ||||
|                         kv.Tag3 = js.ReginId.ToString(); | ||||
|                         kv.Tag3 = js.RegionId.ToString(); | ||||
|                         list.Add(kv); | ||||
|                     } | ||||
|  | ||||
| @@ -482,12 +486,15 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                 if (session != null) | ||||
|                 { | ||||
|                     MachineTypeItem[] types = JobSitesManagement.GetMachineTypes(); | ||||
|                     var typesinuse = CreateClient<AssetDataAdjustClient>().GetAssetTypesInUse(SystemParams.CompanyID); | ||||
|  | ||||
|                     List<StringKeyValue> list = new List<StringKeyValue>(); | ||||
|                     foreach (MachineTypeItem type in types) | ||||
|                     { | ||||
|                         StringKeyValue kv = new StringKeyValue(); | ||||
|                         kv.Key = type.ID.ToString(); | ||||
|                         kv.Value = type.Name; | ||||
|                         kv.Tag1 = typesinuse.Contains(type.ID) ? "1" : "0"; | ||||
|                         list.Add(kv); | ||||
|                     } | ||||
|  | ||||
| @@ -631,6 +638,7 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                         HasSchedule = selMinDate != DateTime.MaxValue, | ||||
|                         BeginDate = selMinDate, | ||||
|                         TotalDays = selMinDate != DateTime.MaxValue ? (selMaxDate - selMinDate).Days + 1 : 0, | ||||
|                         RelatedRequirementAssets = reqinfo.RelatedRequirementAssets, | ||||
|                         DispatchAssets = items | ||||
|                     }; | ||||
|                 } | ||||
| @@ -654,11 +662,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                     var clientdata = Request.Form["ClientData"]; | ||||
|                     clientdata = HttpUtility.HtmlDecode(clientdata); | ||||
|                     UserParams.SetStringParameter(session.User.UID, "RequirmentsDefault", clientdata); | ||||
|                     return "OK"; | ||||
|                     return OkResult; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     return "Failed"; | ||||
|                     return FailedResult; | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
| @@ -717,6 +725,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                     { | ||||
|                         JobSiteAssetDispatchItem item = new JobSiteAssetDispatchItem(); | ||||
|                         Helper.CloneProperty(item, re); | ||||
|                         if (!item.Completed) | ||||
|                         { | ||||
|                             item.CompletedTime = null; | ||||
|                             item.CompletedBy = ""; | ||||
|                         } | ||||
|                         ls.Add(item); | ||||
|                     } | ||||
|  | ||||
| @@ -830,11 +843,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                         disids = item.ObjectIDs; | ||||
|  | ||||
|                     CreateClient<JobSiteDispatchProvider>().AssignDispatch(SystemParams.CompanyID, disids, item.AssetID); | ||||
|                     return "OK"; | ||||
|                     return OkResult; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     return "Failed"; | ||||
|                     return FailedResult; | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
| @@ -854,9 +867,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                     var clientdata = Request.Form["ClientData"].Split((char)170); | ||||
|                     var id = HttpUtility.HtmlDecode(clientdata[0]); | ||||
|                     var data = HttpUtility.HtmlDecode(clientdata[1]); | ||||
|                     var disassetsstr = HttpUtility.HtmlDecode(clientdata[2]); | ||||
|                     JobSiteAssetDispatchInfo[] assts = JsonConvert.DeserializeObject<JobSiteAssetDispatchInfo[]>(data); | ||||
|                     DispatchAssetInfo[] disassets = JsonConvert.DeserializeObject<DispatchAssetInfo[]>(disassetsstr); | ||||
|  | ||||
|                     long[] dispatchids = CreateClient<JobSiteDispatchProvider>().AddDispatch(SystemParams.CompanyID, Convert.ToInt64(id), assts); | ||||
|                     long[] dispatchids = CreateClient<JobSiteDispatchProvider>().AddDispatch(SystemParams.CompanyID, Convert.ToInt64(id), assts, disassets); | ||||
|  | ||||
|                     return dispatchids; | ||||
|                 } | ||||
| @@ -897,11 +912,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                     { | ||||
|                     } | ||||
|  | ||||
|                     return "OK"; | ||||
|                     return OkResult; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     return "Failed"; | ||||
|                     return FailedResult; | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
| @@ -924,11 +939,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                     DispatchItem item = JsonConvert.DeserializeObject<DispatchItem>(clientdata); | ||||
|  | ||||
|                     CreateClient<JobSiteDispatchProvider>().DeleteDispatch(SystemParams.CompanyID, item.DispatchId, item.DeleteNotes); | ||||
|                     return "OK"; | ||||
|                     return OkResult; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     return "Failed"; | ||||
|                     return FailedResult; | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
| @@ -962,11 +977,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|  | ||||
|                     SendDispatchRequest(items, si); | ||||
|  | ||||
|                     return "OK"; | ||||
|                     return OkResult; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     return "Failed"; | ||||
|                     return FailedResult; | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
| @@ -1056,11 +1071,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                     bool compeleted = Helper.IsTrue(kv.Value); | ||||
|                     CreateClient<JobSiteDispatchProvider>().UpdateDispatchCompleted(SystemParams.CompanyID, dispatchid, compeleted, user.IID); | ||||
|  | ||||
|                     return "OK"; | ||||
|                     return OkResult; | ||||
|                 } | ||||
|                 else | ||||
|                 { | ||||
|                     return "Failed"; | ||||
|                     return FailedResult; | ||||
|                 } | ||||
|             } | ||||
|             catch (Exception ex) | ||||
| @@ -1079,7 +1094,7 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                     string clientdata = HttpUtility.HtmlDecode(Request.Form["ClientData"]); | ||||
|                     long[] ps = JsonConvert.DeserializeObject<long[]>(clientdata); | ||||
|  | ||||
|                     var items = UserManagement.GetUsersByAssets(session.SessionID, ps, SystemParams.CompanyID); | ||||
|                     var items = UserManagement.GetUsersByAssets(session.SessionID, ps, SystemParams.CompanyID, GetLanguageCookie()); | ||||
|                     return items; | ||||
|                 } | ||||
|                 else | ||||
| @@ -1116,11 +1131,11 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|  | ||||
|                     if (!DateTime.TryParse(ps[6], out endDate)) | ||||
|                         endDate = DateTime.MaxValue; | ||||
|                     bool unscheduled = ps[7] == "1"; | ||||
|                     int scheduled = Convert.ToInt32(ps[7]); | ||||
|  | ||||
|                     DispatchAssetInfo[] infos = CreateClient<JobSiteDispatchProvider>().GetAssetSchedulers(SystemParams.CompanyID, jss, regions, assetGroups, assetTypes, beginDate, endDate, unscheduled, searchtxt); | ||||
|                     DispatchAssetInfo[] infos = CreateClient<JobSiteDispatchProvider>().GetAssetSchedulers(SystemParams.CompanyID, jss, regions, assetGroups, assetTypes, beginDate, endDate, scheduled, searchtxt); | ||||
|  | ||||
|                     var items = DispatchAssetItem.Convert(infos, beginDate, endDate).OrderBy(m => m.AssetName).ToArray(); | ||||
|                     var items = DispatchAssetItem.Convert(infos, beginDate, endDate, true).OrderBy(m => m.AssetName).ToArray(); | ||||
|                     if (items.Count() == 0) | ||||
|                         return null; | ||||
|  | ||||
| @@ -1216,8 +1231,15 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|             public int ConflictDays { get; set; } | ||||
|             public DateTime? BeginDate { get; set; } | ||||
|             public DateTime? EndDate { get; set; } | ||||
|             public DateTime? StartDate { get; set; } | ||||
|             public DateTime? FinishDate { get; set; } | ||||
|             public string NextJobSite { get; set; } | ||||
|             public int DurationDays { get; set; } | ||||
|             public string BeginDateStr { get { return BeginDate == null ? "" : BeginDate.Value.ToString("M/d/yyyy"); } } | ||||
|             public string EndDateStr { get { return EndDate == null ? "" : EndDate.Value.ToString("M/d/yyyy"); } } | ||||
|             public string StartDateStr { get { return StartDate == null ? "" : StartDate.Value.ToString("M/d/yyyy"); } } | ||||
|             public string FinishDateStr { get { return FinishDate == null ? "" : FinishDate.Value.ToString("M/d/yyyy"); } } | ||||
|  | ||||
|             public string DistanceStr | ||||
|             { | ||||
|                 get | ||||
| @@ -1266,7 +1288,7 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             public static DispatchAssetItem[] Convert(IEnumerable<DispatchAssetInfo> infos, DateTime begindate, DateTime enddate) | ||||
|             public static DispatchAssetItem[] Convert(IEnumerable<DispatchAssetInfo> infos, DateTime begindate, DateTime enddate, bool schedulerlist = false) | ||||
|             { | ||||
|                 List<DispatchAssetItem> items = new List<DispatchAssetItem>(); | ||||
|                 foreach (var i in infos) | ||||
| @@ -1277,6 +1299,7 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                         item.DistanceToDestJobSite = Math.Round(item.DistanceToDestJobSite.Value, 2); | ||||
|                     if (begindate > DateTime.Now.AddYears(-5) && enddate < DateTime.Now.AddYears(5)) | ||||
|                         item.ConflictDays = GetConflictDays(i, begindate, enddate); | ||||
|                     item.AttachedAssets.AddRange(i.AttachedAssets); | ||||
|                     foreach (var s in i.Schedules) | ||||
|                     { | ||||
|                         AssetScheduleItem si = new AssetScheduleItem(); | ||||
| @@ -1284,6 +1307,17 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|                         item.Schedules.Add(si); | ||||
|                     } | ||||
|                     item.ComputeSchedules(); | ||||
|                     if (schedulerlist) | ||||
|                     { //schedulerlist | ||||
|                         if (item.Schedules.Count > 0) | ||||
|                         { | ||||
|                             var sch = item.Schedules[0]; | ||||
|                             item.StartDate = sch.BeginDate; | ||||
|                             item.FinishDate = sch.EndDate; | ||||
|                             item.NextJobSite = sch.JobSiteName; | ||||
|                             item.DurationDays = (sch.EndDate - sch.BeginDate).Days + 1; | ||||
|                         } | ||||
|                     } | ||||
|                     items.Add(item); | ||||
|                 } | ||||
|  | ||||
|   | ||||
| @@ -192,7 +192,10 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|             { | ||||
|                 if (GetCurrentLoginSession() != null) | ||||
|                 { | ||||
|                     var jss = CreateClient<JobSiteProvider>().GetJobSiteItems(SystemParams.CompanyID, "", null, true); | ||||
|                     var companyid = Request.Form["ClientData"]; | ||||
|                     if (string.IsNullOrEmpty(companyid)) | ||||
|                         companyid = SystemParams.CompanyID; | ||||
|                     var jss = CreateClient<JobSiteProvider>().GetJobSiteItems(companyid, "", null, true); | ||||
|                     var js = jss.OrderBy(g => g.Name).Select(i => new | ||||
|                     { | ||||
|                         i.ID, | ||||
| @@ -695,7 +698,7 @@ namespace IronIntel.Contractor.Site.JobSite | ||||
|             { | ||||
|                 if (GetCurrentLoginSession() != null) | ||||
|                 { | ||||
|                     Users.UserInfo[] items = UserManagement.GetUsers(null, string.Empty); | ||||
|                     Users.UserInfo[] items = UserManagement.GetUsers(string.Empty, string.Empty, GetLanguageCookie()); | ||||
|                     items = items.Where(m => m.Active).OrderBy(u => u.ID).ToArray(); | ||||
|                     return items; | ||||
|                 } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user