public UseCase_RemoveProductFromShop ( SystemContext systemContext, ShopImage shopImage, Func <ShopImage, IEnumerable <ProductIdentifiable> > productsProviderRemove ) : base(systemContext, shopImage.OwnerUser) { ShopImage = shopImage; ProductsProviderRemove = productsProviderRemove; }
public UseCase_EditShopProductInShop ( SystemContext systemContext, ShopImage shopImage, Func <ShopImage, IEnumerable <ProductShopEditInfo> > productsProvidersEdit ) : base(systemContext, shopImage.OwnerUser) { ShopImage = shopImage; ProductsProvidersEdit = productsProvidersEdit; }
public UseCase_AddProductToCart ( SystemContext systemContext, UserInfo buyerUser, ShopImage shopImage, Func <ShopImage, IEnumerable <ProductForCart> > productsProviderAdd ) : base(systemContext, buyerUser) { ShopImage = shopImage; ProductsAdd = productsProviderAdd(shopImage); }
public UseCase_EditProductInCart( SystemContext systemContext, UserInfo buyerUser, ShopImage shopImage, Func <ShopImage, IEnumerable <ProductForCart> > productsProviderAdd, Func <ShopImage, IEnumerable <ProductCartEditInfo> > productsProviderEdit ) : base(systemContext, buyerUser) { ShopImage = shopImage; ProductsProviderAdd = productsProviderAdd; ProductsEdit = productsProviderEdit(shopImage); }
public UseCase_RemoveProductFromCart ( SystemContext systemContext, UserInfo buyerUser, ShopImage shopImage, Func <ShopImage, IEnumerable <ProductForCart> > productsProviderAdd, Func <ShopImage, IEnumerable <ProductIdentifiable> > productsProviderRemove ) : base(systemContext, buyerUser) { ShopImage = shopImage; ProductsProviderAdd = productsProviderAdd; ProductsRemove = productsProviderRemove(shopImage); }
public int CreateShop(CreateShopInputModel data) { try { var checkLatLong = cnn.Shops.Where(i => i.IsActive.Equals(SystemParam.ACTIVE) && i.Lati.Equals(data.Lati) && i.Long.Equals(data.Long)); if (checkLatLong.Count() > 0) { return(SystemParam.EXISTING); } Shop obj = new Shop(); obj.Name = data.Name; obj.ProvinceID = data.ProvinceID; obj.DistrictID = data.DistrictID; obj.Address = data.Address; obj.PlusCode = data.PlusCode; obj.Lati = data.Lati; obj.Long = data.Long; obj.ContactName = data.ContactName; obj.ContactPhone = data.ContactPhone; obj.CraeteDate = DateTime.Now; obj.IsActive = SystemParam.ACTIVE; //int k = obj.PlusCode.Length; if (data.ListUrl != null && data.ListUrl.Count() > 0) { obj.ShopImages = new List <ShopImage>(); foreach (var img in data.ListUrl) { if (img != "") { ShopImage objImg = new ShopImage(); objImg.Path = img; objImg.IsActive = SystemParam.ACTIVE; objImg.CraeteDate = DateTime.Now; obj.ShopImages.Add(objImg); } } } cnn.Shops.Add(obj); cnn.SaveChanges(); return(SystemParam.RETURN_TRUE); } catch (Exception ex) { ex.ToString(); return(SystemParam.RETURN_FALSE); } }
public UseCase_PurchaseCart ( SystemContext systemContext, BuyerUserInfo buyerUser, BuyerUserInfo buyerUser2, BuyerUserInfo buyerUser_empty, BuyerUserInfo competitorUser, ShopImage shopImage ) : base(systemContext) { ShopImage = shopImage; BuyerUser = buyerUser; BuyerUser2 = buyerUser2; BuyerUser_Empty = buyerUser_empty; CompetitorUser = competitorUser; }
public int EditShop(CreateShopInputModel data) { try { var obj = cnn.Shops.Find(data.ID); obj.Name = data.Name; obj.ProvinceID = data.ProvinceID; obj.DistrictID = data.DistrictID; obj.ContactName = data.ContactName; obj.ContactPhone = data.ContactPhone; obj.Address = data.Address; obj.PlusCode = data.PlusCode; obj.Lati = data.Lati; obj.Long = data.Long; List <ShopImage> lstImg = cnn.ShopImages.Where(u => u.ShopID.Equals(data.ID)).ToList(); foreach (var i in lstImg) { cnn.ShopImages.Remove(i); } obj.ShopImages = new List <ShopImage>(); if (data.ListUrl != null && data.ListUrl.Count() > 0) { foreach (var img in data.ListUrl) { if (img != "") { ShopImage objImg = new ShopImage(); objImg.Path = img; objImg.IsActive = SystemParam.ACTIVE; objImg.CraeteDate = DateTime.Now; obj.ShopImages.Add(objImg); } } } cnn.SaveChanges(); return(SystemParam.RETURN_TRUE); } catch (Exception ex) { ex.ToString(); return(SystemParam.RETURN_FALSE); } }
public bool AddShopImages(ShopImageDto dataDto) { if (dataDto != null) { using (EAharaDB context = new EAharaDB()) { ShopImage addData = new ShopImage(); addData.Name = dataDto.Name; addData.Image = dataDto.Image; addData.ShopId = dataDto.ShopId; addData.IsActive = true; if (dataDto.Image != null && dataDto.Image != "") { Guid id = Guid.NewGuid(); var imgData = dataDto.Image.Substring(dataDto.Image.IndexOf(",") + 1); byte[] bytes = Convert.FromBase64String(imgData); Image image; using (MemoryStream ms = new MemoryStream(bytes)) { image = Image.FromStream(ms); } Bitmap b = new Bitmap(image); string filePath = System.Web.HttpContext.Current.Server.MapPath("~") + "UploadedFiles\\" + id + ".jpg"; b.Save(filePath, System.Drawing.Imaging.ImageFormat.Jpeg); addData.Image = string.Concat("UploadedFiles\\" + id + ".jpg"); } context.ShopImages.Add(addData); context.SaveChanges(); return(true); } } return(false); }
public async Task <ActionResult> CreateShop(Shop item1, List <int> item3, SHOPKEEPER item2, HttpPostedFileBase ImageFileOw, HttpPostedFileBase ImageFileShop) { ShopkeeperImage shopkima = new ShopkeeperImage(); ShopImage shopima = new ShopImage(); byte[] buf; if (ImageFileOw.ContentLength > 0) { buf = new byte[ImageFileOw.ContentLength]; ImageFileOw.InputStream.Read(buf, 0, buf.Length); shopkima.image = buf; } if (ImageFileShop.ContentLength > 0) { buf = new byte[ImageFileShop.ContentLength]; ImageFileShop.InputStream.Read(buf, 0, buf.Length); shopima.shopImage = buf; } item1.owner = item2.Id; item1.RegisteredDate = DateTime.Now; item2.password = EncryptClass.getpassword(item2.password); context.Shopkeeper.Add(item2); context.Shops.Add(item1); shopima.shopId = item1.ID; shopkima.shopKeeperId = item2.Id; foreach (int itemx in item3) { var ob = new Shop_Types { shopId = item1.ID, shopTypetId = itemx }; context.Shop_Types.Add(ob); } await context.SaveChangesAsync(); return(RedirectToAction("Login", "Home")); }
public UseCase_AddProductToShop(SystemContext systemContext, ShopImage shopImage) : base(systemContext, shopImage.OwnerUser) { ShopImage = shopImage; teardownProducts = new List <ProductId>(shopImage.ShopProducts.Length); }
internal static string MakeSearchingItem(int QIDnow, int OIDnow, string UserID) { // 從OrderTemp裡面拿到OrderPartitionID OrderTemp orderTemp = new OrderTemp(UserID); orderTemp.SelectByUserID(); // 用OrderPartitionID去找到ShopID,再用ShopID找到ShopItem OrderInfo orderInfo = new OrderInfo(UserID); orderInfo.OrderPartitionID = orderTemp.OrderPartitionID; string OrderPartitionIDSplitted = orderTemp.OrderPartitionID.Substring(0, 2); switch (OrderPartitionIDSplitted) { case "MO": // MyOrder orderInfo.SelectMyOrderTableByOrderPartitionID(); break; case "CO": // ClubOrder orderInfo.SelectClubOrderTableByOrderPartitionID(); break; default: break; } //NextHelper nextHelper = new NextHelper(QIDnow, OIDnow); //QuestionDetail questionDetailNext = nextHelper.GetNext(); //PreviousHelper previousHelper = new PreviousHelper(QIDnow, OIDnow); //QuestionDetail questionDetailPrevious = previousHelper.GetPrevious(); //CancelHelper cancelHelper = new CancelHelper(QIDnow, OIDnow); //QuestionDetail questionDetailCancel = cancelHelper.GetCancel(); ShopItem shopItem = new ShopItem(orderInfo.ShopID); List <ShopItem> myshopItems = shopItem.SelectByMyShopID(); List <ShopItem> bossshopItems = shopItem.SelectByBossShopID(); List <ShopItem> clubshopItems = shopItem.SelectByClubShopID(); ShopInfo shopInfo = new ShopInfo(); shopInfo.ShopID = orderInfo.ShopID; string OrderShopName; ShopImage shopImage = new ShopImage(orderInfo.ShopID); List <string> BossShopimagesUris = shopImage.SelectImageByShopID(); //抓出該商店的圖片 ShuffleImage(BossShopimagesUris); //隨機洗亂 ///// string DefaultUri = "https://i220.photobucket.com/albums/dd130/jung_04/GJ.gif"; //Flex圖片超連結 int ButtonControl = 4; //設定Button數量 ///// int ButtonCount = 0; //控制Button數量 FlexPushOrderMenu flexPushOrderMenu = new FlexPushOrderMenu(); if (myshopItems.Count > 0) { shopInfo.SelectMyShopNameByShopID(); OrderShopName = shopInfo.ShopName; int BubbleCount = 0; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(DefaultUri)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.StartTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 foreach (ShopItem item in myshopItems) { if (ButtonCount >= ButtonControl) { ButtonCount = 0; BubbleCount++; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(DefaultUri)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.EndTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 } flexPushOrderMenu.contents.contents[BubbleCount].footer.contents.Add(new FlexPushOrderMenu.OrderButton(item.shopItem, item.ShopItemPrice)); flexPushOrderMenu.contents.contents[BubbleCount].footer.contents[ButtonCount].action.data = DateTime.Now.Add((orderInfo.EndTime - orderInfo.StartTime).Add(new TimeSpan(0, -5, 0)))//主程式檢查按鈕有效時間為5分鐘 + "," + 9999 + "," + 2 + "," + orderInfo.OrderPartitionID + "," + item.shopItem + "," + item.ShopItemPrice; ButtonCount++; } } if (bossshopItems.Count > 0) { if (bossshopItems.Count >= BossShopimagesUris.Count * ButtonControl) { int NeedAddcount = bossshopItems.Count - BossShopimagesUris.Count; for (int i = 0; i <= NeedAddcount; i++) { BossShopimagesUris.Add(BossShopimagesUris[i]); } } shopInfo.SelectBossShopNameByShopID(); OrderShopName = shopInfo.ShopName; int BubbleCount = 0; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(BossShopimagesUris[0])); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.EndTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 foreach (ShopItem item in bossshopItems) { if (ButtonCount >= ButtonControl) { ButtonCount = 0; BubbleCount++; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(BossShopimagesUris[BubbleCount])); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.EndTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 } flexPushOrderMenu.contents.contents[BubbleCount].footer.contents.Add(new FlexPushOrderMenu.OrderButton(item.shopItem, item.ShopItemPrice)); flexPushOrderMenu.contents.contents[BubbleCount].footer.contents[ButtonCount].action.data = DateTime.Now.Add((orderInfo.EndTime - orderInfo.StartTime).Add(new TimeSpan(0, -5, 0)))//主程式檢查按鈕有效時間為5分鐘 + "," + 9999 + "," + 2 + "," + orderInfo.OrderPartitionID + "," + item.shopItem + "," + item.ShopItemPrice; ButtonCount++; } } if (clubshopItems.Count > 0) { shopInfo.SelectClubShopNameByShopID(); OrderShopName = shopInfo.ShopName; int BubbleCount = 0; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(DefaultUri)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.EndTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 foreach (ShopItem item in clubshopItems) { if (ButtonCount >= ButtonControl) { ButtonCount = 0; BubbleCount++; flexPushOrderMenu.contents.contents.Add(new FlexPushOrderMenu.Bubble(DefaultUri)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.OrderName(orderInfo.OrderName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName("結單時間:" + orderInfo.EndTime.ToString("yyyy-MM-dd HH:mm"))); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.DateAndShopName(OrderShopName)); flexPushOrderMenu.contents.contents[BubbleCount].body.contents.Add(new FlexPushOrderMenu.Content2() { type = "separator", margin = "xxl" }); //分隔線 } flexPushOrderMenu.contents.contents[BubbleCount].footer.contents.Add(new FlexPushOrderMenu.OrderButton(item.shopItem, item.ShopItemPrice)); flexPushOrderMenu.contents.contents[BubbleCount].footer.contents[ButtonCount].action.data = DateTime.Now.Add((orderInfo.EndTime - orderInfo.StartTime).Add(new TimeSpan(0, -5, 0)))//主程式檢查按鈕有效時間為5分鐘 + "," + 9999 + "," + 2 + "," + orderInfo.OrderPartitionID + "," + item.shopItem + "," + item.ShopItemPrice; ButtonCount++; } } JsonSerializerSettings settings = new JsonSerializerSettings(); settings.NullValueHandling = NullValueHandling.Ignore; var json = JsonConvert.SerializeObject(flexPushOrderMenu, settings); return("[" + json + "]"); }
public UseCase_ViewShopProducts(SystemContext systemContext, ShopImage shopImage) : base(systemContext) { ShopImage = shopImage; }