コード例 #1
0
 protected void btnSaveCetification_Click(object sender, ImageClickEventArgs e)
 {
     ProductManager productManager = new ProductManager(this);
     productManager.InsertProductCertificate(productId, new ProductCertificate()
     {
         Name = txtCertification.Text
     });
     grdProductCertificates.DataBind();
 }
コード例 #2
0
 public void GetListTest()
 {
     ProductManager target = new ProductManager(); // TODO: Initialize to an appropriate value
     IEnumerable<Product> expected = null; // TODO: Initialize to an appropriate value
     IEnumerable<Product> actual;
     actual = target.GetList();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
コード例 #3
0
 public void DeleteTest()
 {
     ProductManager target = new ProductManager(); // TODO: Initialize to an appropriate value
     Product entity = null; // TODO: Initialize to an appropriate value
     bool expected = false; // TODO: Initialize to an appropriate value
     bool actual;
     actual = target.Delete(entity);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
コード例 #4
0
    public void BindTree()
    {
        
        
        ProductManager manager = new ProductManager(this);
        DataTable table = manager.GetProductPartsByCompany((int)Company.MatrixId).Sort("ParentId").ToDataTable();
        RadTreeView1.DataSource = table;
        RadTreeView1.DataBind();

        lblDelete.Visible = RadTreeView1.Nodes.Count > 0;
        btnDelete.Visible = RadTreeView1.Nodes.Count > 0;
    }
コード例 #5
0
        private void LoadInfoForEdit(string PK)
        {
            ProductManager mgr = new ProductManager();
              Product entity = new Product();
              entity = mgr.GetProduct(Convert.ToInt32(PK));

              txtProductName.Text = entity.ProductName;
              txtIntroductionDate.Text = entity.IntroductionDate.ToString("yyyy-MM-dd");
              txtCost.Text = entity.Cost.ToString("#.##");
              txtPrice.Text = entity.Price.ToString("#.##");
              hdnPK.Value = entity.ProductId.ToString();
              hdnAddMode.Value = "false";
        }
コード例 #6
0
 protected void btnSaveImage_Click(object sender, EventArgs e)
 {
     ProductManager productManager = new ProductManager(this);
     Product product;
     ProductImage productImages = new ProductImage();
     if (fupProductImage.FileName != null)
     {
         productImages.ProductId = Convert.ToInt32(Page.ViewState["ProductId"]);
         productImages.Description = txtDescription.Text;
         productManager.InsertProductImage(Page.Company.CompanyId, productImages, fupProductImage.PostedFile);
         grdProductImage.DataBind();
     }
 }
コード例 #7
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     ProductManager manager = new ProductManager(this);
     manager.InsertProductPart(
         new ProductPart
         {
             Name = txtProductPart.Text,
             ParentId = RadTreeView1.SelectedNode != null ? Convert.ToInt32(RadTreeView1.SelectedNode.Value) : (int?)null,
             ModifiedDate = DateTime.Now,
             //CompanyId = (int)Company.MatrixId,
             Quantity = Convert.ToInt16(txtQuantity.Text)
         });
     BindTree();
 }
コード例 #8
0
ファイル: FrmSearchProduct.cs プロジェクト: hamalawy/ssmp
        public FrmSearchProduct(FrmDanhMucSanPham frmParent)
        {
            InitializeComponent();

            productManager = new ProductManager();
            productNameManager = new ProductNameManager();
            categoryManager = new CategoryManager();
            unitManager = new UnitManager();
            countryManager = new CountryManager();
            manufacturerManager = new ManufacturerManager();
            productStatusManager = new ProductStatusManager();

            this.frmParent = frmParent;
        }
コード例 #9
0
        private void DisplayProduct()
        {
            ProductManager mgr = new ProductManager();
              Product entity = null;

              entity = mgr.GetProduct(AppCache.ProductId);
              if(entity!= null)
              {
            txtProductName.Text = entity.ProductName;
            txtIntroductionDate.Text = entity.IntroductionDate.ToString("yyyy-MM-dd");
            txtCost.Text = entity.Cost.ToString();
            txtPrice.Text = entity.Price.ToString();
            chkIsDiscontinued.Checked = entity.IsDiscontinued;
              }
        }
コード例 #10
0
        protected void grdProducts_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            ProductManager mgr = new ProductManager();

              switch (e.CommandName.ToLower())
              {
            case "delete":
              mgr.Delete(Convert.ToInt32(e.CommandArgument));

              e.Handled = true;
              break;

            default:
              break;
              }
        }
コード例 #11
0
 public static bool DeleteProduct(int productid)
 {
     bool result = true;
     using (ProductManager productManager = new ProductManager(null))
     {
         try
         {
             productManager.Delete(productManager.GetProduct(productid));
         }
         catch (System.Data.SqlClient.SqlException e)
         {
             result = false;
         }
     }
     return result;
 }
コード例 #12
0
    protected void btnSaveImage_Click(object sender, EventArgs e) 
    {
        var productManager = new ProductManager(this);

        if (fupProductImage.FileName != null)
        {
            productManager.InsertProductImage(Company,
                                              new ProductImage
                                              {
                                                  ProductId = productId,
                                                  Description = txtDescription.Text
                                              },
                                              fupProductImage.PostedFile);
            lstProductImages.DataBind();
            txtDescription.Text = String.Empty;
        }
    }
コード例 #13
0
    protected void SetABCCurveParameters()
    {
        productManager = new ProductManager(this);
        if (cboDeposit.SelectedValue != "0")
            listAbcCurve = productManager.GetProductsRankByDeposit(Company.CompanyId, Convert.ToInt32(cboDeposit.SelectedValue), "", ucDateTimeInterval.DateInterval);
        else
            listAbcCurve = productManager.GetProductsRankByDeposit(Company.CompanyId, null, "", ucDateTimeInterval.DateInterval);

        productsCount = listAbcCurve.Count;
        Page.ViewState["A"] = (Convert.ToDecimal("0" + ucCurrFieldValA.Text) * productsCount) / 100;
        Page.ViewState["B"] = ((Convert.ToDecimal("0" + ucCurrFieldValB.Text) * productsCount) / 100) + Convert.ToDecimal(Page.ViewState["A"]);
        Page.ViewState["C"] = ((Convert.ToDecimal("0" + ucCurrFieldValC.Text) * productsCount) / 100) + Convert.ToDecimal(Page.ViewState["B"]);
        Page.ViewState["D"] = ((Convert.ToDecimal("0" + ucCurrFieldValD.Text) * productsCount) / 100) + Convert.ToDecimal(Page.ViewState["C"]);
        Page.ViewState["E"] = ((Convert.ToDecimal("0" + ucCurrFieldValE.Text) * productsCount) / 100) + Convert.ToDecimal(Page.ViewState["D"]);
        grdAbcCurve.DataSource = listAbcCurve;
        grdAbcCurve.DataBind();
    }
コード例 #14
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        if (RadTreeView1.SelectedNode == null)
        {
            ShowError("Selecione uma categoria!");
            return;
        }

        ProductManager manager = new ProductManager(this);
        ProductPart productPart = manager.GetProductPart(Convert.ToInt32(RadTreeView1.SelectedNode.Value));
        productPart.Name = txtProductPart.Text;
        productPart.Quantity = Convert.ToInt16(txtQuantity.Text);
        manager.DbContext.SubmitChanges();
        //DataManager.CurrentContext.SubmitChanges();

        BindTree();
    }
コード例 #15
0
ファイル: DanhMucSanPham.cs プロジェクト: hamalawy/ssmp
        public FrmDanhMucSanPham()
        {
            InitializeComponent();

            //Create Manager which will use in form
            productManager = new ProductManager();
            productNameManager = new ProductNameManager();
            productStatusManager = new ProductStatusManager();
            unitManager = new UnitManager();

            categoryManager = new CategoryManager();
            manufacturerManager = new ManufacturerManager();
            countryManager = new CountryManager();
            providerManager = new ProviderManager();

            //
            MODE = Constants.MODE.ADD;
        }
コード例 #16
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ProductManager mgr = new ProductManager();
              Product entity = new Product();

              entity.ProductId = Convert.ToInt32(hdnPK.Value);
              entity.ProductName = txtProductName.Text;
              // Have to check for different types of date formats
              entity.IntroductionDate = DataConvert.HTMLDateToDotNet(txtIntroductionDate.Text);
              entity.Cost = Convert.ToDecimal(txtCost.Text);
              entity.Price = Convert.ToDecimal(txtPrice.Text);
              entity.IsDiscontinued = chkIsDiscontinued.Checked;

              if (Convert.ToBoolean(hdnAddMode.Value))
              {
            mgr.Insert(entity);
              }
              else
              {
            mgr.Update(entity);
              }
        }
コード例 #17
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        if (RadTreeView1.SelectedNode == null)
        {
            ShowError("Selecione uma categoria!");
            return;
        }
        ProductManager manager = new ProductManager(this);
        ProductPart productPart = manager.GetProductPart(Convert.ToInt32(RadTreeView1.SelectedNode.Value));

        try
        {
            manager.DeleteProductPart(productPart);
        }
        catch (Exception ex)
        {
            ShowError(ex.Message.ToString());
            return;
        }

        BindTree();
    }
コード例 #18
0
        protected void grdProducts_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            ProductManager mgr = new ProductManager();
              AppCache.LastPage = Request.Url.AbsoluteUri;
              AppCache.ProductId = Convert.ToInt32(e.CommandArgument);

              switch (e.CommandName.ToLower())
              {
            case "edit":
              Response.Redirect("../ProductForms/ProductEdit.aspx");
              e.Handled = true;
              break;

            case "delete":
              mgr.Delete(AppCache.ProductId);
              e.Handled = true;
              break;

            default:
              break;
              }
        }
コード例 #19
0
        //Also need to pass in customer ID as an argument

        //Does the add product for a customer to sell.
        //Needs a product manager and a product type manager
        public static void DoAction(ProductManager products, ProductTypeManager ptm)

        {
            Console.Clear();
            Console.WriteLine("What is the name of the product you are selling?");
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write("> ");
            Console.ResetColor();
            string name = Console.ReadLine();

            //checks to make sure a name is entered
            name = NoEmptyAnswers.notAOne(name, "Please enter a name for the product you are selling");

            Console.Clear();
            Console.WriteLine($"Please provide a short description of {name}:");
            Console.ForegroundColor = ConsoleColor.Red;
            Console.Write("> ");
            Console.ResetColor();
            string desc = Console.ReadLine();

            desc = NoEmptyAnswers.notAOne(desc, "Please enter a description for your product");
            Double doublePrice = 0;

            //do loop will check that value is an integer
            do
            {
                Console.Clear();
                Console.WriteLine($"How much do you wish to sell {name} for?");
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("> ");
                Console.ResetColor();
                string price = Console.ReadLine();
                price = NoEmptyAnswers.notAOne(price, "Please enter a price for your product");

                try{
                    doublePrice = Convert.ToDouble(price);
                } catch {
                    Console.WriteLine("Please enter a number for a price");
                    price = Console.ReadLine();
                    Double.TryParse(price, out doublePrice);
                }
            }while(doublePrice == 0);

            Console.Clear();

            int intChoice = 0;
            int counter   = 1;
            int selectedTypeIndex;

            productTypeList = ptm.GetProductTypeList();
            //Checks to make sure the selection is in the range of the availble product types
            //Check the selected value agains the length of the list
            do
            {
                do
                {
                    Console.WriteLine($"What kind of product is {name}?");
                    counter = 1;
                    foreach (ProductType item in productTypeList)
                    {
                        Console.WriteLine($"{counter}. {item.name}");
                        counter++;
                    }
                    string choice = Console.ReadLine();
                    choice = NoEmptyAnswers.notAOne(choice, "Please select a number for a value type");
                    try{
                        intChoice = Convert.ToInt32(choice);
                    } catch {
                        Console.WriteLine("Please enter a number");
                    }
                }while(intChoice == 0);

                selectedTypeIndex = intChoice - 1;
            }while(selectedTypeIndex + 1 > productTypeList.Count);

            Console.Clear();
            Console.WriteLine($"How many are you posting for sale?");
            String quantity    = Console.ReadLine();
            int    intQuantity = 0;

            quantity = NoEmptyAnswers.notAOne(quantity, "Please enter a quantity");
            do
            {
                try{
                    intQuantity = Convert.ToInt32(quantity);
                } catch {
                    Console.WriteLine("Please enter a quantity");
                    quantity = Console.ReadLine();
                    Int32.TryParse(quantity, out intQuantity);
                }
            }while(intQuantity == 0);


            Product newProduct = new Product();

            newProduct.name          = name;
            newProduct.description   = desc;
            newProduct.price         = doublePrice;
            newProduct.dateCreated   = DateTime.Today;
            newProduct.quantity      = intQuantity;
            newProduct.customerID    = CustomerManager.currentCustomer.customerID;
            newProduct.productTypeID = productTypeList[selectedTypeIndex].productTypeID;
            products.AddNewProduct(newProduct);
            Console.Clear();
            Console.WriteLine($"{newProduct.name} was successfully added! Press any key to continue");
            Console.ReadKey();
        }
コード例 #20
0
ファイル: HomeController.cs プロジェクト: tekinali/AbcShop
 public HomeController()
 {
     _productManager = new ProductManager();
     _orderManager   = new OrderManager();
     _userManager    = new UserManager();
 }
コード例 #21
0
ファイル: ProductsWindow.cs プロジェクト: Hengle/UnityApex
        private void CreateProductEntry(ProductInfo p)
        {
            EditorGUILayout.BeginVertical("Box", GUILayout.Width(428));

            EditorGUILayout.BeginHorizontal();

            //Create and anchor the foldout
            GUILayout.Label(GUIContent.none, GUILayout.Width(230));

            var productLabel = new GUIContent(" " + p.name, p.icon);

            p.expanded = EditorGUI.Foldout(GUILayoutUtility.GetLastRect(), p.expanded, productLabel, true, _styles.foldout);

            //New update marker
            if (p.newUpdateAvailable)
            {
                if (p.status == ProductStatus.PatchAvailable)
                {
                    GUILayout.Label(new GUIContent("#", "New patch available!"), _styles.labelHighlight, GUILayout.Width(20));
                }
                else
                {
                    GUILayout.Label(new GUIContent("!", "New update available!"), _styles.labelHighlight, GUILayout.Width(20));
                }
            }
            else
            {
                GUILayout.Label(GUIContent.none, GUILayout.Width(20));
            }

            //Version
            GUIContent status;

            if (p.installedVersion == null)
            {
                status = new GUIContent("N/A", "Not installed");
            }
            else
            {
                status = new GUIContent(Write(p.installedVersion), "Installed version");
            }

            GUILayout.Label(status, GUILayout.Width(50));

            //Link buttons / status
            if (p.status != ProductStatus.UpToDate)
            {
                if (p.status == ProductStatus.ComingSoon)
                {
                    EditorGUILayout.LabelField("Coming soon", GUILayout.Width(80));
                }
                else if (p.status == ProductStatus.UpdateAvailable)
                {
                    if (GUILayout.Button(new GUIContent("Update It", string.Format("Version {0} is now available.\n\nClick to open the product's page on the Unity Asset Store.", p.newestVersion))))
                    {
                        AssetStore.Open(p.storeUrl);
                    }
                }
                else if (p.status == ProductStatus.ProductAvailable)
                {
                    if (GUILayout.Button(new GUIContent("Get It", "Now available.\n\nClick to open the product's page on the Unity Asset Store.")))
                    {
                        AssetStore.Open(p.storeUrl);
                    }
                }
                else if (p.status == ProductStatus.PatchAvailable)
                {
                    if (GUILayout.Button(new GUIContent("Patch It", "A patch is available.\n\nClick to download and apply the patch. Patches are hot fixes and all patches will be included in the following product update.")))
                    {
                        ProductManager.ApplyPatches(p, _settings);
                    }
                }
            }

            EditorGUILayout.EndHorizontal();

            //Details
            if (p.expanded)
            {
                GUILayout.Box(GUIContent.none, _styles.boxSeparator);
                var description = string.IsNullOrEmpty(p.description) ? "No description available" : p.description;
                EditorGUILayout.LabelField(description, _styles.labelWithWrap);

                EditorGUILayout.BeginHorizontal();

                if (!string.IsNullOrEmpty(p.productUrl))
                {
                    if (GUILayout.Button("Product Page", _styles.labelLink))
                    {
                        Application.OpenURL(p.productUrl);
                    }

                    EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
                }

                if (!string.IsNullOrEmpty(p.changeLogPath))
                {
                    if (GUILayout.Button("Change Log", _styles.labelLink))
                    {
                        Application.OpenURL(p.changeLogPath);
                    }

                    EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
                }

                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.EndVertical();
        }
コード例 #22
0
        public static void DoAction(ProductManager productManager)
        {
            Console.Clear();
            // Checks if there's an active customer. If not, kicks them to the main menu
            if (CustomerManager.activeCustomer == 0)
            {
                Console.WriteLine("* Please choose an active customer before continuing *");
                Console.WriteLine("* Press 'ENTER' to return to the main menu *");
                Console.ReadLine();
            }
            else
            {
                // Enter in the necessary info to create a product
                Console.WriteLine("Enter product name");
                Console.Write("> ");
                string name = Console.ReadLine();
                Console.Clear();

                //jk-Wrapped Product Price in a do while to loop through the statement unless certain condition is met, if price is not a valid input, catch the error and make user re-enter a valid price
                bool   priceIsADouble = true;
                double price          = 0;

                do
                {
                    Console.WriteLine("Enter product price");
                    Console.Write("> ");
                    string line = Console.ReadLine();
                    //Console.WriteLine(line);
                    try
                    {
                        price          = double.Parse(line);
                        priceIsADouble = true;
                    }
                    catch (FormatException)
                    {
                        Console.WriteLine("{0} is not a valid price", line);
                        Console.WriteLine("*Press 'ENTER' and re-enter a valid price*");
                        Console.ReadLine();
                        priceIsADouble = false;
                    }
                }while(priceIsADouble == false);

                //Console.Clear();
                Console.WriteLine("Enter product description");
                Console.Write("> ");
                string description = Console.ReadLine();
                Console.Clear();
                Console.WriteLine("Enter product quantity");
                Console.Write("> ");
                int quantity = int.Parse(Console.ReadLine());
                Console.Clear();
                Console.WriteLine("Thank you!");

                // Builds/Sends a new product to ProductManager where it gets added to the database
                int prodId = productManager.AddCustomerProduct(new Product()
                {
                    Name        = name,
                    Price       = price,
                    Description = description,
                    Quantity    = quantity,
                    CustomerId  = CustomerManager.activeCustomer
                }
                                                               );

                Console.WriteLine($"Product Id: {prodId} successfully added!");
                Console.WriteLine("* Press 'ENTER' to return to the main menu *");
                Console.ReadLine();
            }
        }
コード例 #23
0
 public JsonResult GroupEditStatus(int id)
 {
     return(Json(ProductManager.UpdateSubGroupStatus(id)));
 }
コード例 #24
0
        public ActionResult Create(BookingClaimViewModel model, FormCollection collection)
        {
            try
            {
                //initial working status
                var workingStatusId = WorkingStatusManager.GetAll().Where(m => m.iDefault == (int)Working.Claiming).SingleOrDefault();

                if (model.Product != null)
                {
                    model.Product.Brand = BrandManager.GetById(model.Product.kBrandId);
                }
                model.Product.ProductType = ProductTypeManager.GetById(model.Product.kProductTypeId);

                #region SAVE CUSTOMER
                var insCount = InsuranceManager.GetCountDuplicate(model.Insurance.sInsuranceName.Trim());
                if (insCount.Count <= 0)
                {
                    Insurance insurance = new Insurance
                    {
                        kInsuranceId   = Guid.NewGuid(),
                        sInsuranceName = model.Insurance.sInsuranceName,
                        sAddress1      = model.Insurance.sAddress1,
                        sCity          = model.Insurance.sCity,
                        sZip           = model.Insurance.sZip,
                        sPhone         = model.Insurance.sPhone,
                        sMobile        = model.Insurance.sMobile,
                        sFax           = model.Insurance.sFax,
                        sEmailAddress  = model.Insurance.sEmailAddress
                    };
                    InsuranceManager.Create(insurance);
                    model.Claim.Insurance = insurance;
                }
                else
                {
                    model.Claim.Insurance = insCount[0];
                }
                #endregion

                #region SAVE Brand
                var brandCount = BrandManager.GetCountDuplicate(model.Product.Brand.sBrandName.Trim());
                if (brandCount.Count <= 0)
                {
                    Brand brand = new Brand
                    {
                        kBrandId   = Guid.NewGuid(),
                        sBrandName = model.Product.Brand.sBrandName
                    };
                    BrandManager.Create(brand);
                    model.Product.Brand = brand;
                }
                else
                {
                    model.Product.Brand = brandCount[0];
                }
                #endregion

                #region SAVE Product Type
                var productTypeCount = ProductTypeManager.GetCountDuplicate(model.Product.ProductType.sDescription.Trim());
                if (productTypeCount.Count <= 0)
                {
                    ProductType productType = new ProductType
                    {
                        kProductTypeId = Guid.NewGuid(),
                        sDescription   = model.Product.ProductType.sDescription
                    };
                    ProductTypeManager.Create(productType);
                    model.Product.ProductType = productType;
                }
                else
                {
                    model.Product.ProductType = productTypeCount[0];
                }
                #endregion

                #region SAVE PRODUCT
                var productCount = ProductManager.GetCountDuplicate(
                    model.Product.sProductName.Trim()
                    //, model.Product.Brand.sBrandName.Trim()
                    //, model.Product.ProductType.sDescription.Trim()
                    );
                if (productCount.Count <= 0)
                {
                    Product product = new Product
                    {
                        kProductId     = Guid.NewGuid(),
                        kProductTypeId = productTypeCount.SingleOrDefault().kProductTypeId,
                        kBrandId       = brandCount.SingleOrDefault().kBrandId,
                        sProductName   = model.Product.sProductName,
                        sProductModel  = model.Product.sProductModel
                    };
                    ProductManager.Create(product);
                    model.Product = product;
                }
                else
                {
                    model.Product = productCount[0];
                }
                #endregion

                #region SAVE CLAIM BOOKING
                var repair = RepairManager.GetByRepairNo(model.Claim.sRepairNo ?? "");

                //initial booking first character
                string char_number = CharBooking.C.ToString();

                Claim claim = new Claim();
                claim.dtDateUpdate = DateTime.Now;
                claim.kClaimId     = Guid.NewGuid();
                claim.kStaffId     = (Guid)Membership.GetUser().ProviderUserKey;
                claim.kOwnerId     = repair.kOwnerId ?? (Guid)Membership.GetUser().ProviderUserKey;
                claim.kInsuranceId = model.Claim.Insurance.kInsuranceId;
                claim.kProductId   = model.Product.kProductId;
                claim.sRepairNo    = model.Claim.sRepairNo;
                claim.sClaimNo     = String.Format("{0}{1}", char_number, ClaimNextItemNoManager.GetNextItemNo());
                claim.sSerial      = model.Claim.sSerial;
                if (model.Claim.dtInsuranceExpire != null)
                {
                    claim.dtInsuranceExpire = model.Claim.dtInsuranceExpire.Value.AddYears(-543);
                }


                model.Claim = claim;
                ClaimManager.Create(model.Claim);
                ClaimNextItemNoManager.IncreaseNextItemNo();

                #region also pdate repair side

                repair.dtDateUpdate = DateTime.Now;
                repair.kStaffId     = (Guid)Membership.GetUser().ProviderUserKey;
                RepairManager.Edit(repair);

                #endregion

                #endregion

                #region SAVE REPAIR WORKING STATUS

                ClaimStatus claimStatus = new ClaimStatus
                {
                    kClaimStatusId   = Guid.NewGuid(),
                    kWorkingStatusId = workingStatusId.kWorkingStatusId,
                    kStaffId         = (Guid)Membership.GetUser().ProviderUserKey,
                    kClaimId         = model.Claim.kClaimId
                };
                ClaimStatusManager.Create(claimStatus);

                #endregion

                #region UPDATE REPAIR WORKING STATUS
                if (!String.IsNullOrEmpty(model.Claim.sRepairNo))
                {
                    repair = RepairManager.GetByRepairNo(model.Claim.sRepairNo);

                    RepairStatus repairStatus = new RepairStatus
                    {
                        kRepairStatusId  = Guid.NewGuid(),
                        kWorkingStatusId = workingStatusId.kWorkingStatusId,
                        kStaffId         = (Guid)Membership.GetUser().ProviderUserKey,
                        kRepairId        = repair.kRepairId
                    };
                    RepairStatusManager.Create(repairStatus);
                }
                #endregion



                #region SAVE CAUSE OF CLAIM

                //initial cause
                string keyname;
                string keyvalue;
                int    countvalue = 0;
                for (int i = 0; i <= collection.Count - 1; i++)
                {
                    keyname  = collection.AllKeys[i];
                    keyvalue = collection[i];

                    if (keyname.Contains("cause"))
                    {
                        countvalue++;
                    }
                }

                if (countvalue > 1)
                {
                    model.ClaimCauses = new List <ClaimCause>();
                    for (int i = 1; i <= countvalue / 4; i++)
                    {
                        ClaimCause claimCause = new ClaimCause();
                        claimCause.kClaimCauseId = Guid.NewGuid();
                        claimCause.kClaimId      = model.Claim.kClaimId;
                        claimCause.kStaffId      = (Guid)Membership.GetUser().ProviderUserKey;
                        claimCause.sDescription  = collection[String.Format("cause_description_{0}", i)];
                        claimCause.sNote         = collection[String.Format("cause_note_{0}", i)];

                        if (!String.IsNullOrEmpty(claimCause.sDescription))
                        {
                            int qty = 0;
                            if (int.TryParse(collection[String.Format("cause_qty_{0}", i)], out qty))
                            {
                                claimCause.iQty = qty;
                            }

                            Decimal price = 0;
                            if (Decimal.TryParse(collection[String.Format("cause_price_{0}", i)], out price))
                            {
                                claimCause.dPrice = price;
                            }

                            model.ClaimCauses.Add(claimCause);
                            ClaimCourseManager.Create(claimCause);
                        }
                    }
                }

                if (model.ClaimCauses != null)
                {
                    foreach (var item in model.ClaimCauses)
                    {
                        var causeCount = CauseManager.GetCountDuplicate(item.sDescription.Trim());
                        if (causeCount <= 0)
                        {
                            Cause cause = new Cause
                            {
                                kCauseId     = Guid.NewGuid(),
                                sDescription = item.sDescription.Trim()
                            };
                            CauseManager.Create(cause);
                        }
                    }
                }
                #endregion
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Error", "Home"));
            }

            Claim model2 = ClaimManager.GetById(model.Claim.kClaimId);

            //create remind for history
            RemindHistory remind = new RemindHistory
            {
                sRemind  = model2.vMessage,
                kStaffId = model2.kStaffId
            };
            RemindHistoryManager.Create(remind);

            var clientName = User.Identity.Name;
            Task.Factory.StartNew(() =>
            {
                var clients = Hub.GetClients <RealTimeJTableDemoHub>();
                clients.RecordCreated(clientName, model2);
            });

            return(RedirectToAction("Index"));
        }
コード例 #25
0
ファイル: PriceGrabberService.cs プロジェクト: terry2012/DSV
        /// <summary>
        /// Generate PriceGrabber feed
        /// </summary>
        /// <param name="stream">Stream</param>
        public static void GenerateFeed(Stream stream)
        {
            using (StreamWriter writer = new StreamWriter(stream))
            {
                writer.WriteLine("Unique Retailer SKU;Manufacturer Name;Manufacturer Part Number;Product Title;Categorization;Product URL;Image URL;Detailed Description;Selling Price;Condition;Availability");

                foreach (Product p in ProductManager.GetAllProducts(false))
                {
                    foreach (ProductVariant pv in ProductManager.GetProductVariantsByProductId(p.ProductId, false))
                    {
                        string sku = pv.ProductVariantId.ToString();
                        string manufacturerName       = p.ProductManufacturers.Count > 0 ? p.ProductManufacturers[0].Manufacturer.Name : String.Empty;
                        string manufacturerPartNumber = pv.ManufacturerPartNumber;
                        string productTitle           = pv.FullProductName;
                        string productUrl             = SEOHelper.GetProductUrl(p);

                        string imageUrl = string.Empty;
                        var    pictures = PictureManager.GetPicturesByProductId(p.ProductId, 1);
                        if (pictures.Count > 0)
                        {
                            imageUrl = PictureManager.GetPictureUrl(pictures[0], SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize"), true);
                        }
                        else
                        {
                            imageUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Entity, SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize"));
                        }

                        string description    = pv.Description;
                        string price          = pv.Price.ToString(new CultureInfo("en-US", false).NumberFormat);
                        string availability   = pv.StockQuantity > 0 ? "Yes" : "No";
                        string categorization = "no category";

                        if (String.IsNullOrEmpty(description))
                        {
                            description = p.FullDescription;
                        }
                        if (String.IsNullOrEmpty(description))
                        {
                            description = p.ShortDescription;
                        }
                        if (String.IsNullOrEmpty(description))
                        {
                            description = p.Name;
                        }

                        var productCategories = p.ProductCategories;
                        if (productCategories.Count > 0)
                        {
                            StringBuilder sb = new StringBuilder();
                            foreach (Category cat in CategoryManager.GetBreadCrumb(productCategories[0].CategoryId))
                            {
                                sb.AppendFormat("{0}>", cat.Name);
                            }
                            sb.Length     -= 1;
                            categorization = sb.ToString();
                        }

                        productTitle           = RemoveSpecChars(productTitle);
                        manufacturerPartNumber = RemoveSpecChars(manufacturerPartNumber);
                        manufacturerName       = RemoveSpecChars(manufacturerName);
                        description            = HtmlHelper.StripTags(description);
                        description            = RemoveSpecChars(description);
                        categorization         = RemoveSpecChars(categorization);

                        writer.WriteLine("{0};{1};{2};{3};{4};{5};{6};{7};{8};New;{9}",
                                         sku,
                                         manufacturerName,
                                         manufacturerPartNumber,
                                         productTitle,
                                         categorization,
                                         productUrl,
                                         imageUrl,
                                         description,
                                         price,
                                         availability);
                    }
                }
            }
        }
コード例 #26
0
ファイル: ProductController.cs プロジェクト: war-man/pos
 public ProductController(ApplicationDbContext context, IHostingEnvironment environment)
 {
     _context     = context;
     _environment = environment;
     _manager     = new ProductManager(context);
 }
コード例 #27
0
 public ProductsController(ProductManager productManager)
 {
     ProductManager = productManager;
 }
コード例 #28
0
ファイル: ProductInfo.ascx.cs プロジェクト: terry2012/DSV
        protected void BindData()
        {
            var product = ProductManager.GetProductById(this.ProductId);

            if (product != null)
            {
                lProductName.Text      = Server.HtmlEncode(product.LocalizedName);
                lShortDescription.Text = product.LocalizedShortDescription;
                lFullDescription.Text  = product.LocalizedFullDescription;

                //manufacturers
                List <Manufacturer> manufacturers = new List <Manufacturer>();
                foreach (var pm in product.ProductManufacturers)
                {
                    var manufacturer = pm.Manufacturer;
                    if (manufacturer != null)
                    {
                        manufacturers.Add(manufacturer);
                    }
                }
                if (manufacturers.Count > 0)
                {
                    if (manufacturers.Count == 1)
                    {
                        lManufacturersTitle.Text = GetLocaleResourceString("Products.Manufacturer");
                    }
                    else
                    {
                        lManufacturersTitle.Text = GetLocaleResourceString("Products.Manufacturers");
                    }
                    rptrManufacturers.DataSource = manufacturers;
                    rptrManufacturers.DataBind();
                }
                else
                {
                    phManufacturers.Visible = false;
                }

                //pictures
                var pictures = PictureManager.GetPicturesByProductId(product.ProductId);
                if (pictures.Count > 1)
                {
                    defaultImage.ImageUrl        = PictureManager.GetPictureUrl(pictures[0], SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                    defaultImage.ToolTip         = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    defaultImage.AlternateText   = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    lvProductPictures.DataSource = pictures;
                    lvProductPictures.DataBind();
                }
                else if (pictures.Count == 1)
                {
                    defaultImage.ImageUrl      = PictureManager.GetPictureUrl(pictures[0], SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                    defaultImage.ToolTip       = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    lvProductPictures.Visible  = false;
                }
                else
                {
                    defaultImage.ImageUrl      = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                    defaultImage.ToolTip       = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    lvProductPictures.Visible  = false;
                }
                if (SettingManager.GetSettingValueBoolean("Media.Product.DefaultPictureZoomEnabled", false))
                {
                    var picture = product.DefaultPicture;
                    if (picture != null)
                    {
                        lnkMainLightbox.Attributes["href"] = PictureManager.GetPictureUrl(picture);
                        lnkMainLightbox.Attributes["rel"]  = "lightbox-pd";
                    }
                }
            }
            else
            {
                this.Visible = false;
            }
        }
コード例 #29
0
ファイル: WPIHelper.cs プロジェクト: lwhitelock/Websitepanel
        private void LoadFeeds()
        {
            if (null == _feeds || !_feeds.Any())
            {
                throw new Exception("WpiHelper: no feeds provided");
            }

            _productManager = new ProductManager();

            try
            {
                TryLoadFeeds();
                // ok, all feeds loaded
            }
            catch(Exception ex1)
            {
                // feed loading failed

                if (_feeds.Count > 1)
                {
                    // exclude feeds except first (default microsoft feed)
                    _feeds = new List<string> {_feeds[0]};

                    // re-create product manager
                    _productManager = new ProductManager();

                    try
                    {
                        // loaded first (default) feed only
                        TryLoadFeeds();
                    }
                    catch(Exception ex2)
                    {
                        throw new Exception(string.Format("WpiHelper: download first feed failed: {0}", ex2), ex2);
                    }
                }
                else
                {
                    throw new Exception(string.Format("WpiHelper: download all ({0}) feeds failed: {1}", _feeds.Count, ex1), ex1);
                }
            }
        }
コード例 #30
0
        public void ProductManagerTest_SaveOrUpdateTest()
        {
            ProductManager target = new ProductManager(); // TODO: Initialize to an appropriate value

            Product entity = target.Get(1);
            entity.Price = 200;
            entity.ProductCategoryId = 1;
            entity.ProductName = "Test Product2";

            target.SaveOrUpdate(entity);
            target.Delete(entity);
            Assert.AreNotSame(0, entity.Id);
        }
コード例 #31
0
    protected void lstBudget_SelectedIndexChanged(object sender, EventArgs e)
    {
        //
        //Toda vez que um usuário selecionar um orçamento, eu envio o valor para uma variável JavaScript,
        //para poder pegar na tela de pagamento dinamicamente, o processo é feito, para no caso de a venda
        //ser concretizada, o orçamento deverá ser apagado (Executando em sessão, pois não achei o método de 
        //fazer com hidden
        //
        //Page.ViewState["bugdetId"] = bugdetId;


        CreateBasket();
        Session["BudgetId"] = Convert.ToInt32(lstBudget.SelectedValue);
        ProductManager productManager = new ProductManager(this);
        SaleManager saleManager = new SaleManager(this);
        Budget budget = saleManager.GetBudget((Int32)Session["BudgetId"], Company.CompanyId);

        if (budget.Discount.HasValue)
        {
            if (budget.DiscountType == (int)DiscountType.Cash)
                txtDiscount.Text = budget.Discount.Value.ToString("##,##0.00");
            else
            {
#warning eliminar variavel temporaria/ criar método, ou executar função novamente
                Decimal? discount = budget.BudgetItems.Sum(bi => bi.Quantity * bi.UnitPrice) * (budget.Discount.Value / 100);
                if (discount.HasValue)
                    txtDiscount.Text = discount.Value.ToString("##,##0.00");
            }


        }
        if (budget.AdditionalCost.HasValue)
            txtDiscount.Text = (Convert.ToDecimal(txtDiscount.Text) - Convert.ToDecimal(budget.AdditionalCost.Value)).ToString("##,##0.00");
        foreach (DataRow row in productManager.GetProductsByBudget((Int32)Session["BudgetId"]).Rows)
        {
            string productName;
            if (!String.IsNullOrEmpty(row["Name"].ToString()))
                productName = row["Name"].ToString();
            else
                productName = row["SpecialProductName"].ToString();
            //string productName = row["Name"].ToString() + row["SpecialProductName"].ToString();

            if (String.IsNullOrEmpty(row["ProductId"].ToString()))
                productName += "&nbsp;&nbsp;&nbsp;&nbsp;<img src='" + ResolveClientUrl("~/App_Shared/themes/glasscyan/Company/Product_warning.gif") + "' alt='Este produto não se encontra cadastrado!' />";

            basket.Rows.Add(
                row["ProductId"],
                row["Quantity"],
                    productName,
                /*SerialNumber*/ "",
                row["ProductCode"],
                row["unitPrice"],
                Convert.ToDouble(row["Quantity"]) * Convert.ToDouble(row["unitPrice"]),
                row["UnitCost"] != DBNull.Value ? Convert.ToDouble(row["UnitCost"]) : 0
                );
        }

        BindGrid();
    }
コード例 #32
0
        // GET: Home
        public ActionResult Index()
        {
            var products = ProductManager.GetProducts();

            return(View(products));
        }
コード例 #33
0
ファイル: HomeController.cs プロジェクト: doganaker/MVC
        public IActionResult Index()
        {
            List <Product> products = ProductManager.GetAllProducts();

            return(View(products));
        }
コード例 #34
0
 public void ProductManagerConstructorTest()
 {
     ProductManager target = new ProductManager();
     Assert.Inconclusive("TODO: Implement code to verify target");
 }
コード例 #35
0
    protected void grdInventory_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        DataTable productList = (DataTable)Page.ViewState["ProductList"];
        Inventory inv = new Inventory();
        ProductManager pManager = new ProductManager(this);

        var productName = (grdInventory.Rows[e.RowIndex].FindControl("txtProduct") as TextBox).Text;
        var product = pManager.GetProductByName((int)Company.MatrixId, productName);
        if (product != null)
        {
            inv.ProductId = product.ProductId;
            inv.Quantity = Convert.ToInt16((grdInventory.Rows[e.RowIndex].FindControl("txtQuantity") as TextBox).Text);
            AddProduct(inv, productName);
            BindGrid();
            e.Cancel = true;
        }
        else
        {
            ShowError(Resources.Exception.nonexistentProduct);
            BindGrid();
        }

    }
コード例 #36
0
        //save button click
        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (productId.Text != "" && productName.Text != "" && buyingRate.Text != "" && saleRate.Text != "")
            {
                if (String.IsNullOrEmpty(MinimumQuantity.Text))
                {
                    minQuantity = 0.0m;
                }
                else
                {
                    if (Double.TryParse(MinimumQuantity.Text.Trim(), out num))
                    {
                        minQuantity = Convert.ToDecimal(this.MinimumQuantity.Text.Trim());
                    }
                    else
                    {
                        MessageBox.Show("Enter Number Only");
                        MinimumQuantity.Clear();
                    }
                }
                if (String.IsNullOrEmpty(SKUTextbox.Text))
                {
                    barcode = null;
                }
                else
                {
                    barcode = SKUTextbox.Text;
                }

                if (Double.TryParse(buyingRate.Text.Trim(), out num) && Double.TryParse(saleRate.Text.Trim(), out num) && UnitCombox.Text != "" && Double.TryParse(vat.Text.Trim(), out num))
                {
                    try
                    {
                        // update the product using  aupdate model
                        aUpdateProductModel.ProductName        = productName.Text;
                        aUpdateProductModel.ProductType        = productType.Text;
                        aUpdateProductModel.ProductBuyingRate  = Convert.ToDecimal(buyingRate.Text);
                        aUpdateProductModel.ProductSellingRate = Convert.ToDecimal(saleRate.Text);
                        aUpdateProductModel.Vat = Convert.ToDecimal(vat.Text);
                        aUpdateProductModel.ProductSaleRateWithVat = Convert.ToDecimal(vatsale.Text);
                        aUpdateProductModel.Barcode                = barcode;
                        aUpdateProductModel.ProductUnit            = UnitCombox.Text;
                        aUpdateProductModel.ProductMinimumQuantity = minQuantity;


                        ProductManager newProductManager = new ProductManager();
                        int            isDone            = newProductManager.ProductUpdate(aUpdateProductModel);
                        if (isDone > 0)
                        {
                            MessageBox.Show("Update Sucessfully");
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("Update Unsucessful");
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Try Again");
                    }
                }
                else
                {
                    MessageBox.Show("Please Enter Number Only");
                    buyingRate.Clear();
                    saleRate.Clear();
                    MinimumQuantity.Clear();
                }
            }


            else
            {
                MessageBox.Show("Please Fill The Data");
            }
        }
コード例 #37
0
 public Form1()
 {
     InitializeComponent();
     _productService  = new ProductManager(new EfProductDal());
     _categoryService = new CategoryManager(new EfCategoryDal());
 }
コード例 #38
0
ファイル: Program.cs プロジェクト: igmo1910/Day5Homework
        static void Main(string[] args)
        {
            Console.WriteLine("Yapmak istediğiniz işlemi seçiniz: ");
            Console.WriteLine("1- Oyuncu kayıt");
            Console.WriteLine("2- Oyuncu güncelle");
            Console.WriteLine("3- Oyuncu sil");
            Console.WriteLine("4- Oyun satın al");
            Console.WriteLine("5- Kampanya ekle");
            Console.WriteLine("6- Kampanya güncelle");
            Console.WriteLine("7- Kampanya sil");
            var selection = Convert.ToInt32(Console.ReadLine());

            Customer customer = new Customer()
            {
                Id            = 1,
                FirstName     = "İsmail",
                Surname       = "Gümüş",
                DateOfBirth   = new DateTime(1984, 4, 9),
                NationalityId = "11122233344"
            };

            Product product = new Product()
            {
                Id          = 2,
                ProductName = "BeeKeeper's World",
                Price       = 99.99
            };

            Campaign campaign = new Campaign()
            {
                Id           = 3,
                CampaignName = "Bahar Kampanyası",
                Discount     = 49.99
            };

            IBaseService <Customer> customerManager = new CustomerManager(new UserCheckManager());

            IProductService productManager = new ProductManager();

            IBaseService <Campaign> campaignManager = new CampaignManager();

            switch (selection)
            {
            case 1:
                customerManager.Add(customer);
                break;

            case 2:
                customerManager.Update(customer);
                break;

            case 3:
                customerManager.Delete(customer);
                break;

            case 4:
                if (campaign.Discount > 0)
                {
                    productManager.Sell(product, customer, campaign);
                }
                else
                {
                    productManager.Sell(product, customer);
                }
                break;

            case 5:
                campaignManager.Add(campaign);
                break;

            case 6:
                campaignManager.Update(campaign);
                break;

            case 7:
                campaignManager.Delete(campaign);
                break;
            }
        }
コード例 #39
0
ファイル: Factory.cs プロジェクト: fontana38/AnimaliaPet
        public static ProductManager CreateProducManager()
        {
            var productManager = new ProductManager();

            return(productManager);
        }
コード例 #40
0
        public static object UpdateProduct(string WebFormDataParameter)
        {
            object         response       = new object();
            dynamic        webFormData    = JsonConvert.DeserializeObject <dynamic>(WebFormDataParameter);
            ProductManager productManager = new ProductManager();

            bool[] check1;
            //collected field
            string collectedProductID           = webFormData[0].productID.Value;
            string collectedproductNameText     = webFormData[0].productNameText.Value;
            string collectedproductCodeText     = webFormData[0].productCodeText.Value;
            string collectedproductPriceText    = webFormData[0].productPriceText.Value;
            string collectedproductPointsEarned = webFormData[0].productPointsEarned.Value;
            string collectedproductPointsNeeded = webFormData[0].productPointsNeeded.Value;
            string collecteddescription         = webFormData[0].description.Value;
            string collectedStockQuantities     = webFormData[0].StockQuantities.Value.ToString();
            string collectedStockAvailability   = webFormData[0].StockAvailability.Value.ToString();
            string collectedAlertOutOfStock     = webFormData[0].AlertOutOfStock.Value.ToString();
            string collectedViewableByPublic    = webFormData[0].ViewableByPublic.Value.ToString();

            //UpdateOneProduct return row affect and uniqueconstraint check
            check1 = productManager.UpdateOneProduct(collectedProductID, collectedproductNameText, collectedproductCodeText, collecteddescription, collectedViewableByPublic,
                                                     collectedAlertOutOfStock);

            bool rowAffected = check1[0];
            bool constraint  = check1[1];

            if (rowAffected == false)
            {
                response = new
                {
                    status  = "fail",
                    message = "Product not Added!"
                }
            }
            ;
            else if (constraint == true)
            {
                response = new
                {
                    status  = "constraint",
                    message = "Product Not Added. Name Already Exist. Please use a different Product Name"
                };
            }

            if ((rowAffected || !constraint)) //if no constraint and rowaffected > 0 for .UpdateOneProduct() execute this
            {
                bool checkStock = false, checkPrice = false, checkPoint = false, checkCategory = false, checkSubCategory = false;
                checkStock = productManager.UpdateProductStock(collectedStockQuantities, collectedStockAvailability, collectedAlertOutOfStock, collectedProductID);
                checkPrice = productManager.UpdateProductPrice(collectedProductID, collectedproductPriceText, "");
                checkPoint = productManager.UpdateProductPoint(collectedProductID, collectedproductPointsEarned, collectedproductPointsNeeded);
                // retrieve collectedCheckSubCategoryIDarray from client side
                //convert Newtonsoft.Json.Linq.JArray to int[]
                string[] items = webFormData[1].ToObject <string[]>();

                int countSub     = 0;
                int countCateSub = 0;
                foreach (string s in items)
                {
                    if (s.Substring(0, 3) == "Sub")
                    {
                        countCateSub++;
                    }
                    else
                    {
                        countSub++;
                    }
                }
                //store subcategories ID
                int[] subcategories = new int[countCateSub];
                //store categories ID
                int[] categories = new int[countSub];
                int   subcount   = 0;
                int   count      = 0;
                foreach (string s in items)
                {
                    if (s.Substring(0, 3) == "Sub")
                    {
                        string temp = s.Substring(12, 1);//
                        subcategories[subcount] = int.Parse(temp);
                        subcount++;
                    }
                    else
                    {
                        string temp = s.Substring(9, 1);//
                        categories[count] = int.Parse(temp);
                        count++;
                    }
                }

                //do the update
                checkCategory    = productManager.UpdateProductCategory(collectedProductID, categories);
                checkSubCategory = productManager.UpdateProductSubCategory(collectedProductID, subcategories);

                string message = "";
                string status  = "fail";

                if (!checkPoint)
                {
                    message += "Point Not Updated.\n";
                }
                if (!checkPrice)
                {
                    message += "Price Not Updated.\n";
                }
                if (!checkStock)
                {
                    message += "Stock Not Updated.\n";
                }
                if (!checkCategory)
                {
                    message += "Category Not Updated\n";
                }
                if (!checkSubCategory)
                {
                    message += "SubCategory Not Updated\n";
                }

                if ((checkPoint && checkPrice && checkStock && checkCategory && checkSubCategory))//if all successfully updated,status =true

                {
                    status = "success";
                }

                response = new
                {
                    status,
                    message
                };
            }

            return(response);
        }
コード例 #41
0
        public override void Run()
        {
            Console.Clear();
            Console.WriteLine(MenuSystem.Path);

            ProductManager productManager = ProductManager.getInstance();

            Console.Write("Name: ");
            string name = Console.ReadLine();

            name.IsMandatory(ref name);
            Console.Write("Short Code: ");
            string shortCode = Console.ReadLine();

            shortCode.IsMandatory(ref shortCode);
            while (shortCode.Length > 4)
            {
                Console.WriteLine("ShortCode length must be smaller than 4. Please enter shortcode again.");
                shortCode = Console.ReadLine();
            }
            while (ProductManager.shortCodeSet.Contains(shortCode))
            {
                Console.WriteLine("ShortCode must be unique and it's length must be smaller than 4. Please enter shortcode again.");
                shortCode = Console.ReadLine();
            }
            ProductManager.shortCodeSet.Add(shortCode);
            Console.Write("Description: ");
            string desc = Console.ReadLine();

            desc.IsMandatory(ref desc);
            Console.Write("Manufacturer: ");
            string manufacturer = Console.ReadLine();

            manufacturer.IsMandatory(ref manufacturer);
            double price = -1; Console.Write("Price: ");

            while (price > 0 || Double.TryParse("" + Console.ReadLine(), out price))
            {
                Console.WriteLine("Price is mandatory, it cannot be empty. Please enter price again.");
                manufacturer = Console.ReadLine();
            }

            Console.Write("Catagory: \nChoose from below list:\n");
            CatagoryManager.Catagories.ForEach(x => Console.WriteLine($"{x.ID}. {x.Name}"));
            List <Catagory> productCatagories = new List <Catagory>();
            int             id = -1; string choice;

            do
            {
                Console.Write("Enter the id of the catagory: ");

                Int32.TryParse("" + Console.ReadKey(false).KeyChar, out id);
                var listFound = CatagoryManager.Catagories.Find(x => x.ID == id);
                if (listFound != null)
                {
                    productCatagories.Add(listFound);
                }
                Console.WriteLine("\nPress yes to enter more catagories otherwise no or any other key to exit:");
                choice = Console.ReadLine().ToLower();
            } while (choice.Equals("yes"));

            Console.WriteLine();

            productManager.AddProduct(name, manufacturer, shortCode, productCatagories, desc, price);
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }
コード例 #42
0
        public ActionResult Szukaj(string productName, int?categoryID, int?page, int?minV, int?maxV, string sortV, string codeProduct)
        {
            if (Request["searchProduct"] != null)
            {
                productName = Request["searchProduct"];
            }
            System.Diagnostics.Debug.WriteLine("co to " + productName);

            if (String.IsNullOrEmpty(Request["kategoria"]) && categoryID == null)
            {
                categoryID = -1;
            }
            else if (!String.IsNullOrEmpty(Request["kategoria"]))
            {
                categoryID = Int32.Parse(Request["kategoria"]);
            }

            int min, max;

            if (Request["minPole"] == null && minV == null)
            {
                min = 0;
            }
            else if (Request["minPole"] == null)
            {
                min = minV.Value;
            }
            else
            {
                min  = Int32.Parse(Request["minPole"]) * 10;
                page = 1;
            }
            if (Request["maxPole"] == null && maxV == null)
            {
                max = 99999;
            }
            else if (Request["maxPole"] == null)
            {
                max = maxV.Value;
            }
            else
            {
                max = Int32.Parse(Request["maxPole"]) * 10;
            }

            int sortV1 = Int32.Parse(String.IsNullOrEmpty(sortV) ? "0" : sortV);

            ViewBag.sortV = sortV1;
            ViewBag.min   = min;
            ViewBag.max   = max;
            int maxToSelect;

            System.Diagnostics.Debug.WriteLine("wart sortV1" + sortV1 + " min " + min + " max " + max + " cat " + categoryID.Value + " name " + productName);
            List <ProductCategoryView> listProducts = ProductManager.GetProductFromSearch(productName, categoryID.Value, min, max, sortV1, out maxToSelect);

            if (listProducts == null)
            {
                ViewBag.Ilosc = 0;
                return(View());
            }

            if (max == 99999)
            {
                ViewBag.max = maxToSelect;
            }
            var list          = listProducts;
            var pageNumber    = page ?? 1;
            int pageSize      = 10;
            var onePageOfItem = list.ToPagedList(pageNumber, pageSize);

            ViewBag.productName = productName;
            ViewBag.page        = 1;
            ViewBag.categoryID  = categoryID.Value;
            List <CategoryView> listCategories = CategoryManager.GetCategoriesNamesForSearchName(categoryID.Value, productName);

            foreach (CategoryView item in listCategories)
            {
                System.Diagnostics.Debug.WriteLine(" " + item.Name);
            }
            ViewData["categories"] = listCategories;
            return(View(onePageOfItem));
        }
コード例 #43
0
 public JsonResult DeleteRecord(int id)
 {
     return(Json(ProductManager.DeleteSubGroup(id)));
 }
コード例 #44
0
 public Product(ProductManager productManager)
 {
     m_productManager = productManager;
 }
コード例 #45
0
        static void Main(string[] args)
        {
            #region Information Etries
            Console.WriteLine("Nationality ID :");
            string nationalityID = Console.ReadLine();

            Console.WriteLine("Name:");
            string name = Console.ReadLine();

            Console.WriteLine("Last Name:");
            string lastName = Console.ReadLine();

            Console.WriteLine("Date of Birth:");
            DateTime dateofBirth = Convert.ToDateTime(Console.ReadLine());
            #endregion

            #region Customer Control Service

            Customer confirmedCustomer = new Customer
            {
                CustomerIdentityKey = nationalityID,
                CustomerName        = name.ToUpper(),
                CustomerLastName    = lastName.ToUpper(),
                DateofBirth         = dateofBirth
            };

            // KPSWebService
            IPersonCheckService checkService = new MernisServiceAdapter();
            checkService.CheckIfRealPerson(confirmedCustomer);

            // Manual Control
            //ICustomerCheckService checkService = new CustomerCheckService();
            //checkService.CustomerCheck(confirmedCustomer);

            #endregion

            #region Added Entities
            // Products
            Product product1 = new Product {
                ProductID = 1, ProductName = "Football Manager 2021", ProductUnitPrice = 24
            };
            Product product2 = new Product {
                ProductID = 2, ProductName = "FIFA 21", ProductUnitPrice = 44
            };
            Product product3 = new Product {
                ProductID = 3, ProductName = "Raccoon City Edition", ProductUnitPrice = 34
            };

            // Campaigns
            Campaign campaign1 = new Campaign {
                CampaignID = 10, CampaignName = "FIFA 21", LowerLimit = 0, DiscountRate = 0.3
            };
            Campaign campaign2 = new Campaign {
                CampaignID = 11, CampaignName = "Raccoon City Edition", LowerLimit = 0, DiscountRate = 0.12
            };
            Campaign campaign3 = new Campaign {
                CampaignID = 12, CampaignName = "November Discounts", LowerLimit = 200, DiscountRate = 0.3
            };

            //Customers / Gamers
            Customer customer1 = new Customer {
                CustomerID = 101, CustomerIdentityKey = "1111111", CustomerName = "Mehmet", CustomerLastName = "Akın", DateofBirth = new DateTime(2001, 1, 6)
            };
            Customer customer2 = new Customer {
                CustomerID = 102, CustomerIdentityKey = "2222222", CustomerName = "Zeynep", CustomerLastName = "Eren", DateofBirth = new DateTime(1997, 11, 26)
            };
            Customer customer3 = new Customer {
                CustomerID = 103, CustomerIdentityKey = "1111111", CustomerName = "Mehmet", CustomerLastName = "Akın", DateofBirth = new DateTime(1992, 5, 17)
            };
            #endregion

            #region Create Managers
            SalesManager    salesManager    = new SalesManager();
            CustomerManager customerManager = new CustomerManager();
            ProductManager  productManager  = new ProductManager();
            CampaignManager campaignManager = new CampaignManager();
            #endregion


            List <Product> productList = new List <Product> {
                product1, product2, product3
            };
            productManager.GetAll(productList);
            //salesManager.DiscountCalculate(product2, campaign3);
            //salesManager.DiscountCalculate(productList, campaign3);
            //customerManager.Add(customer3);
            //campaignManager.Update(campaign1);
            //productManager.Delete(product1);
        }
コード例 #46
0
    protected void btnAdd_Click(object sender, ImageClickEventArgs e)
    {
        btnAdd.Focus();

        var inv = new Inventory();
        var pManager = new ProductManager(this);

        if (selProduct.Product != null)
        {
            inv.ProductId = selProduct.Product.ProductId;
            if (ucCurrFieldQuantity.IntValue == 0)
            {
                ShowError(Exception.InvalidProductQuantity);
                return;
            }

            inv.Quantity = ucCurrFieldQuantity.IntValue;
            inv.Localization = txtLocalization.Text;
            if (uctxtUnitPrice1.CurrencyValue.HasValue)
                inv.UnitPrice = uctxtUnitPrice1.CurrencyValue.Value;

            if (uctxtUnitPrice2.CurrencyValue.HasValue)
                inv.UnitPrice2 = uctxtUnitPrice2.CurrencyValue.Value;

            if (uctxtUnitPrice3.CurrencyValue.HasValue)
                inv.UnitPrice3 = uctxtUnitPrice3.CurrencyValue.Value;

            if (uctxtUnitPrice4.CurrencyValue.HasValue)
                inv.UnitPrice4 = uctxtUnitPrice4.CurrencyValue.Value;

            if (uctxtUnitPrice5.CurrencyValue.HasValue)
                inv.UnitPrice5 = uctxtUnitPrice5.CurrencyValue.Value;

            if (uctxtRealCost.CurrencyValue.HasValue)
                inv.RealCost = uctxtRealCost.CurrencyValue.Value;

            if (uctxtProfit.CurrencyValue.HasValue)
                inv.Profit = uctxtProfit.CurrencyValue.Value;
            AddProduct(inv, selProduct.Name);
        }
        else
            ShowError(Exception.nonexistentProduct);

        BindGrid();

        CleanFields();
    }
コード例 #47
0
ファイル: Program.cs プロジェクト: Zeghs/NetWings.Converter
        static void Main(string[] args)
        {
            XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo("log4net_config.xml"));

            ServicePointManager.DefaultConnectionLimit = 1024;

            ProductManager.Load("exchanges");
            QuoteManager.Manager.Refresh("plugins\\quotes");

            QuoteServiceInformation[] cQuoteServiceInfos = QuoteManager.Manager.GetQuoteServiceInformations();
            QuoteManager.Manager.StartQuoteService(cQuoteServiceInfos[0]);
            AbstractQuoteService cService = QuoteManager.Manager.GetQuoteService(cQuoteServiceInfos[0].DataSource);

            cService.Load();
            cService.onLoginCompleted += Service_onLoginCompleted;

            Zeghs.Settings.GlobalSettings.Load();

            //*
            //轉換三竹資訊源即時資料
            if (args.Length > 0 && args[0].Equals("/admin"))
            {
                int iCommand = PrintMenu();
                if (iCommand > 0)
                {
                    ExcuteCommand(iCommand);
                }
            }
            else
            {
                MitakeSourceAdapter cAdapter = new MitakeSourceAdapter();
                cAdapter.Load(DateTime.Today);
            }
            // */

            /* 轉換期交所指數期貨 RPT 資料
             * if (args.Length > 0 && args[0].Equals("/admin")) {
             *      int iCommand = PrintMenu();
             *      if (iCommand > 0) {
             *              ExcuteCommand(iCommand);
             *      }
             * } else {
             *      bool bEvent = __cManualEvent.WaitOne(60000);
             *      FuturesRptAdapter.Convert(DateTime.Now);
             * }
             * // */

            //DumpDataUtil.Load("TXF0.tw", true, new DateTime(2017, 12, 22, 8, 45, 0), new DateTime(2017, 12, 26, 13, 45, 0));
            //DumpDataUtil.Save("TXF0.tw", true, "abc.txt", new DateTime(2013,11,20,8,45,0));

            //FuturesCsvAdapter.Convert();  //轉換CSV使用

            //bool bEvent = __cManualEvent.WaitOne(60000);

            /*
             * MitakeSourceAdapter cAdapter = new MitakeSourceAdapter();
             * DateTime cStartDate = new DateTime(2012, 1, 1);
             * DateTime cEndDate = new DateTime(2014, 12, 31);
             *
             * while (cStartDate <= cEndDate) {
             *      cAdapter.Load(cStartDate);
             *      cStartDate = cStartDate.AddSeconds(86400);
             * }
             * cAdapter.Dispose();
             *
             * //*/
            //System.Console.WriteLine("Completed...");
            //System.Console.ReadLine();
            //return;

            __cManualEvent.Dispose();
            QuoteManager.Manager.CloseAll();
        }
コード例 #48
0
    /// <summary>
    /// this method return true if product exists or return false if its not exists
    /// </summary>
    /// <returns></returns>
    private Boolean CheckProductExists()
    {
        ProductManager pManager = new ProductManager(this);

        if (selProduct.Product != null)
            return true;
        else
            return false;
    }
コード例 #49
0
 //货品查询
 public ActionResult ProductAll(int PageIndex, int PageSize, string pname)
 {
     return(Json(ProductManager.ProductAll(PageIndex, PageSize, pname), JsonRequestBehavior.AllowGet));
 }
コード例 #50
0
ファイル: ProductController.cs プロジェクト: cemelma/astonweb
        public ActionResult AddProduct(ProductAddModel model, IEnumerable <HttpPostedFileBase> attachments, HttpPostedFileBase prd1, HttpPostedFileBase prd2, string ddl_group)
        {
            var languages = LanguageManager.GetLanguages();
            var list      = new SelectList(languages, "Culture", "Language", model.Product.Language);

            ViewBag.LanguageList = list;

            try
            {
                model.Product.PageSlug = Utility.SetPagePlug(model.Product.Name);

                model.Product.ProductGroupId = Convert.ToInt32(ddl_group);

                model.Product.TopProductGroupId = GetTopCategoryId(Convert.ToInt32(ddl_group));
                //if (teknikresim != null)
                //{
                //    Random random = new Random();
                //    int rand = random.Next(1000, 99999999);
                //    string path = Utility.SetPagePlug(model.Product.Name) + "_" + rand + Path.GetFileNameWithoutExtension(teknikresim.FileName);
                //    teknikresim.SaveAs(Server.MapPath("/Content/images/userfiles/productbig/") + path);
                //    new ImageHelper(210, 125).SaveThumbnail(teknikresim, "/Content/images/userfiles/productthumb/", path);
                //    model.Product.TeknikResim = "/Content/images/userfiles/productthumb/" + path + ".jpeg"; ;

                //    Helpers.ImageHelper.WaterMark("/Content/images/userfiles/productbig/" + path, 100);
                //    Helpers.ImageHelper.WaterMarkThumb("/Content/images/userfiles/productthumb/" + path);
                //}
                //else
                //{
                //    model.Product.TeknikResim = "/Content/images/front/noimage.jpeg";
                //}
                if (prd1 != null)
                {
                    Random random = new Random();
                    int    rand   = random.Next(1000, 99999999);
                    string path   = Utility.SetPagePlug(model.Product.Name) + "_" + rand + Path.GetFileNameWithoutExtension(prd1.FileName);
                    prd1.SaveAs(Server.MapPath("/Content/images/userfiles/productbig/") + path);
                    new ImageHelper(210, 125).SaveThumbnail(prd1, "/Content/images/userfiles/productthumb/", path);
                    model.Product.Image1 = "/Content/images/userfiles/productthumb/" + path + ".jpeg";;

                    Helpers.ImageHelper.WaterMark("/Content/images/userfiles/productbig/" + path, 100);
                    Helpers.ImageHelper.WaterMarkThumb("/Content/images/userfiles/productthumb/" + path);
                }
                else
                {
                    model.Product.Image1 = "/Content/images/front/noimage.jpeg";
                }

                if (prd2 != null)
                {
                    Random random = new Random();
                    int    rand   = random.Next(1000, 99999999);
                    string path   = Utility.SetPagePlug(model.Product.Name) + "_" + rand + Path.GetFileNameWithoutExtension(prd2.FileName);

                    prd2.SaveAs(Server.MapPath("/Content/images/userfiles/productbig/") + path);
                    new ImageHelper(210, 125).SaveThumbnail(prd2, "/Content/images/userfiles/productthumb/", path);
                    model.Product.Image2 = "/Content/images/userfiles/productthumb/" + path + ".jpeg";;

                    Helpers.ImageHelper.WaterMark("/Content/images/userfiles/productbig/" + path, 40);
                    Helpers.ImageHelper.WaterMarkThumb("/Content/images/userfiles/productthumb/" + path);
                }
                else
                {
                    model.Product.Image2 = "/Content/images/front/noimage.jpeg";
                }

                ProductManager.AddProduct(model.Product);

                foreach (var item in attachments)
                {
                    if (item != null && item.ContentLength > 0)
                    {
                        Random random = new Random();
                        int    rand   = random.Next(1000, 99999999);
                        string path   = Utility.SetPagePlug(model.Product.Name) + "_" + rand + Path.GetFileNameWithoutExtension(item.FileName);
                        item.SaveAs(Server.MapPath("/Content/images/userfiles/productbig/") + path);
                        new ImageHelper(1020, 768).SaveThumbnail(item, "/Content/images/userfiles/productthumb/", path);

                        string thumbnail = Utility.SetPagePlug(model.Product.Name) + "_" + rand + Path.GetFileNameWithoutExtension(item.FileName);
                        Bitmap bmp       = new Bitmap(Server.MapPath("/Content/images/userfiles/productbig/") + path);
                        Bitmap bmp2      = new Bitmap(bmp);
                        using (Bitmap Orgbmp = bmp2)
                        {
                            int    sabit       = 90;
                            Size   Boyut       = new Size(210, 125);
                            Bitmap ReSizedThmb = new Bitmap(Orgbmp, Boyut);
                            ReSizedThmb.Save(Server.MapPath("/Content/images/userfiles/productthumb/") + thumbnail);
                            bmp.Dispose();
                            bmp2.Dispose();
                            Orgbmp.Dispose();
                            GC.Collect();
                        }

                        Helpers.ImageHelper.WaterMark("/Content/images/userfiles/productbig/" + path, 60);
                        Helpers.ImageHelper.WaterMarkThumb("/Content/images/userfiles/productthumb/" + thumbnail);
                        Photo p = new Photo();
                        p.CategoryId  = (int)PhotoType.ProductUygulama;
                        p.ItemId      = model.Product.ProductId;
                        p.Path        = "/Content/images/userfiles/productbig/" + path + ".jpeg";;
                        p.Thumbnail   = "/Content/images/userfiles/productthumb/" + thumbnail + ".jpeg";
                        p.Online      = true;
                        p.SortOrder   = 9999;
                        p.Language    = model.Product.Language;
                        p.TimeCreated = DateTime.Now;
                        p.Title       = model.Product.Name;
                        PhotoManager.Save(p);
                    }
                }


                ViewBag.SaveResult     = true;
                ViewBag.ProcessMessage = true;
            }
            catch (Exception ex)
            {
                ViewBag.SaveResult     = false;
                ViewBag.ProcessMessage = false;
            }



            return(Redirect("/yonetim/urunduzenle/" + model.Product.ProductId));
            //return View();
        }
コード例 #51
0
    /// <summary>
    /// this method add a existent product in DataTable Products
    /// </summary>
    private void AddExistentProduct()
    {

        if (Deposit == null)
        {
            ShowError("O usuário não está habilitado para gerar vendas!");
            return;
        }

        var iManager = new InventoryManager(this);
        var pManager = new ProductManager(this);
        Inventory productInInventory;

        var product = pManager.GetProductByName(Company.CompanyId, selProduct.Product.Name);

        decimal unitCost = 0;
        decimal unitPrice = 0;

        if (ucTxtUnitPrice.CurrencyValue.HasValue)
            unitPrice = ucTxtUnitPrice.CurrencyValue.Value;

        productInInventory = iManager.GetProductInventory(Company.CompanyId, product.ProductId, Deposit.DepositId);

        if (productInInventory != null)
        {
            if (unitPrice == 0)
                unitPrice = productInInventory.UnitPrice;
            unitCost = productInInventory.RealCost;
        }

        Page.ViewState["InventoryProductId"] = product.ProductId;

        if (!ucTxtUnitPrice.CurrencyValue.HasValue)
            ucTxtUnitPrice.CurrencyValue = 0;

        addProductRow(product.ProductId, ucCurrFieldQuantityData.IntValue, product.Name, product.ProductCode, unitPrice, unitCost);
    }
コード例 #52
0
        public JsonResult UrunFiltrele(int page, Guid magazaId, List <int> renkId, List <Guid> kategoriId, int?enDusukFiyat, int?enYuksekFiyat)
        {
            VotedressUser user = new VotedressUser();

            user = Session["login"] as VotedressUser;

            if (enDusukFiyat == null)
            {
                enDusukFiyat = 0;
            }

            if (enYuksekFiyat == null)
            {
                enYuksekFiyat = 0;
            }

            ProductManager productManager = new ProductManager();
            List <Product> urunler        = productManager.SayfalamaliUrunleriGetir(page, 12, magazaId, renkId, kategoriId, enDusukFiyat.Value, enYuksekFiyat.Value);


            CollectionManager collectionManager = new CollectionManager();

            List <Category> kategoriler = collectionManager.KategorileriGetir(magazaId);

            if (urunler.Count != 0)
            {
                var JsonModel = new
                {
                    urunler = urunler.Select(x => new
                    {
                        id           = x.id,
                        productName  = x.ProductName,
                        productImage = x.ProductImage,
                        Collections  = x.ProductCategory.Select(k => new
                        {
                            id             = k.Category.id,
                            collectionName = k.Category.CategoryName,
                            description    = k.Category.Description,
                            createDate     = k.Category.CreateDate,
                        }),
                        price            = x.Price,
                        shortDescription = x.ShortDescription,
                        longDescription  = x.LongDescription,
                        uploadDate       = x.UploadDate,
                        detail           = x.ProductSize.Select(k => new
                        {
                            productSize   = k.Size,
                            productColors = k.ProductColor.Select(y => new
                            {
                                stockCount = y.StockCount,
                                color      = y.ProductColorDetail.Select(u => new
                                {
                                    colorName = u.Color.ColorName,
                                    colorCode = u.Color.ColorCode,
                                }),
                                productImageGallery = y.ProdutImageGallery.Select(u => new
                                {
                                    id        = u.id,
                                    imagePath = u.ImagePath
                                })
                            }),
                        }),
                    }),

                    magazaAdi   = urunler[0].User.UserDetail.CompanyName,
                    kategoriler = kategoriler.Select(k => new
                    {
                        id             = k.id,
                        collectionName = k.CategoryName,
                        description    = k.Description,
                        createDate     = k.CreateDate,
                    }),
                };

                return(Json(JsonModel, JsonRequestBehavior.AllowGet));
            }
            return(Json(null, JsonRequestBehavior.AllowGet));
        }
コード例 #53
0
        public JsonResult UrunDetayiGetir(Guid UrunID)
        {
            ProductManager productManager = new ProductManager();
            Product        urun           = productManager.UrunGetir(UrunID);

            int commentCount = urun.ProductComment.Count;

            for (int i = 0; i < urun.ProductComment.Count; i++)
            {
                commentCount = commentCount + urun.ProductComment[i].ProductCommentReply.Count();
            }


            SocialShareManager socialShareManager = new SocialShareManager();
            List <SocialShare> urunPaylasimi      = socialShareManager.UrunPaylasimlariniGetir(UrunID);

            OylamaManager oylamaMnager         = new OylamaManager();
            int           urunluOylamalarCount = oylamaMnager.UrunluOylamalariGetir(UrunID).Count();


            int facebookShareCount  = urunPaylasimi.Where(x => x.SocialName == "facebook").Count();
            int instagramShareCount = urunPaylasimi.Where(x => x.SocialName == "instagram").Count();
            int twitterShareCount   = urunPaylasimi.Where(x => x.SocialName == "twitter").Count();
            int votedressShareCount = urunPaylasimi.Where(x => x.SocialName == "votedress").Count();


            var JsonModel = new
            {
                urun = new
                {
                    id           = urun.id,
                    productName  = urun.ProductName,
                    productImage = urun.ProductImage,
                    Collections  = urun.ProductCollection.Select(k => new
                    {
                        id             = k.Collection.id,
                        collectionName = k.Collection.CollectionName,
                        description    = k.Collection.Description,
                        createDate     = k.Collection.CreateDate,
                    }),
                    price            = urun.Price,
                    shortDescription = urun.ShortDescription,
                    longDescription  = urun.LongDescription,
                    uploadDate       = urun.UploadDate,
                    detail           = urun.ProductSize.Select(k => new
                    {
                        productSize   = k.Size,
                        productColors = k.ProductColor.Select(y => new
                        {
                            id         = y.id,
                            stockCount = y.StockCount,
                            color      = y.ProductColorDetail.Select(u => new
                            {
                                colorName = u.Color.ColorName,
                                colorCode = u.Color.ColorCode,
                            }),
                            productImageGallery = y.ProdutImageGallery.Select(u => new
                            {
                                id        = u.id,
                                imagePath = u.ImagePath
                            })
                        }),
                    }),
                    urunSosyalGucu = new
                    {
                        facebookShareCount   = facebookShareCount,
                        instagramShareCount  = instagramShareCount,
                        twitterShareCount    = twitterShareCount,
                        votedressShareCount  = votedressShareCount,
                        urunluOylamalarCount = urunluOylamalarCount,

                        commentCount = commentCount
                    }
                }
            };

            return(Json(JsonModel, JsonRequestBehavior.AllowGet));
        }
コード例 #54
0
        public ActionResult UrunDetayliIncele(Guid id)
        {
            ProductManager productManager = new ProductManager();
            Product        urun           = productManager.UrunGetir(id);

            int commentCount = urun.ProductComment.Count;

            for (int i = 0; i < urun.ProductComment.Count; i++)
            {
                commentCount = commentCount + urun.ProductComment[i].ProductCommentReply.Count();
            }


            SocialShareManager socialShareManager = new SocialShareManager();
            List <SocialShare> urunPaylasimi      = socialShareManager.UrunPaylasimlariniGetir(id);

            OylamaManager oylamaMnager         = new OylamaManager();
            int           urunluOylamalarCount = oylamaMnager.UrunluOylamalariGetir(id).Count();


            int facebookShareCount  = urunPaylasimi.Where(x => x.SocialName == "facebook").Count();
            int instagramShareCount = urunPaylasimi.Where(x => x.SocialName == "instagram").Count();
            int twitterShareCount   = urunPaylasimi.Where(x => x.SocialName == "twitter").Count();
            int votedressShareCount = urunPaylasimi.Where(x => x.SocialName == "votedress").Count();


            var JsonModel = new
            {
                urun = new
                {
                    id           = urun.id,
                    productName  = urun.ProductName,
                    productImage = urun.ProductImage,
                    Collections  = urun.ProductCollection.Select(k => new
                    {
                        id             = k.Collection.id,
                        collectionName = k.Collection.CollectionName,
                        description    = k.Collection.Description,
                        createDate     = k.Collection.CreateDate,
                    }),
                    price            = urun.Price,
                    shortDescription = urun.ShortDescription,
                    longDescription  = urun.LongDescription,
                    uploadDate       = urun.UploadDate,
                    detail           = urun.ProductSize.Select(k => new
                    {
                        productSize   = k.Size,
                        productColors = k.ProductColor.Select(y => new
                        {
                            id         = y.id,
                            stockCount = y.StockCount,
                            color      = y.ProductColorDetail.Select(u => new
                            {
                                colorName = u.Color.ColorName,
                                colorCode = u.Color.ColorCode,
                            }),
                            productImageGallery = y.ProdutImageGallery.Select(u => new
                            {
                                id        = u.id,
                                imagePath = u.ImagePath
                            })
                        }),
                    }),
                    urunSosyalGucu = new
                    {
                        facebookShareCount   = facebookShareCount,
                        instagramShareCount  = instagramShareCount,
                        twitterShareCount    = twitterShareCount,
                        votedressShareCount  = votedressShareCount,
                        urunluOylamalarCount = urunluOylamalarCount,

                        commentCount = commentCount
                    },
                    comments = urun.ProductComment.OrderBy(x => x.CommentDate).Select(x => new
                    {
                        commentId               = x.id,
                        commentOwnerId          = x.VotedressUser.id,
                        commentOwnerFullName    = x.VotedressUser.UserDetail.Name + " " + x.VotedressUser.UserDetail.SurName,
                        commentOwnerProfilImage = x.VotedressUser.ProfileImage,
                        comment      = x.Comment,
                        commentDate  = x.CommentDate,
                        commentLikes = x.ProductCommentLike.Select(t => new
                        {
                            LikedFullName = t.VotedressUser.UserDetail.Name + " " + t.VotedressUser.UserDetail.SurName,
                            LikedId       = t.VotedressUser.id,
                        }),

                        commentReplies = x.ProductCommentReply.OrderBy(k => k.CommentDate).Select(k => new
                        {
                            commentId               = k.id,
                            commentOwnerId          = k.VotedressUser.id,
                            commentOwnerFullName    = k.VotedressUser.UserDetail.Name + " " + k.VotedressUser.UserDetail.SurName,
                            commentOwnerProfilImage = k.VotedressUser.ProfileImage,
                            comment      = k.Comment,
                            commentDate  = k.CommentDate,
                            commentLikes = k.ProductCommentReplyLike.Select(t => new
                            {
                                LikedFullName = t.VotedressUser.UserDetail.Name + " " + t.VotedressUser.UserDetail.SurName,
                                LikedId       = t.VotedressUser.id,
                            }),
                        })
                    })
                }
            };


            return(View(JsonModel));
        }
コード例 #55
0
 protected void RadTreeView1_NodeBound(object o, RadTreeNodeEventArgs e)
 {
     ProductManager manager = new ProductManager(this);
     ProductPart productPart = manager.GetProductPart(Convert.ToInt32(e.Node.Value));
     e.Node.Text += " (" + productPart.Quantity + ")";
     e.Node.Expanded = true;
 }
コード例 #56
0
        public ActionResult Magaza(Guid id)
        {
            VotedressUser user = new VotedressUser();

            user = Session["login"] as VotedressUser;

            ProductManager productManager = new ProductManager();
            List <Product> urunler        = productManager.UrunleriGetir(id);


            CollectionManager collectionManager = new CollectionManager();

            List <Category> kategoriler = collectionManager.KategorileriGetir(id);

            var JsonModel = new
            {
                urunler = urunler.Select(x => new
                {
                    id           = x.id,
                    productName  = x.ProductName,
                    productImage = x.ProductImage,
                    Collections  = x.ProductCategory.Select(k => new
                    {
                        id             = k.Category.id,
                        collectionName = k.Category.CategoryName,
                        description    = k.Category.Description,
                        createDate     = k.Category.CreateDate,
                    }),
                    price            = x.Price,
                    shortDescription = x.ShortDescription,
                    longDescription  = x.LongDescription,
                    uploadDate       = x.UploadDate,
                    detail           = x.ProductSize.Select(k => new
                    {
                        productSize   = k.Size,
                        productColors = k.ProductColor.Select(y => new
                        {
                            stockCount = y.StockCount,
                            color      = y.ProductColorDetail.Select(u => new
                            {
                                colorName = u.Color.ColorName,
                                colorCode = u.Color.ColorCode,
                            }),
                            productImageGallery = y.ProdutImageGallery.Select(u => new
                            {
                                id        = u.id,
                                imagePath = u.ImagePath
                            })
                        }),
                    }),
                }),

                magazaAdi   = urunler[0].User.UserDetail.CompanyName,
                magazaId    = urunler[0].User.id,
                kategoriler = kategoriler.Select(k => new
                {
                    id             = k.id,
                    collectionName = k.CategoryName,
                    description    = k.Description,
                    createDate     = k.CreateDate,
                }),
            };

            return(View(JsonModel));
        }
コード例 #57
0
 public ProductService(ProductManager productManager)
 {
     _ProductManager = productManager;
 }
コード例 #58
0
 public void GetTest1()
 {
     ProductManager target = new ProductManager(); // TODO: Initialize to an appropriate value
     long id = 0; // TODO: Initialize to an appropriate value
     bool eagerLoad = false; // TODO: Initialize to an appropriate value
     Product expected = null; // TODO: Initialize to an appropriate value
     Product actual;
     actual = target.Get(id, eagerLoad);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }
コード例 #59
0
 protected void grdProductCertificates_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     ProductManager productManager = new ProductManager(this);
     productManager.DeleteProductCertificate(Convert.ToInt32(grdProductCertificates.DataKeys[e.RowIndex]["ProductCertificateId"]));
     grdProductCertificates.DataBind();
 }
コード例 #60
0
ファイル: ProductController.cs プロジェクト: cemelma/astonweb
        public ActionResult EditProduct(ProductAddModel model, IEnumerable <HttpPostedFileBase> attachments, HttpPostedFileBase prd1, HttpPostedFileBase prd2, int hdProductId)
        {
            try
            {
                model.Product.PageSlug  = Utility.SetPagePlug(model.Product.Name);
                model.Product.ProductId = hdProductId;

                //if (teknikresim != null)
                //{
                //    Random random = new Random();
                //    int rand = random.Next(1000, 99999999);
                //    string path = Utility.SetPagePlug(model.Product.Name) + "_" + rand + Path.GetFileNameWithoutExtension(teknikresim.FileName);
                //    teknikresim.SaveAs(Server.MapPath("/Content/images/userfiles/productbig/") + path);
                //    new ImageHelper(1024, 768).SaveThumbnail(teknikresim, "/Content/images/userfiles/productthumb/", path);
                //    model.Product.TeknikResim = "/Content/images/userfiles/productthumb/" + path + ".jpeg"; ;

                //    Helpers.ImageHelper.WaterMark("/Content/images/userfiles/productbig/" + path, 100);
                //    Helpers.ImageHelper.WaterMarkThumb("/Content/images/userfiles/productthumb/" + path);
                //}

                if (prd1 != null)
                {
                    Random random = new Random();
                    int    rand   = random.Next(1000, 99999999);
                    string path   = Utility.SetPagePlug(model.Product.Name) + "_" + rand + Path.GetFileNameWithoutExtension(prd1.FileName);
                    prd1.SaveAs(Server.MapPath("/Content/images/userfiles/productbig/") + path);
                    new ImageHelper(210, 125).SaveThumbnail(prd1, "/Content/images/userfiles/productthumb/", path);
                    model.Product.Image1 = "/Content/images/userfiles/productthumb/" + path + ".jpeg";;

                    Helpers.ImageHelper.WaterMark("/Content/images/userfiles/productbig/" + path, 100);
                    Helpers.ImageHelper.WaterMarkThumb("/Content/images/userfiles/productthumb/" + path);
                }

                if (prd2 != null)
                {
                    Random random = new Random();
                    int    rand   = random.Next(1000, 99999999);
                    string path   = Utility.SetPagePlug(model.Product.Name) + "_" + rand + Path.GetFileNameWithoutExtension(prd2.FileName);

                    prd2.SaveAs(Server.MapPath("/Content/images/userfiles/productbig/") + path);
                    new ImageHelper(210, 125).SaveThumbnail(prd2, "/Content/images/userfiles/productthumb/", path);
                    model.Product.Image2 = "/Content/images/userfiles/productthumb/" + path + ".jpeg";;

                    Helpers.ImageHelper.WaterMark("/Content/images/userfiles/productbig/" + path, 40);
                    Helpers.ImageHelper.WaterMarkThumb("/Content/images/userfiles/productthumb/" + path);
                }

                ProductManager.EditProduct(model.Product);
                ViewBag.lang = model.Product.Language;
                foreach (var item in attachments)
                {
                    if (item != null && item.ContentLength > 0)
                    {
                        Random random = new Random();
                        int    rand   = random.Next(1000, 99999999);
                        string path   = Utility.SetPagePlug(model.Product.Name) + "_" + rand + Path.GetFileNameWithoutExtension(item.FileName);
                        item.SaveAs(Server.MapPath("/Content/images/userfiles/productbig/") + path);
                        new ImageHelper(1020, 768).SaveThumbnail(item, "/Content/images/userfiles/productthumb/", path);

                        string thumbnail = Utility.SetPagePlug(model.Product.Name) + "_" + rand + Path.GetFileNameWithoutExtension(item.FileName);
                        Bitmap bmp       = new Bitmap(Server.MapPath("/Content/images/userfiles/productbig/") + path);
                        Bitmap bmp2      = new Bitmap(bmp);
                        using (Bitmap Orgbmp = bmp2)
                        {
                            int    sabit       = 90;
                            Size   Boyut       = new Size(210, 125);
                            Bitmap ReSizedThmb = new Bitmap(Orgbmp, Boyut);
                            ReSizedThmb.Save(Server.MapPath("/Content/images/userfiles/productthumb/") + thumbnail);
                            bmp.Dispose();
                            bmp2.Dispose();
                            Orgbmp.Dispose();
                            GC.Collect();
                        }

                        Helpers.ImageHelper.WaterMark("/Content/images/userfiles/productbig/" + path, 60);
                        Helpers.ImageHelper.WaterMarkThumb("/Content/images/userfiles/productthumb/" + thumbnail);
                        Photo p = new Photo();
                        p.CategoryId  = (int)PhotoType.ProductUygulama;
                        p.ItemId      = Convert.ToInt32(RouteData.Values["id"]);
                        p.Path        = "/Content/images/userfiles/productbig/" + path + ".jpeg";;
                        p.Thumbnail   = "/Content/images/userfiles/productthumb/" + thumbnail + ".jpeg";
                        p.Online      = true;
                        p.SortOrder   = 9999;
                        p.Language    = "tr";
                        p.TimeCreated = DateTime.Now;
                        p.Title       = model.Product.Name;
                        PhotoManager.Save(p);
                    }
                }


                ViewBag.SaveResult = true;
            }
            catch (Exception ex)
            {
                ViewBag.SaveResult = false;
            }



            var photos = PhotoManager.GetList(11, Convert.ToInt32(RouteData.Values["id"]));

            ViewBag.Photos = photos;

            web.Areas.Admin.Models.VMProductGroupModel grouplist = new Models.VMProductGroupModel();
            grouplist.ProductGroup    = ProductManager.GetProductGroupList("tr");
            model.VMProductGroupModel = grouplist;

            return(View(model));
        }