Esempio n. 1
0
    void Start()
    {
        OtherScriptToAccess = ShopStoreObject.GetComponent <ShopStore> ();
        testStringToGet     = OtherScriptToAccess.testString;

        Debug.Log(testStringToGet);
    }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            SupplyAssemblyOrder order = (SupplyAssemblyOrder)dataGridView1.CurrentRow.DataBoundItem;
            var sscios = from sad in DataService.db.GetTable <SupplyAssemblyDetails>()
                         where sad.supplyAssemblyOrderId == order.id
                         join st in DataService.db.GetTable <SupplierStore>() on sad.supplierStoreId equals st.id
                         select new SupplierStoreComponentInOrder(st.computerComponent.id, st.computerComponent.type, st.computerComponent.name, st.supplierPrice, sad.id, sad.count);

            foreach (var sscio in sscios)
            {
                var ss = DataService.db.GetTable <ShopStore>()
                         .Where(ssP => ssP.computerComponentId == sscio.id)
                         .SingleOrDefault();
                if (ss == null)
                {
                    var shopStore = new ShopStore(sscio.id, sscio.count);
                    DataService.db.GetTable <ShopStore>().InsertOnSubmit(shopStore);
                }
                else
                {
                    ss.count = ss.count + sscio.count;
                }
            }
            order.status = SupplyAssemblyOrderStatus.ARRIVED;
            DataService.db.SubmitChanges();
            updateForm();
        }
Esempio n. 3
0
    public void Additem()
    {
        //testStringToGet = GetComponent<ShopStore> ().testString;

        OtherScriptToAccess = ShopStoreObject.GetComponent <ShopStore> ();
        testStringToGet     = OtherScriptToAccess.testString;
        Debug.Log(testStringToGet);
    }
        private void SaveStoreItem(object sender, RoutedEventArgs e)
        {
            if (FoodBox.SelectedItem == null)
            {
                MessageBox.Show("Food is not selected!");
                return;
            }
            if (FoodUnitBox.SelectedItem == null)
            {
                MessageBox.Show("Unit is not selected!");
                return;
            }
            if (FoodAmount.Text == "")
            {
                MessageBox.Show("Food amount field is empty!");
                return;
            }

            ShopContext   shopContext = new ShopContext();
            string        foodName    = FoodBox.SelectedItem.ToString();
            int           foodId      = shopContext.FoodDictionary.Where(f => f.Name == foodName).Select(f => f.FoodID).First();
            UnitPropertis unit        = FoodUnitBox.SelectedItem as UnitPropertis;
            List <int>    unitIdList  = shopContext.UnitDictionary.Where(u => u.Name == unit.Name).Select(u => u.UnitID).ToList();
            int           unitId      = shopContext.Unit.Where(u => unitIdList.Any(d => d == u.UnitID))
                                        .Where(u => u.UnitStep == unit.Step).Select(u => u.UnitID).First();
            float amount = Convert.ToSingle(FoodAmount.Text);

            ShopStore shopStore = new ShopStore();

            shopStore.ShopID = ShopId;
            shopStore.FoodID = foodId;
            shopStore.Amount = amount;
            shopStore.UnitID = unitId;

            if (shopContext.ShopStore.Where(s => s.FoodID == shopStore.FoodID && s.UnitID == shopStore.UnitID).Count() > 0)
            {
                MessageBox.Show("Element is existed!");
                return;
            }

            shopContext.ShopStore.Add(shopStore);
            shopContext.SaveChanges();
            FoodTypeBox.SelectedItem = null;
            FoodBox.SelectedItem     = null;
            FoodUnitBox.SelectedItem = null;
            FoodTypeBox.Text         = "Type";
            FoodBox.Text             = "Food";
            FoodUnitBox.Text         = "Unit";
            FoodAmount.Text          = "";
        }
        private void SaveStore(object sender, RoutedEventArgs e)
        {
            if (StoreList.SelectedItem != null)
            {
                ShopStorePropertie itemProperty = StoreList.SelectedItem as ShopStorePropertie;
                ShopContext        shopContext  = new ShopContext();
                ShopStore          editedItem   = shopContext.ShopStore
                                                  .Where(s => s.ShopID == ShopId && s.FoodID == itemProperty.FoodId && s.UnitID == itemProperty.Unit.UnitId).First();
                float userAmount = Convert.ToSingle(StoreAmount.Text);
                if (userAmount != editedItem.Amount)
                {
                    ShopStore newItem = new ShopStore();
                    newItem.ShopID = editedItem.ShopID;
                    newItem.FoodID = editedItem.FoodID;
                    newItem.Amount = userAmount;
                    newItem.UnitID = editedItem.UnitID;
                    shopContext.ShopStore.Remove(editedItem);
                    shopContext.ShopStore.Add(newItem);
                    shopContext.SaveChanges();
                }
            }
            NamePanel.Visibility = Visibility.Collapsed;
            string lang;
            string type;

            if (LanguageBox.SelectedItem != null)
            {
                lang = LanguageBox.SelectedItem.ToString();
            }
            else
            {
                lang = MainLanguage;
            }
            if (TypeBox.SelectedItem != null)
            {
                type = TypeBox.SelectedItem.ToString();
                RefreshList(lang, type);
            }
            else
            {
                RefreshList(lang);
            }
        }
        private void button5_Click(object sender, EventArgs e)
        {
            decimal price = 0;

            try
            {
                price = decimal.Parse(textBox1.Text);
                textBox1.Clear();
            }
            catch (FormatException)
            {
                MessageBox.Show("Неверный формат в поле 'количества'.");
                return;
            }
            ShopStore shopStore = (ShopStore)dataGridView1.CurrentRow.DataBoundItem;

            DataService.db.ExecuteCommand("update computer_component set trade_price = {0} where id = {1}",
                                          price, shopStore.computerComponent.id);
            DataService.refreshAll();
            var sss = from ss in DataService.db.GetTable <ShopStore>()
                      select ss;

            bindingSource1.DataSource = sss;
        }
Esempio n. 7
0
        private void DeleteStoreItem(object sender, RoutedEventArgs e)
        {
            ShopContext shopContext = new ShopContext();

            if (StoreList.SelectedItem != null)
            {
                ShopStorePropertie storeItem   = StoreList.SelectedItem as ShopStorePropertie;
                ShopStore          deletedItem = shopContext.ShopStore
                                                 .Where(s => s.ShopID == ShopId && s.FoodID == storeItem.FoodId && s.UnitID == storeItem.Unit.UnitId).First();
                shopContext.ShopStore.Remove(deletedItem);
                shopContext.SaveChanges();

                string lang;
                string type = null;
                if (StoreLanguageBox.SelectedItem != null)
                {
                    lang = StoreLanguageBox.SelectedItem.ToString();
                }
                else
                {
                    lang = MainLanguage;
                }
                if (FoodTypeBox.SelectedItem != null)
                {
                    type = FoodTypeBox.SelectedItem.ToString();
                }
                if (type != null)
                {
                    RefreshList(lang, type);
                }
                else
                {
                    RefreshList(lang);
                }
            }
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult ShopStore(long shopId)
        {
            ShopStore homeModel = new ShopStore();

            ShopInfo shop = ServiceHelper.Create <IShopService>().GetShop(shopId, false);

            if (shop != null)
            {
                ViewBag.SortType                          = shop.SortType;
                ViewBag.Logo                              = base.CurrentSiteSetting.MemberLogo;
                homeModel.ShopId                          = shop.Id;
                homeModel.ShopLogo                        = shop.Logo;
                homeModel.CompanyAddress                  = shop.CompanyAddress; // +"/" + shop.ECompanyAddress + "</span>";
                homeModel.ShopName                        = shop.ShopName;       // +"/" + shop.ECompanyName;
                homeModel.ContactsEmail                   = shop.ContactsEmail;
                homeModel.ContactsPhone                   = shop.ContactsPhone;
                homeModel.CompanyFoundingDate             = shop.CompanyFoundingDate.HasValue ? shop.CompanyFoundingDate.Value.ToString("yyyy-MM-dd") : string.Empty;
                homeModel.URL                             = shop.URL;
                homeModel.CompanyFoundingDate             = shop.CreateDate.ToShortDateString();
                homeModel.GMPPhoto                        = shop.GMPPhoto;
                homeModel.ISOPhoto                        = shop.ISOPhoto;
                homeModel.FDAPhoto                        = shop.FDAPhoto;
                homeModel.Fax                             = shop.Fax;
                homeModel.OrganizationCodePhoto           = shop.OrganizationCodePhoto;
                homeModel.TaxRegistrationCertificatePhoto = shop.TaxRegistrationCertificatePhoto;
                homeModel.BusinessLicenceNumberPhoto      = shop.BusinessLicenceNumberPhoto;
                homeModel.ShopAccount                     = shop.ShopAccount;
                homeModel.ContactsName                    = shop.ContactsName;// +"/" + shop.EContactsName;
                homeModel.BankName                        = shop.BankName;
                homeModel.BankAccountNumber               = shop.BankAccountNumber;
                // homeModel.Price=
                homeModel.ShopEndDate = (shop.EndDate.HasValue ? shop.EndDate.Value.ToString("yyyy-MM-dd") : string.Empty);
                ShopGradeInfo shopGradeInfo = (
                    from c in ServiceHelper.Create <IShopService>().GetShopGrades()
                    where c.Id == shop.GradeId
                    select c).FirstOrDefault();
                homeModel.ShopGradeName = (shopGradeInfo != null ? shopGradeInfo.Name : string.Empty);


                IQueryable <StatisticOrderCommentsInfo> shopStatisticOrderComments = ServiceHelper.Create <IShopService>().GetShopStatisticOrderComments(shopId);
                StatisticOrderCommentsInfo statisticOrderCommentsInfo = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 13
                    select c).FirstOrDefault(); //质量与描述满意度
                StatisticOrderCommentsInfo statisticOrderCommentsInfo1 = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 14
                    select c).FirstOrDefault();//发货速度满意度
                StatisticOrderCommentsInfo statisticOrderCommentsInfo2 = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 15
                    select c).FirstOrDefault();//服务态度满意度
                StatisticOrderCommentsInfo statisticOrderCommentsInfo3 = (
                    from c in shopStatisticOrderComments
                    where (int)c.CommentKey == 16 //包装质量满意度
                    select c).FirstOrDefault();
                string str = "5";                 //如果无评价数据,默认为5分
                homeModel.ProductAndDescription = (statisticOrderCommentsInfo != null ? string.Format("{0:F}", statisticOrderCommentsInfo.CommentValue) : str);
                homeModel.SellerServiceAttitude = (statisticOrderCommentsInfo1 != null ? string.Format("{0:F}", statisticOrderCommentsInfo1.CommentValue) : str);
                homeModel.SellerDeliverySpeed   = (statisticOrderCommentsInfo2 != null ? string.Format("{0:F}", statisticOrderCommentsInfo2.CommentValue) : str);
                homeModel.PackingQuality        = (statisticOrderCommentsInfo3 != null ? string.Format("{0:F}", statisticOrderCommentsInfo3.CommentValue) : str);


                DateTime            date          = DateTime.Now.AddDays(-1).Date;
                DateTime            dateTime      = date.AddDays(1).AddMilliseconds(-1);
                ShopInfo.ShopVistis shopVistiInfo = ServiceHelper.Create <IShopService>().GetShopVistiInfo(date, dateTime, shopId);
                List <EchartsData>  echartsDatas  = new List <EchartsData>();
                if (shopVistiInfo == null)
                {
                    string str1 = (new decimal(0)).ToString();
                    ViewBag.VistiCounts = str1;
                    ViewBag.OrderCounts = str1;
                    ViewBag.SaleAmounts = str1;
                }
                else
                {
                    ViewBag.VistiCounts = shopVistiInfo.VistiCounts;
                    ViewBag.OrderCounts = shopVistiInfo.OrderCounts;
                    ViewBag.SaleAmounts = shopVistiInfo.SaleAmounts;
                }
            }

            return(View(homeModel));
        }