public ActionResult ProductMasterNew() { var model = new ProductNew(); model.listGenres = LoadGenreDropDown(); model.listLang = LoadLanguageDropDown(); return View(model); }
public ActionResult ProductInfo(int? ProductID) { var model = new ProductNew(); model.ListProduct = BLObj.GetProductInfoByProductID(Convert.ToInt32(ProductID)); model.ListAuthor = BLObj.GetAthorByProductID(Convert.ToInt32(ProductID)); model.ListProductbyAuthor = BLObj.GetProductByAuthor(Convert.ToInt32(ProductID)); return View(model); }
public void ProductsInsert(ProductNew pd, DataTable dt) { try { clsParameterCollection clsParaCollection = new clsParameterCollection(); clsParaCollection.ProcedureName = Constants.VP_ProductNew_Insert; clsParaCollection.Add(new clsParameter("@authordetails", dt)); clsParaCollection.Add(new clsParameter("@ProductTitle", pd.ProductTitle)); clsParaCollection.Add(new clsParameter("@Price", pd.Price)); clsParaCollection.Add(new clsParameter("@ProductImage", pd.ProductImage)); clsParaCollection.Add(new clsParameter("@ProductInfo", pd.ProductInfo)); clsParaCollection.Add(new clsParameter("@Author", " ")); clsParaCollection.Add(new clsParameter("@AuthorImage", " ")); clsParaCollection.Add(new clsParameter("@AuthorInfo", " ")); clsParaCollection.Add(new clsParameter("@AuthorEmail", " ")); clsParaCollection.Add(new clsParameter("@BookByAuthor", " ")); clsParaCollection.Add(new clsParameter("@lang", pd.Language)); clsParaCollection.Add(new clsParameter("@Genre", pd.Category)); // clsParaCollection.Add(new clsParameter("@Type", pd.Type)); clsParaCollection.Add(new clsParameter("@Binding", pd.Binding)); clsParaCollection.Add(new clsParameter("@ISBN", pd.ISBN)); clsParaCollection.Add(new clsParameter("@Publisher", pd.Publisher)); clsParaCollection.Add(new clsParameter("@ProductCode", pd.ProductCode)); clsParaCollection.Add(new clsParameter("@Format", pd.Format)); clsParaCollection.Add(new clsParameter("@Page_Extent", pd.PageExtent)); clsParaCollection.Add(new clsParameter("@FacebookLink", pd.FacebookLink)); clsParaCollection.Add(new clsParameter("@TwitterLink", pd.TwitterLink)); clsParaCollection.Add(new clsParameter("@PInterestLink", pd.PInterestLinks)); clsParaCollection.Add(new clsParameter("@BuyBookLink", pd.BuyBookLink)); DataAccess.ExecuteNonQuerySp(clsParaCollection); } catch (Exception ex) { BL_Exception.WriteLog(ex); throw ex; } }
public ActionResult ProductMasterNew(FormCollection form) { int getauthor = 0,insertauthornu = 0; List<int> authorid = new List<int>(); string fileName = "", fileName1 = "", fileName2 = "", fileName3 = "", fileName4 = "", sociallinks = ""; //Book Image if (Request.Files[0].FileName != "") { var uploadedFile = Request.Files[0]; fileName = uploadedFile.FileName; uploadedFile.SaveAs(Server.MapPath(Constants.BookImagePath) + "//" + fileName); } //AuthorImage if (Request.Files[1].FileName != "") { var uploadedFile1 = Request.Files[1]; fileName1 = uploadedFile1.FileName; uploadedFile1.SaveAs(Server.MapPath(Constants.AuthorImagePath1) + "//" + fileName1); getauthor++; } //OtherBookImage if (Request.Files[2].FileName != "") { var uploadedFile2 = Request.Files[2]; fileName2 = uploadedFile2.FileName; uploadedFile2.SaveAs(Server.MapPath(Constants.AuthorImagePath2) + "//" + fileName2); getauthor++; } if (Request.Files[3].FileName != "") { var uploadedFile3 = Request.Files[3]; fileName3 = uploadedFile3.FileName; uploadedFile3.SaveAs(Server.MapPath(Constants.AuthorImagePath3) + "//" + fileName3); getauthor++; } if (Request.Files[4].FileName != "") { var uploadedFile4 = Request.Files[4]; fileName4 = uploadedFile4.FileName; uploadedFile4.SaveAs(Server.MapPath(Constants.AuthorImagePath4) + "//" + fileName4); getauthor++; } var model = new ProductNew(); model.ProductTitle = form["txtProductTitle"]; model.ProductInfo = form["txtDesc"]; // model.AuthorName = form["txtAuthor"]; // model.AuthorImage = ; //model.AuthorInfo = form["txtAuthorinfo"]; //model.AuthorEmail = form["txtAuthorEmail"]; model.Price = form["txtPrice"]; model.Category = form["ddlGenre"]; model.Language = form["ddlLang"]; model.Binding = form["txtBinding"]; model.ISBN = form["txtISBN"]; model.Publisher = form["txtPublisher"]; model.ProductCode = form["txtbookCode"]; model.Format = form["txtFormat"]; model.PageExtent = Convert.ToInt32(form["txtPage_Extent"]); //social media links if (form["txtSocialMediaLinks1"] != "") model.FacebookLink = form["txtSocialMediaLinks1"]; else model.FacebookLink = ""; if (form["txtSocialMediaLinks2"] != "") model.TwitterLink = form["txtSocialMediaLinks2"]; else model.TwitterLink = ""; if (form["txtSocialMediaLinks3"] != "") model.PInterestLinks = form["txtSocialMediaLinks3"]; else model.PInterestLinks = ""; model.BuyBookLink = form["txtbuylink"]; model.ProductImage = fileName; DataTable author = new DataTable(); DataColumn column; DataRow row; // Create new DataColumn, set DataType, ColumnName and add to DataTable. column = new DataColumn(); column.DataType = System.Type.GetType("System.String"); column.ColumnName = "AuthorName"; author.Columns.Add(column); // Create second column. column = new DataColumn(); column.DataType = Type.GetType("System.String"); column.ColumnName = "AuthorImage"; author.Columns.Add(column); column = new DataColumn(); column.DataType = Type.GetType("System.String"); column.ColumnName = "AuthorInfo"; author.Columns.Add(column); column = new DataColumn(); column.DataType = Type.GetType("System.String"); column.ColumnName = "AuthorEmail"; author.Columns.Add(column); // Create new DataRow objects and add to DataTable. for (int i = 0; i < getauthor; i++) { DataTable dt = BLObj.GetAuthorbyauthorname(form["txtAuthor" + (i + 1)]); if (dt.Rows.Count > 0) { authorid.Add(Convert.ToInt32(dt.Rows[0][0])); } else { insertauthornu++; row = author.NewRow(); string file = "fileName" + (i + 1); row["AuthorName"] = form["txtAuthor" + (i + 1)]; row["AuthorImage"] = Request.Files[i+1].FileName; row["AuthorInfo"] = form["txtAuthorinfo" + (i + 1)]; row["AuthorEmail"] = form["txtAuthorEmail" + (i + 1)]; author.Rows.Add(row); } } int getmax = BLObj.Getmaximumauthorid(); BLObj.ProductsInsert(model, author); DataTable book_author = new DataTable(); DataColumn book_author_column; DataRow book_author_row; book_author_column = new DataColumn(); book_author_column.DataType = System.Type.GetType("System.String"); book_author_column.ColumnName = "bookid"; book_author.Columns.Add(book_author_column); // Create second column. book_author_column = new DataColumn(); book_author_column.DataType = Type.GetType("System.String"); book_author_column.ColumnName = "authorid"; book_author.Columns.Add(book_author_column); int getmaxproductid = BLObj.Getmaximumbookid(); foreach (var item in authorid) { book_author_row = book_author.NewRow(); book_author_row["bookid"] = getmaxproductid; book_author_row["authorid"] = item; book_author.Rows.Add(book_author_row); } for (int i = 0; i < insertauthornu; i++) { getmax++; book_author_row = book_author.NewRow(); book_author_row["bookid"] = getmaxproductid; book_author_row["authorid"] = getmax; book_author.Rows.Add(book_author_row); } BLObj.BookAuthorInsert(book_author); ViewBag.ClassName = "text-success bg-success"; ViewBag.ResultMessage = "Product added successfully.."; model.listGenres = LoadGenreDropDown(); model.listLang = LoadLanguageDropDown(); return View(model); }
public ActionResult VishwaPressStore(int? Page, int? GenreID) { var model = new ProductNew(); model.PagingRange = Constants.BookStorePagingRange; if (Page != null && Page != 0) { model.CurrentPage = Convert.ToInt32(Page); model.StartIndex = (Convert.ToInt32(Page) * Constants.BookStorePagingRange) - ((Constants.BookStorePagingRange) - 1); model.EndIndex = Convert.ToInt32(Page) * Constants.BookStorePagingRange; } else { model.CurrentPage = 1; model.StartIndex = 1; model.EndIndex = Constants.BookStorePagingRange; } model.LastPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(BLObj.GetCountOfProductsForStore()) / Convert.ToDouble(8.00))); //if (GenreID != null) // model.ListProduct = BLObj.getProductsfromCategory(Convert.ToInt32(GenreID)); //else model.ListProduct = BLObj.GetProductsForStore(model.StartIndex, model.EndIndex, Convert.ToInt32(GenreID)); //model.LastPage = Convert.ToInt32(Math.Ceiling(Convert.ToDouble(BLObj.GetCountOfProductsForStore()) / Convert.ToDouble(8.00))); model.listGenres = LoadGenreDropDown(); if (User.IsInRole("Admin")) ViewBag.Admin = 1; if (Request.IsAjaxRequest()) { return PartialView("_WebgridVishwaPressStore", model); } return View(model); }