private bool InsertInbound() { bool bres = false; string time = Database.GetDateTimeString(); string sql = String.Format("Insert into T_Inbound (InboundID, ProductNo,OrderDate, CreateTime, Operator, Status ) " + "Values('{0}','{1}','{2}','{3}','{4}','{5}' )", txtInboundNo.Text, txtProductNo.Text.Replace("'", "''"), dateOrder.DateTime.ToString("yyyy-MM-dd"), time, txtDealWorker.Text.Replace("'", "''"), DealStatus.PreInput); bres = Database.ExecuteSQL(sql, "FrmInbound-InsertInbound") == 1 ? true : false; if (bres) { newInbound = new InBound(); newInbound.InboundID = txtInboundNo.Text; newInbound.ProductNo = txtProductNo.Text.Replace("'", "''"); newInbound.Operator = txtDealWorker.Text.Replace("'", "''"); newInbound.CreateTime = time; newInbound.OrderDate = dateOrder.DateTime.ToString("yyyy-MM-dd"); newInbound.Status = DealStatus.PreInput; } return(bres); }
private void mnuMasterEditInbound_Click(object sender, EventArgs e) { string inboundID = inboundView.GetFocusedRowCellValue("InboundID").ToString(); string orderDate = inboundView.GetFocusedRowCellValue("OrderDate").ToString(); string productNo = inboundView.GetFocusedRowCellValue("ProductNo").ToString(); InBound inbound = new InBound(); inbound.InboundID = inboundID; inbound.ProductNo = productNo; inbound.OrderDate = orderDate; FrmEditInbound dlg = new FrmEditInbound(); dlg.InboundID = inboundID; dlg.InboundItem = inbound; if (DialogResult.Cancel == dlg.ShowDialog()) { return; } inboundView.SetFocusedRowCellValue("OrderDate", inbound.OrderDate); inboundView.SetFocusedRowCellValue("ProductNo", inbound.ProductNo); string sql = String.Format("update T_Inbound Set ProductNo = '{0}' , OrderDate = '{1}' Where inboundID = '{2}' ", inbound.ProductNo, inbound.OrderDate, inboundID); Database.ExecuteSQL(sql, "FrmInbound-mnuMasterEditInbound_Click"); }
public void InsertInbound(int pos, InBound inbound) { DataRow dr = dataTable.NewRow(); dr["InboundID"] = inbound.InboundID; dr["ProductNo"] = inbound.ProductNo; dr["OrderDate"] = inbound.OrderDate; dr["Operator"] = inbound.Operator; dr["Status"] = inbound.Status; dataTable.Rows.InsertAt(dr, pos); }
private void btnOK_Click(object sender, EventArgs e) { if (inbound == null) { inbound = new InBound(); } inbound.ProductNo = txtProductNo.Text.Trim(); inbound.OrderDate = dateOrder.DateTime.ToString("yyyy-MM-dd"); DialogResult = DialogResult.OK; this.Close(); }