Exemplo n.º 1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            if (readyOrder)
            {
                var orderPartLaborView       = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.view_orderpartlabor, parent, false);
                var orderPartLaborViewHolder = new OrderPartLaborViewHolder(orderPartLaborView, OnDelete, OnChange);
                return(orderPartLaborViewHolder);
            }
            View makeOrderPartLaborView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.view_orderpartlabor, parent, false);
            MakeOrderPartLaborViewHolder makeOrderPartLaborViewHolder = new MakeOrderPartLaborViewHolder(makeOrderPartLaborView, OnClick);

            return(makeOrderPartLaborViewHolder);
        }
Exemplo n.º 2
0
 public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
 {
     if (orderItemType == OrderItemType.PhisicalPart)
     {
         MakeOrderPartLaborViewHolder vh = holder as MakeOrderPartLaborViewHolder;
         vh.PartLaborDescription.Text = $"{Items[position]["OEM"]}\n{Items[position]["Count"]} шт.\n{Items[position]["Price"]} руб.";
         vh.PartLaborCheckBox.Checked = (position == lastCheckedPosition);
         return;
     }
     if (readyOrder)
     {
         OrderPartLaborViewHolder vh = holder as OrderPartLaborViewHolder;
         vh.PartLaborDescription.Text            = orderItemType == OrderItemType.Part ? $"OEM: {Items[position]["OEM"]}\nВремя доставки: {Items[position]["DeliveryTime"]}\nСтоимость: {Items[position]["Price"]}" : $"Название: {Items[position]["Text"]}\nВремя: {Items[position]["Time"]}\nДействие: {Items[position]["Action"]}";
         vh.PartLaborChangeRealizeBtn.Visibility = orderItemType == OrderItemType.Part ? ViewStates.Visible : ViewStates.Gone;
     }
     else
     {
         MakeOrderPartLaborViewHolder vh = holder as MakeOrderPartLaborViewHolder;
         vh.PartLaborCheckBox.Checked = (orderItemType == OrderItemType.Part && DataPreferences.Instance.selectedParts != null && DataPreferences.Instance.selectedParts.Contains(Items[position]["Id"])) || (orderItemType == OrderItemType.Labor && DataPreferences.Instance.selectedLabors != null && DataPreferences.Instance.selectedLabors.Contains(Items[position]["Id"]));
         var isLaborsExist = Items[position].ContainsKey("LaborIds") && Items[position]["LaborIds"] != null && JsonConvert.DeserializeObject <int[]>(Items[position]["LaborIds"].ToString()).Length > 0 ? "ЕСТЬ" : "НЕТ";
         vh.PartLaborDescription.Text = orderItemType == OrderItemType.Part ? $"Работы: {isLaborsExist}\nНазвание: {Items[position]["Text"]}\nOEM: {Items[position]["OEM"]}\nКол.-во: {(Items[position] as Dictionary<string, object>)["RequiredCount"]}" : $"Название: {Items[position]["Text"]}\nВремя: {Items[position]["Time"]}\nNote: {Items[position]["Note"]}";
     }
 }