private OtherweighingClass GetValue() { OtherweighingClass info = new OtherweighingClass(); info.Name = CBName.Text; info.Model = CBModel.Text; info.No = CBTruckNo.Text; info.Client = CBClientName.Text; info.Date = dtpDate.Value.ToString(); info.Money = CBExpenditure.Text; info.PiId = CBWeighMan.SelectedValue == null ? "" : CBWeighMan.SelectedValue.ToString(); info.GrossWeight = CBGrossWeight.Text; info.Tare = CBTare.Text; info.Suttle = CBSuttle.Text; return(info); }
private void button1_Click(object sender, EventArgs e) { if (MessageBox.Show("是否确定保存数据", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes) { string temp = isFull(); if (temp.Trim().Equals("")) { OtherweighingClass info = GetValue(); if (logic.saveData(info)) { MessageBox.Show("保存成功"); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("保存失败"); } } else { MessageBox.Show(temp); } } }
public bool saveData(OtherweighingClass info) { return(dbLayer.InsertThirdPartyWeight(info)); }