protected void lbDownload_Click(object sender, EventArgs e) { try { WebServicePattern objWebServicePattern = new WebServicePattern(); PatternBO objPattern = new PatternBO(); objPattern.Number = this.QueryNumber; objPattern.IsActiveWS = true; objPattern.IsActive = true; objPattern = objPattern.SearchObjects().SingleOrDefault(); string filePath = objWebServicePattern.GeneratePDF(objPattern, false, this.hdnType.Value, this.CompressionImagePhysicalPath); this.DownloadPDFFile(filePath, objPattern.Number); } catch (Exception ex) { IndicoLogging.log.Error("Error occured while downloading pdf in Sizingspecs.aspx", ex); } }
protected void ddlPattern_SelectedIndexChanged(object sender, EventArgs e) { int id = int.Parse(this.ddlPattern.SelectedValue); if (id > 0) { this.ddlComparePattern.Enabled = true; this.Repopulate(); PatternBO objPattern = new PatternBO(); objPattern.ID = id; objPattern.GetObject(); this.litPattern1.Text = objPattern.Number + " - " + objPattern.NickName; PatternBO objPat = new PatternBO(); objPat.SizeSet = objPattern.SizeSet; objPat.Item = objPattern.Item; List <PatternBO> lstPattern = objPat.SearchObjects().Where(o => o.ID != id).ToList(); this.ddlComparePattern.Items.Clear(); this.ddlComparePattern.Items.Add(new ListItem("Select Next Pattern", "0")); if (lstPattern.Count > 0) { foreach (PatternBO pat in lstPattern) { this.ddlComparePattern.Items.Add(new ListItem(pat.Number + " - " + pat.NickName, pat.ID.ToString())); } } else { this.ddlComparePattern.Enabled = false; } this.PopulateOriginalPatternSpec(objPattern.ID); } }
// GET api/PatternDetails public PatternDetailModel Get(string number) { PatternDetailModel objModel = new PatternDetailModel(); try { PatternBO objPattern = new PatternBO(); objPattern.IsActiveWS = true; objPattern.IsActive = true; objPattern.Number = number; objPattern = objPattern.SearchObjects().SingleOrDefault(); if (objPattern != null && objPattern.Creator > 0) { objModel.Pattern = objPattern.ID; objModel.Number = objPattern.Number; objModel.Remarks = objPattern.Remarks; objModel.Gender = objPattern.objGender.Name; objModel.Description = objPattern.Description; if ((objPattern.PatternCompressionImage ?? 0) > 0) { objModel.GarmentSpecChartImagePath = PopulatePatternCompressionImage(objPattern); } else { List <MeasurementLocation> lstMLocations = new List <MeasurementLocation>(); SizeChartBO objSChart = new SizeChartBO(); objSChart.Pattern = objPattern.ID; List <SizeChartBO> lstSizeCharts = objSChart.SearchObjects().Where(o => o.objMeasurementLocation.IsSend == true && o.Val > 0).ToList(); List <MeasurementLocationBO> lstLocations = lstSizeCharts.Select(m => m.objMeasurementLocation).Distinct().ToList(); IEnumerable <IGrouping <string, MeasurementLocationBO> > lst = lstLocations.GroupBy(m => m.Name); foreach (IGrouping <string, MeasurementLocationBO> objML in lst) { MeasurementLocation location = new MeasurementLocation(); location.Name = objML.Key; List <SizeChartBO> lstMSizes = lstSizeCharts.Where(m => m.MeasurementLocation == objML.ElementAtOrDefault(0).ID).ToList(); foreach (SizeChartBO objSize in lstMSizes) { location.ListSizes.Add(new Size { name = objSize.objSize.SizeName, Value = objSize.Val.ToString() }); } lstMLocations.Add(location); } objModel.ListMeasurementLocations = lstMLocations; } //Populate Images PatternTemplateImageBO objOtherImage = new PatternTemplateImageBO(); objOtherImage.Pattern = objPattern.ID; List <PatternTemplateImageBO> lstOtherImages = objOtherImage.SearchObjects(); List <PatternTemplateImageBO> lstOtherImages1 = lstOtherImages.Where(o => o.ImageOrder == 1).ToList(); List <PatternTemplateImageBO> lstOtherImages2 = lstOtherImages.Where(o => o.ImageOrder == 2).ToList(); List <PatternTemplateImageBO> lstOtherImages3 = lstOtherImages.Where(o => o.ImageOrder == 3).ToList(); objModel.GarmentImagePath1 = TemplateImagePath(lstOtherImages1); objModel.GarmentImagePath2 = TemplateImagePath(lstOtherImages2); objModel.GarmentImagePath3 = TemplateImagePath(lstOtherImages3); objModel.GarmentSpecImagePath = TemplateImagePath(lstOtherImages.Where(o => o.IsHero).ToList(), true); } } catch (Exception ex) { objModel.Ex = ex; } return(objModel); }
private void PopulateDataGrid() { // Hide Controls this.dvEmptyContent.Visible = false; this.dvDataContent.Visible = false; this.dvNoSearchResult.Visible = false; // Search text this.txtSearch.Value = this.QuerySearchText; string searchText = this.txtSearch.Value.ToLower().Trim(); // Populate GSpecs int totalCount = 0; List <PatternBO> lstPattern = new List <PatternBO>(); if (Source != null) { lstPattern = Source; } else { PatternBO objPattern = new PatternBO(); objPattern.IsActiveWS = true; objPattern.IsActive = true; if (this.QueryMainCategory > 0) { objPattern.CoreCategory = QueryMainCategory; } switch (this.QueryCategory.ToLower()) { case "mens": objPattern.Gender = 1; objPattern.AgeGroup = 1; lstPattern = objPattern.SearchObjects().ToList(); break; case "ladies": objPattern.Gender = 2; objPattern.AgeGroup = 1; lstPattern = objPattern.SearchObjects().ToList(); break; case "unisex": objPattern.Gender = 3; lstPattern = objPattern.SearchObjects().ToList(); break; case "youth": objPattern.AgeGroup = 2; lstPattern = objPattern.SearchObjects().ToList(); break; case "other": lstPattern = objPattern.SearchObjects().Where(m => m.Gender > 3 || m.AgeGroup > 2).ToList(); break; default: lstPattern = objPattern.SearchObjects().ToList(); break; } if (!string.IsNullOrEmpty(searchText)) { lstPattern = lstPattern.Where(m => (m.NickName.ToLower() + " " + m.Number.ToLower() + " " + m.objCoreCategory.Name.ToLower() + " " + (string.IsNullOrEmpty(m.Keywords) ? "" : m.Keywords.ToLower())).Contains(searchText)).ToList(); } Source = lstPattern; } switch (this.SortBy) { case "Number": lstPattern = lstPattern.OrderBy(m => m.Number).ToList(); break; case "Newest": lstPattern = lstPattern.OrderByDescending(m => m.ModifiedDate).ToList(); break; case "CoreRange": lstPattern = lstPattern.OrderByDescending(m => m.IsCoreRange).ToList(); break; //case "Popular": // lstPattern = lstPattern.OrderBy(m => m.MostPopular ?? 0).ToList(); // break; //case "Rating": // lstPattern = lstPattern.OrderBy(m => m.Ratings ?? 0).ToList(); // break; default: lstPattern = lstPattern.OrderByDescending(m => m.IsCoreRange).ToList(); break; } totalCount = lstPattern.Count; int offSet = 0; if (lstPattern.Count > 0) { if (lstPattern.Count < (this.PageSize * 10)) { offSet = (this.Source.Count > this.PageSize) ? this.PageSize : this.Source.Count; } else { offSet = ((this.Source.Count - ((this.PageNumber - 1) * this.PageSize)) > this.PageSize) ? this.PageSize : (this.Source.Count - ((this.PageNumber - 1) * this.PageSize)); } int recordsLeft = totalCount - (offSet * (this.PageNumber - 1)); int nextFetchCount = (this.PageSize > recordsLeft) ? recordsLeft : this.PageSize; lstPattern = lstPattern.GetRange(offSet * (this.PageNumber - 1), nextFetchCount); this.rptGarmentSpecs.DataSource = lstPattern; this.rptGarmentSpecs.DataBind(); Session["PatternView"] = lstPattern; TotalCount = (totalCount == 0) ? TotalCount : totalCount; Session["PageCount"] = (TotalCount % PageSize == 0) ? (TotalCount / PageSize) : ((TotalCount / PageSize) + 1); this.dvPagingFooter.Visible = this.dvPagingHeader.Visible = (TotalCount > PageSize); this.lbFooterPrevious.Visible = (pageIndex != 1 && pageIndex != 90); this.ProcessNumbering(1, Convert.ToInt32(Session["PageCount"])); this.SetDisplayCount(); this.dvDataContent.Visible = true; } else if ((searchText != string.Empty && searchText != "search")) { this.lblSerchKey.Text = searchText + ((searchText != string.Empty) ? " - " : string.Empty); this.dvDataContent.Visible = true; this.dvNoSearchResult.Visible = true; this.dvPagingFooter.Visible = this.dvPagingHeader.Visible = false; } else { this.dvEmptyContent.Visible = true; this.dvPagingFooter.Visible = this.dvPagingHeader.Visible = false; } this.rptGarmentSpecs.Visible = (lstPattern.Count > 0); }
private void PopulateControls() { if (string.IsNullOrEmpty(this.QueryNumber)) { //#if DEBUG // Response.Redirect("http://www.bmizzle.com.au/sizing-specs/"); //#else // Response.Redirect("http://www.blackchrome.com.au/garment-sizing-specifications/"); //#endif Response.Redirect("http://www.blackchrome.com.au/"); } else { PatternBO objPattern = new PatternBO(); objPattern.IsActiveWS = true; objPattern.IsActive = true; objPattern.Number = this.QueryNumber; objPattern = objPattern.SearchObjects().SingleOrDefault(); if (objPattern != null && objPattern.Creator > 0) { WebServicePattern obj = new WebServicePattern(); if ((objPattern.PatternCompressionImage ?? 0) > 0) { this.imgSpec.ImageUrl = PopulatePatternCompressionImage(objPattern); this.imgSpec.Visible = true; } else { this.litSpecBody.Text = obj.CreateHtml(objPattern, "0", true); this.litSpecBody.Visible = this.dvUnits.Visible = true; } //Populate Images PatternTemplateImageBO objOtherImage = new PatternTemplateImageBO(); objOtherImage.Pattern = objPattern.ID; List <PatternTemplateImageBO> lstOtherImages = objOtherImage.SearchObjects(); List <PatternTemplateImageBO> lstOtherImages1 = lstOtherImages.Where(o => o.ImageOrder == 1).ToList(); List <PatternTemplateImageBO> lstOtherImages2 = lstOtherImages.Where(o => o.ImageOrder == 2).ToList(); List <PatternTemplateImageBO> lstOtherImages3 = lstOtherImages.Where(o => o.ImageOrder == 3).ToList(); this.imgOther1.Src = this.TemplateImagePath(lstOtherImages1); this.lnkImage1.Attributes.Add("data-image", "../" + this.imgOther1.Src); this.lnkImage1.Attributes.Add("data-zoom-image", "../" + this.imgOther1.Src); this.lnkImage1.Visible = !string.IsNullOrEmpty(this.imgOther1.Src); this.imgOther2.Src = TemplateImagePath(lstOtherImages2); this.lnkImage2.Attributes.Add("data-image", "../" + this.imgOther2.Src); this.lnkImage2.Attributes.Add("data-zoom-image", "../" + this.imgOther2.Src); this.lnkImage2.Visible = !string.IsNullOrEmpty(this.imgOther2.Src); this.imgOther3.Src = TemplateImagePath(lstOtherImages3); this.lnkImage3.Attributes.Add("data-image", "../" + this.imgOther3.Src); this.lnkImage3.Attributes.Add("data-zoom-image", "../" + this.imgOther3.Src); this.lnkImage3.Visible = !string.IsNullOrEmpty(this.imgOther3.Src); //PatternTemplateImageBO objGamentSpec = new PatternTemplateImageBO(); //if (lstOtherImages.Where(o => o.IsHero).Any()) //{ // objGamentSpec = lstOtherImages.Where(o => o.IsHero).Last(); this.imgGamentSpec.Src = TemplateImagePath(lstOtherImages.Where(o => o.IsHero).ToList(), true); // } this.lblNumber.InnerText = objPattern.Number; this.lblRemarks.InnerText = objPattern.Remarks; this.lblGender.InnerText = objPattern.objGender.Name; this.lblDescription.InnerText = objPattern.Description; this.imgHero.Src = (this.lnkImage3.Visible) ? this.imgOther3.Src : (this.lnkImage1.Visible) ? this.imgOther1.Src : IndicoConfiguration.AppConfiguration.DataFolderName + "/noimage-png-350px-350px.png"; } else { //#if DEBUG // Response.Redirect("http://www.bmizzle.com.au/sizing-specs/"); //#else // Response.Redirect("http://www.blackchrome.com.au/garment-sizing-specifications/"); //#endif Response.Redirect("http://www.blackchrome.com.au/"); } } }