private void OnDeleteBackbound() { string boundID = masterView.GetFocusedRowCellValue("BackboundID").ToString(); if (string.IsNullOrEmpty(boundID)) { MsgBox.Error("请先选择要删除的退货单!"); return; } if (MsgBox.Confirm("您确定要完成选中的退货单?(删除后将恢复库存)") == false) { return; } if (CancelBackbound(boundID) == false) { MsgBox.Error("删除退货单失败!"); return; } masterView.DeleteRow(masterView.FocusedRowHandle); SwitchBackbound(); FrmTip.ShowTip("删除退货单成功!"); }
private void OnDelete() { string name = custView.GetFocusedRowCellValue("CustomerNo").ToString(); string tip = string.Format("您确定要删除选中的用户“{0}”", name); if (MsgBox.Confirm(tip) == false) { return; } string id = custView.GetFocusedRowCellValue("ID").ToString(); CustomerHelper ch = new CustomerHelper(); if (true == ch.DeleteCustomer(id)) { FrmTip.ShowTip("删除客户成功!"); DataTable dt = custGrid.DataSource as DataTable; //dt.Rows[custView.FocusedRowHandle].Delete(); custView.BeginUpdate(); //custView.DeleteRow(custView.FocusedRowHandle); dt.Rows.RemoveAt(custView.FocusedRowHandle); custView.EndUpdate(); } else { MsgBox.Error("删除客户失败!"); } }
private void DoEditRcvdRecord() { string aOld = rcvdView.GetRowCellValue(rcvdView.FocusedRowHandle, "RcvdAmount").ToString(); double fAmoutOld = 0.0; double.TryParse(aOld, out fAmoutOld); FrmRcvdEdit dlg = new FrmRcvdEdit(); dlg.RcvdGridView = rcvdView; if (DialogResult.OK != dlg.ShowDialog()) { return; } string aNew = rcvdView.GetRowCellValue(rcvdView.FocusedRowHandle, "RcvdAmount").ToString(); double fAmoutNew = 0.0; double.TryParse(aNew, out fAmoutNew); string decm = masterView.GetFocusedRowCellValue("DecmAmount").ToString(); double fDecm = 0.0; double.TryParse(decm, out fDecm); masterView.BeginUpdate(); masterView.SetRowCellValue(masterView.FocusedRowHandle, "DecmAmount", (fDecm - fAmoutOld + fAmoutNew).ToString("f2")); masterView.EndUpdate(); FrmTip.ShowTip("修改数据成功!"); }
private void DeleteRvcdAmount() { string recId = masterView.GetRowCellValue(masterView.FocusedRowHandle, colSerialNo).ToString(); string sql = string.Format("delete from T_RcvdRecord where RcvdRecdID = '{0}'", recId); int cnt = 0; cnt = rcvdView.RowCount; if (cnt > 0 && false == MsgBox.Confirm("该收款记录已经分到具体的出库单了,您确定要删除选中的收款记录吗?")) { return; } if (cnt == 0 && false == MsgBox.Confirm("您确定要删除选中的收款记录吗?")) { return; } Database.ExecuteSQL(sql, "FrmCashWindow, DeleteRvcdAmount"); sql = string.Format("delete from T_RcvdAmount where serialNo = '{0}'", recId); if (Database.ExecuteSQL(sql, "FrmCashWindow, DeleteRvcdAmount") <= 0) { MsgBox.Error("删除数据失败!"); return; } cashRecordView.ClearRows(); masterView.DeleteRow(masterView.FocusedRowHandle); FrmTip.ShowTip("删除数据成功!"); }
private void DeleteRcvdRecord() { string recId = rcvdView.GetRowCellValue(rcvdView.FocusedRowHandle, "RecordID").ToString(); string amount = rcvdView.GetRowCellValue(rcvdView.FocusedRowHandle, "RcvdAmount").ToString(); string sql = string.Format("delete from T_RcvdRecord where recordID = '{0}'", recId); if (false == MsgBox.Confirm("您确定要删除选中的收款记录吗?")) { return; } if (Database.ExecuteSQL(sql, "FrmCashBrower, DeleteRcvdRecord") <= 0) { MsgBox.Error("删除数据失败!"); return; } rcvdView.DeleteRow(rcvdView.FocusedRowHandle); string srcvd = "0", sbalance = "0"; Object obj = cashView.GetFocusedRowCellValue("RcvdAmount"); if (obj != null && string.IsNullOrEmpty(obj.ToString()) == false) { srcvd = obj.ToString(); } obj = cashView.GetFocusedRowCellValue("Balance"); if (obj != null && string.IsNullOrEmpty(obj.ToString()) == false) { sbalance = obj.ToString(); } double ftemp = Convert.ToDouble(amount); double frcvd = Convert.ToDouble(srcvd); double fbalance = Convert.ToDouble(sbalance); cashView.SetFocusedRowCellValue("RcvdAmount", (frcvd - ftemp).ToString("f2")); cashView.SetFocusedRowCellValue("Balance", (fbalance + ftemp).ToString("f2")); FrmTip.ShowTip("删除数据成功!"); }
private void mnuSyncOutbound_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; string sql = "UPDATE T_Outbound a, T_Customer b Set a.Sales = b.Sales where a.CustomerNo = b.CustomerNo"; Database.ExecuteSQL(sql); sql = "UPDATE T_Outbound a, T_Customer b Set a.SellTo = b.Company where a.CustomerNo = b.CustomerNo"; Database.ExecuteSQL(sql); sql = "UPDATE T_Outbound a, T_Customer b Set a.Address = b.Address where a.CustomerNo = b.CustomerNo"; Database.ExecuteSQL(sql); sql = "UPDATE T_Outbound a, T_Customer b Set a.ShipTo = b.ShipTo where a.CustomerNo = b.CustomerNo"; Database.ExecuteSQL(sql); Cursor.Current = Cursors.Default; FrmTip.ShowTip("同步出库表订单数据成功!"); }
private void DeleteRcvdRecord() { string boundId = rcvdView.GetRowCellValue(rcvdView.FocusedRowHandle, "OutboundID").ToString(); string recId = rcvdView.GetRowCellValue(rcvdView.FocusedRowHandle, "RecordID").ToString(); string amount = rcvdView.GetRowCellValue(rcvdView.FocusedRowHandle, "RcvdAmount").ToString(); double fAmout = 0.0; double.TryParse(amount, out fAmout); string sql = string.Format("delete from T_RcvdRecord where recordID = '{0}'", recId); if (false == MsgBox.Confirm("您确定要删除选中的收款记录吗?")) { return; } if (Database.ExecuteSQL(sql, "FrmCashWindow, DeleteRcvdRecord") <= 0) { MsgBox.Error("删除数据失败!"); return; } UpdateOutboundPayOff(boundId, ""); rcvdView.DeleteRow(rcvdView.FocusedRowHandle); string decm = masterView.GetFocusedRowCellValue("DecmAmount").ToString(); double fDecm = 0.0; double.TryParse(decm, out fDecm); masterView.BeginUpdate(); masterView.SetRowCellValue(masterView.FocusedRowHandle, "DecmAmount", (fDecm - fAmout).ToString("f2")); masterView.EndUpdate(); FrmTip.ShowTip("删除数据成功!"); }
private void mnuMasterDelete_Click(object sender, EventArgs e) { string inboundID = inboundView.GetFocusedRowCellValue("InboundID").ToString(); if (string.IsNullOrEmpty(inboundID)) { MsgBox.Error("请先选择要删除的入库单!"); return; } if (MsgBox.Confirm("您确定要完成选中的入库单?(删除后将恢复库存)") == false) { return; } Object obj = inboundView.GetFocusedRowCellValue("Status").ToString(); if (obj != null && obj.ToString() == DealStatus.PreInput) { //删除虚拟入库 MissionAssign missionAssign = new MissionAssign(); missionAssign.DeleteVirtualInbound(inboundID); } else if (CancelInbound(inboundID) == false) { //删除真实入库 MsgBox.Error("删除入库单失败!"); return; } inboundView.DeleteRow(inboundView.FocusedRowHandle); SwitchInbound(); FrmTip.ShowTip("删除入库单成功!"); }