public ActionResult ItemList(int?page) { var region_cd = this.CurrentRegionInfo.CurrentDestination; var area_cd = this.CurrentSelectItem.area_cd; var item_type = this.CurrentSelectItem.item_type; var lang = this.CurrentRegionInfo.CurrentLanguage; string church_cd = null; var agent_cd = TypeHelper.GetStrTrim(ConfigurationManager.AppSettings["AgentCd"]); ////ログイン済みでかつ確定済のPKGがあったらそのchurch_cdで表示するオプション商品を絞り込む。 //if (this.CurrentLoginUser != null) //{ // var wtBookingRepo = new WtbApi.Proxy.All.WtBookingRepository(); // var c_num = this.CurrentLoginUser.c_num; // if (!string.IsNullOrEmpty(c_num)) // { // church_cd = wtBookingRepo.GetConfirmedWeddingChurchCd(region_cd, c_num, area_cd); // } //} //商品一覧を取得。 var model = new CItemRepository() .GetItemList(item_type, lang, church_cd, this.CurrentSelectItem.wed_date, agent_cd); int pageSize = 10; int pageNumber = (page ?? 1); //return PartialView("_ItemList", model); return(PartialView("_ItemList", model.ToPagedList(pageNumber, pageSize))); }
private static int OnAddItem(void *pItemRepository, void **ppItem, byte x, byte y, byte z, int bAllowEncumbrance, int bMergeItem) { CItemRepository itemRepository = CItemRepository.FromPointer(pItemRepository); NwGameObject? parent = itemRepository.m_oidParent.ToNwObject <NwGameObject>(); // Early out if parent isn't an item or placeable or Bad Things(tm) happen if (parent is null || parent is not NwItem && parent is not NwPlaceable) { return(Hook.CallOriginal(pItemRepository, ppItem, x, y, z, bAllowEncumbrance, bMergeItem)); } if (ppItem == null) { return(Hook.CallOriginal(pItemRepository, ppItem, x, y, z, bAllowEncumbrance, bMergeItem)); } OnInventoryItemAdd eventData = new OnInventoryItemAdd { AcquiredBy = parent, Item = CNWSItem.FromPointer(*ppItem).ToNwObject <NwItem>() !, }; eventData.Result = new Lazy <bool>(() => !eventData.PreventItemAdd && Hook.CallOriginal(pItemRepository, ppItem, x, y, z, bAllowEncumbrance, bMergeItem).ToBool()); ProcessEvent(eventData); return(eventData.Result.Value.ToInt()); } }
private static int OnRemoveItem(void *pItemRepository, void *pItem) { CItemRepository itemRepository = CItemRepository.FromPointer(pItemRepository); NwGameObject? parent = itemRepository.m_oidParent.ToNwObject <NwGameObject>(); // Early out if parent isn't an item or placeable or Bad Things(tm) happen if (parent is null || parent is not NwItem && parent is not NwPlaceable) { return(Hook.CallOriginal(pItemRepository, pItem)); } ProcessEvent(new OnInventoryItemRemove { RemovedFrom = parent, Item = CNWSItem.FromPointer(pItem).ToNwObject <NwItem>() !, });
public ActionResult AddCart(CustomerItem currentItem, short quantity, short?fixed_qty, DateTime wed_date, string wed_time, bool is_reserve) { var hash = new Dictionary <string, object>(); string failureType = "error"; try { var cartList = Session[Constants.SSKEY_CART] as List <CBooking>; if (cartList != null) { //PKGの場合、既に同じアイテムがカートにあったらNG(異なるperiodでもNG) if (currentItem.is_pkg) { var exists = cartList.Any(m => m.item_cd == currentItem.item_cd); if (exists) { hash.Add("Result", "error"); hash.Add("Message", L("You've already selected same item.", "既に同じ商品がカートに入っています。")); return(Json(hash)); } } } //表示通貨判断 var is_japan = this.IsJpnClientOrJpnAccount(); var lang = this.CurrentRegionInfo.CurrentLanguage; var region_cd = this.CurrentRegionInfo.CurrentDestination; //Item詳細取得 var item = new CItemRepository() .FindItem( currentItem.item_cd, lang, wed_date); int account_id = this.CurrentLoginUser == null ? 0 : this.CurrentLoginUser.account_id; string c_num = this.CurrentLoginUser == null ? null : this.CurrentLoginUser.c_num; DateTime?wed_time_d = null; if (!String.IsNullOrEmpty(wed_time)) { wed_time_d = System.DateTime.ParseExact(wed_time, "HH:mm", null); } var booking = EditCBooking(item, account_id, c_num, quantity, wed_date, wed_time_d, is_reserve, currentItem); if (this.CurrentLoginUser != null) { //ログイン済の場合DB保存 var cBookingRepo = new CBookingRepository(); cBookingRepo.AddCart(booking); cartList = cBookingRepo.GetBookingList(CBooking.PAYSTATUS_INIT, this.CurrentLoginUser.account_id, IsJPN()); } else { //未ログインの場合、セッションの情報を更新 if (cartList == null) { cartList = new List <CBooking>(); } var exist_booking = cartList.Where(m => m.account_id == booking.account_id && m.area_cd == booking.area_cd && m.item_type == booking.item_type && m.alb_cover == booking.alb_cover && m.alb_mount == booking.alb_mount && m.alb_type == booking.alb_type && m.dvd_menucolor == booking.dvd_menucolor && m.item_cd == booking.item_cd && m.payment_status == CBooking.PAYSTATUS_INIT).FirstOrDefault(); if (exist_booking == null || (exist_booking.fixed_qty >= 1 || exist_booking.fixed_qty == null)) { booking.booking_id_for_session = cartList.Count() + 1; cartList.Add(booking); } else { //同じItemがカートに入っていたらquantityを更新(ただしfixed_qtyが数量固定のものは別レコードとしてカートに追加) var total = exist_booking.quantity + booking.quantity; exist_booking.quantity = (short)total; } } Session[Constants.SSKEY_CART] = cartList; var total_quantity = (short)cartList.Count(); this.CurrentSelectItem.wed_date = wed_date; hash.Add("Result", "success"); hash.Add("Count", total_quantity); } catch (Exception ex) { //ex = Common.GetMostInnerException(ex); hash.Add("Result", failureType); hash.Add("Message", ex.Message); } return(Json(hash)); }
internal Inventory(NwGameObject owner, CItemRepository repo) { this.owner = owner; this.repo = repo; }