void FillCbox() { try { CboxSearch.DataSource = Db.Search("SELECT HeTongBianHao FROM GongDan order by Id Desc").Tables[0]; CboxSearch.DisplayMember = "HeTongBianHao"; } catch { return; } }
private void button3_Click(object sender, EventArgs e) { if (DGrdWork.RowCount <= 0 || DGrdMaterial.RowCount <= 0) { MessageBox.Show("单据生成不完整,填充完整后单击 '生成单据'", "存入数据库失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (TxtContractNu.Text == "") { TxtContractNu.BackColor = Color.Red; MessageBox.Show("合同编号不能为空'", "存入数据库失败", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } DataSet Ds = new DataSet(); if ((Ds = Db.Search("SELECT * FROM GongDan where HeTongBianHao='" + TxtContractNu.Text + "'")) != null && Ds.Tables[0].Rows.Count > 0) { MessageBox.Show("该单号已存在!!"); return; } string temp = ""; if (GongDanSqlStr != "") { Db.DataProcess(GongDanSqlStr); temp += " 工单 "; } if (LiaoDanSqlStr != "") { Db.DataProcess(LiaoDanSqlStr); temp += " 料单 "; } if (CanShuDanSqlStr != "") { Db.DataProcess(CanShuDanSqlStr); temp += " 参数单 "; } MessageBox.Show(temp + "保存成功"); DGrdWork.Rows.Clear(); DGrdDemand.Rows.Clear(); DGrdMaterial.Rows.Clear(); GongDanSqlStr = ""; LiaoDanSqlStr = ""; CanShuDanSqlStr = ""; }
void FillGongDan() { DataSet Ds = new DataSet(); Ds = Db.Search("select * from GongDan where HeTongBianHao='" + HeTongBianHao + "'"); if (Ds.Tables[0].Rows.Count <= 0) { return; } int j = 0; int i = 0; AddGridRow(DgridGongDanMore, "标识名称", Ds.Tables[0].Rows[j][i++].ToString()); AddGridRow(DgridGongDanMore, "合同编号", Ds.Tables[0].Rows[j][i++].ToString(), " 日期", Ds.Tables[0].Rows[j][i++].ToString()); AddGridRow(DgridGongDanMore, "产品名称", Ds.Tables[0].Rows[j][i++].ToString(), " 定金", Ds.Tables[0].Rows[j][i++].ToString()); AddGridRow(DgridGongDanMore, "型号", Ds.Tables[0].Rows[j][i++].ToString(), " 金额", Ds.Tables[0].Rows[j][i++].ToString()); AddGridRow(DgridGongDanMore, "开向", Ds.Tables[0].Rows[j][i++].ToString(), " 颜色", Ds.Tables[0].Rows[j][i++].ToString()); AddGridRow(DgridGongDanMore, "客户地址", Ds.Tables[0].Rows[j][i++].ToString(), "联系人", Ds.Tables[0].Rows[j][i++].ToString()); AddGridRow(DgridGongDanMore, "客户电话", Ds.Tables[0].Rows[j][i++].ToString(), " 安装日期 : ", Ds.Tables[0].Rows[0][i++].ToString()); Ds.Dispose(); }