/// <summary> /// 根据部门检索 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cboDept_TextChanged(object sender, EventArgs e) { string filter = "c.名称 like '%{0}%'"; if (cboDept.Text == "全部") { filter = ""; } else { filter = string.Format(filter, this.cboDept.Text.Replace("'", "''")); } //得到数据源 QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); DataTable tab = dsUnit.Tables["补助管理"];; if (null == tab) { return; } tab.Clear(); query.FillDataSet(tab.TableName, this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.dsUnit); detpList.Items.Clear(); foreach (DataRow dr in tab.Rows) { this.detpList.Items.Add(dr["姓名"] + "(" + dr["卡号"] + ")"); } }
/// <summary> /// 初始化发行器 /// </summary> /// <returns></returns> public DataTable initDev() { IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName()); string myip = IpEntry.AddressList[0].ToString(); string filter = "(电脑='{0}' or IP地址='{1}') and 通讯类别='发行器'"; filter = string.Format(filter, Dns.GetHostName(), myip); DataTable tab = this.dsUnit.Tables["发行器"]; tab.Clear(); QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); query.FillDataSet("发行器", this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.dsUnit); return(tab); }
/// <summary> /// 条件查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCheck_Click(object sender, EventArgs e) { string filter = "a.NAME like '%{0}%' or a.EMPCODE like '%{0}%' or b.名称 like '%{0}%'"; filter = string.Format(filter, this.txtCheck.Text.Replace("'", "''")); //得到数据源 QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); DataTable tab = this.dbUser.DataSource as DataTable; if (null == tab) { return; } tab.Clear(); query.FillDataSet(tab.TableName, this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.ds); }
/// <summary> /// 时间段查询,部门,班制 检索 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSelect_Click(object sender, EventArgs e) { DataTable tab = this.dbDeptRpt.DataSource as DataTable; if (null == tab) { return; } string filter = "a.日期>=(SELECT convert(datetime,'{0}',121)) and a.日期<=(SELECT convert(datetime, '{1}',121)) and (c.名称 like '%{2}%')"; filter = string.Format(filter, this.cboStart.Text.Replace("'", "''"), this.cboEnd.Text.Replace("'", "''"), this.cboDept.Text.Replace("'", "''")); QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); tab.Clear(); query.FillDataSet(tab.TableName, this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.dsUnit); }
/// <summary> /// 条件查询 用户编号,卡号,姓名,部门检索 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCheck_Click(object sender, EventArgs e) { DataTable tab = this.dbGrid.DataSource as DataTable; if (null == tab) { return; } string filter = ""; filter = "(a.用户编号 like '%{0}%' or a.卡号 like '%{0}%' or b.name like '%{0}%' or e.名称 like '%{0}%') and f.类别 like '%{1}%'"; filter = string.Format(filter, this.tbcardno.Text.Replace("'", "''"), this.cboType.Text.Replace("'", "''")); QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); tab.Clear(); query.FillDataSet(tab.TableName, this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.dsUnit); }
/// <summary> /// 条件检索 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void sbtFilter_Click(object sender, EventArgs e) { //获取当前单元名称 DataTable tab = dsUnit.Tables["用户选择"]; if (null == tab) { return; } //数据源 string filter = "姓名 like '%{0}%' or 用户编号 like '%{0}%' or 卡号 like '%{0}%' or 部门名称 like '%{0}%' or 车牌 like '%{0}%' or 车辆类型 like '%{0}%'"; filter = string.Format(filter, this.tbFilter.Text.Replace("'", "''")); QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); tab.Clear(); query.FillDataSet(tab.TableName, this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.dsUnit); }
/// <summary> /// 根据门岗查询设备 /// </summary> public void GetDEvById(string DoorID) { //获取当前单元名称 DataTable tab = this.dbDev.DataSource as DataTable; if (null == tab) { return; } string filter = ""; filter = "门岗ID='{0}'"; filter = string.Format(filter, DoorID.Replace("'", "''")); QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); tab.Clear(); query.FillDataSet(tab.TableName, this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.ds); }
/// <summary> /// 根据餐厅检索 消费时段,菜单,消费机ddd /// </summary> /// <param name="db">GridControl</param> /// <param name="flag">类别标示</param> /// <param name="ID">编号</param> public void CheckByDin(DevExpress.XtraGrid.GridControl db, string flag, string ID) { try { DataTable tab = db.DataSource as DataTable; if (null == tab) { return; } if (string.IsNullOrEmpty(ID)) { return; } string filter = ""; switch (flag) { case "1": filter = "餐厅ID='{0}' order by 星期序号"; break; case "2": filter = "餐厅ID='{0}'"; break; case "4": filter = "a.餐厅ID='{0}'"; break; case "3": filter = "餐厅ID='{0}'"; break; default: break; } filter = string.Format(filter, ID.Replace("'", "''")); QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); tab.Clear(); query.FillDataSet(tab.TableName, this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.ds); } catch (Exception ex) { } }
/// <summary> /// 根据部门查询 /// </summary> public void GetUserByDept(string Num) { try { DataTable tab = this.dbUser.DataSource as DataTable; if (null == tab) { return; } string filter = "DEPARTMENT='{0}'"; filter = string.Format(filter, Num.Replace("'", "''")); QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); tab.Clear(); query.FillDataSet(tab.TableName, this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.ds); } catch (Exception ex) { } }
/// <summary> /// 条件查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnCheck_Click(object sender, EventArgs e) { string StartDtTime = this.cboStartDate.Text + " " + this.cboStartTime.Text; string EndDtTime = this.cboEndDate.Text + " " + this.cboEndTime.Text; //获取当前单元名称 DataTable tab = this.dbGrid.DataSource as DataTable; if (null == tab) { return; } string filter = ""; filter = "a.接班时间 between '{0}' and '{1}'and a.接班人 like '%{2}%'and a.交班人 like '%{3}%'"; filter = string.Format(filter, StartDtTime.Replace("'", "''"), EndDtTime.Replace("'", "''"), this.cboStartEmp.Text.Replace("'", "''"), this.cboEndEmp.Text.Replace("'", "''")); QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); tab.Clear(); query.FillDataSet(tab.TableName, this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.dsUnit); }
/// <summary> /// 条件查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtQuery_Click(object sender, EventArgs e) { string StartDtTime = this.StartDate.Text + " " + this.cboStartTime.Text; string EndDtTime = this.EndDate.Text + " " + this.cboEndTime.Text; //获取当前单元名称 DataTable tab = this.dbGridIn.DataSource as DataTable; if (null == tab) { return; } string filter = ""; filter = " a.日期 between (SELECT convert(datetime,'{0}',121)) and (SELECT convert(datetime,'{1}',121)+1) and a.用户编号 like '%{2}%' and b.name like '%{3}%' and c.卡类 like '%{4}%' and (a.车牌 like '%{5}%' or a.车牌 is null) and a.卡号 like '%{6}%' and p.名称 like '%{7}%'"; filter = string.Format(filter, StartDtTime.Replace("'", "''"), EndDtTime.Replace("'", "''"), txtuserID.Text.Replace("'", "''"), this.txtuserName.Text.Replace("'", "''"), this.CbCardtype.Text.Replace("'", "''"), TxtCarNo.Text.Replace("'", "''"), TxtCardNo.Text.Replace("'", "''"), this.dtDev.Text.Replace("'", "''")); QueryDataRes query = new QueryDataRes(this.unitItem.DataSrcFile); tab.Clear(); query.FillDataSet(tab.TableName, this.paramwin, ParamManager.setMacroParam(MacroPmType.FW, filter), this.dsUnit); }