/// <summary> /// 添加店面信息表StoreInfo /// </summary> /// <param name="dt"></param> /// <returns></returns> public int InsertStoreInfo(DataTable dt) { int rows = 0; AccessHelper ah = new AccessHelper(); try { foreach (DataRow dr in dt.Rows) { if (SelectStoreInfoByStoreName(dr["StoreName"].ToString()).Rows.Count == 0) { OleDbDataAdapter adapt = new OleDbDataAdapter("select * from StoreInfo", ah.Conn); var cmd = new OleDbCommand("insert into StoreInfo (StoreName,Address,Contact,Tel) values(@StoreName,@Address,@Contact,@Tel) ", ah.Conn); cmd.Parameters.Add("@StoreName", OleDbType.VarChar, 20, "StoreName"); cmd.Parameters.Add("@Address", OleDbType.VarChar, 40, "Address"); cmd.Parameters.Add("@Contact", OleDbType.VarChar, 20, "Contact"); cmd.Parameters.Add("@Tel", OleDbType.VarChar, 20, "Tel"); adapt.InsertCommand = cmd; rows += adapt.Update(dt); } } } catch (Exception ex) { //throw ex; ah.Close(); return(0); } ah.Close(); return(rows); }
public int UpdateEmployeeID(DataTable dt) { int rows = 0; AccessHelper ah = new AccessHelper(); try { string resetSql = string.Format("Update Users Set [IsAble]=0 Where [UID]<>'Administrator'"); OleDbCommand comm1 = new OleDbCommand(resetSql, ah.Conn); rows += comm1.ExecuteNonQuery(); foreach (DataRow dr in dt.Rows) { string sql = string.Format("Update Users Set [IsAble] =1 Where [ID]={0}", dr["ID"]); OleDbCommand comm = new OleDbCommand(sql, ah.Conn); rows += comm.ExecuteNonQuery(); } } catch (Exception ex) { //throw ex; ah.Close(); return(0); } ah.Close(); return(rows); }
/// <summary> /// 收货店面确认 /// </summary> /// <param name="CtrlID">控制号</param> /// <returns></returns> public int ReceiptConfirm(string CtrlID, string check, Users user, int ReceiptState) { int rows = 0; AccessHelper ah = new AccessHelper(); string sql; if (ReceiptState == 2 || ReceiptState == 3) { sql = string.Format("Update ApplicationInfo Set ReceiptState = {4} ,ReceiptCheck='{1}' , ReceiptChecker='{2}' , ReceiptCheckerName='{3}' , AppState=3 where ReceiptState = 0 and DeliverState = 1 and ApprovalState2 = 1 and ApprovalState = 1 and AppState =3 and IsDelete = 0 and CtrlID='{0}'", CtrlID, check, user.UID, user.UserName, ReceiptState); } else { sql = string.Format("Update ApplicationInfo Set ReceiptState = {4} ,ReceiptCheck='{1}' , ReceiptChecker='{2}' , ReceiptCheckerName='{3}' , AppState=4 where ReceiptState = 0 and DeliverState = 1 and ApprovalState2 = 1 and ApprovalState = 1 and AppState =3 and IsDelete = 0 and CtrlID='{0}'", CtrlID, check, user.UID, user.UserName, ReceiptState); } try { OleDbCommand comm = new OleDbCommand(sql, ah.Conn); rows = comm.ExecuteNonQuery(); } catch (Exception ex) { //throw ex; ah.Close(); return(0); } ah.Close(); return(rows); }
/// <summary> /// 计算已用额度 /// </summary> /// <param name="CtrlID">控制号</param> /// <returns></returns> public bool CanBuy(string TransNo, string check, string UID, double TotalPrice) { AccessHelper ah = new AccessHelper(); try { string sql; string sqlString = string.Format("select * from Users where IsDelete = 0 and UID='{0}'", UID); DataTable Result = ah.SelectToDataTable(sqlString); if (Result.Rows.Count > 0) { double RestMoney = double.Parse(Result.Rows[0]["RestAmount"].ToString()); RestMoney = RestMoney - TotalPrice; if (RestMoney > 0) { return(true); } } } catch (Exception ex) { ah.Close(); return(false); } ah.Close(); return(false); }
public int UpdateReceiptDetail(DataTable dt) { int rows = 0; AccessHelper ah = new AccessHelper(); //AccessHelper ahstr = new AccessHelper(); try { //OleDbDataAdapter adapt = new OleDbDataAdapter("select * from ReceiptDetail", ah.Conn); //OleDbCommandBuilder odcb = new OleDbCommandBuilder(adapt); //odcb.QuotePrefix = "["; //odcb.QuoteSuffix = "]"; //rows += adapt.Update(dt); DeleteReceiptDetail(dt); InsertReceiptDetail(dt); } catch (Exception ex) { //throw ex; ah.Close(); return(0); } ah.Close(); return(rows); }
/// <summary> /// 财务部审批 /// </summary> /// <param name="CtrlID">控制号</param> /// <returns></returns> public int ApprovalApplication2(string CtrlID, Users users, int ApprovalState, DateTime dt) { int rows = 0; AccessHelper ah = new AccessHelper(); string sql; if (ApprovalState == 2) { sql = string.Format("Update ApplicationInfo Set ApprovalDate2='{5}', ApprovalState2 = {4} ,AppState=1 , Approval2='{1}' , ApprovalName2='{2}' , ApprovalPos2='{3}' where ApprovalState = 1 and ApprovalState2 = 0 and AppState =1 and IsDelete = 0 and CtrlID='{0}'", CtrlID, users.UID, users.UserName, users.Position, ApprovalState, dt); } else { sql = string.Format("Update ApplicationInfo Set ApprovalDate2='{5}', ApprovalState2 = {4} ,AppState=2 , Approval2='{1}' , ApprovalName2='{2}' , ApprovalPos2='{3}' where ApprovalState = 1 and ApprovalState2 = 0 and AppState =1 and IsDelete = 0 and CtrlID='{0}'", CtrlID, users.UID, users.UserName, users.Position, ApprovalState, dt); } try { OleDbCommand comm = new OleDbCommand(sql, ah.Conn); rows = comm.ExecuteNonQuery(); } catch (Exception ex) { //throw ex; ah.Close(); return(0); } ah.Close(); return(rows); }
private void toolStripButton6_Click(object sender, EventArgs e) { bool connSuccess = false; try { AccessHelper ah = new AccessHelper(); ah.Close(); connSuccess = true; } catch { MessageBox.Show("远程缓存同步失败", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); connSuccess = false; } if (connSuccess) { try { SqlQueue sq = new SqlQueue(); sq.QuickExecuteSqlQuery(); sq.Close(); //MessageBox.Show("远程缓存同步完成,远程服务器每小时轮询处理一次,在此期间,您无法查看到新处理的结果,请勿重复操作!", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("远程缓存同步完成", "消息", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { } } }
/// <summary> /// 收货店面查询ApplicationInfo /// </summary> /// <param name="Store"></param> /// <returns></returns> public DataTable SelectApplicationByReceipt(string[] Store, string sql) { DataTable Result = null; Boolean boolFlag = false; for (int i = 0; i < Store.Length; i++) { if (Store[i].ToString() != null && Store[i].ToString() != "") { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where IsDelete = 0 and AppState=3 and ApprovalState =1 and ApprovalState2 = 1 and DeliverState = 1 and ReceiptState = 0 and ReceiptStore = '{0}' {1} order by [ApplicantsDate] desc", Store[i].ToString(), sql); DataTable tempResult = ah.SelectToDataTable(sqlString); if (boolFlag == false) { Result = tempResult; boolFlag = true; } else { foreach (DataRow dr in tempResult.Rows) { Result.Rows.Add(dr.ItemArray); } } ah.Close(); } } return(Result); }
private void tbSave_Click(object sender, EventArgs e) { //检查数据格式 if (CheckMsg()) { AccessHelper ah = new AccessHelper(); string sql = string.Empty; if (XZQHID == 0)//新增 { sql = "insert into QuHua(行政区编码,行政区名称,父级编码) values('" + tbQHBM.Text.Trim() + "',"; sql += "'" + tbQHMC.Text.Trim() + "','" + FJQHBM + "')"; } else { sql = "update QuHua set 行政区编码='" + tbQHBM.Text.Trim() + "',行政区名称='" + tbQHMC.Text.Trim() + "',父级编码='" + FJQHBM + "' where ID=" + XZQHID; } if (ah.ExecuteSQLNonquery(sql)) { this.DialogResult = DialogResult.OK; string OtherSql = "update QuHua set 父级编码='" + tbQHBM.Text.Trim() + "' where 父级编码='" + oldQHBM + "'"; ah.ExecuteSQLNonquery(OtherSql); MessageBox.Show("保存成功"); this.Close(); } else { MessageBox.Show("保存失败"); } ah.Close(); } FJQHBM = string.Empty; }
/// <summary> /// 保存编辑的目录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { AccessHelper ah = new AccessHelper(); string sql = string.Empty; if (CheckMsg()) { if (MLID == 0)//新增 { if (ExistSameMuLu(tbCGML.Text.Trim())) { MessageBox.Show("包含相同目录的记录,请检查后录入"); return; } sql = "insert into Mulu(目录名称,检查级别) values('" + tbCGML.Text.Trim() + "',"; sql += "'" + "省级质检" + "')";//后期修改 } else//修改 { sql = "update Mulu set 目录名称='" + tbCGML.Text.Trim() + "',"; sql += "检查级别='" + "省级质检" + "' where ID=" + MLID;//后期修改 } if (ah.ExecuteSQLNonquery(sql)) { this.DialogResult = DialogResult.OK; MessageBox.Show("保存成功"); this.Close(); } else { MessageBox.Show("保存失败"); } ah.Close(); } }
public void QuickInsertUser(DataTable dt) { AccessHelper ah = new AccessHelper(); try { string strSQL = "select * from Users"; DataTable dtSQl = ah.SelectToDataTable(strSQL); foreach (DataRow dr in dt.Rows) { DataRow[] drSelect = dtSQl.Select("UID='" + dr["UID"].ToString() + "'"); if (drSelect.Length < 1) { DataRow drNew = dtSQl.NewRow(); drNew["UID"] = dr["UID"]; drNew["UserName"] = dr["UserName"]; drNew["UserPwd"] = dr["UserPwd"]; drNew["EmployeeID"] = dr["EmployeeID"]; drNew["Character"] = dr["Character"]; drNew["ManagerID"] = dr["ManagerID"]; drNew["MoneyUnit"] = dr["MoneyUnit"]; drNew["Store"] = dr["Store"]; drNew["Position"] = dr["Position"]; drNew["Department"] = dr["Department"]; drNew["Email"] = dr["Email"]; drNew["Detail"] = dr["Detail"]; drNew["RestAmount"] = dr["RestAmount"]; drNew["EmpDate"] = dr["EmpDate"]; drNew["IsAdmin"] = 0; drNew["IsDelete"] = 0; drNew["TotalAmount"] = 0; drNew["UsedAmount"] = 0; drNew["IsAble"] = 0; dtSQl.Rows.Add(drNew); } } ah.Close(); QuickImportUsers(dtSQl); } catch (Exception ex) { //throw ex; ah.Close(); } ah.Close(); }
/// <summary> /// 物流已确认查询ApplicationInfo /// </summary> /// <param name="Store"></param> /// <returns></returns> public DataTable SelectApplication(string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select a.DeliverStore as 发货店铺,ReceiptStore as 收货店铺,a.receiptdate as 收货日期,b.ctrlid as 控制号,b.department as 部门,b.app_level as 级别,b.itemid as 货号,b.itemid2 as 双货号,a.S_O,a.S_O_Str,a.O_O,a.O_O_Str,a.Batch_Num1,a.Batch_Num2,b.price as 单价,b.app_count as 数量,b.ItemHighlight from applicationinfo a inner join ReceiptDetail b on a.ctrlid=b.ctrlid where a.AppState>4 and b.isdelete=0 {0} order by a.receiptdate,b.ctrlid,b.department,b.app_level,b.itemid,b.itemid2,b.price,b.app_count", sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 财务部查询ApplicationInfo /// </summary> /// <returns></returns> public DataTable SelectApplicationByApproval2(string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where IsDelete = 0 and AppState=1 and ApprovalState =1 and ApprovalState2 = 0 and DeliverState = 0 and ReceiptState = 0 {0} order by [ApplicantsDate] desc", sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
public DataTable SelectAllDetail(string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select a.CtrlID,b.ItemID,b.ItemID2,a.DeliverStore,a.ReceiptStore,a.ApplicantsDate,a.ApplicantsName,a.TotalPrice,a.AppState,a.IsDelete from ApplicationInfo a left join ApplicationDetail b on a.CtrlID=b.CtrlID where a.IsDelete=0 and b.IsDelete=0 {0} order by [ApplicantsDate] desc", sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 商品部查询未通过ApplicationInfo /// </summary> /// <returns></returns> public DataTable SelectNotPassedApplication(string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where IsDelete = 0 and AppState<9 and ( ApprovalState=2 or ApprovalState2=2 or DeliverState=2 or ReceiptState=3) {0} order by [ApplicantsDate] desc", sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 根据控制ID查询订单ApplicationInfo表 /// </summary> /// <param name="Applicants">申请人ID</param> /// <returns>Application表</returns> public DataTable SelectApplicationByCtrlID(string CtrlID) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where IsDelete = 0 and CtrlID = '{0}' order by [ApplicantsDate] desc ", CtrlID); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 查询全部ApplicationInfo /// </summary> /// <returns></returns> public DataTable SelectAllApplicationInfo(string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo order by [ApplicantsDate] desc", sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 获取发货后超时提醒 /// </summary> /// <param name="UID"></param> /// <returns></returns> public DataTable SelectAlertDeliver(string DeliverStore) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where [IsDelete]=0 and [Alert_Deliver]=0 and [DeliverStore]='{0}' and [AppState]>=3 and [AppState]<4 and [DeliverDate]<#{1}# ", DeliverStore, DateTime.Now.AddHours(-72)); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
public DataTable SelectAllItem(string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from Items where IsDelete=0 {0}", sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 根据店名查询店面信息StoreInfo /// </summary> /// <param name="CtrlID"></param> /// <returns></returns> public DataTable SelectStoreInfoByStoreName(string StoreName) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from StoreInfo where IsDelete = 0 and StoreName='{0}'", StoreName); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 确认店面查询报表 /// </summary> /// <param name="Store"></param> /// <returns></returns> public DataTable SelectHisApplicationByStore1(string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select ApplicationInfo.TransNo,ApplicationInfo.ApplicantsDate,ApplicationInfo.ApplicantsName,ApplicationDetail.ItemID,ApplicationDetail.ApprovalCount,ApplicationDetail.FinalPrice,ApplicationDetail.MoneyUnit from ApplicationDetail left join ApplicationInfo on ApplicationDetail.TransNo=ApplicationInfo.TransNo where ApplicationInfo.AppState=9 and ApplicationInfo.IsDelete=0 {0}", sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 获取申请批准后超时提醒 /// </summary> /// <param name="UID"></param> /// <returns></returns> public DataTable SelectAlertApproval() { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where [IsDelete]=0 and [AppState]<2 and [ApplicantsDate]<#{1}# ", DateTime.Now.AddHours(-72)); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 查询历史订单ApplicationInfo表 /// </summary> /// <returns>Application表</returns> public DataTable SelectHistoryApplication(string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where IsDelete = 0 and AppState = 9 {0} order by [ApplicantsDate] desc", sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 经理查询已审核ApplicationInfo /// </summary> /// <returns></returns> public DataTable SelectHistoryApplicationByApproval2(string sql, Users users) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where IsDelete = 0 and AppState>0 and Approval2='{1}' {0} order by [ApplicantsDate] desc", sql, users.UID); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 确认店面根据唯一码查询ApplicationInfo /// </summary> /// <param name="Store"></param> /// <returns></returns> public DataTable SelectApplicationByStoreStaff(string Uncode, string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where IsDelete = 0 and AppState>3 and Uncode= '{0}' {1}", Uncode, sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 根据申请人ID查询生成唯一码后的ApplicationInfo表 /// </summary> /// <param name="Applicants">申请人ID</param> /// <returns>Application表</returns> public DataTable SelectPassedApplicationByApplicants(string Applicants, string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where IsDelete = 0 and AppState>3 and AppState<9 and Applicants = '{0}' {1} order by [ApplicantsDate] desc", Applicants, sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 根据TransNo查询订单ApplicationInfo表 /// </summary> /// <param name="Applicants">申请人ID</param> /// <returns>Application表</returns> public DataTable SelectApplicationByTransNo(string TransNo) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationInfo where IsDelete = 0 and TransNo = '{0}'", TransNo); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
public DataTable SelectAllStoreInfo(string strSQL) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from StoreInfo where IsDelete = 0 {0} ", strSQL); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 通过货号查询Item表 /// </summary> /// <param name="ItemID"></param> /// <returns></returns> public DataTable SelectItemByItemID(string ItemID) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from Items where ItemID='{0}' ", ItemID); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
/// <summary> /// 报表 /// </summary> /// <param name="sql"></param> /// <returns></returns> public DataTable SelectAppReport(string sql) { AccessHelper ah = new AccessHelper(); string sqlString = string.Format("select * from ApplicationDetail left join ApplicationInfo on ApplicationDetail.CtrlID=ApplicationInfo.CtrlID where ApplicationInfo.AppState=9 and ApplicationInfo.IsDelete=0 {0}", sql); DataTable Result = ah.SelectToDataTable(sqlString); ah.Close(); return(Result); }
private void btnSave_Click(object sender, EventArgs e) { if(CheckMsg()) { AccessHelper ah = new AccessHelper(); string sql = string.Empty; //新增 if(CGWJID==0) { if (!ExistSameWenJian(cbAction.Text.Trim(), tbEnd.Text.Trim())) { sql = "insert into WenJian(文件开始字符,文件结束字符,文件扩展名,文件类型,是否必填) values("; sql += "'" + cbAction.SelectedText + "',"; sql += "'" + tbEnd.Text.Trim() + "',"; sql += "'" + lbWJKZM.Text + "',"; sql += "'" + tbType.Text.Trim() + "',"; sql += "" + (rbYes.Checked ? 1 : 0) + ")"; } else { MessageBox.Show("包含相同开始字符和结束字符的数据"); return; } } else//修改 { sql = "update WenJian set 文件开始字符='" + cbAction.Text + "',"; sql += "文件结束字符='" + tbEnd.Text.Trim() + "',"; sql += "文件扩展名='" + lbWJKZM.Text + "',"; sql += "文件类型='" + tbType.Text.Trim() + "',"; sql += "是否必填=" + (rbYes.Checked ? 1 : 0) + " where ID="+CGWJID; } if (ah.ExecuteSQLNonquery(sql)) { this.DialogResult = DialogResult.OK; MessageBox.Show("保存成功"); this.Close(); } else { MessageBox.Show("保存失败"); } ah.Close(); } }
/// <summary> /// 根据字典类型编码获取字典名称 /// </summary> /// <param name="code">字典类型编码</param> /// <returns>字典名称</returns> public string GetZiDianName(string code) { if (ComMsg.ziDian.ContainsKey(code)) { return ComMsg.ziDian[code]; } else { AccessHelper ah = new AccessHelper(); DataTable dt = ah.SelectToDataTable("select 类型名称 from ZiDian where 类型编码='" + code + "'"); ah.Close(); if (dt != null && dt.Rows.Count > 0) { ComMsg.ziDian.Add(code, dt.Rows[0]["类型名称"].ToString()); return dt.Rows[0]["类型名称"].ToString(); } } return ""; }
/// <summary> /// 删除规则配置项 /// </summary> private void btnDel_Click(object sender, EventArgs e) { MessageBoxButtons messButton = MessageBoxButtons.OKCancel; DialogResult dr = MessageBox.Show("确定要删除吗?", "删除选定数据", messButton); if (dr == DialogResult.OK)//如果点击“确定”按钮 { AccessHelper ah = new AccessHelper(); string sql = "delete from GuiZe where ID=" + dataGridView1.SelectedRows[0].Cells[0].Value + ""; if (ah.ExecuteSQLNonquery(sql)) { MessageBox.Show("删除成功"); this.guiZeTableAdapter.Fill(this.settingDataSet3.GuiZe); } else { MessageBox.Show("删除失败"); } ah.Close(); } }
/// <summary> /// 保存编辑的目录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { AccessHelper ah = new AccessHelper(); string sql = string.Empty; if (CheckMsg()) { if(MLID==0)//新增 { if(ExistSameMuLu(tbCGML.Text.Trim())) { MessageBox.Show("包含相同目录的记录,请检查后录入"); return; } sql = "insert into Mulu(目录名称,检查级别) values('"+tbCGML.Text.Trim()+"',"; sql+="'"+"省级质检"+"')";//后期修改 } else//修改 { sql = "update Mulu set 目录名称='"+tbCGML.Text.Trim()+"',"; sql+="检查级别='"+"省级质检"+"' where ID=" + MLID;//后期修改 } if(ah.ExecuteSQLNonquery(sql)) { this.DialogResult = DialogResult.OK; MessageBox.Show("保存成功"); this.Close(); } else { MessageBox.Show("保存失败"); } ah.Close(); } }
/// <summary> /// 保存编辑的数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if(CheckMsg()) { //access帮助类 AccessHelper ah = new AccessHelper(); string sql = string.Empty;//sql语句 if (!ExistGZ(GetDJLXType(cbDJLX.Text.Trim()), cbGZLX.Text.Trim(), tbGZBH.Text.Trim(), tbGZZBH.Text.Trim())) { sql = "insert into GuiZe(登记类型,规则类型,规则编号,规则子编号,规则名称,错误描述,严重程度,校验类型,表达式,表名,字段名,是否检查) values("; sql += "'" + GetDJLXType(cbDJLX.Text.Trim()) + "',"; sql += "'" + cbGZLX.Text.Trim() + "',"; sql += "'" + tbGZBH.Text.Trim() + "',"; sql += "" + tbGZZBH.Text.Trim() + ","; sql += "'" + tbGZMC.Text.Trim() + "',"; sql += "'" + tbCWMS.Text.Trim() + "',"; sql += "'" + (rbZQX.Checked ? "重缺陷" : "轻缺陷") + "',"; sql += "'" + cbXYLX.Text.Trim() + "',"; sql += "'" + tbBDS.Text.Trim() + "',"; sql += "'" + tbBM.Text.Trim() + "',"; sql += "'" + tbZDM.Text.Trim() + "',"; sql += "'" + (rbCheck.Checked ? 1 : 0) + "')"; } else { sql = "update GuiZe set 登记类型='" + GetDJLXType(cbDJLX.Text.Trim()) + "',"; sql += "规则类型='" + cbGZLX.Text.Trim() + "',规则编号='" + tbGZBH.Text.Trim() + "',"; sql += "规则子编号='" + tbGZZBH.Text.Trim() + "',规则名称='"+tbGZMC.Text.Trim()+"'"; sql += ",错误描述='" + tbCWMS.Text.Trim() + "',严重程度='" + (rbZQX.Checked ? "重缺陷" : "轻缺陷") + "',"; sql += "校验类型='" + cbXYLX.Text.Trim() + "',表达式='" + tbBDS.Text.Trim() + "',"; sql+="表名='"+tbBM.Text.Trim()+"',字段名='"+tbZDM.Text.Trim()+"',"; sql += "是否检查=" + (rbCheck.Checked ? 1 : 0) + " where ID="+GZID; } if (ah.ExecuteSQLNonquery(sql)) { this.DialogResult = DialogResult.OK; MessageBox.Show("保存成功"); this.Close(); } else { MessageBox.Show("保存失败"); } ah.Close(); } }
private void tbSave_Click(object sender, EventArgs e) { //检查数据格式 if(CheckMsg()) { AccessHelper ah = new AccessHelper(); string sql = string.Empty; if(XZQHID==0)//新增 { sql = "insert into QuHua(行政区编码,行政区名称,父级编码) values('"+tbQHBM.Text.Trim()+"',"; sql+="'"+tbQHMC.Text.Trim()+"','"+FJQHBM+"')"; } else { sql = "update QuHua set 行政区编码='"+tbQHBM.Text.Trim()+"',行政区名称='"+tbQHMC.Text.Trim()+"',父级编码='"+FJQHBM+"' where ID="+XZQHID; } if(ah.ExecuteSQLNonquery(sql)) { this.DialogResult = DialogResult.OK; string OtherSql = "update QuHua set 父级编码='" + tbQHBM.Text.Trim() + "' where 父级编码='"+oldQHBM+"'"; ah.ExecuteSQLNonquery(OtherSql); MessageBox.Show("保存成功"); this.Close(); } else { MessageBox.Show("保存失败"); } ah.Close(); } FJQHBM = string.Empty; }
/// <summary> /// 新增/修改指标表配置项 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { if(CheckMsg()) { AccessHelper ah = new AccessHelper(); string sql = string.Empty; if (IntZhiBiaoId == 0)//新增 { if (!ExistZhiBiaoByTableAndRow(tbTableName.Text.Trim(),tbColName.Text.Trim())) { MessageBox.Show("存在相同表名和列名数据!"); return; } sql = "insert into ZhiBiao(表名,列名,列描述,数据类型编码,数据类型,数据长度,数据精度) values('" + tbTableName.Text.Trim() + "',"; sql += "'" + tbColName.Text.Trim() + "',"; sql += "'" + tbColRemark.Text.Trim() + "'," + GetDataType(cbType.Text) + ",'"; sql += "" + cbType.Text.Trim() + "',"; sql += "" + tbDataLen.Text.Trim() + ","; sql += "" + tbDataProcision.Text.Trim() + ")"; } else//修改 { sql = "update ZhiBiao set 表名='" + tbTableName.Text.Trim() + "',列名='"; sql += "" + tbColName.Text.Trim() + "'"; sql += ",列描述='" + tbColRemark.Text.Trim() + "'"; sql += ",数据类型编码=" + GetDataType(cbType.Text) + ""; sql += ",数据类型='" + cbType.Text.Trim() + "'"; sql += ",数据长度=" + tbDataLen.Text.Trim() + ""; sql += ",数据精度=" + tbDataProcision.Text.Trim() + " where ID=" + IntZhiBiaoId + ""; } if (ah.ExecuteSQLNonquery(sql)) { this.DialogResult = DialogResult.OK; MessageBox.Show("保存成功"); this.Close(); } else { MessageBox.Show("保存失败"); } ah.Close(); } }