private InWeighingClass SetInValue() { InWeighingClass info = new InWeighingClass(); info.IId = CBName.SelectedValue == null ? "" : CBName.SelectedValue.ToString(); info.GrossWeight = textGrossWeight.Text; info.Tare = textTare.Text; info.Suttle = textSuttle.Text; //info.AsphaltumSuttle = textAsphaltum.Text; //info.Surveyor = lblSurveyor.Text; info.ViId = CBTruckNo.SelectedValue == null ? "" : CBTruckNo.SelectedValue.ToString(); info.SId1 = CBSite1.SelectedValue == null ? "" : CBSite1.SelectedValue.ToString(); info.SId2 = CBSite2.SelectedValue == null ? "" : CBSite2.SelectedValue.ToString(); //info.HydrousImpurityRate = textHSL.Text; info.InputDate = DateTime.Now.ToString(); info.BarCode = CBBarCode.Text; info.ComputationMark = "2"; //if (Check.CheckFloat(textHSL.Text)) // info.ComputationMark = "1"; //else // info.ComputationMark = "0"; info.Remark = CBRemark.Text; info.TgicId = CBTransportContract.SelectedValue == null ? "" : CBTransportContract.SelectedValue.ToString(); info.UnloadTime = label11.Text; info.PiId3 = CBPersonnelInfo.SelectedValue == null ? "" : CBPersonnelInfo.SelectedValue.ToString(); info.WiId = CBWarehouseInfo.SelectedValue == null ? "" : CBWarehouseInfo.SelectedValue.ToString(); info.BatchNumber = CBBatchNumber.Text; info.BatchNo = CBBatchNo.Text; return(info); }
private void 归档ToolStripMenuItem_Click(object sender, EventArgs e) { FrmRegressArchives form = new FrmRegressArchives(); switch (style) { case WeighingStyle.InStyle: InWeighingClass info1 = new InWeighingClass(); form.TruckNo = dataGridView1.SelectedRows[0].Cells["Column2"].Value.ToString(); form.GrossWeight = dataGridView1.SelectedRows[0].Cells["Column6"].Value.ToString(); form.Tare = dataGridView1.SelectedRows[0].Cells["Column7"].Value.ToString(); form.Suttle = dataGridView1.SelectedRows[0].Cells["Column8"].Value.ToString(); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { info1.Id = dataGridView1.SelectedRows[0].Cells["Column1"].Value.ToString(); info1.GrossWeight = form.GrossWeight; info1.Tare = form.Tare; info1.Suttle = form.Suttle; if (weighingLogic.UpdateIninfo(info1)) { MessageBox.Show("归档成功"); } DataTable dt1 = new DataTable(); dt1 = weighingLogic.FindWeighingInfo(style, ""); dataGridView1.DataSource = dt1; } break; case WeighingStyle.OutStyle: OutWeighingClass info2 = new OutWeighingClass(); form.TruckNo = dataGridView1.SelectedRows[0].Cells["Column2"].Value.ToString(); form.GrossWeight = dataGridView1.SelectedRows[0].Cells["Column6"].Value.ToString(); form.Tare = dataGridView1.SelectedRows[0].Cells["Column7"].Value.ToString(); form.Suttle = dataGridView1.SelectedRows[0].Cells["Column8"].Value.ToString(); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { info2.Id = dataGridView1.SelectedRows[0].Cells["Column1"].Value.ToString(); info2.GrossWeight = form.GrossWeight; info2.Tare = form.Tare; info2.Suttle = form.Suttle; if (weighingLogic.UpdateOutinfo(info2)) { MessageBox.Show("归档成功"); } DataTable dt2 = new DataTable(); dt2 = weighingLogic.FindWeighingInfo(style, ""); dataGridView1.DataSource = dt2; } break; default: ; break; } }
private void button2_Click(object sender, EventArgs e) { FrmCodingAdd frmCodingAdd = new FrmCodingAdd(); frmCodingAdd.ShowDialog(); CBBarCode.Text = frmCodingAdd.CodingNo; if (recordId != -1) { switch (style) { case WeighingStyle.InStyle: InWeighingClass info1 = new InWeighingClass(); InWeighingDBLayer dbLayer1 = new InWeighingDBLayer(); info1.Id = recordId.ToString(); info1.BarCode = frmCodingAdd.CodingNo; if (dbLayer1.UpdateInfo(info1)) { ClearValue(); CBTruckNo.SelectedIndex = -1; } else { MessageBox.Show("条码保存有问题!"); } break; case WeighingStyle.OutStyle: OutWeighingClass info2 = new OutWeighingClass(); OutWeighingDBLayer dbLayer2 = new OutWeighingDBLayer(); info2.Id = recordId.ToString(); info2.BarCode = frmCodingAdd.CodingNo; if (dbLayer2.UpdateInfo(info2)) { ClearValue(); CBTruckNo.SelectedIndex = -1; } else { MessageBox.Show("条码保存有问题!"); } break; default: break; } } }
public bool UpdateIninfo(InWeighingClass info) { InWeighingDBLayer dbLayer = new InWeighingDBLayer(); DataTable dt = new DataTable(); if (dbLayer.UpdateInfo(info)) { return(true); } else { return(false); } }
private void button3_Click(object sender, EventArgs e) { if (dataGridView1.SelectedRows.Count > 0) { if (MessageBox.Show("是否审批所选记录", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) { MetageFindClass findClass = new MetageFindClass(); InWeighingClass info = new InWeighingClass(); for (int i = 0; i < dataGridView1.SelectedRows.Count; i++) { info.Id = dataGridView1.SelectedRows[i].Cells["id"].Value.ToString(); info.CheckupMan = "审批人"; findClass.checkupInInfo(info); } MessageBox.Show("审批完成"); FindInfo(); } } }
/* * 方法名称:SaveInInfo * 方法功能描述:保存入厂称重信息 * 参数: info 信息内容光 * 返回: * 创建人:袁宇 * 创建时间:2009-03-06 * * 修改人: * 修改时间: * 修改内容: * */ public bool SaveInInfo(InWeighingClass info, out long recId) { InWeighingDBLayer dbLayer = new InWeighingDBLayer(); DataTable dt = new DataTable(); dt = dbLayer.SelectinWeighInfo(info.ViId); if ((!dt.Equals(null)) && (dt.Rows.Count > 0)) { //更新 info.Id = dt.Rows[0]["id"].ToString(); if (dbLayer.UpdateInfo(info)) { recId = Convert.ToInt64(info.Id); return(true); } else { recId = -1; return(false); } } else { //新增 if (dbLayer.InsertInfo(info)) { recId = dbLayer.GetMaxInRecId(); return(true); } else { recId = -1; return(false); } } }
private void SaveInfo() { if (MessageBox.Show("是否确定保存数据", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { string str = ""; switch (style) { case WeighingStyle.OutStyle: OutWeighingClass outInfo = new OutWeighingClass(); outInfo = SetOutValue(); str = IsFull(); if (str.Trim().Equals("")) { if (weighingLogic.SaveOutInfo(outInfo, out recordId)) { MessageBox.Show("保存成功", "提示"); if (Check.CheckFloat(lblSuttle.Text)) { button4.Enabled = true; } } else { MessageBox.Show("保存失败,请再次确认", "提示"); } } else { MessageBox.Show(str); } break; case WeighingStyle.InStyle: InWeighingClass inInfo = new InWeighingClass(); inInfo = SetInValue(); str = IsFull(); if (str.Trim().Equals("")) { if (weighingLogic.SaveInInfo(inInfo, out recordId)) { MessageBox.Show("保存成功", "提示"); if (Check.CheckFloat(lblSuttle.Text)) { button4.Enabled = true; } } else { MessageBox.Show("保存失败,请再次确认", "提示"); } } else { MessageBox.Show(str); } break; default: break; } } }
public bool checkupInInfo(InWeighingClass info) { InWeighingDBLayer dbLayer = new InWeighingDBLayer(); return(dbLayer.UpdateInfo(info)); }