private void btnMoreCondition_Click(object sender, EventArgs e) { string condition = txtPNumber.Text.Trim() + "," + dtStDay.EditValue.ToString() + "," + dtEndDay.EditValue.ToString() + ","; frmMoreCondition frmMore = new frmMoreCondition(condition); if (frmMore.ShowDialog() == DialogResult.OK) { if (cbk == null) { cbk = new GridCheckMarksSelection(gridView1); } this.gridControl1.DataSource = frmMore.dtCondition.Tables[0]; } }
//查询 private void btnOk_Click(object sender, EventArgs e) { if (cboUnitFee.Text.Trim() == string.Empty) { MessageBox.Show("为了避免误操作,请选择工费计算方式!"); return; } cbk = null; string COL_SQL = string.Empty; string COL_SQL_Null = string.Empty; string COL_SQL_Max = string.Empty; string[] strAry = this.chkComCust.Text.Split(','); for (int i = 0; i < strAry.Length; i++) { COL_SQL = COL_SQL + "[" + strAry[i].ToString().Trim() + "],"; COL_SQL_Null = COL_SQL_Null + "[" + strAry[i].ToString().Trim() + "]= ISNULL(" + "[" + strAry[i].ToString().Trim() + "],0),"; COL_SQL_Max = COL_SQL_Max + "[" + strAry[i].ToString().Trim() + "]= Max(" + strAry[i].ToString().Trim() + "),"; } string[] strKey = "EUser_Id,EDept_Id,Fy_Id,COL_SQL_NULL,COL_SQL,COL_SQL_Max,PNumber,UnitType,Flag".Split(",".ToCharArray()); string[] strVal = new string[] { CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), COL_SQL_Null.TrimEnd(','), COL_SQL.TrimEnd(','), COL_SQL_Max.TrimEnd(','), txtPNumber.Text.Trim(), cboUnitFee.Text.Trim(), "3" }; DataSet ds = this.DataRequest_By_DataSet(strSpName, strKey, strVal); this.gridVMain.Columns.Clear(); this.gridCMain.DataSource = ds.Tables[0]; if (cbk == null) { cbk = new GridCheckMarksSelection(gridVMain); } this.gridVMain.Columns[0].Visible = false; if (cboUnitFee.Text.Trim() == "按件计") { this.gridVMain.Columns[3].Visible = false; } else { this.gridVMain.Columns[4].Visible = false; } }
private void InitContr() { if (dsLoad != null) { return; } dsFormAdt = this.GetFrmLoadDsAdt(strBusClassName); dsFormAdt.AcceptChanges(); dsLoad = this.GetFrmLoadDsNew(strBusClassName); dsLoad.AcceptChanges(); dtShow = dsLoad.Tables[0]; dtConst = dsLoad.Tables[1]; drMain = dsLoad.Tables[2].Rows[0]; strSpName = drMain["SpName"].ToString(); dtBtns = dsLoad.Tables[3]; dtTabs = dsLoad.Tables[4]; dtGroupC = dsLoad.Tables[5]; dtSte = dsLoad.Tables[6]; dtContr = dsLoad.Tables[7]; dtBtnsM = dsLoad.Tables[8]; dtSp = dsLoad.Tables[9]; blInitBound = true; Rectangle rect = SystemInformation.VirtualScreen; lisBarItems = StaticFunctions.ShowBarButtonItem(dtBtns, bar2, "bar2", strAllowList, imageList1); foreach (BarButtonItem item in lisBarItems) { item.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.btn_ItemClick); } gcItems = StaticFunctions.ShowTabItem(dtTabs, dtBtns, xtabItemInfo, "xtabItemInfo", strAllowList, lisrepImg, GvNeedGCEdit, lisBtnAlls, lisBtns, imageList1, true, lisGcQuerys); foreach (string strGv in gcItems.Keys) { StaticFunctions.ShowGridControl(gcItems[strGv], dtShow, dtConst); DataRow[] drTabs = dtTabs.Select("IsAddChildGv=1 AND GridViewName='" + strGv + "'"); if (drTabs.Length == 1) { GridView gvChild = StaticFunctions.ShowGridVChildGv(strGv + "Com", gcItems[strGv].GridControl, dtShow, dtConst); StaticFunctions.SetGridViewStyleFormatCondition(gvChild, dtBtnsM); } StaticFunctions.SetGridViewStyleFormatCondition(gcItems[strGv], dtBtnsM); drTabs = dtTabs.Select("ShowGridChkSel=1 AND GridViewName='" + strGv + "'"); if (drTabs.Length == 1) { GridCheckMarksSelection gc = new GridCheckMarksSelection(gcItems[strGv]); gc.StrGridKeyField = drTabs[0]["EditInfoKeyId"].ToString(); gcGridCheckSels.Add(strGv, gc); } } foreach (RepositoryItemImageEdit rep in lisrepImg) { rep.Popup += new System.EventHandler(this.repImg_Popup); } #region gcQuery int igcHeight; foreach (Control ctrlQuery in lisGcQuerys.Values) { List <Control> lisGcContrsQuery = StaticFunctions.ShowGroupControl(ctrlQuery, rect.Width - 50, dtShow, dtConst, true, 30, false, null, true, out igcHeight); foreach (Control ctrl in lisGcContrsQuery) { ctrl.Enter += new System.EventHandler(this.TxtQ_Enter); switch (ctrl.GetType().ToString()) { case "DevExpress.XtraEditors.TextEdit": break; case "DevExpress.XtraEditors.CheckEdit": break; case "DevExpress.XtraEditors.LookUpEdit": LookUpEdit dpl = ctrl as LookUpEdit; dpl.Properties.QueryPopUp += new System.ComponentModel.CancelEventHandler(this.lookUpEdit_Properties_QueryPopUp); dpl.Properties.Closed += new DevExpress.XtraEditors.Controls.ClosedEventHandler(this.lookUpEdit_Properties_Closed); break; case "DevExpress.XtraEditors.CheckedComboBoxEdit": CheckedComboBoxEdit chkdpl = ctrl as CheckedComboBoxEdit; chkdpl.Properties.Closed += new DevExpress.XtraEditors.Controls.ClosedEventHandler(this.lookUpEdit_Properties_Closed); break; case "DevExpress.XtraEditors.DateEdit": break; case "ProduceManager.UcTxtPopup": ProduceManager.UcTxtPopup ucp = ctrl as ProduceManager.UcTxtPopup; ucp.onClosePopUp += new UcTxtPopup.ClosePopUp(ucp_onClosePopUp); break; default: break; } } } #endregion StaticFunctions.SetBtnStyle(barManager1, lisBtnAlls, drMain); this.txtOrdFilter.Location = new System.Drawing.Point(int.Parse(drMain["ControlFilterLocalPointX"].ToString()), int.Parse(drMain["ControlFilterLocalPointY"].ToString())); foreach (XtraTabPage tap in xtabItemInfo.TabPages) { if (dtTabs.Select("LoadQuery=1 AND TabName='" + tap.Name + "'").Length > 0) { Query(tap.Name); } } blInitBound = false; }