public ItemDetailsResponse GetItemDetails(int objectId) { ItemDetailsResponse resp = new ItemDetailsResponse(); IItemService itemService = new ItemService(); resp = itemService.GetItemDetails(objectId); return(resp); }
/// <summary> /// Gets the item details. /// </summary> /// <param name="id">The item identifier.</param> /// <param name="language">The language.</param> /// <returns>The detailed item view.</returns> public ItemDetailsResponse GetItemDetails(string id, string language) { var response = new ItemDetailsResponse(); var item = this._workflowRepository.GetItem(id, language); if (item == null) { response.IsSuccess = false; response.Message = $"Item with ID: {id} cannot be found"; return(response); } response.Name = item.Name; response.Id = item.ID.ToString(); response.TemplateId = item.TemplateID.ToString(); response.TemplateName = item.TemplateName; response.HasLayout = item.Visualization?.Layout != null; response.VersionNumber = item.Version.Number; response.Icon = this._workflowRepository.GetIconUrl(item); response.Language = item.Language.Name; response.Updated = item.Statistics.Updated; response.UpdatedBy = item.Statistics.UpdatedBy; response.Created = item.Statistics.Created; response.CreatedBy = item.Statistics.CreatedBy; response.FullPath = item.Paths.FullPath; var defaultDevice = this._sitecoreFactory.GetDefaultDevice(); foreach (var rendering in item.Visualization.GetRenderings(defaultDevice, false)) { if (!string.IsNullOrEmpty(rendering.Settings.PersonalizationTest)) { response.PersonalizedRenderings.Add(new PersonalizationDetailResponse { RenderingName = rendering.WebEditDisplayName }); } if (!string.IsNullOrEmpty(rendering.Settings.MultiVariateTest)) { response.MultiVariateTestedRenderings.Add(new MultiVariateTestDetailResponse { RenderingName = rendering.WebEditDisplayName }); } } var history = this._workflowRepository.GetHistory(item); response.History = history.Select(this.LoadHistoryRecord).ToList(); response.IsSuccess = true; return(response); }
public void RefreshParent() { nfloat width = View.Frame.Width; ServiceWrapper svc = new ServiceWrapper(); ItemReviewResponse rv = svc.GetItemReviewUID(CurrentUser.RetreiveUserId()).Result; ItemDetailsResponse myData = svc.GetItemDetailsBarcode(WineBarcode, _storeId).Result; TableView.Source = new SKUDetailTableSource(width, this, NavigationController, myData.ItemDetails, _storeId); TableView.ReloadData(); }
public void RefreshParent() { ServiceWrapper svc = new ServiceWrapper(); //int wineid = Intent.GetIntExtra("WineID", 138); ItemDetailsResponse myData = svc.GetItemDetails(WineBarcode, storeid).Result; var SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; comments = new reviewAdapter(this, SkuRating.Reviews.ToList()); commentsview.Adapter = comments; comments.NotifyDataSetChanged(); }
public ItemDetailsResponse GetItemDetails(int WineId) { ItemDetailsResponse itemDetailsResponse = new ItemDetailsResponse(); ItemDetails itemDetailsList = new ItemDetails(); itemDetailsResponse.ItemDetails = itemDetailsList; #region DB Interaction IItemDBManager itemDBManager = new ItemDBManager(); IList <RetrieveWineDetailsResult> wineDetailsResults = itemDBManager.GetDetails(WineId).ToList(); if (wineDetailsResults.Any()) { foreach (RetrieveWineDetailsResult result in wineDetailsResults) { itemDetailsList = new ItemDetails { SKU = result.SKU.ToString(), Name = result.Name, Region = result.Region, Country = result.Country, SalePrice = Convert.ToDouble(result.SalePrice), RegPrice = Convert.ToDouble(result.RegPrice), AverageRating = Convert.ToDecimal(result.AverageRating), IsLike = Convert.ToBoolean(result.Liked), LargeImageUrl = result.LargeImageUrl, //Sub_Region = result.Sub_Region, //GrapeVerietal = result.GrapeVerietal, Vintage = Convert.ToInt32(result.Vintage), UsersRating = Convert.ToDecimal(result.UsersRating), Description = result.Description, WineProperties = new Dictionary <string, string>(), WineId = Convert.ToInt32(result.WineId) //Type = result.Type, //BottleSize = result.BottleSize.ToString(), //Tasting_Notes = result.t, //Alcohol_Levels = result.Alcohol_Levels, //Food_Pairings = result.Food_Pairings, //ServingAt = result.ServingAt, //WineMakerNotes = result.WineMakerNotes, //TechnicalNotes = result.TechnicalNotes, //Notes = result.Notes, //OtherText = result.OtherText, //Producer = result.Producer }; } itemDetailsResponse.ItemDetails = itemDetailsList; } #endregion return(itemDetailsResponse); }
public void RefreshParent() { Internal_ViewDidLoad(); ErrorDescription.Visibility = ViewStates.Gone; ServiceWrapper svc = new ServiceWrapper(); int wineid = Intent.GetIntExtra("WineID", 138); myData = svc.GetItemDetails(WineBarcode, storeid).Result; AvgRating.Rating = (float)myData.ItemDetails.AverageRating; // var SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; //comments = new reviewAdapter(this, SkuRating.Reviews.ToList()); // commentsview.Adapter = comments; //comments.NotifyDataSetChanged(); }
public void RefreshParent() { ServiceWrapper svc = new ServiceWrapper(); int wineid = Intent.GetIntExtra("WineID", 138); ItemDetailsResponse myData = svc.GetItemDetails(wineid).Result; var SkuRating = svc.GetItemReviewsByWineID(wineid).Result; this.Title = "Wine Details"; var commentsView = FindViewById <ListView>(Resource.Id.listView2); reviewAdapter comments = new reviewAdapter(this, SkuRating.Reviews.ToList()); commentsView.Adapter = comments; comments.NotifyDataSetChanged(); }
public override void ViewDidLoad() { try { LoggingClass.LogInfo("Entered into detail view of " + WineBarcode, screenid); BTProgressHUD.Show(); nfloat width = View.Frame.Width; ServiceWrapper svc = new ServiceWrapper(); ItemDetailsResponse myData = svc.GetItemDetailsBarcode(WineBarcode, _storeId).Result; ItemReviewResponse rv = svc.GetItemReviewUID(CurrentUser.RetreiveUserId()).Result; TableView.SeparatorStyle = UITableViewCellSeparatorStyle.None; TableView.AllowsSelection = false; TableView.RowHeight = UITableView.AutomaticDimension; TableView.Source = new SKUDetailTableSource(width, this, NavigationController, myData.ItemDetails, _storeId); BTProgressHUD.Dismiss(); } catch (Exception ex) { LoggingClass.LogError(ex.Message, screenid, ex.StackTrace.ToString()); } }
public async Task <ItemDetailsResponse> GetItemDetails(string WineBarcode, int storeid) { ItemDetailsResponse output = null; sw.Start(); LoggingClass.LogServiceInfo("Service Called", "GetItemDetails"); try { var uri = new Uri(ServiceURL + "GetItemDetailsBarcode/" + WineBarcode + "/user/" + storeid); var response = await client.GetStringAsync(uri).ConfigureAwait(false); output = JsonConvert.DeserializeObject <ItemDetailsResponse>(response); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); } sw.Stop(); LoggingClass.LogTime("The total time to start and end the service GetItemDetails", "The timer ran for " + sw.Elapsed.TotalSeconds); return(output); }
private void PostItem(ItemDetails Oitem, int i, SAPbouiCOM.Matrix oMatx) { String EbizKey = ""; try { var Token = getToken(); ItemDetailsResponse resp = ebiz.AddItem(Token, Oitem); if (resp.ErrorCode == 2 && resp.Error.Equals("Record already exists") && resp.Status.Equals("Error")) { ItemDetails[] list = ebiz.SearchItems(Token, "", Oitem.ItemId, null, 0, 2, ""); if (list != null && list.Count() > 0) { UpdateEbizChargeKey("OITM", list[0].ItemInternalId, Oitem.ItemId); EbizKey = list[0].ItemInternalId; } ShowSystemLog(String.Format("ItemCode:{0} Updated successfully", Oitem.ItemId)); } else if (resp.ErrorCode == 0 && resp.Error.Equals("") && resp.Status.Equals("Success")) { UpdateEbizChargeKey("OITM", resp.ItemInternalId, Oitem.ItemId); EbizKey = resp.ItemInternalId; ShowSystemLog(String.Format("ItemCode:{0} Added successfully", Oitem.ItemId)); } //SAPbouiCOM.EditText oEdit = (SAPbouiCOM.EditText)oMatx.Columns.Item("clEbizkey").Cells.Item(i + 1).Specific; //oEdit.Value = EbizKey; SAPbouiCOM.EditText oEdit = (SAPbouiCOM.EditText)oMatx.Columns.Item("clSync").Cells.Item(i + 1).Specific; oEdit.Value = "True"; //(SAPbouiCOM.EditText)oMatx.Columns.Item("clEbizkey").Cells.Item(i + 1).Specific = ""; } catch (Exception ex) { errorLog(ex); } }
public async Task <ItemDetailsResponse> GetItemDetailsBarcode(string wineid, int storeid) { sw.Start(); ItemDetailsResponse output = null; try { var uri = new Uri(ServiceURL + "GetItemDetailsBarcode/" + wineid + "/user/" + storeid); string Token = CurrentUser.GetAuthToken(); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Token); var response = await client.GetStringAsync(uri).ConfigureAwait(false); output = JsonConvert.DeserializeObject <ItemDetailsResponse>(response); } catch (Exception ex) { LoggingClass.LogError(ex.ToString(), screen, ex.StackTrace); } sw.Stop(); LoggingClass.LogServiceInfo("Service " + sw.Elapsed.TotalSeconds, "GetItemDetails"); //Console.WriteLine("GetItemDetails service Time Elapsed"+sw.Elapsed.TotalSeconds); return(output); }
public void Internal_ViewDidLoad() { try { WineBarcode = Intent.GetStringExtra("WineBarcode"); storeid = Intent.GetIntExtra("storeid", 1); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); myData = new ItemDetailsResponse(); ItemReviewResponse SkuRating = new ItemReviewResponse(); this.Title = "Wine Details"; try { DownloadAsync(this, System.EventArgs.Empty, WineBarcode); myData = svc.GetItemDetails(WineBarcode, storeid).Result; SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; ReviewArray = SkuRating.Reviews.ToList(); var tempReview = SkuRating.Reviews.ToList().Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId())); if (tempReview != null) { editPopup._editObj.RatingText = tempReview.RatingText; } comments = new reviewAdapter(this, ReviewArray); if (comments.Count == 0) { ErrorDescription.Visibility = ViewStates.Visible; ErrorDescription.Text = SkuRating.ErrorDescription; ErrorDescription.SetTextColor(Android.Graphics.Color.Black); } else { commentsview.Adapter = comments; } setListViewHeightBasedOnChildren1(commentsview); WineName.Text = myData.ItemDetails.Name; WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; Vintage.Text = myData.ItemDetails.Vintage.ToString(); if (Vintage.Text == null || Vintage.Text == "0") { Vintage.Text = ""; } else { Vintage.Text = myData.ItemDetails.Vintage.ToString(); } if (myData.ItemDetails.Producer == null || myData.ItemDetails.Producer == "") { WineProducer.Text = "Not Available"; } else { WineProducer.Text = myData.ItemDetails.Producer; } if (myData.ItemDetails.Description == null || myData.ItemDetails.Description == "") { WineDescription.Text = "Not Available"; } else { WineDescription.Text = myData.ItemDetails.Description; } AvgRating.Rating = (float)myData.ItemDetails.AverageRating; //ReviewPopup editPopup = new ReviewPopup(this, edit); //RatingBar RatingInput = FindViewById<RatingBar>(Resource.Id.ratingInput);//Taking rating stars input //RatingInput.RatingBarChange += editPopup.CreatePopup; var metrics = Resources.DisplayMetrics; var widthInDp = ConvertPixelsToDp(metrics.WidthPixels); var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage); BitmapFactory.Options options = new BitmapFactory.Options { InJustDecodeBounds = false, OutHeight = 75, OutWidth = 75 }; ProgressIndicator.Hide(); LoggingClass.LogInfo("Entered into detail view" + WineBarcode, screenid); Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); AlertDialog.Builder alert = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); alert.SetTitle("Sorry"); alert.SetMessage("We're under maintainence"); alert.SetNegativeButton("Ok", delegate { }); Dialog dialog = alert.Create(); dialog.Show(); } } catch { } }
protected override void OnCreate(Bundle savedInstanceState) { CheckInternetConnection(); Stopwatch st = new Stopwatch(); st.Start(); base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.detailedView); WineBarcode = Intent.GetStringExtra("WineBarcode"); storeid = Intent.GetIntExtra("storeid", 1); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); ItemDetailsResponse myData = new ItemDetailsResponse(); ItemReviewResponse SkuRating = new ItemReviewResponse(); this.Title = "Wine Details"; commentsview = FindViewById <ListView>(Resource.Id.listView2); TextView WineName = FindViewById <TextView>(Resource.Id.txtWineName); //Assigning values to respected Textfields WineName.Focusable = false; TextView WineProducer = FindViewById <TextView>(Resource.Id.txtProducer); WineProducer.Focusable = false; TextView Vintage = FindViewById <TextView>(Resource.Id.txtVintage); Vintage.Focusable = false; TextView WineDescription = FindViewById <TextView>(Resource.Id.txtWineDescription); WineDescription.Focusable = false; RatingBar AvgRating = FindViewById <RatingBar>(Resource.Id.avgrating); AvgRating.Focusable = false; TextView ErrorDescription = FindViewById <TextView>(Resource.Id.Error); ErrorDescription.Focusable = false; ErrorDescription.Visibility = ViewStates.Invisible; TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5); try { DownloadAsync(this, System.EventArgs.Empty, WineBarcode); myData = svc.GetItemDetails(WineBarcode, storeid).Result; SkuRating = svc.GetItemReviewsByWineBarcode(WineBarcode).Result; ReviewArray = SkuRating.Reviews.ToList(); comments = new reviewAdapter(this, ReviewArray); if (comments.Count == 0) { ErrorDescription.Text = SkuRating.ErrorDescription; ErrorDescription.Visibility = ViewStates.Visible; //AlertDialog.Builder aler = new AlertDialog.Builder(this, Resource.Style.MyDialogTheme); //aler.SetTitle("No Reviews"); //aler.SetMessage("Be the first one to Review"); //aler.SetNegativeButton("Ok", delegate { }); //Dialog dialog = aler.Create(); //dialog.Show(); } else { commentsview.Adapter = comments; } setListViewHeightBasedOnChildren1(commentsview); WineName.Text = myData.ItemDetails.Name; WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; Vintage.Text = myData.ItemDetails.Vintage.ToString(); if (myData.ItemDetails.Producer == null || myData.ItemDetails.Producer == "") { WineProducer.Text = "Not Available"; } else { WineProducer.Text = myData.ItemDetails.Producer; } if (myData.ItemDetails.Description == null || myData.ItemDetails.Description == "") { WineDescription.Text = "Not Available"; } else { WineDescription.Text = myData.ItemDetails.Description; } AvgRating.Rating = (float)myData.ItemDetails.AverageRating; Review edit = new Review() { Barcode = WineBarcode, RatingText = "", PlantFinal = storeid.ToString() }; var tempReview = ReviewArray.Find(x => x.ReviewUserId == Convert.ToInt32(CurrentUser.getUserId())); if (tempReview != null) { edit.RatingText = tempReview.RatingText; } ReviewPopup editPopup = new ReviewPopup(this, edit); RatingBar RatingInput = FindViewById <RatingBar>(Resource.Id.ratingInput); //Taking rating stars input RatingInput.RatingBarChange += editPopup.CreatePopup; var metrics = Resources.DisplayMetrics; var widthInDp = ConvertPixelsToDp(metrics.WidthPixels); var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage); BitmapFactory.Options options = new BitmapFactory.Options { InJustDecodeBounds = false, OutHeight = 75, OutWidth = 75 }; ProgressIndicator.Hide(); LoggingClass.LogInfo("Entered into detail view" + WineBarcode, screenid); Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screenid, exe.StackTrace.ToString()); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Sorry"); alert.SetMessage("We're under maintainence"); alert.SetNegativeButton("Ok", delegate { }); Dialog dialog = alert.Create(); dialog.Show(); } //downloadButton = FindViewById<Button>(Resource.Id.Download); //try //{ // //downloadButton.Enabled = true; // downloadButton.Click += downloadAsync; // //downloadButton.Enabled = false; //} //catch (Exception e) { } st.Stop(); LoggingClass.LogTime("Detail activity", st.Elapsed.TotalSeconds.ToString()); TokenModel devInfo = new TokenModel(); var activityManager = (ActivityManager)this.GetSystemService(Context.ActivityService); ActivityManager.MemoryInfo memInfo = new ActivityManager.MemoryInfo(); activityManager.GetMemoryInfo(memInfo); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Avail {0} - {1} MB", memInfo.AvailMem, memInfo.AvailMem / 1024 / 1024); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Low {0}", memInfo.LowMemory); System.Diagnostics.Debug.WriteLine("GetDeviceInfo - Total {0} - {1} MB", memInfo.TotalMem, memInfo.TotalMem / 1024 / 1024); devInfo.AvailableMainMemory = memInfo.AvailMem; devInfo.IsLowMainMemory = memInfo.LowMemory; devInfo.TotalMainMemory = memInfo.TotalMem; }
public void Internal_ViewDidLoad(Boolean refresh) { try { LoggingClass.LogInfo("Entered into detail view of " + _wineId, screen); //BTProgressHUD.Show(); nfloat width = View.Frame.Width; ItemDetailsResponse mydata = svc.GetItemDetailsBarcode(_wineId, _storeId).Result; //ItemReviewResponse rv = svc.GetItemReviewUID(CurrentUser.RetreiveUserId()).Result; var data = mydata.ItemDetails; if (data.Barcode != null) { var lblName = new UILabel(); lblName.Frame = new CGRect(0, 0, width, 40); lblName.Text = data.Name; lblName.Font = UIFont.FromName("Verdana-Bold", 16f); lblName.TextAlignment = UITextAlignment.Center; lblName.TextColor = UIColor.Purple; //var Separator = new UIImageView(); //Separator.Frame = new CGRect(0, 50, View.Frame.Width, 2); //Separator.Image = UIImage.FromFile("separator.png"); var lblVintage = new UILabel(); lblVintage.Frame = new CGRect(View.Frame.Width / 2 - 10, 40, 40, 20); double l = Math.Floor(Math.Log10(data.Vintage) + 1); if (l < 4) { lblVintage.Text = " "; } else { lblVintage.Text = data.Vintage.ToString(); } lblVintage.Font = UIFont.FromName("Verdana", 12f); lblVintage.TextAlignment = UITextAlignment.Center; lblVintage.BackgroundColor = UIColor.FromPatternImage(UIImage.FromFile("line123.png")); var btlImage = new UIImageView(); //92 * 233 btlImage.Frame = new CGRect(0, 10, width, width); UIImage image = new UIImage("Images/loadin.png"); var btnBuy = new UIButton(); btnBuy.Frame = new CGRect(UIScreen.MainScreen.Bounds.Width - 140, 70 + View.Frame.Width, 130, 70); btnBuy.ClipsToBounds = true; btnBuy.Layer.BorderColor = UIColor.White.CGColor; //btnBuy.Layer.EdgeAntialiasingMask = CAEdgeAntialiasingMask.LeftEdge | CAEdgeAntialiasingMask.RightEdge | CAEdgeAntialiasingMask.BottomEdge | CAEdgeAntialiasingMask.TopEdge; btnBuy.SetImage(UIImage.FromFile("buy.png"), UIControlState.Normal); btnBuy.TouchUpInside += delegate { UIApplication.SharedApplication.OpenUrl(new NSUrl("http://www.wineoutlet.com/sku" + data.SKU + ".html")); }; CGRect rect = btlImage.Bounds; nfloat boxHeight = rect.Height; // which is = width; //nfloat imgHeight = image.Size.Height; //nfloat ratio = boxHeight / imgHeight; //CGSize newSize = new CGSize(image.Size.Width * ratio, image.Size.Height * ratio); //image = image.Scale(newSize); nfloat X = (rect.Width / 2) - 50; btlImage.Frame = new CGRect(X, btlImage.Bounds.Height / 2, 100, 100); btlImage.Image = image; DownloadAsync(data.Barcode, _storeId, btlImage, boxHeight, 70); nfloat Y1 = 90 + View.Frame.Width; UITextView txtWineleft = new UITextView(new CGRect(0, Y1 + 10, width, 40)); txtWineleft.Text = "Wine left in bottle: " + data.AvailableVolume.ToString() + ".ml"; txtWineleft.TextAlignment = UITextAlignment.Center; txtWineleft.Editable = false; //uip.SetProgress(Convert.ToSingle(data.AvailableVolume), false); //uip.ProgressTintColor = UIColor.Green; //uip.TintColor = UIColor.Gray; //CGAffineTransform transform=CGAffineTransform.MakeScale(1.0f,Convert.ToSingle(data.AvailableVolume)); //uip.Transform = transform; var ratingConfig = new RatingConfig(emptyImage: UIImage.FromBundle("Stars/empty.png"), filledImage: UIImage.FromBundle("Stars/star.png"), chosenImage: UIImage.FromBundle("Stars/star.png")); nfloat Y = 70 + View.Frame.Width; ratingView = new PDRatingView(new CGRect(width * 3 / 8 + 2, Y, width / 4, 20f), ratingConfig, data.AverageRating); ratingView.UserInteractionEnabled = false; var lblRateTitle = new UILabel(); lblRateTitle.Frame = new CGRect(4, Y + 40, width, 50); lblRateTitle.Text = "Rate this Wine"; lblRateTitle.TextAlignment = UITextAlignment.Center; lblRateTitle.Font = UIFont.FromName("Verdana-Bold", 16f); lblRateTitle.TextColor = UIColor.Purple; var lblRateRequest = new UILabel(); lblRateRequest.Frame = new CGRect(4, Y + 75, width, 10); lblRateRequest.Text = "Select number of Stars"; lblRateRequest.Font = UIFont.FromName("AmericanTypewriter", 10f); lblRateRequest.TextAlignment = UITextAlignment.Center; var starUpLine = new UIImageView(new CGRect(4, Y + 90, width - 8, 1)); starUpLine.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; starUpLine.Image = UIImage.FromFile("separator.png"); starUpLine.ContentMode = UIViewContentMode.ScaleAspectFill; starUpLine.ClipsToBounds = true; starUpLine.Layer.BorderColor = UIColor.White.CGColor; starUpLine.BackgroundColor = UIColor.LightGray; Y = Y + 10; PDRatingView ratingViewSelect = new PDRatingView(new CGRect(width * 2 / 8, Y + 82, width / 2, 36f), ratingConfig, 0m); UIViewController that = this; var starDownLine = new UIImageView(new CGRect(4, Y + 120, View.Frame.Width - 8, 1)); starDownLine.AutoresizingMask = UIViewAutoresizing.FlexibleWidth; starDownLine.Image = UIImage.FromFile("separator.png"); starDownLine.ContentMode = UIViewContentMode.ScaleAspectFill; starDownLine.ClipsToBounds = true; starDownLine.Layer.BorderColor = UIColor.White.CGColor; starDownLine.BackgroundColor = UIColor.LightGray; Y = Y + 140; var lblDesc = new UILabel(); lblDesc.Frame = new CGRect(4, Y, View.Frame.Width, 20); lblDesc.Text = "Description: "; lblDesc.TextAlignment = UITextAlignment.Left; Y = Y + 20; var lblDescText = new UITextView(); lblDescText.Editable = false; if (data.Description == null || data.Description == "") { lblDescText.Text = "Not available"; lblDescText.Font = UIFont.FromName("EuphemiaUCAS-Italic", 10f); } else { lblDescText.Text = data.Description.Trim(); } lblDescText.TextAlignment = UITextAlignment.Justified; CGSize sTemp = new CGSize(width, 100); sTemp = lblDescText.SizeThatFits(sTemp); lblDescText.Frame = new CGRect(0, Y, width, sTemp.Height); Y = Y + lblDescText.Frame.Size.Height; var table = new UITableView(); table.Frame = new CGRect(0, Y, width, data.WineProperties.Count * 22); table.Source = new WineInfoTableSource(data.WineProperties); table.AllowsSelection = false; table.ScrollEnabled = false; Y = Y + table.Frame.Size.Height + 10; var lblProducer = new UILabel(); lblProducer.Frame = new CGRect(4, Y, width, 20); lblProducer.Text = "Producer: "; lblProducer.TextAlignment = UITextAlignment.Left; Y = Y + 20; var lblProducerText = new UITextView(); lblProducerText.Editable = false; if (data.Producer == null || data.Producer == "") { lblProducerText.Text = "Not available"; lblProducerText.Font = UIFont.FromName("EuphemiaUCAS-Italic", 10f); } else { lblProducerText.Text = data.Producer.Trim(); } lblProducerText.TextAlignment = UITextAlignment.Justified; sTemp = new CGSize(width, 100); sTemp = lblProducerText.SizeThatFits(sTemp); lblProducerText.Frame = new CGRect(0, Y, width, sTemp.Height); ItemReviewResponse ratings = svc.GetItemReviewsByWineID(data.Barcode).Result; data.Reviews = ratings.Reviews.ToList(); Y = Y + lblProducerText.Frame.Size.Height; var review = LoadReviews(data, Y, width); Y = Y + review.Frame.Size.Height; //Y = Y + 20; var NoReviews = new UITextView(); NoReviews.Hidden = true; if (data.Reviews.Count == 0) { _noreviews = true; reviewTable.SeparatorColor = UIColor.Clear; NoReviews.Text = ratings.ErrorDescription; sTemp = NoReviews.SizeThatFits(sTemp); NoReviews.Frame = new CGRect(0, Y - 50, width, 40); NoReviews.Editable = false; NoReviews.TextAlignment = UITextAlignment.Center; NoReviews.Hidden = false; } var currentReview = data.Reviews.Where(x => x.ReviewUserId == CurrentUser.RetreiveUserId()).FirstOrDefault(); string currComments = ""; if (currentReview != null) { currComments = currentReview.RatingText; } if (_notif == true) { //ratingViewSelect.RatingChosen += (sender, e) => //{ //if (CurrentUser.RetreiveUserId() == 0) //{ // UIAlertView alert = new UIAlertView() // { // Title = "This feature is allowed only for VIP Card holders", // //Message = "Coming Soon..." // }; // alert.AddButton("OK"); // alert.AddButton("Know more"); // alert.Clicked += (senderalert, buttonArgs) => // { // if (buttonArgs.ButtonIndex == 1) // { // UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html")); // } // }; // alert.Show(); // ratingViewSelect.ChosenRating = 0; //} //else //{ try { LoggingClass.LogInfo("Came from notifications and giving rating for " + data.Barcode, screen); PopupView yourController = new PopupView(data.Barcode, _storeId); yourController.NavController = NavigationController; yourController.parent = that; yourController.StartsSelected = 5; yourController.Comments = currComments; yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext; that.PresentModalViewController(yourController, false); } catch (Exception exe) { LoggingClass.LogError(exe.Message, screen, exe.StackTrace); } //} //}; } ratingViewSelect.RatingChosen += (sender, e) => { if (CurrentUser.RetreiveUserId() == 0) { UIAlertView alert = new UIAlertView() { Title = "This feature is allowed only for VIP Card holders", //Message = "Coming Soon..." }; alert.AddButton("OK"); alert.AddButton("Know more"); alert.Clicked += (senderalert, buttonArgs) => { if (buttonArgs.ButtonIndex == 1) { UIApplication.SharedApplication.OpenUrl(new NSUrl("https://hangoutz.azurewebsites.net/index.html")); } }; alert.Show(); ratingViewSelect.ChosenRating = 0; } else { LoggingClass.LogInfo("Clicked on stars to give rating on " + data.Barcode, screen); PopupView yourController = new PopupView(data.Barcode, _storeId); yourController.NavController = NavigationController; yourController.parent = that; yourController.StartsSelected = e.Rating; yourController.Comments = currComments; yourController.ModalPresentationStyle = UIModalPresentationStyle.OverCurrentContext; that.PresentModalViewController(yourController, false); } }; scrollView = new UIScrollView(); scrollView.Frame = new CGRect(0, 70, View.Frame.Width, View.Frame.Height); if (_noreviews == true) { scrollView.ContentSize = new CGSize(View.Frame.Width, Y + 70); } else { scrollView.ContentSize = new CGSize(View.Frame.Width, Y + 20); } if (refresh == true) { //scrollView.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width, 70); scrollView.ContentOffset = new CGPoint(0, 300); var tap = new UITapGestureRecognizer { CancelsTouchesInView = false }; tap.AddTarget(() => { scrollView.ContentSize = new CGSize(View.Frame.Width, Y + 70); scrollView.ContentOffset = new CGPoint(0, 0); }); } scrollView.BackgroundColor = UIColor.White; scrollView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight; //}; if (_fav != true) { scrollView.AddSubview(txtWineleft); } //When making it async the Frame.Y is messing up by image Y. So changing it to 70. Ideally it should be 0. //Same will apply to ContentSize.Y View.AddSubview(scrollView); //View.AddSubview(NoReviews); //scrollView.AddSubview(btnBuy); scrollView.AddSubview(lblName); //scrollView.AddSubview(txtWineleft); scrollView.AddSubview(lblVintage); scrollView.AddSubview(btlImage); scrollView.AddSubview(ratingView); scrollView.AddSubview(lblRateTitle); scrollView.AddSubview(lblRateRequest); scrollView.AddSubview(ratingViewSelect); scrollView.AddSubview(starUpLine); scrollView.AddSubview(starDownLine); scrollView.AddSubview(lblDesc); scrollView.AddSubview(lblDescText); scrollView.AddSubview(table); scrollView.AddSubview(lblProducer); scrollView.AddSubview(lblProducerText); scrollView.AddSubview(review); scrollView.AddSubview(NoReviews); //scrollView. BTProgressHUD.Dismiss(); } else { BTProgressHUD.Dismiss(); UIAlertView alert = new UIAlertView() { Title = "Sorry", Message = "Something went wrong. We are on it" }; alert.AddButton("OK"); alert.Show(); } } catch (Exception ex) { LoggingClass.LogError(ex.Message, screen, ex.StackTrace.ToString()); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.detailedView); wineid = Intent.GetIntExtra("WineID", 123); ActionBar.SetHomeButtonEnabled(true); ActionBar.SetDisplayHomeAsUpEnabled(true); ServiceWrapper svc = new ServiceWrapper(); ItemDetailsResponse myData = new ItemDetailsResponse(); ItemReviewResponse SkuRating = new ItemReviewResponse(); this.Title = "Wine Details"; var commentsView = FindViewById <ListView>(Resource.Id.listView2); TextView WineName = FindViewById <TextView>(Resource.Id.txtWineName); //Assigning values to respected Textfields WineName.Focusable = false; TextView WineProducer = FindViewById <TextView>(Resource.Id.txtProducer); WineProducer.Focusable = false; TextView Vintage = FindViewById <TextView>(Resource.Id.txtVintage); Vintage.Focusable = false; TextView WineDescription = FindViewById <TextView>(Resource.Id.txtWineDescription); WineDescription.Focusable = false; RatingBar AvgRating = FindViewById <RatingBar>(Resource.Id.avgrating); AvgRating.Focusable = false; TableRow tr5 = FindViewById <TableRow>(Resource.Id.tableRow5); try { downloadAsync(this, System.EventArgs.Empty, wineid); myData = svc.GetItemDetails(wineid).Result; SkuRating = svc.GetItemReviewsByWineID(wineid).Result; reviewAdapter comments = new reviewAdapter(this, SkuRating.Reviews.ToList()); commentsView.Adapter = comments; setListViewHeightBasedOnChildren1(commentsView); WineName.Text = myData.ItemDetails.Name; WineName.InputType = Android.Text.InputTypes.TextFlagNoSuggestions; Vintage.Text = myData.ItemDetails.Vintage.ToString(); WineProducer.Text = myData.ItemDetails.Producer; WineDescription.Text = myData.ItemDetails.Description; AvgRating.Rating = (float)myData.ItemDetails.AverageRating; Review edit = new Review(); edit.WineId = wineid; ReviewPopup editPopup = new ReviewPopup(this, edit); RatingBar RatingInput = FindViewById <RatingBar>(Resource.Id.ratingInput);//Taking rating stars input RatingInput.RatingBarChange += editPopup.CreatePopup; var metrics = Resources.DisplayMetrics; var widthInDp = ConvertPixelsToDp(metrics.WidthPixels); var heightInDp = ConvertPixelsToDp(metrics.HeightPixels); //imgWine = FindViewById<ImageView>(Resource.Id.imgWine12); HighImageWine = FindViewById <ImageView>(Resource.Id.WineImage); //ProfilePicturePickDialog pppd = new ProfilePicturePickDialog(); //string path = pppd.CreateDirectoryForPictures(); //var filePath = System.IO.Path.Combine(path + "/" + wineid + ".jpg"); //if (System.IO.File.Exists(filePath)) //{ // Bitmap imageBitmap = BitmapFactory.DecodeFile(filePath); // imgWine.SetImageBitmap(imageBitmap); //} //else //{ // Bitmap imageBitmap = BlobWrapper.Bottleimages(wineid); // imgWine.SetImageBitmap(imageBitmap); //} //imgWine.LayoutParameters = new RelativeLayout.LayoutParams(1100, 1100); BitmapFactory.Options options = new BitmapFactory.Options { InJustDecodeBounds = false, OutHeight = 75, OutWidth = 75 }; ProgressIndicator.Hide(); Bitmap result = BitmapFactory.DecodeResource(Resources, Resource.Drawable.placeholder_re, options); } catch (Exception ex) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Sorry"); alert.SetMessage("We're under maintainence"); alert.SetNegativeButton("Ok", delegate { }); Dialog dialog = alert.Create(); dialog.Show(); } //downloadButton = FindViewById<Button>(Resource.Id.Download); //try //{ // //downloadButton.Enabled = true; // downloadButton.Click += downloadAsync; // //downloadButton.Enabled = false; //} //catch (Exception e) { } }