예제 #1
0
        public static void UpdateVinRequestItem(VinRequestItem item)
        {
            using (StoreDataContext ctx = new StoreDataContext())
            {
                var old = _getRequestItem(ctx, item.Id).Single();

                old.Name = item.Name;
                old.ManagerComment = item.ManagerComment;
                old.Manufacturer = item.Manufacturer;
                old.PartNumber = item.PartNumber;
                old.PartNumberOriginal = item.PartNumberOriginal;
                old.DeliveryDays = item.DeliveryDays;
                old.PricePerUnit = item.PricePerUnit;
                old.Quantity = item.Quantity;

                ctx.SubmitChanges();
            }
        }
예제 #2
0
        protected void btnAddRequestClick(object sender, EventArgs e)
        {
            if (_gvLineItems.Rows.Count == 0)
            {
                _lblNoItems.Visible = true;
                ScrollToButtons();
                return;
            }

            if (_gvLineItems.EditIndex > -1)
            {
                _lblEditingItems.Visible = true;
                ScrollToButtons();
                return;
            }

            Page.Validate("CarEditGroup");

            if (Page.IsValid && SaveRequest != null)
            {
                var rq = _garageCarEdit.GetNewCarData<VinRequest>();
                this.LineItems.Each(item =>
                    {
                        VinRequestItem rqItem = new VinRequestItem();
                        rqItem.VinRequest = rq;
                        rqItem.Name = item.Name;
                        rqItem.Quantity = item.Qty;
                        rqItem.Description = item.Description;

                        rq.VinRequestItems.Add(rqItem);
                    });

                SaveRequest(this, new VinRequestEventArgs(rq));
            }
        }
예제 #3
0
 protected void _listViewItemUpdating(object sender, ListViewUpdateEventArgs e)
 {
     if (Page.IsValid)
     {
         var listItem = _listView.Items[e.ItemIndex];
         var priceText = (listItem.FindControl("_txtPricePerUnit") as TextBox).Text;
         var reqItem = new VinRequestItem
         {
             Id = Convert.ToInt32(_listView.DataKeys[e.ItemIndex].Value),
             Name = (listItem.FindControl("_txtName") as TextBox).Text,
             ManagerComment = (listItem.FindControl("_txtManagerComment") as TextBox).Text,
             Manufacturer = (listItem.FindControl("_txtManufacturer") as TextBox).Text,
             PartNumber = (listItem.FindControl("_txtPartNumber") as TextBox).Text,
             PartNumberOriginal = (listItem.FindControl("_txtPartNumberOriginal") as TextBox).Text,
             DeliveryDays = (listItem.FindControl("_txtDeliveryDays") as TextBox).Text,
             PricePerUnit = !String.IsNullOrEmpty(priceText) ?
                 Convert.ToDecimal(priceText) : (decimal?)null,
             Quantity = Convert.ToInt16((listItem.FindControl("_txtQuantity") as TextBox).Text)
         };
         _sSendBLock.Visible = true;
         VinRequestsDac.UpdateVinRequestItem(reqItem);
         _listView.EditIndex = -1;
     }
 }