protected void rptImages_ItemCommand(object sender, RepeaterCommandEventArgs e) { switch (e.CommandName) { case DELETE: BrandService.DeleteBrandMedia(Convert.ToInt32(e.CommandArgument)); enbNotice.Message = "Image was deleted successfully."; break; } PopulateBrandInfo(GetIntState(BRAND_ID)); hfCurrentPanel.Value = "media"; }
protected void gvBanners_RowCommand(object sender, GridViewCommandEventArgs e) { int brandId = GetIntState(BRAND_ID); switch (e.CommandName) { case "save": if (brandId != AppConstant.DEFAULT_BRAND) { int brandMediaId = Convert.ToInt32(e.CommandArgument); var media = BrandService.GetBrandMediaById(brandMediaId); GridViewRow row = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer; int displayOrder = Convert.ToInt32(((TextBox)row.FindControl("txtBannerDisplayOrder")).Text.Trim()); media.Priority = displayOrder; string title = ((TextBox)row.FindControl("txtBannerTitle")).Text.Trim(); if (string.IsNullOrEmpty(title)) { media.Title = null; } else { media.Title = title; } CheckBox cbStatus = ((CheckBox)row.FindControl("cbBannerEnabled")); media.Enabled = cbStatus.Checked; string fromDate = ((TextBox)row.FindControl("txtBannerStartDate")).Text.Trim(); if (string.IsNullOrEmpty(fromDate)) { media.StartDate = null; } else { media.StartDate = DateTime.ParseExact(fromDate, AppConstant.DATE_FORM1, CultureInfo.InvariantCulture); } string toDate = ((TextBox)row.FindControl("txtBannerEndDate")).Text.Trim(); if (string.IsNullOrEmpty(toDate)) { media.EndDate = null; } else { media.EndDate = DateTime.ParseExact(toDate, AppConstant.DATE_FORM1, CultureInfo.InvariantCulture); } BrandService.UpdateBrandMedia(media); enbNotice.Message = "Banner was successfully updated."; PopulateBrandInfo(brandId); } break; case "remove": if (brandId != AppConstant.DEFAULT_BRAND) { int id = Convert.ToInt32(e.CommandArgument); BrandService.DeleteBrandMedia(id); enbNotice.Message = "Banner was successfully removed."; PopulateBrandInfo(brandId); } break; default: break; } hfCurrentPanel.Value = "banners"; }