public SoView(int rfqId) { InitializeComponent(); this.rfqId = rfqId; soList = SoMgr.GetSoAccordingToRfqId(rfqId); this.Text = "List All SO info for RFQ:" + rfqId; }
public void SoSave() { if (false == CheckValues()) { return; } So so = GetValues(); if (!SoMgr.SaveSoMain(so)) { MessageBox.Show("Save Sale Order Error!"); return; } int soId = SoMgr.GetTheInsertId(so.salesId); foreach (SoItemsContentAndState sics in soItemsStateList) { sics.soitem.soId = soId; } SoMgr.UpdateSoItems(soItemsStateList); new AmbleClient.RfqGui.RfqManager.RfqMgr().ChangeRfqState(RfqStatesEnum.HasSO, rfqId); MessageBox.Show("Save Sale Order Successfully"); }
public SoView(int soId, int soItemId) { InitializeComponent(); soList = new List <So>(); soList.Add(SoMgr.GetSoAccordingToSoId(soId)); this.Text = "Info for SO:" + soId; this.selectedSoItemId = soItemId; }
private void tsbForceClose_Click(object sender, EventArgs e) { if (DialogResult.Yes == MessageBox.Show("Close SO and its all Items?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2)) { So so = soList[tabControl1.SelectedIndex]; SoMgr.WholeUpdateSoState(so.soId, UserInfo.UserId, SoStatesEnum.Closed); this.DialogResult = DialogResult.Yes; this.Close(); } }
private void tsbCancel_Click(object sender, EventArgs e) { if (DialogResult.Yes == MessageBox.Show("Cancel SO?", "", MessageBoxButtons.YesNo)) { So so = soList[tabControl1.SelectedIndex]; SoMgr.WholeUpdateSoState(so.soId, UserInfo.UserId, SoStatesEnum.Cancel); this.DialogResult = DialogResult.Yes; this.Close(); } }
private void btSplit_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { return; } int rowIndex = dataGridView1.SelectedRows[0].Index; int qty = soItemsStateList[rowIndex].soitem.qty; DateTime dockDate = soItemsStateList[rowIndex].soitem.dockDate; ItemSplit itemSplit = new ItemSplit(qty, dockDate); if (DialogResult.OK == itemSplit.ShowDialog()) { //get the first value; int firstValue = itemSplit.GetFirstQty(); soItemsStateList[rowIndex].soitem.qty = firstValue; soItemsStateList[rowIndex].soitem.dockDate = itemSplit.GetFirstDateTime(); if (soItemsStateList[rowIndex].state != OrderItemsState.New) { soItemsStateList[rowIndex].state = OrderItemsState.Modified; } //set the second one var soItemContentAndState = new SoItemsContentAndState(); soItemContentAndState.soitem = (SoItems)soItemsStateList[rowIndex].soitem.Clone(); soItemContentAndState.soitem.soId = this.soId; soItemContentAndState.soitem.qty = qty - firstValue; soItemContentAndState.soitem.dockDate = itemSplit.GetSecondDateTime(); if ((soItemContentAndState.soitem.soItemState != new SoItemNew().GetStateValue()) && (soItemContentAndState.soitem.soItemState != new SoItemRejected().GetStateValue()) && (soItemContentAndState.soitem.soItemState != new SoItemCancelled().GetStateValue()) ) { soItemContentAndState.soitem.soItemState = new SoItemApprove().GetStateValue(); } soItemContentAndState.state = OrderItemsState.New; soItemsStateList.Insert(rowIndex + 1, soItemContentAndState); if (!isNewCreateSo) { SoMgr.UpdateSoItems(soItemsStateList); GetSoItems(); } ShowDataInDataGridView(); this.HasItemChange = true; } }
private void GetSoItems() { this.soItemsStateList.Clear(); foreach (SoItems item in SoMgr.GetSoItemsAccordingToSoId(this.soId)) { this.soItemsStateList.Add( new SoItemsContentAndState { soitem = item, state = OrderItemsState.Normal } ); } }
public void SoUpdate() { if (false == CheckValues()) { return; } So so = GetValues(); if (!SoMgr.UpdateSoMain(so)) { MessageBox.Show("Update Sale Order Error!"); return; } MessageBox.Show("Update Sale Order Successfully"); }
private void tsbOp_Click(object sender, EventArgs e) { if (soItemsControl1.CheckValues() == false) { return; } if (!isNewCreateSo) { SoItems soItemForUpdate = soItemsControl1.GetSoItem(); soItemForUpdate.soId = soItem.soId; soItemForUpdate.soItemsId = soItem.soItemsId; soItemForUpdate.rfqId = soItem.rfqId; soItemForUpdate.soItemState = soItem.soItemState; SoMgr.UpdateSoItems(soItemForUpdate); } this.DialogResult = DialogResult.Yes; this.Close(); }
public void FillTheTable(So so) { this.soId = so.soId; tbCustomer.Text = so.customerName; tbContact.Text = so.contact; tbSalesOrder.Text = so.salesOrderNo; if (so.approverId != null) { tbApprover.Text = new AmbleClient.Admin.AccountMgr.AccountMgr().GetNameById(so.approverId.Value); } if (so.approveDate != null) { tbApproveDate.Text = so.approveDate.Value.ToShortDateString(); } dateTimePicker1.Value = so.orderDate; tbCustomerPo.Text = so.customerPo; tbPaymentTerm.Text = so.paymentTerm; tbFreightTerm.Text = so.freightTerm; tbCustomerAccount.Text = so.customerAccount; tbSpecialInstructions.Text = so.specialInstructions; tbBillto.Text = so.billTo; tbShipTo.Text = so.shipTo; //Fill the sales ID FillTheSalesComboBox(); cbSp.SelectedIndex = mySubs.IndexOf(so.salesId); foreach (SoItems item in SoMgr.GetSoItemsAccordingToSoId(so.soId)) { this.soItemsStateList.Add( new SoItemsContentAndState { soitem = item, state = OrderItemsState.Normal } ); } ShowDataInDataGridView(); }
private void btDelete_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count == 0) { return; } if (DialogResult.Yes == MessageBox.Show("Delete the selected SO item ?", "Warning", MessageBoxButtons.YesNo)) { int rowIndex = dataGridView1.SelectedRows[0].Index; if (isNewCreateSo) { soItemsStateList.RemoveAt(rowIndex); } else { SoMgr.DeleteSoItembySoItemId(soItemsStateList[rowIndex].soitem.soItemsId); GetSoItems(); } ShowDataInDataGridView(); this.HasItemChange = true; } }
private void btAdd_Click(object sender, EventArgs e) { NewAddItem nai = new NewAddItem(true); if (DialogResult.Yes == nai.ShowDialog()) { Rfq rfq = RfqGui.RfqManager.RfqMgr.GetRfqAccordingToRfqId(nai.rfqId); SoItems soItem = new SoItems(); soItem.currencyType = (int)AmbleClient.Currency.USD; soItem.unitPrice = rfq.targetPrice ?? 0; soItem.mfg = rfq.mfg; soItem.partNo = rfq.partNo; soItem.rohs = rfq.rohs; soItem.qty = rfq.qty ?? 0; soItem.intPartNo = rfq.custPartNo; soItem.dc = rfq.dc; soItem.dockDate = rfq.dockdate; soItem.rfqId = nai.rfqId; if (isNewCreateSo) { soItemsStateList.Add(new SoItemsContentAndState { soitem = soItem, state = OrderItemsState.New } ); } else { SoMgr.SaveSoItems(this.soId, soItem); GetSoItems(); } ShowDataInDataGridView(); this.HasItemChange = true; } }
public void SoUpdate() { if (false == CheckValues()) { return; } So so = GetValues(); if (!SoMgr.UpdateSoMain(so)) { MessageBox.Show("Update Sale Order Error!"); return; } SoMgr.UpdateSoItems(soItemsStateList); foreach (SoItemsContentAndState sics in deletedList) { SoMgr.DeleteSoItembySoItemId(sics.soitem.soItemsId); } MessageBox.Show("Update Sale Order Successfully"); }
public SoView(int rfqId) { InitializeComponent(); this.rfqId = rfqId; soList = SoMgr.GetSoAccordingToRfqId(rfqId); }