示例#1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected Task <bool> OnSaveAsync(BindItem item)
 {
     // 增加数据演示代码
     if (item.Id == 0)
     {
         lock (_objectLock)
         {
             item.Id = EditItems.Max(i => i.Id) + 1;
             EditItems.Add(item);
         }
     }
     else
     {
         var oldItem = EditItems.FirstOrDefault(i => i.Id == item.Id);
         if (oldItem != null)
         {
             oldItem.Name      = item.Name;
             oldItem.Address   = item.Address;
             oldItem.DateTime  = item.DateTime;
             oldItem.Count     = item.Count;
             oldItem.Complete  = item.Complete;
             oldItem.Education = item.Education;
         }
     }
     return(Task.FromResult(true));
 }
        public async Task GetEditItems()
        {
            var edititems = from items in Items
                            join vat in VAT on items.vatId equals vat.vatId
                            join sekce in Sekces on items.sectionId equals sekce.id
                            select new
            {
                ItemId      = items.itemId,
                Name        = items.name,
                VatName     = vat.name,
                Price       = items.price,
                SectionName = sekce.name
            };

            foreach (var item in edititems)
            {
                EditItems.Add(new EditItem()
                {
                    SectionName = item.SectionName,
                    itemId      = item.ItemId,
                    Name        = item.Name,
                    Price       = (int)item.Price,
                    VatName     = item.VatName
                }
                              );
            }
        }
 public async Task FillVatAndSectiontNames()
 {
     foreach (var item in EditItems.Select(x => x.VatName).Distinct())
     {
         VatNames.Add(item);
     }
     foreach (var item in Sekces.Select(x => x.name).Distinct())
     {
         SectionNames.Add(item);
     }
 }
示例#4
0
        private void DoubleClick([NotNull] object sender, [NotNull] MouseButtonEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            var command = new EditItems();

            var context = GetContext();

            if (!command.CanExecute(context))
            {
                return;
            }

            AppHost.Usage.ReportCommand(command, context);
            command.Execute(context);
            e.Handled = true;
        }
示例#5
0
        private void UC_Sclad_Load(object sender, EventArgs e)
        {
            OleDbDataAdapter dataAdapter = new OleDbDataAdapter(db.selectSclad, db.connect);
            DataSet          ds          = new DataSet();

            dataAdapter.Fill(ds);
            DGVIEWBlydo.DataSource = ds.Tables[0].DefaultView;

            DGVIEWBlydo.Columns[0].Visible = false;
            if (DGVIEWBlydo.RowCount > 0)
            {
                EditItems.Clear();
                for (int i = 0; i < DGVIEWBlydo.ColumnCount; i++)
                {
                    EditItems.Add(DGVIEWBlydo.Rows[0].Cells[i].Value.ToString());
                }
            }
        }
示例#6
0
        private void UC_Blydo_Load(object sender, EventArgs e)
        {
            OleDbDataAdapter dataAdapter = new OleDbDataAdapter(db.selectBlydo, db.connect);
            DataSet          ds          = new DataSet();

            dataAdapter.Fill(ds);
            DGVIEWBlydo.DataSource = ds.Tables[0].DefaultView;

            //TRecept.Enabled = false;

            DGVIEWBlydo.Columns[0].Visible = false;
            if (DGVIEWBlydo.RowCount > 0)
            {
                EditItems.Clear();
                for (int i = 0; i < DGVIEWBlydo.ColumnCount; i++)
                {
                    EditItems.Add(DGVIEWBlydo.Rows[0].Cells[i].Value.ToString());
                }
            }
            DGSostav(Convert.ToInt32(EditItems[0]));

            getRecept(Convert.ToInt32(EditItems[0]));
        }
示例#7
0
        private void UC_Menu_Load(object sender, EventArgs e)
        {
            TBlydo.Items.Clear();
            OleDbDataAdapter dataAdapter = new OleDbDataAdapter(db.selectMenu, db.connect);
            DataSet          ds          = new DataSet();

            dataAdapter.Fill(ds);
            DGVIEWBlydo.DataSource = ds.Tables[0].DefaultView;

            string[] kategor = getProdict().Select(n => n.ToString()).ToArray();
            TBlydo.Items.AddRange(kategor);

            DGVIEWBlydo.Columns[0].Visible = false;

            if (DGVIEWBlydo.RowCount > 0)
            {
                EditItems.Clear();
                for (int i = 0; i < DGVIEWBlydo.ColumnCount; i++)
                {
                    EditItems.Add(DGVIEWBlydo.Rows[0].Cells[i].Value.ToString());
                }
            }
        }
示例#8
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="items"></param>
 /// <returns></returns>
 protected Task <bool> OnDeleteAsync(IEnumerable <BindItem> items)
 {
     items.ToList().ForEach(i => EditItems.Remove(i));
     return(Task.FromResult(true));
 }
        //Get A particular product items
        private EditItems GetItemsData(PurchaseOrderItemModel item)
        {
            EditItems record = new EditItems();

            record.OrderItems.autoCompleteProductStyleName = item.autoCompleteProductStyleName;
            record.OrderItems.StyleSKU = item.StyleSKU;

            record.OrderItems.autoCompleteProductName = item.autoCompleteProductName;
            record.OrderItems.ProductId = item.ProductId;

            record.OrderItems.autoCompleteGridName = item.autoCompleteGridName;
            record.OrderItems.SizeGridId           = item.SizeGridId;

            record.OrderItems.autoCompleteColorName = item.autoCompleteColorName;
            record.OrderItems.ColorId = item.ColorId;

            record.OrderItems.SuplierStyle = item.SuplierStyle;
            record.OrderItems.Amount       = item.Amount;

            record.OrderItems.PurchaseOrderId = item.PurchaseOrderId;
            record.OrderItems.ID = item.ID;

            if (item.ItemSize1 != null)
            {
                ItemsDetails data = new ItemsDetails();
                data.Size     = item.ItemSize1;
                data.Cost     = item.CostSize1 ?? 0;
                data.Quantity = item.QuantitySize1 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize2 != null)
            {
                ItemsDetails data = new ItemsDetails();
                data.Size     = item.ItemSize2;
                data.Cost     = item.CostSize2 ?? 0;
                data.Quantity = item.QuantitySize2 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize3 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize3;
                data.Cost     = item.CostSize3 ?? 0;
                data.Quantity = item.QuantitySize3 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize4 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize4;
                data.Cost     = item.CostSize4 ?? 0;
                data.Quantity = item.QuantitySize4 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize5 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize5;
                data.Cost     = item.CostSize5 ?? 0;
                data.Quantity = item.QuantitySize5 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize6 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize6;
                data.Cost     = item.CostSize6 ?? 0;
                data.Quantity = item.QuantitySize6 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize7 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize7;
                data.Cost     = item.CostSize7 ?? 0;
                data.Quantity = item.QuantitySize7 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize8 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize8;
                data.Cost     = item.CostSize8 ?? 0;
                data.Quantity = item.QuantitySize8 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize9 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize9;
                data.Cost     = item.CostSize9 ?? 0;
                data.Quantity = item.QuantitySize9 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize10 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize10;
                data.Cost     = item.CostSize10 ?? 0;
                data.Quantity = item.QuantitySize10 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize11 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize11;
                data.Cost     = item.CostSize11 ?? 0;
                data.Quantity = item.QuantitySize11 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize12 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize12;
                data.Cost     = item.CostSize12 ?? 0;
                data.Quantity = item.QuantitySize12 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize13 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize13;
                data.Cost     = item.CostSize13 ?? 0;
                data.Quantity = item.QuantitySize13 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize14 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize14;
                data.Cost     = item.CostSize14 ?? 0;
                data.Quantity = item.QuantitySize14 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize15 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize15;
                data.Cost     = item.CostSize15 ?? 0;
                data.Quantity = item.QuantitySize15 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize16 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize16;
                data.Cost     = item.CostSize16 ?? 0;
                data.Quantity = item.QuantitySize16 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize17 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize17;
                data.Cost     = item.CostSize17 ?? 0;
                data.Quantity = item.QuantitySize17 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize18 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize18;
                data.Cost     = item.CostSize18 ?? 0;
                data.Quantity = item.QuantitySize18 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize19 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize19;
                data.Cost     = item.CostSize19 ?? 0;
                data.Quantity = item.QuantitySize19 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize20 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize20;
                data.Cost     = item.CostSize20 ?? 0;
                data.Quantity = item.QuantitySize20 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize21 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize21;
                data.Cost     = item.CostSize21 ?? 0;
                data.Quantity = item.QuantitySize21 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize22 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize22;
                data.Cost     = item.CostSize22 ?? 0;
                data.Quantity = item.QuantitySize22 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize23 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize23;
                data.Cost     = item.CostSize23 ?? 0;
                data.Quantity = item.QuantitySize23 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize24 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize24;
                data.Cost     = item.CostSize24 ?? 0;
                data.Quantity = item.QuantitySize24 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize25 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize25;
                data.Cost     = item.CostSize25 ?? 0;
                data.Quantity = item.QuantitySize25 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize26 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize26;
                data.Cost     = item.CostSize26 ?? 0;
                data.Quantity = item.QuantitySize26 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize27 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize27;
                data.Cost     = item.CostSize27 ?? 0;
                data.Quantity = item.QuantitySize27 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize28 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize28;
                data.Cost     = item.CostSize28 ?? 0;
                data.Quantity = item.QuantitySize28 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize29 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize29;
                data.Cost     = item.CostSize29 ?? 0;
                data.Quantity = item.QuantitySize29 ?? 0;
                record.Details.Add(data);
            }
            if (item.ItemSize30 != null)
            {
                ItemsDetails data = new ItemsDetails();

                data.Size     = item.ItemSize30;
                data.Cost     = item.CostSize30 ?? 0;
                data.Quantity = item.QuantitySize30 ?? 0;
                record.Details.Add(data);
            }
            return(record);
        }
        //get item by item Id(Edit)
        public ActionResult EditItem(int id)
        {
            PurchaseOrderItemModel item = Services.PurchaseOrderItemsService.GetPurchaseOrderItemsById(id);

            if (item.ItemSize1.Contains(".0"))
            {
                item.ItemSize1 = item.ItemSize1.Replace(".0", "");
            }
            if (item.ItemSize2.Contains(".0"))
            {
                item.ItemSize2 = item.ItemSize2.Replace(".0", "");
            }
            if (item.ItemSize3.Contains(".0"))
            {
                item.ItemSize3 = item.ItemSize3.Replace(".0", "");
            }
            if (item.ItemSize4.Contains(".0"))
            {
                item.ItemSize4 = item.ItemSize4.Replace(".0", "");
            }
            if (item.ItemSize5.Contains(".0"))
            {
                item.ItemSize5 = item.ItemSize5.Replace(".0", "");
            }
            if (item.ItemSize6.Contains(".0"))
            {
                item.ItemSize6 = item.ItemSize6.Replace(".0", "");
            }
            if (item.ItemSize7.Contains(".0"))
            {
                item.ItemSize7 = item.ItemSize7.Replace(".0", "");
            }
            if (item.ItemSize8.Contains(".0"))
            {
                item.ItemSize8 = item.ItemSize8.Replace(".0", "");
            }
            if (item.ItemSize9.Contains(".0"))
            {
                item.ItemSize9 = item.ItemSize9.Replace(".0", "");
            }
            if (item.ItemSize10.Contains(".0"))
            {
                item.ItemSize10 = item.ItemSize10.Replace(".0", "");
            }
            if (item.ItemSize11.Contains(".0"))
            {
                item.ItemSize11 = item.ItemSize11.Replace(".0", "");
            }
            if (item.ItemSize12.Contains(".0"))
            {
                item.ItemSize12 = item.ItemSize12.Replace(".0", "");
            }
            if (item.ItemSize13.Contains(".0"))
            {
                item.ItemSize13 = item.ItemSize13.Replace(".0", "");
            }
            if (item.ItemSize14.Contains(".0"))
            {
                item.ItemSize14 = item.ItemSize14.Replace(".0", "");
            }
            if (item.ItemSize15.Contains(".0"))
            {
                item.ItemSize15 = item.ItemSize15.Replace(".0", "");
            }
            if (item.ItemSize16.Contains(".0"))
            {
                item.ItemSize16 = item.ItemSize16.Replace(".0", "");
            }
            if (item.ItemSize17.Contains(".0"))
            {
                item.ItemSize17 = item.ItemSize17.Replace(".0", "");
            }
            if (item.ItemSize18.Contains(".0"))
            {
                item.ItemSize18 = item.ItemSize18.Replace(".0", "");
            }
            if (item.ItemSize19.Contains(".0"))
            {
                item.ItemSize19 = item.ItemSize19.Replace(".0", "");
            }
            if (item.ItemSize20.Contains(".0"))
            {
                item.ItemSize20 = item.ItemSize20.Replace(".0", "");
            }
            if (item.ItemSize21.Contains(".0"))
            {
                item.ItemSize21 = item.ItemSize21.Replace(".0", "");
            }
            if (item.ItemSize22.Contains(".0"))
            {
                item.ItemSize22 = item.ItemSize22.Replace(".0", "");
            }
            if (item.ItemSize23.Contains(".0"))
            {
                item.ItemSize23 = item.ItemSize23.Replace(".0", "");
            }
            if (item.ItemSize24.Contains(".0"))
            {
                item.ItemSize24 = item.ItemSize24.Replace(".0", "");
            }
            if (item.ItemSize25.Contains(".0"))
            {
                item.ItemSize25 = item.ItemSize25.Replace(".0", "");
            }
            if (item.ItemSize26.Contains(".0"))
            {
                item.ItemSize26 = item.ItemSize26.Replace(".0", "");
            }
            if (item.ItemSize27.Contains(".0"))
            {
                item.ItemSize27 = item.ItemSize27.Replace(".0", "");
            }
            if (item.ItemSize28.Contains(".0"))
            {
                item.ItemSize28 = item.ItemSize28.Replace(".0", "");
            }
            if (item.ItemSize29.Contains(".0"))
            {
                item.ItemSize29 = item.ItemSize29.Replace(".0", "");
            }
            EditItems Data = new EditItems();

            if (item.PurchaseOrder.IsFinalize == true)
            {
                Data.IsFinalize = true;
            }
            else
            {
                Data            = GetItemsData(item);
                Data.ItemsCount = Data.Details.Count;
            }
            return(PartialView(Data));
        }