/// <summary>
        /// Gets the details of a single category.
        /// </summary>
        /// <param name="categoryId">The id of the category to get.</param>
        /// <param name="userId">The id of the user performing the operation.</param>
        /// <returns>The details of the category.  An instance of the <see cref="CategoryDetails"/> class.</returns>
        public async Task <CategoryDetails> GetCategoryAsync(string categoryId, string userId)
        {
            var categoryDocument = await this.categoriesRepository.GetCategoryAsync(categoryId, userId).ConfigureAwait(false);

            if (categoryDocument == null)
            {
                return(null);
            }

            var details = new CategoryDetails
            {
                Id       = categoryDocument.Id,
                ImageUrl = categoryDocument.ImageUrl,
                Name     = categoryDocument.Name,
            };

            ((List <string>)details.Synonyms).AddRange(categoryDocument.Synonyms);
            ((List <CategoryItemDetails>)details.Items).AddRange(categoryDocument.Items.Select(i => new CategoryItemDetails
            {
                Id      = i.Id,
                Type    = i.Type,
                Preview = i.Preview,
            }).ToList());

            return(details);
        }
Exemplo n.º 2
0
        public async Task GetCategoryReturnsCorrectText()
        {
            // arrange
            var fakeCategoriesRepository = new FakeCategoriesRepository();

            fakeCategoriesRepository.CategoryDocuments.Add(
                new CategoryDocument
            {
                Id       = "fakeid",
                Name     = "fakename",
                UserId   = "fakeuserid",
                ImageUrl = new Uri("https://www.edenimageurl.com/"),
            });
            var service = new CategoriesService(
                fakeCategoriesRepository,
                new Mock <IImageSearchService>().Object,
                new Mock <ISynonymService>().Object,
                new Mock <IEventGridPublisherService>().Object);

            // act
            CategoryDetails result = await service.GetCategoryAsync("fakeid", "fakeuserid").ConfigureAwait(false);

            // assert
            Assert.IsNotNull(result);
            Assert.AreEqual("fakeid", result.Id);
            Assert.AreEqual("fakename", result.Name);
            Assert.AreEqual("https://www.edenimageurl.com/", result.ImageUrl.ToString());
        }
Exemplo n.º 3
0
    // Get category details
    public static CategoryDetails GetCategoryDetails(string categoryId)
    {
        // get a configured DbCommand object
        DbCommand comm = GenericDataAccess.CreateCommand();

        // set the stored procedure name
        comm.CommandText = "CatalogGetCategoryDetails";
        // create a new parameter
        DbParameter param = comm.CreateParameter();

        param.ParameterName = "@CategoryID";
        param.Value         = categoryId;
        param.DbType        = DbType.Int32;
        comm.Parameters.Add(param);

        // execute the stored procedure
        DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
        // wrap retrieved data into a CategoryDetails object
        CategoryDetails details = new CategoryDetails();

        if (table.Rows.Count > 0)
        {
            details.DepartmentId = Int32.Parse(table.Rows[0]["DepartmentID"].ToString());
            details.Name         = table.Rows[0]["Name"].ToString();
            details.Description  = table.Rows[0]["Description"].ToString();
        }
        // return department details
        return(details);
    }
Exemplo n.º 4
0
        public async Task <IActionResult> PutCategoryDetails([FromRoute] int id, [FromBody] CategoryDetails categoryDetails)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != categoryDetails.id)
            {
                return(BadRequest());
            }

            _context.Entry(categoryDetails).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CategoryDetailsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 5
0
        public int InsertCategorySetting(CategoryDetails obj, string user_code)
        {
            int result = 0;

            try
            {
                using (IDbConnection connection = IDbOpenConnection())
                {
                    var p = new DynamicParameters();
                    p.Add("@UserTypeCode", obj.User_Type_Code);
                    p.Add("@category", obj.Category);
                    p.Add("@kilometer", obj.Kilometer);
                    p.Add("@lesscategory", obj.Less_than_Kilometer);
                    p.Add("@greatercatergory", obj.Greater_than_kilometer);
                    p.Add("@user_code", user_code);
                    p.Add("@From_date", obj.Effective_From);
                    p.Add("@To_date", obj.Effective_To);
                    p.Add("@Result", 0, DbType.Int32, ParameterDirection.Output);
                    connection.Query <int>("Sp_Hd_InsertCategorySetting", p, commandType: CommandType.StoredProcedure).SingleOrDefault();
                    result = p.Get <int>("@Result");
                    connection.Close();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
        public CategoryDetails GetCategory(long categoryId)
        {
            Category        category        = CategoryDao.Find(categoryId);
            CategoryDetails categoryDetails = new CategoryDetails(category.categoryId, category.name);

            return(categoryDetails);
        }
Exemplo n.º 7
0
    // Fill the page with data
    private void PopulateControls()
    {
        // Retrieve DepartmentID from the query string
        string departmentId = Request.QueryString["DepartmentID"];
        // Retrieve CategoryID from the query string
        string categoryId = Request.QueryString["CategoryID"];

        // If browsing a category...
        if (categoryId != null)
        {
            // Retrieve category details and display them
            CategoryDetails cd = CatalogBLO.GetCategoryDetails(categoryId);
            catalogTitleLabel.Text       = cd.Name;
            catalogDescriptionLabel.Text = cd.Description;
            // Set the title of the page
            this.Title = ShopConfiguration.SiteName +
                         " : Category : " + cd.Name;
        }
        // If browsing a department...
        else if (departmentId != null)
        {
            // Retrieve department details and display them
            DepartmentDetails dd = CatalogBLO.GetDepartmentDetails(departmentId);
            catalogTitleLabel.Text       = dd.Name;
            catalogDescriptionLabel.Text = dd.Description;
            // Set the title of the page
            this.Title = ShopConfiguration.SiteName +
                         " : Department : " + dd.Name;
        }
    }
Exemplo n.º 8
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtCategoryName.Text == "")
            {
                MessageBox.Show("Please Enter Category Name", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtCategoryName.Focus();
                return;
            }
            CategoryDetails cd = new CategoryDetails();

            cd.Id           = Convert.ToInt32(txtId.Text);
            cd.CategoryName = txtCategoryName.Text;
            cd.AddedDate    = System.DateTime.Now;

            bool isexists = blc.CheckCategory(txtCategoryName.Text);

            if (isexists)
            {
                MessageBox.Show("Category Already Exists in Database", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCategoryName.Text = "";
                txtCategoryName.Focus();
            }
            else
            {
                int i = blc.UpdateCategory(cd);
                if (i > 0)
                {
                    MessageBox.Show("Category Updated Successfully", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtCategoryName.Text = "";
                    txtCategoryName.Focus();
                }
            }
        }
Exemplo n.º 9
0
    // Fill the page with data
    private void PopulateControls()
    {
        // Retrieve DepartmentID from the query string
        string departmentId = Request.QueryString["DepartmentID"];
        // Retrieve CategoryID from the query string
        string categoryId = Request.QueryString["CategoryID"];

        // If browsing a category...
        if (categoryId != null)
        {
            // Retrieve category and department details and display them
            CategoryDetails cd = CatalogAccess.GetCategoryDetails(categoryId);
            catalogTitleLabel.Text = HttpUtility.HtmlEncode(cd.Name);
            DepartmentDetails dd = CatalogAccess.GetDepartmentDetails(departmentId);
            catalogDescriptionLabel.Text = HttpUtility.HtmlEncode(cd.Description);
            // Set the title of the page
            this.Title = HttpUtility.HtmlEncode(BalloonShopConfiguration.SiteName +
                                                ": " + dd.Name + ": " + cd.Name);
        }
        // If browsing a department...
        else if (departmentId != null)
        {
            // Retrieve department details and display them
            DepartmentDetails dd = CatalogAccess.GetDepartmentDetails(departmentId);
            catalogTitleLabel.Text       = HttpUtility.HtmlEncode(dd.Name);
            catalogDescriptionLabel.Text = HttpUtility.HtmlEncode(dd.Description);
            // Set the title of the page
            this.Title = HttpUtility.HtmlEncode(BalloonShopConfiguration.SiteName + ": " + dd.Name);
        }
    }
        public async Task <dynamic> GetDocCategoriesForSpecificUser(string _DestroyPolicyID, string _OwnerID, string _DestroyID)
        {
            List <DSM_DocCategory>   objDsmDocCategories = null;
            List <DSM_DestroyPolicy> dsmDestroyPolicies  = null;
            List <DSM_DestroyPolicy> dsmDestroy          = null;

            await Task.Run(() => _docCategoryService.GetDocCategories("", UserID, out objDsmDocCategories));

            await Task.Run(() => _destroyPolicyService.GetDestroyPolicyBySearchParam(null, UserID, _OwnerID,
                                                                                     null, null, null, null, out dsmDestroyPolicies));

            await Task.Run(() => _docDestroyService.GetDestroyDetailsBySearchParam(_DestroyID, UserID, _OwnerID,
                                                                                   null, null, null, null, out dsmDestroy));

            if (_DestroyID == "")
            {
                var result = (from dc in dsmDestroyPolicies
                              where dc.PolicyDetailStatus == 1 & dc.DocTypeID == "" & dc.OwnerID == _OwnerID

                              join c in objDsmDocCategories on dc.DocCategoryID equals c.DocCategoryID
                              select new
                {
                    DestroyPolicyDtlID = dc.DestroyPolicyDtlID,
                    DestroyPolicyID = dc.DestroyPolicyID,
                    DocCategoryID = dc.DocCategoryID,
                    DocCategoryName = c.DocCategoryName,
                    IsSelected = false,
                    TimeValue = (dc.TimeValue),
                    TimeUnit = (dc.TimeUnit),
                    ExceptionValue = (dc.ExceptionValue)
                }).ToList();

                return(Json(new { Msg = "", result }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var result = (from dpd in dsmDestroyPolicies
                              where dpd.PolicyDetailStatus == 1 & dpd.DocTypeID == ""

                              join d in dsmDestroy.Where(x => x.DestroyPolicyID == _DestroyPolicyID) on dpd.DocCategoryID equals d.DocCategoryID into Categories
                              from d in Categories.DefaultIfEmpty()

                              join dc in objDsmDocCategories on dpd.DocCategoryID equals dc.DocCategoryID into CategoryDetails
                              from dc in CategoryDetails.DefaultIfEmpty()

                              select new
                {
                    DestroyPolicyDtlID = dpd.DestroyPolicyDtlID,
                    DestroyPolicyID = dpd.DestroyPolicyID,
                    DocCategoryID = dpd.DocCategoryID,
                    DocCategoryName = dc.DocCategoryName,
                    IsSelected = (d != null && d.IsSelected),
                    TimeValue = (dpd.TimeValue),
                    TimeUnit = (dpd.TimeUnit),
                    ExceptionValue = (dpd.ExceptionValue)
                }).ToList();

                return(Json(new { Msg = "", result }, JsonRequestBehavior.AllowGet));
            }
        }
        private void btnAddNewCategory_Click(object sender, EventArgs e)
        {
            if (txtCategoryName.Text == "")
            {
                MessageBox.Show("Please Enter Category Name", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtCategoryName.Focus();
                return;
            }

            CategoryDetails cd = new CategoryDetails();

            cd.CategoryName = txtCategoryName.Text;

            bool isexists = blc.CheckCategory(txtCategoryName.Text);

            if (isexists)
            {
                MessageBox.Show("Category Name Already Exists", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtCategoryName.Text = "";
                txtCategoryName.Focus();
            }
            else
            {
                int i = blc.AddNewCategory(cd);
                if (i > 0)
                {
                    LoadGrid();
                    MessageBox.Show("New Category Added Successfully", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    txtCategoryName.Text = "";
                    txtCategoryName.Focus();
                }
            }
        }
Exemplo n.º 12
0
        public int UpdateCategory(CategoryDetails cd)
        {
            tblCategory tc = _db.tblCategories.Where(c => c.CategoryId == cd.CategoryId).FirstOrDefault();

            tc.CategoryName = cd.CategoryName;
            return(_db.SaveChanges());
        }
        public async Task DeleteArticleFromCategory(CategoryDetails category, string articleId)
        {
            var dbCategory = await this.GetDbCategory(category.Id);

            dbCategory.Articles.Remove(articleId);
            await this.context.Categories.FindOneAndReplaceAsync(c => c.Id == category.Id, dbCategory);
        }
Exemplo n.º 14
0
 public void CreateNewCategory(CategoryDetails item)
 {
     try
     {
         db.BeginTransaction();
         Category category = new Category();
         category.Name        = item.Name;
         category.Description = item.Description;
         category.IconId      = item.IconId;
         category.CreatedOn   = item.CreatedOn;
         category.Status      = "Active";
         int    id = Convert.ToInt32(db.Insert("Category", "Id", true, category));
         Fields fields;
         foreach (var field in item.FieldList)
         {
             fields            = new Fields();
             fields.CategoryId = id;
             fields.Name       = field.Name;
             fields.DataType   = field.DataType;
             fields.Mandatory  = field.Mandatory;
             fields.Position   = field.Position;
             db.Insert("Fields", "Id", true, fields);
         }
         db.CompleteTransaction();
     }
     catch (Exception)
     {
         db.AbortTransaction();
     }
 }
Exemplo n.º 15
0
    public static CategoryDetails GetOneCategory(string categoryID)
    {
        // Command nesnesi olustur
        DbCommand command = DataAccess.CreateCommand();

        // Prosedur Cagır
        command.CommandText = "GetOneCategory";
        // prosedur için parametre oluştur
        DbParameter param = command.CreateParameter();

        param.ParameterName = "@CategoryID";
        param.Value         = categoryID;
        param.DbType        = DbType.Int32;
        command.Parameters.Add(param);
        //prosedur calıştır
        DataTable dt = DataAccess.ExecuteSelectedCommand(command);

        CategoryDetails category = new CategoryDetails();

        if (dt.Rows.Count > 0)
        {
            category.CategoryID  = dt.Rows[0]["CategoryID"].ToString();
            category.Name        = dt.Rows[0]["Name"].ToString();
            category.Description = dt.Rows[0]["Description"].ToString();
        }
        return(category);
    }
Exemplo n.º 16
0
        public ActionResult CreateEdit(long Id = 0)
        {
            Category item = new Category();

            if (Id > 0)
            {
                item = _categoryService.Get(Id);
            }
            else
            {
                CategoryDetails _itemDetails = new CategoryDetails
                {
                    Language = GlobalContext.WebSite.Language
                };
                item.Details.Add(_itemDetails);
            }

            if (GlobalContext.WebSite.IsMultiLangual)
            {
                foreach (var lang in SupportedCultures.Cultures)
                {
                    var count = item.Details.Where(x => x.Language == lang.TwoLetterISOLanguageName).Count();
                    if (count <= 0)
                    {
                        CategoryDetails _itemDetails = new CategoryDetails
                        {
                            Language = lang.TwoLetterISOLanguageName
                        };
                        item.Details.Add(_itemDetails);
                    }
                }
            }
            return(View(item));
        }
Exemplo n.º 17
0
    private void BindGridView()
    {
        string id = Request.QueryString["CategoryID"];

        if (id == null)
        {
            DataTable dt = CatalogAccess.AdminGetAllProducts();
            lblNotFound.Visible = true;
            lblNotFound.Text    = "<h3> Tüm Ürünler Görüntüleniyor..  </h3>";


            grid.DataSource = dt;
            grid.DataBind();
        }
        else
        {
            CategoryDetails cd = CatalogAccess.GetOneCategory(id);

            DataTable dt = CatalogAccess.AdminGetAllProductsInCategory(id);
            if (dt.Rows.Count == 0)
            {
                lblNotFound.Visible = true;
                lblNotFound.Text    = "<h3> Bu Kategoride Hiç Ürün Yok :( </h3>";
            }

            lblCategory.Visible = true;
            lblCategory.Text    = "<h4> Kagori: " + cd.Name + "</h4> ";

            grid.DataSource = dt;
            grid.DataBind();
        }
    }
Exemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request.QueryString["CategoryID"];

        if (!Page.IsPostBack)
        {
            if (id == null)
            {
                DataTable catg = CatalogAccess.GetCategories();
                CatgDropList.DataSource     = catg;
                CatgDropList.DataTextField  = catg.Columns["Name"].ToString();
                CatgDropList.DataValueField = catg.Columns["CategoryID"].ToString();
                CatgDropList.DataBind();
            }
            else
            {
                CategoryDetails cd = CatalogAccess.GetOneCategory(id);
                DataTable       dt = new DataTable();
                dt.Columns.Add(new DataColumn("Name"));
                dt.Columns.Add(new DataColumn("CategoryID"));
                dt.Rows.Add(cd.Name, cd.CategoryID);
                CatgDropList.DataSource     = dt;
                CatgDropList.DataTextField  = dt.Columns["Name"].ToString();
                CatgDropList.DataValueField = dt.Columns["CategoryID"].ToString();
                CatgDropList.DataBind();
            }
            BindGridView();
        }
    }
        protected void SaveEdit_Click(object sender, EventArgs e)
        {
            var newName = (CategoryDetails.FindControl("EditCategory") as TextBox).Text;

            if (string.IsNullOrEmpty(newName))
            {
                Error_Handler_Control.ErrorSuccessNotifier.AddErrorMessage("Title cannot be empty");
                return;
            }
            else if (newName.Length < 5 || newName.Length > 50)
            {
                Error_Handler_Control.ErrorSuccessNotifier.AddErrorMessage("Title must be between 5 and 50 symbols");
                return;
            }

            var id = int.Parse(CategoryDetails.DataKey.Value.ToString());

            LibrarySystemDbContext data = new LibrarySystemDbContext();
            var category = data.Categories.FirstOrDefault(x => x.Id == id);

            category.Name = newName;

            data.SaveChanges();

            CategoryDetails.DataSource = null;
            CategoryDetails.DataBind();
            CategoriesGrid.DataBind();
        }
        public Category Get(CategoryDetails request)
        {
            var category = CategoryRepository.GetById(request.Id);
            if (category == null)
                throw HttpError.NotFound("Category does not exist: " + request.Id);

            return category;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Updates an existing category
        /// </summary>
        public static bool UpdateCategory(int id, string title, int importance, string description, string imageUrl)
        {
            CategoryDetails record = new CategoryDetails(id, DateTime.Now, "", title, importance, description, imageUrl);
            bool            ret    = SiteProvider.Articles.UpdateCategory(record);

            BizObject.PurgeCacheItems("articles_categor");
            return(ret);
        }
        public int UpdateCategory(CategoryDetails cd)
        {
            tbl_category tc = _db.tbl_category.Where(c => c.Id == cd.Id).FirstOrDefault();

            tc.CategoryName = cd.CategoryName;
            tc.AddedDate    = cd.AddedDate;
            return(_db.SaveChanges());
        }
Exemplo n.º 23
0
        public int InsertCategorySetting(CategoryDetails obj)
        {
            CurrentInfo _obj      = new CurrentInfo();
            int         result    = 0;
            string      user_code = _obj.GetUserCode();

            return(result = _objBLSetting.InsertCategorySetting(obj, user_code));
        }
Exemplo n.º 24
0
        public Category EditCategory(Profile profile, Category category, CategoryDetails categoryDetails)
        {
            category.Name       = categoryDetails.Name;
            category.Updated    = DateTime.Now;
            category.ModifierId = profile.Id;

            return(category);
        }
        public async Task AddArticleToCategory(CategoryDetails category, string articleId)
        {
            var dbCategory = await this.GetDbCategory(category.Id);

            dbCategory.Articles.Add(articleId);
            dbCategory.Articles = dbCategory.Articles.Distinct().ToList();
            await this.context.Categories.FindOneAndReplaceAsync(c => c.Id == category.Id, dbCategory);
        }
Exemplo n.º 26
0
        // public ActionResult CategoryMaster()
        // {
        //     CategoryDetails objCategoryModel = new CategoryDetails();
        //     objCategoryModel.IsAdd = "Add";
        //     objCategoryModel.IsActive = true;
        //     return View(objCategoryModel);
        // }

        // // POST: SaveCategoryMaster
        // [HttpPost]
        // public ActionResult SaveCategoryMaster(CategoryDetails model)
        // {
        //     ResponseDetail objResponse = new ResponseDetail();
        //     if (model != null)
        //     {
        //         if (InventorySession.LoginUser != null)
        //         {
        //             model.UserDetails = InventorySession.LoginUser;
        //         }
        //         objResponse = objProductManager.AddCategoryDetails(model);
        //     }
        //     return Json(objResponse,JsonRequestBehavior.AllowGet);
        // }

        // // GET: SubCategoryMaster
        // public ActionResult SubCategoryMaster()
        // {
        //     List<SelectListItem> objCategoryList = new List<SelectListItem>();
        //     List<SelectListItem> objChildCategoryList = new List<SelectListItem>();
        //     var result = objProductManager.GetCategoryList("Y");
        //     SubCategoryDetails model = new SubCategoryDetails();
        //     bool f = true;
        //     foreach(var item in result)
        //     {
        //         SelectListItem tempobj = new SelectListItem();
        //         //SelectListItem tempobj1 = new SelectListItem();
        //         tempobj.Text = item.CategoryName;
        //         tempobj.Value = item.CategoryId.ToString();
        //         if (f == true)
        //         {
        //             f = false;
        //             model.CategoryId = int.Parse(item.CategoryId.ToString());
        //             //model.SubCatId = int.Parse(item.ToString());
        //         }

        //         objCategoryList.Add(tempobj);
        //     }

        //     ViewBag.ListCategory = objCategoryList;
        //    // ViewBag.ListChildCategory = objCategoryList;
        //     model.IsAdd = "Add";
        //     return View(model);
        // }

        // // POST: SaveSubCategoryMaster
        // [HttpPost]
        // public ActionResult SaveSubCategoryMaster(SubCategoryDetails model)
        // {
        //     ResponseDetail objResponse = new ResponseDetail();

        //     if (model != null)
        //     {
        //         if (InventorySession.LoginUser != null)
        //         {
        //             model.UserDetails = InventorySession.LoginUser;
        //         }
        //         objResponse = objProductManager.AddSubCategoryDetails(model);
        //     }
        //     return Json(objResponse, JsonRequestBehavior.AllowGet);
        // }

        // [HttpPost]
        // public ActionResult GetFullSubCategoryList()
        // {
        //     List<SubCategoryDetails> objList = objProductManager.GetSubcategoryDetails(0,"");
        //     return Json(objList, JsonRequestBehavior.AllowGet);
        // }

        // [HttpPost]
        // public ActionResult GetFullCategoryList()
        // {
        //     List<CategoryDetails> objList = objProductManager.GetCategoryList("");
        //     return Json(objList, JsonRequestBehavior.AllowGet);
        // }

        // // GET: ProductMaster
        // public ActionResult ProductMaster()
        // {
        //     List<CategoryDetails> objCategoryDetails = objProductManager.GetCategoryList("Y");

        //     List<SelectListItem> ListCategoryDetails = new List<SelectListItem>();
        //     List<SelectListItem> ListSubCategoryDetails = new List<SelectListItem>();
        //     ProductDetails model = new ProductDetails();
        //     bool f = true;
        //     foreach (var obj in objCategoryDetails)
        //     {
        //         SelectListItem objTemp = new SelectListItem();
        //         objTemp.Text = obj.CategoryName;
        //         objTemp.Value = obj.CategoryId.ToString();
        //         if (f)
        //         {
        //             objTemp.Selected = true;
        //             model.CategoryId = obj.CategoryId;
        //             f = false;
        //         }
        //         ListCategoryDetails.Add(objTemp);
        //     }
        //     f = true;
        //     List<SubCategoryDetails> objSubCategoryDetails = objProductManager.GetSubcategoryDetails(model.CategoryId,"Y");
        //     foreach (var obj in objSubCategoryDetails)
        //     {
        //         SelectListItem objTemp = new SelectListItem();
        //         objTemp.Text = obj.subCategoryName;
        //         objTemp.Value = obj.SubCatId.ToString();
        //         if (f)
        //         {
        //             objTemp.Selected = true;
        //             model.SubCatgeoryId = (int)obj.SubCatId;
        //             f = false;
        //         }
        //         ListSubCategoryDetails.Add(objTemp);
        //     }
        //     ViewBag.ListCategory = ListCategoryDetails;
        //     ViewBag.ListSubCategory = ListSubCategoryDetails;
        //     List<SelectListItem> objBarcodeType = new List<SelectListItem>();
        //     objBarcodeType.Add(new SelectListItem { Text="System Generated",Value= "System Generated" });
        //     objBarcodeType.Add(new SelectListItem { Text = "Other", Value = "Other" });
        //     ViewBag.ListBarcodetype = objBarcodeType;
        //     model.ProductBarcodeDetails = new BarcodeDetails();
        //     model.ProductBarcodeDetails.BarcodeType = "System Generated";
        //     model.ProductBarcodeDetails.Barcode = objProductManager.MaxBarCode().ToString();
        //     model.ProductCode = objProductManager.MaxProductCode();
        //     return View(model);
        // }
        // // POST: SaveProductMaster
        // [HttpPost]
        // public ActionResult SaveProductMaster(ProductDetails model,HttpPostedFileBase upload)
        // {
        //     ResponseDetail objResponse = new ResponseDetail();
        //     try
        //     {
        //         if (upload != null)
        //         {
        //             var path = Server.MapPath("~/ProductImages");
        //             var paths = path.Split(':');
        //             if (paths != null || paths.Count() > 0)
        //             {
        //                 path = paths[0] + ":\\" + "ProductImages";
        //             }
        //             if (upload != null && upload.FileName != null)
        //             {
        //                 if (!Directory.Exists(path))
        //                 {
        //                     //DirectoryInfo dInfo = new DirectoryInfo(path);
        //                     //DirectorySecurity dSecurity = dInfo.GetAccessControl();
        //                     //dSecurity.AddAccessRule(new FileSystemAccessRule(new SecurityIdentifier(WellKnownSidType.WorldSid, null), FileSystemRights.FullControl, InheritanceFlags.ObjectInherit | InheritanceFlags.ContainerInherit, PropagationFlags.NoPropagateInherit, AccessControlType.Allow));
        //                     //dInfo.SetAccessControl(dSecurity);

        //                     Directory.CreateDirectory(path);


        //                 }

        //                 //string myfile = Guid.NewGuid() + "-" + BannerImage.FileName;
        //                 string myfile = Guid.NewGuid() + "-" + Path.GetFileName(upload.FileName);


        //                 var productImage = Path.Combine(path, myfile);
        //                 upload.SaveAs(productImage);
        //                 //model.BannerImage = "/BannerImage/" + myfile;
        //                 model.ProductImagePath = productImage;
        //             }
        //         }
        //         if (InventorySession.LoginUser != null)
        //         {
        //             model.UserDetails = InventorySession.LoginUser;


        //         }
        //         objResponse = objProductManager.SaveProductMaster(model);
        //     }
        //     catch(Exception ex)
        //     {

        //     }

        //     return Json(objResponse, JsonRequestBehavior.AllowGet);
        // }

        // // GET: CheckDuplicateMaster
        // [HttpPost]
        // public ActionResult CheckDuplicateMaster(CheckDuplicateModel model)
        // {
        //     ResponseDetail objResponse = new ResponseDetail();
        //     objResponse = objProductManager.IsMasterExists(model);
        //     return Json(objResponse,JsonRequestBehavior.AllowGet);
        // }
        //[HttpPost]
        // public ActionResult GetActiveListOfSubCat(CheckDuplicateModel model)
        // {
        //     List<SubCategoryDetails> objSubCategoryDetails = objProductManager.GetSubcategoryDetails(0, "Y");
        //     return Json(objSubCategoryDetails, JsonRequestBehavior.AllowGet);
        // }
        public ActionResult CategoryMaster()
        {
            CategoryDetails objCategoryModel = new CategoryDetails();

            objCategoryModel.IsAdd    = "Add";
            objCategoryModel.IsActive = true;
            return(View(objCategoryModel));
        }
Exemplo n.º 27
0
        public int AddNewCategory(CategoryDetails cd)
        {
            tblCategory tc = new tblCategory();

            tc.CategoryName = cd.CategoryName;
            _db.tblCategories.Add(tc);
            return(_db.SaveChanges());
        }
Exemplo n.º 28
0
        /// <summary>
        /// Creates a new category
        /// </summary>
        public static int InsertCategory(string title, int importance, string description, string imageUrl)
        {
            CategoryDetails record = new CategoryDetails(0, DateTime.Now,
                                                         BizObject.CurrentUserName, title, importance, description, imageUrl);
            int ret = SiteProvider.Articles.InsertCategory(record);

            BizObject.PurgeCacheItems("articles_categor");
            return(ret);
        }
Exemplo n.º 29
0
 public Category CreateCategory(Profile profile, CategoryDetails category)
 {
     return(new Category()
     {
         Name = category.Name,
         Added = DateTime.Now,
         Updated = DateTime.Now,
         AdderId = profile.Id,
         ModifierId = profile.Id
     });
 }
Exemplo n.º 30
0
        private void LoadCategory()
        {
            List <CategoryDetails> list = blcat.GetAllCategory();
            CategoryDetails        cd   = new CategoryDetails();

            cd.CategoryName = "Choose Category";
            list.Insert(0, cd);
            cboCategory.DataSource    = list;
            cboCategory.DisplayMember = "CategoryName";
            cboCategory.ValueMember   = "CategoryId";
            cboCategory.SelectedIndex = 0;
        }
Exemplo n.º 31
0
        private void LoadCategory()
        {
            List <CategoryDetails> lsttb = blcat.GetAllCategory();
            CategoryDetails        pro   = new CategoryDetails();

            pro.CategoryName = "Choose Category";
            lsttb.Insert(0, pro);

            cmbCategory.DataSource    = lsttb;
            cmbCategory.DisplayMember = "CategoryName";
            cmbCategory.ValueMember   = "Id";
        }
Exemplo n.º 32
0
    // Get category details
    public static CategoryDetails GetCategoryDetails(string categoryId)
    {
        // get a configured DbCommand object
        DbCommand comm = GenericDataAccess.CreateCommand();
        // set the stored procedure name
        comm.CommandText = "CatalogGetCategoryDetails";
        // create a new parameter
        DbParameter param = comm.CreateParameter();
        param.ParameterName = "@CategoryID";
        param.Value = categoryId;
        param.DbType = DbType.Int32;
        comm.Parameters.Add(param);

        // execute the stored procedure
        DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
        // wrap retrieved data into a CategoryDetails object
        CategoryDetails details = new CategoryDetails();
        if (table.Rows.Count > 0)
        {
            details.DepartmentId = Int32.Parse(table.Rows[0]["DepartmentID"].ToString());
            details.Name = table.Rows[0]["Name"].ToString();
            details.Description = table.Rows[0]["Description"].ToString();
        }
        // return department details
        return details;
    }
 /// <summary>
 /// Creates a new category
 /// </summary>
 public override int InsertCategory(CategoryDetails category)
 {
     using (SqlConnection cn = new SqlConnection(this.ConnectionString))
      {
     SqlCommand cmd = new SqlCommand("tbh_Articles_InsertCategory", cn);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = category.AddedDate;
     cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = category.AddedBy;
     cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = category.Title;
     cmd.Parameters.Add("@Importance", SqlDbType.Int).Value = category.Importance;
     cmd.Parameters.Add("@ImageUrl", SqlDbType.NVarChar).Value = category.ImageUrl;
     cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = category.Description;
     cmd.Parameters.Add("@CategoryID", SqlDbType.Int).Direction = ParameterDirection.Output;
     cn.Open();
     int ret = ExecuteNonQuery(cmd);
     return (int)cmd.Parameters["@CategoryID"].Value;
      }
 }
 /// <summary>
 /// Updates a category
 /// </summary>
 public override bool UpdateCategory(CategoryDetails category)
 {
     using (SqlConnection cn = new SqlConnection(this.ConnectionString))
      {
     SqlCommand cmd = new SqlCommand("tbh_Articles_UpdateCategory", cn);
     cmd.CommandType = CommandType.StoredProcedure;
     cmd.Parameters.Add("@CategoryID", SqlDbType.Int).Value = category.ID;
     cmd.Parameters.Add("@Title", SqlDbType.NVarChar).Value = category.Title;
     cmd.Parameters.Add("@Importance", SqlDbType.Int).Value = category.Importance;
     cmd.Parameters.Add("@ImageUrl", SqlDbType.NVarChar).Value = category.ImageUrl;
     cmd.Parameters.Add("@Description", SqlDbType.NVarChar).Value = category.Description;
     cn.Open();
     int ret = ExecuteNonQuery(cmd);
     return (ret == 1);
      }
 }
    // Get category details
    public static CategoryDetails GetCategoryDetails(string categoryId)
    {
        // get a configured OracleCommand object
        OracleCommand comm = GenericDataAccess.CreateCommand();
        // set the stored procedure name
        comm.CommandText = "CatalogGetCategoryDetails";

        // create a new parameter
        OracleParameter param = comm.Parameters.Add("CategoryID", OracleDbType.Int32);
        param.Direction = ParameterDirection.Input;
        param.Value = Int32.Parse(categoryId);
        comm.CommandType = CommandType.StoredProcedure;
        OracleParameter p2 =
           comm.Parameters.Add("cat_out", OracleDbType.RefCursor);
        p2.Direction = ParameterDirection.Output;

        // execute the stored procedure
        DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
        // wrap retrieved data into a CategoryDetails object
        CategoryDetails details = new CategoryDetails();
        if (table.Rows.Count > 0)
        {
            details.DepartmentId = Int32.Parse(table.Rows[0]["DepartmentID"].ToString());
            details.Name = table.Rows[0]["Name"].ToString();
            details.Description = table.Rows[0]["Description"].ToString();
        }
        // return department details
        return details;
    }
 public static CategoryDetails GetCategoryDetails(string categoryId)
 {
     DbCommand comm = GenericDataAccess.CreateCommand();
     comm.CommandText = "CatalogGetCategoryDetails";
     DbParameter param = comm.CreateParameter();
     param.ParameterName = "@CategoryID";
     param.Value = categoryId;
     param.DbType = DbType.Int32;
     comm.Parameters.Add(param);
     DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
     CategoryDetails details = new CategoryDetails();
     if (table.Rows.Count > 0)
     {
         DataRow dr = table.Rows[0];
         details.DepartmentId = Int32.Parse(dr["DepartmentID"].ToString());
         details.Name = dr["Name"].ToString();
         details.Description = dr["Description"].ToString();
     }
     return details;
 }