コード例 #1
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel        getResult            = null;
            ClientItemDetailsDao clientItemDetailsDao = null;
            ItemCom       itemCom       = null;
            MParameterCom mParameterCom = null;

            // Variable initialize
            getResult            = new InitDataModel();
            clientItemDetailsDao = new ClientItemDetailsDao();
            itemCom       = new ItemCom();
            mParameterCom = new MParameterCom();

            // Get data
            var item         = clientItemDetailsDao.GetItem(inputObject);
            var listRelation = clientItemDetailsDao.GetListItemsByBrandCd(item.BrandCd, inputObject.ItemCd);
            var strHotline   = mParameterCom.GetString(Logics.PR_HOTLINE, false);

            // Update data
            itemCom.UpdateViewer(inputObject.ItemCd);

            // Set value
            getResult.Item         = itemCom.ToItemModel(item);
            getResult.ListRelation = itemCom.ToListItemModel(listRelation);
            getResult.Hotline      = strHotline;

            // Return value
            return(getResult);
        }
コード例 #2
0
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel         getResult             = null;
            ClientShoppingCartDao clientShoppingCartDao = null;
            ItemCom           itemCom   = null;
            CartCom           cartCom   = null;
            IList <ItemModel> listItems = null;
            ItemModel         itemModel = null;

            // Variable initialize
            getResult             = new InitDataModel();
            clientShoppingCartDao = new ClientShoppingCartDao();
            itemCom   = new ItemCom();
            cartCom   = new CartCom(inputObject.Cart);
            listItems = new List <ItemModel>();

            // Get data
            foreach (var obj in cartCom.Items)
            {
                itemModel          = itemCom.ToItemModel(clientShoppingCartDao.GetSingleItem(obj.ItemCd));
                itemModel.Quantity = obj.Quantity;
                obj.Price          = itemModel.SalesPrice.Value;

                listItems.Add(itemModel);
            }

            // Set value
            getResult.ListItems   = listItems;
            getResult.TotalAmount = cartCom.TotalAmount;
            // Return value
            return(getResult);
        }
コード例 #3
0
 public void CreateItem()
 {
     for (int i = 0; i < content.childCount; i++)
     {
         DataManager.Instance.CreatItemData(i);                              //创建数据类
         GameObject itemobj = Instantiate(item);                             //创建实体
         itemobj.transform.SetParent(content.GetChild(i));
         itemobj.transform.localPosition = Vector3.zero;
         itemobj.transform.localScale    = Vector3.one;
         ItemCom itemCom = new ItemCom(itemobj.transform, i);
         itemCom.SetData((DataManager.Instance.DicDataItemData(i)));
         dicCom.Add(i, itemCom);
     }
 }
コード例 #4
0
 public void UpdataPanel(int index = -1)                                                                                                     //刷新数据
 {
     for (int i = 0; i < PanelManager.Instance.dicCom.Count; i++)
     {
         ItemCom  itemCom  = dicCom[i];
         ItemData itemData = DataManager.Instance.DicDataItemData(i);
         itemCom.SetData(itemData);
     }
     if (index == -1 || DataManager.Instance.DicDataGetImg(index) == null)
     {
         showImg.color   = new Color(255, 255, 255, 0);
         showImg.sprite  = null;
         showEffect.text = null;
         showCoin.text   = null;
         DataManager.Instance.NowItemdata = -1;
         SetCheckBoxToPool();
         return;
     }
     ShowToPanel(index);
 }
コード例 #5
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel  getResult      = null;
            ClientIndexDao clientIndexDao = null;
            ItemCom        itemCom        = null;
            MParameterCom  mParameterCom  = null;

            // Variable initialize
            getResult      = new InitDataModel();
            clientIndexDao = new ClientIndexDao();
            itemCom        = new ItemCom();
            mParameterCom  = new MParameterCom();

            // Get data
            var listBanners    = clientIndexDao.GetListBanners();
            var listNewItems   = clientIndexDao.GetListNewItems();
            var listHotItems   = clientIndexDao.GetListHotItems();
            var listOfferItems = clientIndexDao.GetListOfferItems();
            var discountMember = mParameterCom.GetNumber(Logics.PR_DISCOUNT_MEMBER, false);
            var strHotline     = mParameterCom.GetString(Logics.PR_HOTLINE, false);
            var strChatYahoo   = mParameterCom.GetString(Logics.PR_CHAT_YAHOO, false);
            var strChatSkype   = mParameterCom.GetString(Logics.PR_CHAT_SKYPE, false);

            // Set value
            getResult.DiscountMember = discountMember;
            getResult.Hotline        = strHotline;
            getResult.ChatYahoo      = strChatYahoo;
            getResult.ChatSkype      = strChatSkype;
            getResult.ListBanners    = listBanners;
            getResult.ListNewItems   = itemCom.ToListItemModel(listNewItems);
            getResult.ListHotItems   = itemCom.ToListItemModel(listHotItems);
            getResult.ListOfferItems = itemCom.ToListItemModel(listOfferItems);

            // Return value
            return(getResult);
        }
コード例 #6
0
        public String makeCheckout(Accept accept, IList <CartItem> cart)
        {
            ItemCom itemCom   = new ItemCom();
            decimal priceGift = 0;
            UserCom userCom   = new UserCom();

            accept.AcceptSlipNo = MNumberCom.GetSlipNo(Logics.CD_BUSINESS_ACCEPT);

            int i = 0;

            while (IsExist <Accept>(accept.AcceptSlipNo, false))
            {
                Thread.Sleep(5000);
                accept.AcceptSlipNo = MNumberCom.GetSlipNo(Logics.CD_BUSINESS_ACCEPT);
                if (i == 10)
                {
                    throw new ExecuteException("E_MSG_00014");
                }
                i++;
            }

            accept.DeliveryCd = DataHelper.GetUniqueKey();
            accept.ViewId     = MNumberCom.GenViewId(accept.AcceptSlipNo, Logics.CD_BUSINESS_ACCEPT);

            int countNo = 1;

            foreach (CartItem item in cart)
            {
                AcceptDetail detail = new AcceptDetail();


                detail.AcceptSlipNo = accept.AcceptSlipNo;
                detail.DetailNo     = countNo++;
                detail.ItemCd       = item.ItemCd;
                var itemResult = GetSingle <Item>(item.ItemCd, false);
                if (itemResult == null)
                {
                    throw new DataNotExistException("Mã sản phẩm");
                }
                detail.ItemName    = itemResult.ItemName;
                detail.UnitCd      = itemResult.UnitCd;
                detail.DetailQtty  = item.Quantity;
                detail.DetailPrice = item.Price;
                detail.DetailAmt   = item.Amount;
                detail.CreateUser  = accept.CreateUser;
                detail.CreateDate  = accept.CreateDate;
                detail.UpdateUser  = accept.UpdateUser;
                detail.UpdateDate  = accept.UpdateDate;
                detail.DeleteFlag  = false;
                EntityManager.AcceptDetails.InsertOnSubmit(detail);
                if (!itemCom.HasOffer(item.ItemCd))
                {
                    priceGift = priceGift + itemResult.SalesPrice.Value * item.Quantity;
                }
            }

            if (priceGift != 0 && priceGift > 100000)
            {
                GiftCard gift = new GiftCard();
                gift.GiftCd     = RandomString(10, true);
                gift.Price      = priceGift * 10 / 100;
                gift.CreateDate = accept.CreateDate;
                gift.UpdateUser = accept.UpdateUser;
                gift.UpdateDate = accept.UpdateDate;
                gift.DeleteFlag = false;
                gift.GiftStatus = Logics.CD_GIFT_STATUS_INACTIVE;
                EntityManager.GiftCards.InsertOnSubmit(gift);
                accept.GiftCd = gift.GiftCd;
            }
            if (accept.UseGiftCd != null)
            {
                if (IsExist <GiftCard>(accept.UseGiftCd, false))
                {
                    GiftCard useGift = GetSingle <GiftCard>(accept.UseGiftCd, false);
                    useGift.GiftStatus = Logics.CD_GIFT_STATUS_USED;
                }
            }
            var number = MNumberCom.ToMNumber(accept.AcceptSlipNo);

            EntityManager.MNumbers.InsertOnSubmit(number);
            EntityManager.Accepts.InsertOnSubmit(accept);

            EntityManager.SubmitChanges();
            return(accept.AcceptSlipNo);
        }
コード例 #7
0
ファイル: InitLogic.cs プロジェクト: hieur8/web-mbec
        /// <summary>
        /// Get infomation
        /// </summary>
        /// <param name="inputObject">DataModel</param>
        /// <returns>DataModel</returns>
        private InitDataModel GetInfo(InitDataModel inputObject)
        {
            // Local variable declaration
            InitDataModel  getResult      = null;
            ClientItemsDao clientItemsDao = null;
            ItemCom        itemCom        = null;
            MParameterCom  mParameterCom  = null;

            // Variable initialize
            getResult      = new InitDataModel();
            clientItemsDao = new ClientItemsDao();
            itemCom        = new ItemCom();
            mParameterCom  = new MParameterCom();

            // Get data
            var listItems      = clientItemsDao.GetListItems(inputObject);
            var discountMember = mParameterCom.GetNumber(Logics.PR_DISCOUNT_MEMBER, false);
            var strHotline     = mParameterCom.GetString(Logics.PR_HOTLINE, false);
            var strChatYahoo   = mParameterCom.GetString(Logics.PR_CHAT_YAHOO, false);

            // Title
            var title = string.Empty;

            if (!DataCheckHelper.IsNull(inputObject.SearchText))
            {
                title = "Tìm kiếm";
            }
            else if (!DataCheckHelper.IsNull(inputObject.CategoryCd))
            {
                title = clientItemsDao.GetCategoryName(inputObject.CategoryCd);
            }
            else if (!DataCheckHelper.IsNull(inputObject.BrandCd))
            {
                title = clientItemsDao.GetBrandName(inputObject.BrandCd);
            }
            else if (!DataCheckHelper.IsNull(inputObject.AgeCd))
            {
                title = clientItemsDao.GetAgeName(inputObject.AgeCd);
            }
            else if (!DataCheckHelper.IsNull(inputObject.GenderCd))
            {
                title = clientItemsDao.GetGenderName(inputObject.GenderCd);
            }
            else if (!DataCheckHelper.IsNull(inputObject.OfferGroupCd))
            {
                title = "Khuyến mãi";
            }
            else
            {
                title = "Tất cả";
            }

            // Set value
            getResult.Title          = title;
            getResult.DiscountMember = discountMember;
            getResult.Hotline        = strHotline;
            getResult.ChatYahoo      = strChatYahoo;
            getResult.ListItems      = PagingHelper.GetPagerList(
                itemCom.ToListItemModel(listItems), inputObject);

            // Return value
            return(getResult);
        }