Exemplo n.º 1
0
        public ActionResult Create(CreateNewProductVM np)
        {
            try
            {
                ///creating product
                ProductBiz     productBiz = new ProductBiz();
                List <Company> lst        = new List <Company>();
                Product        product    = new Product();


                product.Name       = np.ProductName;
                product.Versions   = np.Versions;
                product.CompanyId  = np.CompanyId;
                product.Components = np.Components;

                productBiz.CreateProduct(product);

                np.Compaines = productBiz.GetCompanies();
                ModelState.AddModelError("PM", "Product created successfully");
                return(View(np));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public ActionResult Edit(int id)
        {
            TicketBiz ticketbiz = new TicketBiz();
            Ticket    t         = ticketbiz.GetTicketById(id);
            //TicketCreateModel ticketcraetemodel= AutoMapper.Mapper.Map<TicketCreateModel>(t);
            TicketCreateModel ticketCreateModel = new TicketCreateModel();
            ProductBiz        productbiz        = new ProductBiz();

            ticketCreateModel.Products      = productbiz.GetProducts(Convert.ToInt64(Session["CompanyId"]));
            ticketCreateModel.Priorities    = ticketbiz.GetPriorities();
            ticketCreateModel.Seviorities   = ticketbiz.GetSeviorities();
            ticketCreateModel.TicketTypes   = ticketbiz.GetTicketTypes();
            ticketCreateModel.Title         = t.Title;
            ticketCreateModel.TicketId      = t.TicketId;
            ticketCreateModel.Description   = t.Description;
            ticketCreateModel.CompanyId     = t.CompanyId;
            ticketCreateModel.ComponentId   = t.ComponentId;
            ticketCreateModel.ProductId     = t.ProductId;
            ticketCreateModel.VersionId     = t.VersionId;
            ticketCreateModel.PriorityId    = t.PriorityId;
            ticketCreateModel.SeviorityId   = t.SeviorityId;
            ticketCreateModel.TicketTypeId  = t.TicketTypeId;
            ticketCreateModel.ComponentName = t.ComponentName;
            ticketCreateModel.CompanyName   = t.CompanyName;
            ticketCreateModel.ProductName   = t.ProductName;
            long Id = ticketCreateModel.ProductId;

            ticketCreateModel.Components = productbiz.GetComponent(Id);
            ticketCreateModel.Versions   = productbiz.GetVersions(Id);

            return(PartialView(ticketCreateModel));
            //return ticketCreateModel;
            // return View("Create", ticketCreateModel);
        }
Exemplo n.º 3
0
        public ActionResult BindDropDowns(string flag, long Id)
        {
            StringBuilder sbOptions = new StringBuilder();

            if (flag == "Components")
            {
                ProductBiz productbiz    = new ProductBiz();
                var        lstComponents = productbiz.GetComponent(Id);
                //var lstComponents = AllComponents.FindAll(c => c.ID == Id);
                foreach (var item in lstComponents)
                {
                    sbOptions.Append("<option value=" + item.ComponentId + ">" + item.ComponentName + "</option>");
                }
            }

            else if (flag == "Versions")
            {
                ProductBiz productbiz  = new ProductBiz();
                var        lstVersions = productbiz.GetVersions(Id);
                //lstComponents.FindAll(c => c.ID == Id);
                foreach (var item in lstVersions)
                {
                    sbOptions.Append("<option value=" + item.VersionId + ">" + item.VersionName + "</option>");
                }
            }

            return(Content(sbOptions.ToString()));
        }
        private void readerControllerImpler_ReaderTagsHandle(object sender, RfidReaderEventArgs e)
        {
            List <ProductBiz> epcProducts = new List <ProductBiz>();

            foreach (var epc in e.EpcDtos)
            {
                epcs.Add(epc.EpcCode);
            }

            IList <SkuInfoBiz> SkuInfos = Global.dataservice.GetSkusByEpcList(epcs);

            if (SkuInfos == null)
            {
                return;
            }
            for (int i = 0; i < SkuInfos.Count; i++)
            {
                ProductBiz product = ProductBiz.GetProductBySkuInfo(SkuInfos[i]);
                product.ImagePath = Global.ProductDemoImages[i];
                epcProducts.Add(product);
            }
            this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
            {
                if (Global.UserInterface == UserInterface.FittingRoom)
                {
                    Global.MainFrame.Navigate(new Uri("/Views/ProductTryingOnControl.xaml", UriKind.Relative), epcProducts);
                }
                else
                {
                    Global.MainFrame.Navigate(new Uri("/Views/ProductDetailControl.xaml", UriKind.Relative), epcProducts);
                }
                Global.MainFrame.Navigated += MainFrame_Navigated;
            });
        }
Exemplo n.º 5
0
        public ProductForm(int id, User user)
        {
            InitializeComponent();

            InitForm(user);

            textName.Focus();
            itemId = id;

            var biz = new ProductBiz();
            var item = biz.LoadItem(id);

            textName.Text = item.Name;
            if (item.ProductTypeId.HasValue)
            {
                drlType.SelectedValue = item.ProductTypeId.Value;
            }
            numberPrice.Text = item.Price.ToString();

            created = item.Created;
            createdBy = item.CreatedByUserId;
            modified = item.Modified;
            modifiedBy = item.ModifiedByUserId;

            this.Text = "Sửa sản phẩm";
        }
Exemplo n.º 6
0
        private void RefreshItems(object sender, EventArgs e)
        {
            var biz = new ProductBiz();

            dataGridView.DataSource = biz.LoadItems();
            dataGridView.Refresh();
        }
Exemplo n.º 7
0
        private void RefreshItems()
        {
            var biz = new ProductBiz();

            dataGridView.DataSource = biz.LoadItems();
            dataGridView.Refresh();
        }
Exemplo n.º 8
0
        private bool isShopNameExists(string shopName)
        {
            Product productNameCheck = ProductBiz.FindForName(shopName);
            bool    nameExists       = !productNameCheck.IsNull();

            return(nameExists);
        }
Exemplo n.º 9
0
        private void InitialControl()
        {
//            var productList = ProductBiz.GetProductList();
            var productList = ProductBiz.GetProductListNew();

            productList.Insert(0, new Resource.Data.ControlListData()
            {
                TextField = "", ValueField = "-1"
            });
            cmbProductEdit.DataSource = productList;
            cmbProductEdit.DataBind();
            cmbProductSearch.DataSource = productList;
            cmbProductSearch.DataBind();

            var insComList = SlmScr035Biz.GetAllInsComListData();

            insComList.Insert(0, new Resource.Data.ControlListData()
            {
                TextField = "", ValueField = "-1"
            });
            cmbInsComNameEdit.DataSource = insComList;
            cmbInsComNameEdit.DataBind();
            cmbInsComName.DataSource = insComList;
            cmbInsComName.DataBind();

            textCommissionPct.Attributes.Add("OnKeyPress", "return validateDecimal(event, this);");
            textCommissionThb.Attributes.Add("OnKeyPress", "return validateDecimal(event, this);");
            textOV1Pct.Attributes.Add("OnKeyPress", "return validateDecimal(event, this);");
            textOV1Thb.Attributes.Add("OnKeyPress", "return validateDecimal(event, this);");
            textOV2Pct.Attributes.Add("OnKeyPress", "return validateDecimal(event, this);");
            textOV2Thb.Attributes.Add("OnKeyPress", "return validateDecimal(event, this);");

            ddlCoverageTypeSearch.Items.Insert(0, new ListItem("", "-1"));
            ddlInsuranceTypeSearch.Items.Insert(0, new ListItem("", "-1"));
        }
Exemplo n.º 10
0
        private void InitialControl()
        {
            //Search
            cmbProductSearch.DataSource     = ProductBiz.GetProductList();
            cmbProductSearch.DataTextField  = "TextField";
            cmbProductSearch.DataValueField = "ValueField";
            cmbProductSearch.DataBind();
            cmbProductSearch.Items.Insert(0, new ListItem("", ""));

            cmbLeadStatusSearch.DataSource     = OptionBiz.GetOptionListForActivityConfig(AppConstant.OptionType.LeadStatus);
            cmbLeadStatusSearch.DataTextField  = "TextField";
            cmbLeadStatusSearch.DataValueField = "ValueField";
            cmbLeadStatusSearch.DataBind();
            cmbLeadStatusSearch.Items.Insert(0, new ListItem("", ""));

            cmbLeadStatusAvailableSearch.DataSource     = OptionBiz.GetOptionListForActivityConfig(AppConstant.OptionType.LeadStatus);
            cmbLeadStatusAvailableSearch.DataTextField  = "TextField";
            cmbLeadStatusAvailableSearch.DataValueField = "ValueField";
            cmbLeadStatusAvailableSearch.DataBind();
            cmbLeadStatusAvailableSearch.Items.Insert(0, new ListItem("", ""));

            //Popup
            cmbProductPopup.DataSource     = ProductBiz.GetProductList();
            cmbProductPopup.DataTextField  = "TextField";
            cmbProductPopup.DataValueField = "ValueField";
            cmbProductPopup.DataBind();
            cmbProductPopup.Items.Insert(0, new ListItem("", ""));

            cmbLeadStatusPopup.DataSource     = OptionBiz.GetOptionListForActivityConfig(AppConstant.OptionType.LeadStatus);
            cmbLeadStatusPopup.DataTextField  = "TextField";
            cmbLeadStatusPopup.DataValueField = "ValueField";
            cmbLeadStatusPopup.DataBind();
            cmbLeadStatusPopup.Items.Insert(0, new ListItem("", ""));
        }
Exemplo n.º 11
0
 /// <summary>
 /// 取消订单
 /// </summary>
 /// <returns></returns>
 public async Task <bool> CancelOrderAsync(OrderModel order)
 {
     return(await MySqlHelper.TransactionAsync(async (conn, trans) =>
     {
         var productBiz = new ProductBiz();
         var orderDetailModelList = await new OrderDetailBiz().GetModelsByOrderIdAsync(order.OrderGuid);
         foreach (var item in orderDetailModelList)
         {
             var productModel = await productBiz.GetModelByGuidAsync(item.ProductGuid);
             if (productModel.ProductForm.Equals(ProductFormEnum.Physical.ToString()))
             {
                 productModel.Inventory += item.ProductCount;
                 if (await conn.UpdateAsync(productModel) < 1)
                 {
                     return false;
                 }
             }
         }
         if (await conn.UpdateAsync(order) < 1)
         {
             return false;
         }
         return true;
     }));
 }
        public async Task <IActionResult> UpdateOnlieCategory(string productGuid)
        {
            if (string.IsNullOrEmpty(productGuid))
            {
                return(Failed(ErrorCode.UserData, "参数不正确"));
            }

            var productBiz = new ProductBiz();

            var model = await productBiz.GetAsync(productGuid);

            if (model is null)
            {
                return(Failed(ErrorCode.UserData, "商品不存在"));
            }

            model.PlatformOnSale = !model.PlatformOnSale;
            //如何后台启用商品则不修改商户端状态
            if (!model.PlatformOnSale)
            {
                model.OnSale = model.PlatformOnSale;
            }
            var result = await productBiz.UpdateAsync(model);

            return(result ? Success() : Failed(ErrorCode.DataBaseError, "更新失败!"));
        }
Exemplo n.º 13
0
        public ActionResult Delete(int id)
        {
            var biz   = new ProductBiz();
            var model = biz.Get(id);

            return(View(model));
        }
Exemplo n.º 14
0
        public ProductForm(int id, User user)
        {
            InitializeComponent();

            InitForm(user);

            textName.Focus();
            itemId = id;

            var biz  = new ProductBiz();
            var item = biz.LoadItem(id);

            textName.Text = item.Name;
            if (item.ProductTypeId.HasValue)
            {
                drlType.SelectedValue = item.ProductTypeId.Value;
            }
            numberPrice.Text = item.Price.ToString();

            created    = item.Created;
            createdBy  = item.CreatedByUserId;
            modified   = item.Modified;
            modifiedBy = item.ModifiedByUserId;

            this.Text = "Sửa sản phẩm";
        }
        public async Task <IActionResult> ModifyProductInventoryOfDoctorCloudAsync([FromBody] ModifyProductInventoryOfDoctorCloudRequestDto requestDto)
        {
            var productBiz   = new ProductBiz();
            var productModel = await productBiz.GetModelByGuidAsync(requestDto.ProductGuid);

            if (productModel == null)
            {
                return(Failed(ErrorCode.Empty, "未查询到此商品信息"));
            }
            productModel.WarningInventory = requestDto.WarningInventory;
            var resultWarningInventory = await productBiz.UpdateAsync(productModel);

            if (!resultWarningInventory)
            {
                return(Failed(ErrorCode.DataBaseError, "更新警戒库存失败"));
            }

            if (requestDto.ReplenishInventory > 0)
            {
                var resultReplenishInventory = await productBiz.ReplenishProductInventoryAsync(requestDto.ProductGuid, requestDto.ReplenishInventory);

                if (!resultReplenishInventory)
                {
                    return(Failed(ErrorCode.DataBaseError, "追加库存信息失败"));
                }
            }
            return(Success());
        }
Exemplo n.º 16
0
 /// <summary>
 /// This sets up the data. This is data that is expected by the system.
 /// </summary>
 public void InitializeDb()
 {
     SalesmanCategoryBiz.InitializationData();
     VehicalTypeBiz.VehicalTypeDefaultItems();
     ProductBiz.InitializationData();
     //ProductChildBiz.InitializationData();
 }
Exemplo n.º 17
0
        // GET: Product
        public ActionResult Index()
        {
            var biz   = new ProductBiz();
            var model = biz.List();

            return(View(model));
        }
Exemplo n.º 18
0
        private void ListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ProductBiz selProduct = viewModel.ProductBizList[lbProducts.SelectedIndex];

            Global.MainFrame.Navigate(new Uri("/Views/ProductDetailControl.xaml", UriKind.Relative), selProduct);
            Global.MainFrame.Navigated += MainFrame_Navigated;
        }
Exemplo n.º 19
0
        public void TestGetByPage()
        {
            ProductParameter parameter = new ProductParameter();

            parameter.ProductName = "笔";
            var res = ProductBiz.GetListByPage(parameter);
        }
Exemplo n.º 20
0
        private void BindPopupProductCampaignCombo(string mode)
        {
            if (mode == "edit")
            {
                cmbProductPopup.DataSource  = ProductBiz.GetProductList();
                cmbCampaignPopup.DataSource = CampaignBiz.GetCampaignList("");
            }
            else
            {
                cmbProductPopup.DataSource  = ProductBiz.GetProductListNew();
                cmbCampaignPopup.DataSource = CampaignBiz.GetCampaignListNew("");
            }

            cmbProductPopup.DataTextField  = "TextField";
            cmbProductPopup.DataValueField = "ValueField";
            cmbProductPopup.DataBind();
            cmbProductPopup.Items.Insert(0, new ListItem("", ""));

            //cmbProductPopup.Items.Insert(1, new ListItem("DEFAULT", "DEFAULT"));
            cmbCampaignPopup.DataTextField  = "TextField";
            cmbCampaignPopup.DataValueField = "ValueField";
            cmbCampaignPopup.DataBind();
            cmbCampaignPopup.Items.Insert(0, new ListItem("", ""));
            //cmbCampaignPopup.Items.Insert(1, new ListItem("DEFAULT", "DEFAULT"));
        }
Exemplo n.º 21
0
        protected void btnAddConfigCustomer_Click(object sender, EventArgs e)
        {
            try
            {
                cmbAddProduct_Cus.DataSource     = ProductBiz.GetProductList();
                cmbAddProduct_Cus.DataTextField  = "TextField";
                cmbAddProduct_Cus.DataValueField = "ValueField";
                cmbAddProduct_Cus.DataBind();
                cmbAddProduct_Cus.Items.Insert(0, new ListItem("", ""));

                //cmbAddCustomerGrade_Cus.DataSource = new CustomerGradeBiz().GetCustomerGradeList();
                //cmbAddCustomerGrade_Cus.DataTextField = "TextField";
                //cmbAddCustomerGrade_Cus.DataValueField = "ValueField";
                //cmbAddCustomerGrade_Cus.DataBind();
                //cmbAddCustomerGrade_Cus.Items.Insert(0, new ListItem("", ""));

                //cmbAddAssignType_Cus.DataSource = new AssignTypeBiz().GetAssignTypeList();
                //cmbAddAssignType_Cus.DataTextField = "TextField";
                //cmbAddAssignType_Cus.DataValueField = "ValueField";
                //cmbAddAssignType_Cus.DataBind();
                //cmbAddAssignType_Cus.Items.Insert(0, new ListItem("", ""));

                mpePopupAddConfigCustomer.Show();
                upPopupAddConfigCustomer.Update();
            }
            catch (Exception ex)
            {
                string message = ex.InnerException != null ? ex.InnerException.Message : ex.Message;
                _log.Error(message);
                AppUtil.ClientAlert(Page, message);
            }
        }
Exemplo n.º 22
0
 public MessageBiz(IRepositry <Message> entityDal, BizParameters bizParameters, PersonBiz personBiz, ProductBiz productBiz, OwnerBiz ownerBiz, PeopleMessageBiz peopleMessageBiz)
     : base(entityDal, bizParameters)
 {
     _personBiz        = personBiz;
     _productBiz       = productBiz;
     _ownerBiz         = ownerBiz;
     _peopleMessageBiz = peopleMessageBiz;
 }
        public IActionResult CollectProduct(string productGuid)
        {
            var collectionBiz = new CollectionBiz();
            var productModel  = new ProductBiz().GetModelByGuid(productGuid);
            var result        = collectionBiz.CollectTarget(productGuid, UserID, "product", out var state, productModel?.PlatformType);

            return(result ? Success($"{state}操作成功!") : Failed(ErrorCode.DataBaseError, $"{state}操作失败!"));
        }
Exemplo n.º 24
0
        public void GetAll_Sucessfull()
        {
            ProductBiz productBiz  = new ProductBiz(_mockUnit.Object);
            var        allPRoducts = productBiz.GetAllAsync();

            Assert.NotNull(allPRoducts);
            Assert.IsTrue(allPRoducts.Result.Count == GetAllProduct().Count);
        }
Exemplo n.º 25
0
 public SaleOrderBiz(Repositry <BuySellDoc> entityDal, BizParameters bizParameters, OwnerBiz ownerBiz, CustomerBiz customerBiz, ProductBiz productBiz, BuySellDocBiz buySellDocBiz)
     : base(entityDal, bizParameters, ownerBiz, customerBiz, productBiz)
 {
     _ownerBiz     = ownerBiz;
     _customerBiz  = customerBiz;
     _productBiz   = productBiz;
     buySellDocBiz = _buySellDocBiz;
 }
Exemplo n.º 26
0
        public GlobalCommentBiz(MenuPathMainBiz menuPathMainBiz, ProductBiz productBiz, UserBiz userBiz, IRepositry <GlobalComment> entityDal, BizParameters bizParameters)
            : base(entityDal, bizParameters)

        {
            _menuPathMainBiz = menuPathMainBiz;
            _productBiz      = productBiz;
            _userBiz         = userBiz;
        }
Exemplo n.º 27
0
 private void BindProductNew()
 {
     cmbProductPopup.DataSource     = ProductBiz.GetProductListNew();
     cmbProductPopup.DataTextField  = "TextField";
     cmbProductPopup.DataValueField = "ValueField";
     cmbProductPopup.DataBind();
     cmbProductPopup.Items.Insert(0, new ListItem("", ""));
 }
Exemplo n.º 28
0
        private void getPeopleFromProductEtc(string productId)
        {
            productId.IsNullOrWhiteSpaceThrowArgumentException("productId");
            Product product = ProductBiz.Find(productId);

            product.IsNullThrowException("product not found");
            getPeopleFromProductEtc(product);
        }
        private void lbProducts_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (lbSelProducts.SelectedIndex == -1)
            {
                this.DataContext               = null;
                lbProductColors.ItemsSource    = null;
                lbProductSizes.ItemsSource     = null;
                lbMatchedProoducts.ItemsSource = null;
                return;
            }
            selProduct       = Global.productViewModel.TryingOnProducts[lbSelProducts.SelectedIndex];
            this.DataContext = selProduct;

            BackgroundWorker bgw = new BackgroundWorker();

            bgw.WorkerSupportsCancellation = true;
            bgw.WorkerReportsProgress      = true;
            bgw.DoWork += new DoWorkEventHandler((s1, e1) =>
            {
                IList <SkuBiz> selProductSkus = Global.dataservice.GetProductSkus(selProduct.Id);
                if (selProductSkus != null && selProductSkus.Count > 0)
                {
                    productColors = Global.dataservice.GetProductColors(selProductSkus);
                    productSizes  = Global.dataservice.GetProductSizes(selProductSkus);
                    //IList<ProductCollocationBiz> relatedProductBizs = Global.dataservice.GetRecommendProducts(selProduct);
                    //if (relatedProductBizs != null && relatedProductBizs.Count == 0) {
                    //    IList<ProductBiz> relShowProduct = new List<ProductBiz>();
                    //    int maxNumber = relShowProduct.Count < Global.ProductDemoImages.Count ? relShowProduct.Count : Global.ProductDemoImages.Count;
                    //    for (int i = 0; i < maxNumber; i++)
                    //    {
                    //        ProductBiz relProduct = ProductBiz.GetProductBiz(relatedProductBizs[i]);
                    //        relProduct.ImagePath = Global.ProductDemoImages[i];
                    //        relShowProduct.Add(relProduct);
                    //    }
                    //    relShowProducts = relShowProduct;
                    //}
                    IList <ProductBiz> relatedProducts = Global.dataservice.GetRelatedProducts(selProduct);
                    if (relatedProducts != null && relatedProducts.Count > 0)
                    {
                        IList <ProductBiz> relShowProduct = relatedProducts.Skip(relatedProducts.Count - Global.ProductDemoImages.Count).ToList();

                        for (int i = 0; i < relShowProduct.Count; i++)
                        {
                            relShowProduct[i].ImagePath = Global.ProductDemoImages[i];
                            relShowProducts             = relShowProduct;
                        }
                    }
                }
            });
            bgw.RunWorkerCompleted += new RunWorkerCompletedEventHandler((s2, e2) =>
            {
                lbProductColors.ItemsSource    = productColors;
                lbProductSizes.ItemsSource     = productSizes;
                lbMatchedProoducts.ItemsSource = relShowProducts;
            });
            bgw.RunWorkerAsync();
        }
Exemplo n.º 30
0
        public ActionResult Create1(ProductCreateModel m)
        {
            Product p = AutoMapper.Mapper.Map <Product>(m);

            ProductBiz productBiz = new ProductBiz();

            productBiz.AddProduct(p);
            return(View(m));
        }
        /// <summary>
        /// 采用命中测试得到三维场景中选中的商品
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void viewport3D_MouseLeftButtonDown(object sender, MouseButtonEventArgs args)
        {
            Point mousePosition = args.GetPosition(viewport3D);
            PointHitTestParameters pointparams = new PointHitTestParameters(mousePosition);

            //测试 Viewport3D 中的结果
            VisualTreeHelper.HitTest(viewport3D, null, rawresult =>
            {
                RayHitTestResult rayResult = rawresult as RayHitTestResult;
                if (rayResult != null)
                {
                    RayMeshGeometry3DHitTestResult rayMeshResult = rayResult as RayMeshGeometry3DHitTestResult;
                    if (rayMeshResult != null)
                    {
                        GeometryModel3D hitgeo         = rayMeshResult.ModelHit as GeometryModel3D;
                        MaterialGroup priorMaterial    = hitgeo.Material as MaterialGroup;
                        DiffuseMaterial difuseMaterial = priorMaterial.Children[0] as DiffuseMaterial;
                        if (difuseMaterial != null && difuseMaterial.Brush is ImageBrush)
                        {
                            ImageBrush imgBrush = difuseMaterial.Brush as ImageBrush;
                            try
                            {
                                string imagesource = imgBrush.ImageSource.ToString();
                                string imageName   = System.IO.Path.GetFileName(imagesource);
                                int selIndex       = 0;
                                for (int i = 0; i < Global.ProductDemoImages.Count; i++)
                                {
                                    if (System.IO.Path.GetFileName(Global.ProductDemoImages[i]) == imageName)
                                    {
                                        selIndex = i;
                                    }
                                }
                                ProductBiz selPruduct = HomeProductDic[selIndex];
                                if (selPruduct != null)
                                {
                                    Grid.SetRowSpan(Global.MainFrame, 1);
                                    if (Global.UserInterface == UserInterface.FittingRoom)
                                    {
                                        Global.MainFrame.Navigate(new Uri("/Views/ProductTryingOnControl.xaml", UriKind.Relative), selPruduct);
                                    }
                                    else
                                    {
                                        Global.MainFrame.Navigate(new Uri("/Views/ProductDetailControl.xaml", UriKind.Relative), selPruduct);
                                    }
                                    Global.MainFrame.Navigated += MainFrame_Navigated;
                                }
                            }
                            catch { }
                        }
                    }
                }
                return(HitTestResultBehavior.Stop);
            }, pointparams);
        }
Exemplo n.º 32
0
        public ProductView(User user)
        {
            InitializeComponent();

            dataGridView.AutoGenerateColumns = false;

            var biz = new ProductBiz();
            dataGridView.DataSource = biz.LoadItems();
            dataGridView.Refresh();

            currentUser = user;

            buttonSelectItems.Text = "Chọn";
        }
Exemplo n.º 33
0
        private void DeleteItem(object sender, EventArgs e)
        {
            var items = new List<Product>();

            foreach (DataGridViewRow row in dataGridView.Rows)
            {
                if (row.Cells[0].Value != null && row.Cells[0].Value == "1")
                {
                    items.Add(row.DataBoundItem as Product);
                }
            }

            var biz = new ProductBiz();
            biz.RemoveItem(items);

            RefreshItems(sender, e);
        }
Exemplo n.º 34
0
        private void Search(object sender, EventArgs e)
        {
            int? typeId = null;

            var biz = new ProductBiz();
            var data = biz.SearchProduct(drlProductType.Text, textName.Text, textCode.Text);

            foreach(var p in ListSelectedProduct)
            {
                var item = data.Find(i => i.Code == p.Code);
                if(item != null)
                {
                    data.Remove(item);
                }
            }

            dataGridView.DataSource = data;
        }
Exemplo n.º 35
0
        private void SaveItem(object sender, EventArgs e)
        {
            if (CustomValidation())
            {
                var item = new Product();
                item.Name = textName.Text;
                item.ProductTypeId = Convert.ToInt32(drlType.SelectedValue);
                item.Price = Convert.ToDecimal(numberPrice.Text);

                if (itemId > 0)
                {
                    item.Id = itemId;
                    item.Created = created;
                    item.CreatedByUserId = createdBy;

                    item.Modified = DateTime.Now;
                    item.ModifiedByUserId = currentUser;

                    var biz = new ProductBiz();
                    biz.UpdateItem(item);
                }
                else
                {
                    item.Created = DateTime.Now;
                    item.CreatedByUserId = currentUser;

                    item.Modified = DateTime.Now;
                    item.ModifiedByUserId = currentUser;

                    var biz = new ProductBiz();
                    biz.SaveItem(item);
                }

                this.Close();
            }
            else
            {
                this.DialogResult = System.Windows.Forms.DialogResult.None;
            }
        }
Exemplo n.º 36
0
 private void RefreshItems(object sender, EventArgs e)
 {
     var biz = new ProductBiz();
     dataGridView.DataSource = biz.LoadItems();
     dataGridView.Refresh();
 }
Exemplo n.º 37
0
 private void RefreshItems()
 {
     var biz = new ProductBiz();
     dataGridView.DataSource = biz.LoadItems();
     dataGridView.Refresh();
 }
Exemplo n.º 38
0
        private void ImportDataSet(string fileName)
        {
            var biz = new ProductBiz();

            using (var document = SpreadsheetDocument.Open(fileName, false))
            {
                var wbPart = document.WorkbookPart;
                var theSheet = wbPart.Workbook.Descendants<Sheet>().FirstOrDefault();

                var wsPart = (WorksheetPart)(wbPart.GetPartById(theSheet.Id));
                var count = wsPart.Worksheet.Descendants<Row>().Count();
                for (var i = 2; i <= count; i++)
                {
                    var product = new Product
                    {
                        Code = IOReader.GetCellValue(document, theSheet, "A" + i),
                        Name = IOReader.GetCellValue(document, theSheet, "B" + i),
                    };

                    decimal number = 0;
                    var price = IOReader.GetCellValue(document, theSheet, "C" + i);
                    if (!string.IsNullOrEmpty(price) && decimal.TryParse(price, out number))
                    {
                        product.Price = number;
                    }

                    int number1 = 0;
                    var productTypeId = IOReader.GetCellValue(document, theSheet, "D" + i);
                    if (!string.IsNullOrEmpty(productTypeId) && int.TryParse(productTypeId, out number1))
                    {
                        product.ProductTypeId = number1;
                    }

                    var item = biz.LoadItems().FirstOrDefault(p => p.Code == product.Code);

                    if (string.IsNullOrEmpty(product.Code))
                    {
                        break;
                    }

                    if (item != null)
                    {
                        product.Id = item.Id;
                        product.Code = item.Code;
                        product.Name = item.Name;
                        product.ProductTypeId = item.ProductTypeId;
                        product.Created = item.Created;
                        product.CreatedByUserId = item.CreatedByUserId;
                        product.Modified = item.Modified;
                        product.ModifiedByUserId = item.ModifiedByUserId;

                        try
                        {
                            biz.UpdateItem(product);
                        }
                        catch (Exception ex)
                        {
                            logger.LogInfoMessage("Import Update Product");
                            string log = string.Format("ID: {0}, Code: {1}, Name: {2}, TypeId: {3}", item.Id, item.Code, item.Name, item.ProductTypeId);
                            logger.LogInfoMessage(log);
                            logger.LogException(ex);
                        }
                    }
                    else
                    {
                        product.Id = 0;
                        product.Created = DateTime.Now;
                        product.CreatedByUserId = currentUser.Id;
                        product.Modified = DateTime.Now;
                        product.ModifiedByUserId = currentUser.Id;

                        try
                        {
                            biz.SaveItem(product);
                        }
                        catch(Exception ex)
                        {
                            logger.LogInfoMessage("Import New Product");
                            string log = string.Format("ID: {0}, Code: {1}, Name: {2}, TypeId: {3}", 0, product.Code, product.Name, product.ProductTypeId);
                            logger.LogInfoMessage(log);
                            logger.LogException(ex);
                        }
                    }
                }

                MessageBox.Show("Cập nhật thành công.");
            }
        }