public IActionResult Index(string id) { //new virtual list VirtualList v = new VirtualList(); try { long booking_number = long.Parse(id); //get the booking data Parcels parcels = db.parcel.Where(x => x.cid == booking_number).FirstOrDefault(); //get the tracking data List <Booking_Statuss> bs = db.booking_status.Where(x => x.booking_id == booking_number).AsNoTracking().OrderByDescending(x => x.status_id).ToList(); v.parcels = parcels; //complete tracking history with status title //join between status id and status ViewBag.list = from b in bs join s in db.status_list.AsNoTracking().ToList() on b.status equals s.id into table1 from s in table1 select new VirtualList { status_lists = s, booking_Statuss = b }; } catch (Exception e) { ViewBag.msg = "no record found" + e.Message; } return(View(v)); }
public bool CanRunScript(UGUI agent, Vector3 location, UUID scriptassetid) { ParcelInfo pinfo; if (!Parcels.TryGetValue(location, out pinfo)) { return(false); } if ((pinfo.Flags & ParcelFlags.AllowOtherScripts) != 0) { return(true); } else if (agent.EqualsGrid(pinfo.Owner) || IsPossibleGod(agent)) { return(true); } else if ((pinfo.Flags & ParcelFlags.AllowGroupScripts) != 0 && pinfo.Group.IsSet && IsGroupMember(agent, pinfo.Group)) { return(true); } else if (WhiteListedRunScriptAssetIds.Contains(scriptassetid)) { return(true); } else { return(false); } }
public void SendExperienceLog(IAgent agent, ObjectGroup grp, ExperienceLogType permissions, UUID experienceID) { var gm = new GenericMessage { Method = "ExperienceEvent", Invoice = experienceID, SessionID = UUID.Zero, AgentID = agent.ID }; var llsd = new Map { { "OwnerID", grp.Owner.ID }, { "Permission", (int)permissions }, { "IsAttachment", grp.IsAttached } }; using (var ms = new MemoryStream()) { LlsdXml.Serialize(llsd, ms); gm.ParamList.Add(ms.ToArray()); } gm.ParamList.Add((grp.Name + "\0").ToUTF8Bytes()); ParcelInfo pInfo; if (!grp.IsAttached && Parcels.TryGetValue(grp.GlobalPosition, out pInfo)) { gm.ParamList.Add((pInfo.Name + "\0").ToUTF8Bytes()); } agent.SendMessageAlways(gm, ID); }
List <ParcelDiscounts> GetDiscountForParcelCode(ParcelCode code, int discountSet) { var discounts = new List <ParcelDiscounts>(); var groupedParcels = Parcels .Where(parcel => parcel.Type.Code == code) .OrderBy(parcel => parcel.TotalPrice) .ToList(); var numberOfRequiredDiscounts = (int)Math.Floor((double)groupedParcels.Count / discountSet); var offset = 0; while (discounts.Count < numberOfRequiredDiscounts) { var discount = new ParcelDiscounts { DiscountedParcel = groupedParcels[offset], Parcels = groupedParcels.GetRange(offset, discountSet), Value = groupedParcels[offset].TotalPrice }; discounts.Add(discount); offset = offset + discountSet; } return(discounts); }
public IActionResult Index(Parcels parcel_data) { Customers customer = db.customer.Where(x => x.customer_id == parcel_data.customer_id).FirstOrDefault(); if (customer == null) { ViewBag.msg = "Customer not found"; } else { parcel_data.customer_id = 1; parcel_data.consignee = "sdds"; parcel_data.consignee_address = "sdsds"; parcel_data.destination = "sdsada"; parcel_data.phone = "2232"; parcel_data.weight = 1; parcel_data.cod = 1; db.parcel.Add(parcel_data); db.SaveChanges(); Parcels parcel_latest = db.parcel.Where(x => x.customer_id == parcel_data.customer_id && x.consignee == parcel_data.consignee && x.destination == parcel_data.destination).OrderByDescending(x => x.cid).FirstOrDefault(); Booking_Statuss bs = new Booking_Statuss(); bs.booking_id = parcel_latest.cid; bs.status = 1; bs.date = DateTime.Now; bs.time = DateTime.Now.ToShortTimeString(); db.booking_status.Add(bs); db.SaveChanges(); ViewBag.msg = "Booking Number: " + parcel_latest.cid; } return(View()); }
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) { base.OnActivityResult(requestCode, resultCode, data); switch (requestCode) { case REQ_DETAIL: { if (resultCode != Result.Ok) { return; } var session = Parcels.Unwrap <Session>(data.GetParcelableExtra(typeof(Session).Name) as IParcelable); statusChangedSessions.Add(session); break; } case REQ_SEARCH_PLACES_AND_CATEGORIES_VIEW: { if (resultCode != Result.Ok) { return; } var sessions = Parcels.Unwrap <IList <Session> >(data.GetParcelableExtra(RESULT_STATUS_CHANGED_SESSIONS) as IParcelable); statusChangedSessions.AddAll(sessions); break; } } }
/// <summary> /// Отменяет все внесенные изменения /// </summary> protected void UndoChanges() { if (!SaveUndoCommandCanExecute) { return; } //Помечаем к удалению записи, которые больше не связаны с земельным участком DeleteDetailRecordTogetherRelationship(); //Удаляем из кэша участков добавленные в данном сеансе редактирования var addParcel = ContextDb.ChangeTracker.Entries <Parcelle>().Where(p => p.State == EntityState.Added); foreach (var del in addParcel) { Parcels.Remove(del.Entity); } //Отменяем все изменения в БД ContextDb.DiscardAllChanges(); //Возвращаем из кэша удаленные земельные участки foreach (var del in ParcelsDelete) { Parcels.Add(del); } ParcelsDelete.Clear(); //Уведомляем об изменении свойств RaisePropertyChanged(nameof(Parcels)); RaisePropertyChanged(nameof(ParcelsViewSource)); }
public bool IsParcelClaimable(int start_x, int start_y, int end_x, int end_y) { ParcelInfo pInfo; if (!Parcels.TryGetValue(new Vector3(start_x, start_y, 0), out pInfo)) { return(false); } ParcelInfo.ParcelDataLandBitmap bmap = pInfo.LandBitmap; if (!bmap[start_x, end_y - 1] || !bmap[end_x - 1, start_x] || !bmap[end_x - 1, end_y - 1]) { /* not dividable */ return(false); } start_x &= (~3); start_y &= (~3); end_x &= (~3); end_y &= (~3); for (int py = start_y; py < end_y; py += 4) { for (int px = start_x; px < end_x; px += 4) { if (!bmap[px, py]) { return(false); } } } return(true); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Delivery_address,Parcel_weight,Content_type,Shipping_cost,SendersId,CompaniesId,RecieversId")] Parcels parcels) { if (id != parcels.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(parcels); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ParcelsExists(parcels.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CompaniesId"] = new SelectList(_context.Companies, "Id", "Email_Id", parcels.CompaniesId); ViewData["RecieversId"] = new SelectList(_context.Recievers, "Id", "Email_Id", parcels.RecieversId); ViewData["SendersId"] = new SelectList(_context.Senders, "Id", "Email_Id", parcels.SendersId); return(View(parcels)); }
public static Intent CreateIntent(Context context, ISearchGroup searchGroup) { Intent intent = new Intent(context, typeof(SearchedSessionsActivity)); intent.PutExtra(typeof(ISearchGroup).Name, Parcels.Wrap(searchGroup)); return(intent); }
private static Intent CreateIntent(Context context, Session session) { var intent = new Intent(context, typeof(SessionDetailActivity)); intent.PutExtra(typeof(Session).Name, Parcels.Wrap(session)); return(intent); }
public void HandleParcelDwellRequest(Message m) { var req = (ParcelDwellRequest)m; if (req.AgentID != req.CircuitAgentID || req.SessionID != req.CircuitSessionID) { return; } IAgent agent; if (!Agents.TryGetValue(req.AgentID, out agent)) { return; } ParcelInfo pInfo; if (Parcels.TryGetValue(req.LocalID, out pInfo)) { var reply = new ParcelDwellReply { AgentID = req.AgentID, LocalID = req.LocalID, ParcelID = new ParcelID(GetRegionInfo().Location, pInfo.ParcelBasePosition), Dwell = pInfo.Dwell }; agent.SendMessageAlways(reply, ID); } }
private void SetResult() { var intent = new Intent(); intent.PutExtra(typeof(Session).Name, Parcels.Wrap(session)); Activity.SetResult(Result.Ok, intent); }
public async override void RefreshView() { Heading = string.Format("Detailed CGT Report for {0}/{1} Financial Year", _Parameter.FinancialYear - 1, _Parameter.FinancialYear); DetailedUnrealisedGainsResponse response; if (_Parameter.Stock.Id == Guid.Empty) { response = await _Parameter.RestClient.Portfolio.GetDetailedCapitalGains(_Parameter.Date); } else { response = await _Parameter.RestClient.Holdings.GetDetailedCapitalGains(_Parameter.Stock.Id, _Parameter.Date); } if (response == null) { return; } Parcels.Clear(); foreach (var item in response.UnrealisedGains.OrderBy(x => x.Stock.Name).ThenBy(x => x.AquisitionDate)) { Parcels.Add(new ParcelCostBaseViewItem(item)); } OnPropertyChanged(""); }
public bool CrossesParcelBoundary(IObject obj, Vector3 newPos, out ParcelInfo toParcel) { ParcelInfo fromParcel; return(Parcels.TryGetValue(newPos, out toParcel) && Parcels.TryGetValue(obj.GlobalPosition, out fromParcel) && fromParcel.LocalID != toParcel.LocalID); }
public IActionResult Index(Parcels parcel, string status, string search) { ViewBag.status_combo = db.status_list.AsNoTracking().ToList(); List <VirtualList> v = new List <VirtualList>(); if (search == "Search") { List <Parcels> parcels = new List <Parcels>(); if (parcel.cid == 0 && parcel.destination == null) { parcels = db.parcel.AsNoTracking().ToList(); } else if (parcel.cid != 0 && parcel.destination == null) { parcels = db.parcel.Where(x => x.cid == parcel.cid).AsNoTracking().ToList(); } else if (parcel.cid == 0 && parcel.destination != null) { parcels = db.parcel.Where(x => x.destination == parcel.destination).AsNoTracking().ToList(); } else if (parcel.cid != 0 && parcel.destination != null) { parcels = db.parcel.Where(x => x.cid == parcel.cid && x.destination == parcel.destination).AsNoTracking().ToList(); } if (status == "0") { var vi = from p in parcels join c in db.customer.AsNoTracking().ToList() on p.customer_id equals c.customer_id into table1 from c in table1 join st in db.booking_status.AsNoTracking().ToList() on p.cid equals st.booking_id into table2 from st in table2.OrderByDescending(x => x.status_id).Take(1) join s in db.status_list.AsNoTracking().ToList() on st.status equals s.id into table3 from s in table3 select new VirtualList { customers = c, parcels = p, status_lists = s }; v = vi.ToList(); } else { int status_id = int.Parse(status); var vi = from p in parcels join c in db.customer.AsNoTracking().ToList() on p.customer_id equals c.customer_id into table1 from c in table1 join st in db.booking_status.AsNoTracking().ToList() on p.cid equals st.booking_id into table2 from st in table2.OrderByDescending(x => x.status_id).Take(1).Where(x => x.status == status_id) join s in db.status_list.AsNoTracking().ToList() on st.status equals s.id into table3 from s in table3 select new VirtualList { customers = c, parcels = p, status_lists = s }; v = vi.ToList(); } } return(View(v)); }
public static SearchedSessionsFragment NewInstance(ISearchGroup searchGroup) { var fragment = new SearchedSessionsFragment(); var bundle = new Bundle(); bundle.PutParcelable(typeof(ISearchGroup).Name, Parcels.Wrap(searchGroup)); fragment.Arguments = bundle; return(fragment); }
public static SessionsTabFragment NewInstance(IList <Session> sessions) { var fragment = new SessionsTabFragment(); var args = new Bundle(); args.PutParcelable(ARG_SESSIONS, Parcels.Wrap(sessions)); fragment.Arguments = args; return(fragment); }
public static SessionDetailFragment Create(Session session) { var fragment = new SessionDetailFragment(); var args = new Bundle(); args.PutParcelable(typeof(Session).Name, Parcels.Wrap(session)); fragment.Arguments = args; return(fragment); }
public override void Finish() { var intent = new Intent(); intent.PutExtra(RESULT_STATUS_CHANGED_SESSIONS, Parcels.Wrap(statusChangedSessions)); SetResult(Result.Ok, intent); OverridePendingTransition(0, Resource.Animation.activity_fade_exit); base.Finish(); }
public bool CanTakeCopy(IAgent agent, ObjectGroup group, Vector3 location) { UGUI agentOwner = agent.Owner; UGUI groupOwner = group.Owner; if (IsPossibleGod(agentOwner)) { return(true); } /* deny modification of admin objects by non-admins */ else if (IsPossibleGod(groupOwner)) { return(false); } /* check locked state */ if (group.RootPart.IsLocked) { return(false); } /* check object owner */ if (agentOwner.EqualsGrid(groupOwner)) { } else if (group.IsAttached) { /* others should not be able to edit attachments */ return(false); } var checkMask = InventoryPermissionsMask.Copy; if (!agentOwner.EqualsGrid(groupOwner)) { checkMask |= InventoryPermissionsMask.Transfer; } ParcelInfo pinfo; if (Parcels.TryGetValue(location, out pinfo) && pinfo.Owner.EqualsGrid(agentOwner) && ParcelOwnerIsAdmin) { return(true); } if (group.RootPart.CheckPermissions(agentOwner, group.Group, checkMask)) { return(true); } else if ((group.RootPart.EveryoneMask & InventoryPermissionsMask.Copy) != 0) { return(true); } return(false); }
public void HandleParcelDisableObjects(Message m) { var req = (ParcelReturnObjects)m; if (req.AgentID != req.CircuitAgentID || req.SessionID != req.CircuitSessionID) { return; } ParcelInfo pinfo = null; IAgent agent; var returnlist = new List <UUID>(); if (Agents.TryGetValue(req.AgentID, out agent) && (req.LocalID == -1 || Parcels.TryGetValue(req.LocalID, out pinfo))) { foreach (Object.ObjectGroup grp in ObjectGroups) { if (grp.IsAttached) { continue; } if (pinfo != null && !pinfo.LandBitmap.ContainsLocation(grp.GlobalPosition)) { continue; } bool isOwner = grp.Owner.EqualsGrid(pinfo.Owner); if (!CanReturn(agent, grp, grp.GlobalPosition)) { continue; } if (((req.ReturnType & ObjectReturnType.Owner) != 0 && isOwner) || ((req.ReturnType & ObjectReturnType.Other) != 0 && !isOwner) || ((req.ReturnType & ObjectReturnType.Group) != 0 && grp.Group == pinfo.Group) || ((req.ReturnType & ObjectReturnType.Sell) != 0 && grp.SaleType != InventoryItem.SaleInfoData.SaleType.NoSale) || ((req.ReturnType & ObjectReturnType.List) != 0 && req.TaskIDs.Contains(grp.ID)) || ((req.ReturnType & ObjectReturnType.List) != 0 && req.OwnerIDs.Contains(grp.Owner.ID))) { foreach (ObjectPart part in grp.Values) { foreach (ObjectPartInventoryItem item in part.Inventory.Values) { ScriptInstance instance = item.ScriptInstance; if (item.ScriptInstance != null) { item.ScriptInstance.IsRunning = false; } } } } } } }
public bool CanReturn(UGUI agentOwner, ObjectGroup group, Vector3 location) { UGUI groupOwner = group.Owner; if (IsPossibleGod(agentOwner)) { return(true); } /* deny modification of admin objects by non-admins */ else if (IsPossibleGod(groupOwner)) { return(false); } /* check locked state */ if (group.RootPart.IsLocked) { return(false); } /* check object owner */ if (agentOwner.EqualsGrid(groupOwner)) { return(true); } else if (group.IsAttached) { /* others should not be able to edit attachments */ return(false); } #warning Add Friends Rights to CanReturn? if (HasGroupPower(agentOwner, group.Group, GroupPowers.ReturnGroupSet) || (group.IsGroupOwned && HasGroupPower(agentOwner, group.Group, GroupPowers.ReturnGroupOwned))) { return(true); } ParcelInfo pinfo; if (Parcels.TryGetValue(location, out pinfo)) { if (pinfo.Owner.EqualsGrid(agentOwner)) { return(true); } if (!pinfo.Group.Equals(group.Group) && HasGroupPower(agentOwner, pinfo.Group, GroupPowers.ReturnNonGroup)) { return(true); } } return(false); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); binding = SessionDetailActivityBinding.SetContentView(this, Resource.Layout.activity_session_detail); MainApplication.GetComponent(this).Inject(this); session = Parcels.Unwrap <Session>(Intent.GetParcelableExtra(typeof(Session).Name) as IParcelable); ReplaceFragment(SessionDetailFragment.Create(session)); }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); session = Parcels.Unwrap <Session>(Arguments.GetParcelable(typeof(Session).Name) as IParcelable); if (Build.VERSION.SdkInt >= Build.VERSION_CODES.Lollipop) { // Change theme by category Activity.SetTheme(session.category.GetThemeResId()); } }
public void CountParcels(bool on) { if (on) { Parcels.ForEach(r => Factors.Add(r)); } else { Parcels.ForEach(r => Factors.Remove(r)); } }
public void AddParcel(Parcel parcel) { if (parcel is null) { throw new DomainValidationException($"Parameter {nameof(parcel)} cannot be null"); } Parcels.Add(parcel); SetUpdateDate(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); binding = SearchedSessionsActivityBinding.SetContentView(this, Resource.Layout.activity_searched_sessions); MainApplication.GetComponent(this).Inject(this); var searchGroup = Parcels.Unwrap <ISearchGroup>(Intent.GetParcelableExtra(typeof(ISearchGroup).Name) as IParcelable); InitToolbar(searchGroup); ReplaceFragment(SearchedSessionsFragment.NewInstance(searchGroup)); }
public bool DivideParcel(UGUI requestingAgent, int start_x, int start_y, int end_x, int end_y) { ParcelInfo pInfo; if (!Parcels.TryGetValue(new Vector3(start_x, start_y, 0), out pInfo)) { return(false); } ParcelInfo.ParcelDataLandBitmap bmap = pInfo.LandBitmap; if (!bmap[start_x, end_y - 1] || !bmap[end_x - 1, start_x] || !bmap[end_x - 1, end_y - 1]) { /* not dividable */ return(false); } start_x &= (~3); start_y &= (~3); end_x &= (~3); end_y &= (~3); for (int py = start_y; py < end_y; py += 4) { for (int px = start_x; px < end_x; px += 4) { if (!bmap[px, py]) { return(false); } } } if (!CanDivideJoinParcel(requestingAgent, pInfo)) { return(false); } var newParcel = new ParcelInfo(pInfo, true); newParcel.ID = UUID.Random; Parcels.Add(newParcel); ParcelInfo.ParcelDataLandBitmap newBmap = newParcel.LandBitmap; for (int py = start_y; py < end_y; ++py) { for (int px = start_x; px < end_x; ++px) { newBmap[px, py] = true; bmap[px, py] = false; } } TriggerParcelUpdate(pInfo); TriggerParcelUpdate(newParcel); return(true); }
public void HandleParcelSelectObjects(Message m) { var req = (ParcelSelectObjects)m; if (req.AgentID != req.CircuitAgentID || req.SessionID != req.CircuitSessionID) { return; } ParcelInfo pinfo; IAgent agent; var reply = new ForceObjectSelect { ResetList = true }; if (Agents.TryGetValue(req.AgentID, out agent) && Parcels.TryGetValue(req.LocalID, out pinfo)) { foreach (Object.ObjectGroup grp in ObjectGroups) { if (grp.IsAttached) { continue; } if (!pinfo.LandBitmap.ContainsLocation(grp.GlobalPosition)) { continue; } bool isOwner = grp.Owner.EqualsGrid(pinfo.Owner); if (((req.ReturnType & ObjectReturnType.Owner) != 0 && isOwner) || ((req.ReturnType & ObjectReturnType.Other) != 0 && !isOwner) || ((req.ReturnType & ObjectReturnType.Group) != 0 && grp.Group == pinfo.Group) || ((req.ReturnType & ObjectReturnType.Sell) != 0 && grp.SaleType != InventoryItem.SaleInfoData.SaleType.NoSale) || ((req.ReturnType & ObjectReturnType.List) != 0 && req.ReturnIDs.Contains(grp.ID))) { if (reply.LocalIDs.Count >= 251) { agent.SendMessageAlways(reply, ID); reply = new ForceObjectSelect(); } reply.LocalIDs.Add(grp.LocalID[ID]); } } agent.SendMessageAlways(reply, ID); } }