public bool sendDeliveryOrder(DeliveryOrder order, string userCode) { IList <OrderDetail> orderDetailList = new List <OrderDetail>(); if (order != null && order.deliveryOrderItems != null && order.deliveryOrderItems.Length > 0) { foreach (DeliveryOrderItem item in order.deliveryOrderItems) { OrderDetail orderDetail = TheOrderDetailMgr.LoadOrderDetail(int.Parse(item.id)); orderDetail.CurrentShipQty = Convert.ToDecimal(item.deliveryQuantity); orderDetailList.Add(orderDetail); } TheOrderMgr.ShipOrder(orderDetailList, userCode); } return(true); }
protected void btnSave_Click(object sender, EventArgs e) { int currentLocTransId = -1; foreach (GridViewRow row in this.GV_List.Rows) { RadioButton rbSelect = (RadioButton)row.FindControl("rbSelect"); HiddenField hfRowIndex = (HiddenField)row.FindControl("hfRowIndex"); if (rbSelect.Checked) { currentLocTransId = int.Parse(hfRowIndex.Value); break; } } if (currentLocTransId == -1) { ShowErrorMessage("Common.Message.Record.Not.Select"); } else { OrderLocationTransaction currentLocationTrans = OrderLocTransList[currentLocTransId]; OrderLocationTransaction oldLocationTrans = TheOrderLocationTransactionMgr.LoadOrderLocationTransaction(this.LocTransId); OrderDetail orderDetail = TheOrderDetailMgr.LoadOrderDetail(oldLocationTrans.OrderDetail.Id, true); orderDetail.OrderHead = TheOrderHeadMgr.LoadOrderHead(orderDetail.OrderHead.OrderNo, true, true, true); oldLocationTrans.OrderDetail = orderDetail; try { TheOrderLocationTransactionMgr.ReplaceAbstractItem(oldLocationTrans, currentLocationTrans.BomDetail); if (SaveEvent != null) { SaveEvent(currentLocationTrans.OrderDetail.OrderHead.OrderNo, e); this.Visible = false; } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } } }
protected void lbtnAdd_Click(object sender, EventArgs e) { int rowIndex = ((GridViewRow)(((DataControlFieldCell)(((LinkButton)(sender)).Parent)).Parent)).RowIndex; GridViewRow row = this.GV_List.Rows[rowIndex]; RequiredFieldValidator rfvItem = (RequiredFieldValidator)(row.FindControl("rfvItem")); RequiredFieldValidator rfvLocation = (RequiredFieldValidator)(row.FindControl("rfvLocation")); if (!rfvItem.IsValid || !rfvLocation.IsValid) { return; } if (checkItemExists()) { ShowErrorMessage("MasterData.Order.OrderDetail.Item.Exists"); return; } OrderLocationTransaction orderLocTrans = new OrderLocationTransaction(); orderLocTrans.Operation = int.Parse(((TextBox)row.FindControl("tbOperation")).Text.Trim()); orderLocTrans.OrderDetail = TheOrderDetailMgr.LoadOrderDetail(int.Parse(((DropDownList)row.FindControl("tbKitItem")).SelectedValue)); orderLocTrans.UnitQty = decimal.Parse(((TextBox)row.FindControl("tbUnitQty")).Text.Trim()); Item item = TheItemMgr.LoadItem(((Controls_TextBox)row.FindControl("tbItem")).Text.Trim()); if (item != null) { orderLocTrans.Item = item; orderLocTrans.Uom = item.Uom; } orderLocTrans.OrderedQty = decimal.Parse(((TextBox)row.FindControl("tbOrderdQty")).Text.Trim()); if (orderLocTrans.OrderedQty == 0) { orderLocTrans.OrderedQty = orderLocTrans.UnitQty * orderLocTrans.OrderDetail.OrderedQty; } if (!this.IsReuse && this.IsScrap) { orderLocTrans.Location = orderLocTrans.OrderDetail.DefaultLocationFrom; } else { Controls_TextBox tbLocation = (Controls_TextBox)row.FindControl("tbLocation"); if (tbLocation.Text.Trim() != string.Empty) { orderLocTrans.Location = TheLocationMgr.LoadLocation(tbLocation.Text.Trim()); } } orderLocTrans.NeedPrint = ((CheckBox)row.FindControl("cbNeedPrint")).Checked; orderLocTrans.IsAssemble = true; orderLocTrans.IOType = this.IOType; orderLocTrans.IsBlank = false; orderLocTrans.TransactionType = BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO; try { TheOrderMgr.AddOrderLocationTransaction(orderLocTrans, this.CurrentUser); ShowSuccessMessage("MasterData.Order.LocTrans.Add.Successfully"); UpdateRoutingEvent(this.OrderNo, e); UpdateView(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }