protected void gvVideos_RowDeleting(object sender, GridViewDeleteEventArgs e) { int productVideoId = (int)gvVideos.DataKeys[e.RowIndex]["VideoId"]; VideoBiz videoBiz = new VideoBiz(); lwg_Video video = videoBiz.GetVideoById(productVideoId); if (video != null) { videoBiz.DeleteCatalogVideo(productVideoId); LWGUtils.ClearOldFile(string.Format("{0}{1}", LWGUtils.GetVideoPath(), video.QTFile)); BindData(); } }
protected void gvVideos_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "UpdateProductVideo") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvVideos.Rows[index]; NumericTextBox txtProductVideoDisplayOrder = row.FindControl("txtProductVideoDisplayOrder") as NumericTextBox; HiddenField hfProductVideoId = row.FindControl("hdVideoId") as HiddenField; int displayOrder = txtProductVideoDisplayOrder.Value; int productVideoId = int.Parse(hfProductVideoId.Value); VideoBiz videoBiz = new VideoBiz(); lwg_Video video = videoBiz.GetVideoById(productVideoId); if (video != null) { video.DisplayOrder = displayOrder; videoBiz.UpdateCatalogVideo(video); } BindData(); } }
protected void btnUploadProductVideo_Click(object sender, EventArgs e) { try { Product product = ProductManager.GetProductById(this.ProductId); if (product != null) { CatalogBiz catalogBiz = new CatalogBiz(); lwg_Catalog catalog = catalogBiz.GetByID(product.ProductId); if (catalog == null) { catalog = new lwg_Catalog(); catalog.CatalogId = product.ProductId; catalog.CatalogNumber = string.Empty; catalog.Subtitle = string.Empty; catalog.TextLang = string.Empty; catalog.PTSprodcode = string.Empty; catalog.KaldbNumber = string.Empty; catalog.SoundIcon = string.Empty; catalog.PDF = string.Empty; catalog.pages = string.Empty; catalogBiz.SaveCatalog(catalog); } List <lwg_Video> videoList = new List <lwg_Video>(); lwg_Video video; string error = string.Empty; string path = SaveVideoFile(fuProductVideo1, ref error); if (string.IsNullOrEmpty(error)) { video = new lwg_Video(); video.CatalogId = this.ProductId; video.DisplayOrder = txtProductVideoDisplayOrder1.Value; video.QTFile = path; videoList.Add(video); } else { if (error == LWG.Business.LWGUtils.INVALID_FILE_EXTENSION) { throw new Exception("Invalid file extension."); } else if (error == LWG.Business.LWGUtils.INVALID_FILE_SIZE) { throw new Exception("Invalid file size"); } } path = SaveVideoFile(fuProductVideo2, ref error); if (string.IsNullOrEmpty(error)) { video = new lwg_Video(); video.CatalogId = this.ProductId; video.DisplayOrder = txtProductVideoDisplayOrder2.Value; video.QTFile = path; videoList.Add(video); } else { if (error == LWG.Business.LWGUtils.INVALID_FILE_EXTENSION) { throw new Exception("Invalid file extension."); } else if (error == LWG.Business.LWGUtils.INVALID_FILE_SIZE) { throw new Exception("Invalid file size"); } } path = SaveVideoFile(fuProductVideo3, ref error); if (string.IsNullOrEmpty(error)) { video = new lwg_Video(); video.CatalogId = this.ProductId; video.DisplayOrder = txtProductVideoDisplayOrder3.Value; video.QTFile = path; videoList.Add(video); } else { if (error == LWG.Business.LWGUtils.INVALID_FILE_EXTENSION) { throw new Exception("Invalid file extension."); } else if (error == LWG.Business.LWGUtils.INVALID_FILE_SIZE) { throw new Exception("Invalid file size"); } } // add videos if (videoList.Count > 0) { VideoBiz videoBiz = new VideoBiz(); videoBiz.AddCatalogVideo(videoList); BindData(); } } } catch (Exception exc) { ProcessException(exc); } }