private void repImg_Popup(object sender, EventArgs e) { DataRow _tpDr = gridVMain.GetDataRow(gridVMain.FocusedRowHandle); if (_tpDr["Icon"].Equals(System.DBNull.Value)) { byte[] _tpBytes = ServerRefManager.PicFileRead(_tpDr["StylePic"].ToString(), _tpDr["Pic_Version"].ToString()); gridVMain.FocusedColumn = gridVMain.Columns["Icon"]; gridVMain.ShowEditor(); if (gridVMain.ActiveEditor is DevExpress.XtraEditors.ImageEdit) { if ((gridVMain.ActiveEditor as DevExpress.XtraEditors.ImageEdit).Properties.ShowPopupShadow == false) { (gridVMain.ActiveEditor as DevExpress.XtraEditors.ImageEdit).ShowPopup(); } } if (_tpBytes == null) { _tpDr["Icon"] = new byte[1]; } else { _tpDr["Icon"] = _tpBytes; } gridVMain.RefreshRow(gridVMain.FocusedRowHandle); (gridVMain.ActiveEditor as DevExpress.XtraEditors.ImageEdit).ShowPopup(); } }
private void repImg_Popup(object sender, EventArgs e) { if (!(sender is DevExpress.XtraEditors.ImageEdit)) return; DevExpress.XtraEditors.ImageEdit repImg = sender as DevExpress.XtraEditors.ImageEdit; DevExpress.XtraGrid.Views.Grid.GridView gv = (repImg.Parent as DevExpress.XtraGrid.GridControl).MainView as DevExpress.XtraGrid.Views.Grid.GridView; DataRow _tpDr = gv.GetDataRow(gv.FocusedRowHandle); if (_tpDr["Icon"].Equals(System.DBNull.Value)) { byte[] _tpBytes = ServerRefManager.PicFileRead(_tpDr["StylePic"].ToString(), _tpDr["Pic_Version"].ToString()); gv.FocusedColumn = gv.Columns["Icon"]; gv.ShowEditor(); if (gv.ActiveEditor is DevExpress.XtraEditors.ImageEdit) { if (repImg.Properties.ShowPopupShadow == false) { repImg.ShowPopup(); } } if (_tpBytes == null) { _tpDr["Icon"] = new byte[1]; } else { _tpDr["Icon"] = _tpBytes; } gv.RefreshRow(gv.FocusedRowHandle); repImg.ShowPopup(); } }
private void Query() { if (!StaticFunctions.CheckSave(gcQuery, dtShow)) { return; } gridCMain.Select(); string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcQuery, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } string[] strKey = (strSpParmName + "EUser_Id,EDept_Id,Fy_Id,flag").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), strQueryFlag }); DataSet dtAdd = this.DataRequest_By_DataSet(strSpName, strKey, lisSpParmValue.ToArray()); if (dtAdd == null) { return; } frmDataTable = dtAdd.Tables[0]; if (drMain["MainGvShowIcon"].ToString() == "True") { DataColumn newColumn = frmDataTable.Columns.Add("Icon", Type.GetType("System.Byte[]")); newColumn.AllowDBNull = true; } else if (drMain["MainGvShowPic"].ToString() == "True") { DataColumn newColumn = frmDataTable.Columns.Add("Icon", Type.GetType("System.Byte[]")); newColumn.AllowDBNull = true; foreach (DataRow dr in frmDataTable.Rows) { dr["Icon"] = ServerRefManager.PicFileRead(dr["StylePic"].ToString(), dr["Pic_Version"].ToString()); } } if (drMain["IsAddChildGv"].ToString() == "True" && strRelationsKeyId != string.Empty && dtAdd.Tables.Count >= 2) { dtAdd.Relations.Add("gridCMainChildGrid", frmDataTable.Columns[strRelationsKeyId], dtAdd.Tables[1].Columns[strRelationsKeyId]); } dtAdd.AcceptChanges(); gridCMain.DataSource = frmDataTable.DefaultView;//可能引发gridView1_FocusedRowChanged gridVMain.BestFitColumns(); SetMoreInfo(false); }
private void DoQuery() { List <string> lisSpParmValue = new List <string>(); string[] strKey = "Key_Ids,EUser_Id,EDept_Id,Fy_Id,flag".Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { StrOrdKeyId, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), strQueryFlag }); DataSet dsTemp = this.DataRequest_By_DataSet(strSpName, strKey, lisSpParmValue.ToArray()); if (dsTemp == null) { return; } frmDataTable = dsTemp.Tables[0]; frmDataTable.AcceptChanges(); gridCMain.DataSource = frmDataTable.DefaultView;//可能引发gridView1_FocusedRowChanged foreach (Control ctrParent in GcOrdControls.Values) { StaticFunctions.SetControlBindings(ctrParent, frmDataTable.DefaultView, frmDataTable.Rows[0]); } dtInfo = dsTemp.Tables[1]; DataColumn newColumn = dtInfo.Columns.Add("Icon", Type.GetType("System.Byte[]")); newColumn.AllowDBNull = true; if (drBtn["FrmShowPicEdit"].ToString() == "True") { foreach (DataRow dr in dtInfo.Rows) { dr["Icon"] = ServerRefManager.PicFileRead(dr["StylePic"].ToString(), dr["Pic_Version"].ToString()); } } if (IsAddChildGv && dsTemp.Tables.Count > 2) { dtInfoInfo = dsTemp.Tables[2]; dtInfo.RowChanging += new DataRowChangeEventHandler(dtInfo_RowChanging); dtInfoInfo.RowChanging += new DataRowChangeEventHandler(dtInfoInfo_RowChanging); string strRelationsKeyId = drBtn["RelationsKeyId"].ToString(); dsTemp.Relations.Add("gridCInfoChildGrid", dtInfo.Columns[strRelationsKeyId], dtInfoInfo.Columns[strRelationsKeyId]); } dtInfo.AcceptChanges(); gridCInfo.DataSource = dtInfo.DefaultView; gridVInfo.BestFitColumns(); blInitBound = true; btnChkItem.Checked = false; btnPreview.Checked = false; dtInfo.DefaultView.RowFilter = string.Empty; blInitBound = false; }
private void DoQuery() { string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcQuery, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } string[] strKey = (strSpParmName + "Ord_Id,EUser_Id,EDept_Id,Fy_Id,flag").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { StrOrdKeyId, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), drBtn["FrmQueryFlag"].ToString() }); DataSet dsTemp = this.DataRequest_By_DataSet(StrUpdSpName, strKey, lisSpParmValue.ToArray()); if (dsTemp == null) { return; } if (dsTemp.Tables[0].Rows.Count == 0) { MessageBox.Show("没有检索到明细记录."); return; } if (drBtn["FrmRFQuery"].ToString() == "True") { dsDataSource = dsTemp; frmDataTable = dsTemp.Tables[0]; dtInfo = frmDataTable; if (IsAddChildGv) { dtInfoInfo = dsTemp.Tables[1]; dtInfo.RowChanging += new DataRowChangeEventHandler(dtInfo_RowChanging); dtInfoInfo.RowChanging += new DataRowChangeEventHandler(dtInfoInfo_RowChanging); string strRelationsKeyId = drBtn["RelationsKeyId"].ToString(); dsDataSource.Relations.Add("gridCInfoChildGrid", frmDataTable.Columns[strRelationsKeyId], dtInfoInfo.Columns[strRelationsKeyId]); } } else { if (dsDataSource == null) { dsDataSource = dsTemp; frmDataTable = dsTemp.Tables[0]; dtInfo = frmDataTable; if (IsAddChildGv) { dtInfoInfo = dsTemp.Tables[1]; dtInfo.RowChanging += new DataRowChangeEventHandler(dtInfo_RowChanging); dtInfoInfo.RowChanging += new DataRowChangeEventHandler(dtInfoInfo_RowChanging); string strRelationsKeyId = drBtn["RelationsKeyId"].ToString(); dsDataSource.Relations.Add("gridCInfoChildGrid", frmDataTable.Columns[strRelationsKeyId], dtInfoInfo.Columns[strRelationsKeyId]); } } else { string strKeyF = drBtn["FrmInfoKeyId"].ToString(); foreach (DataRow drTemp in dsTemp.Tables[0].Rows) { if (frmDataTable.Select(strKeyF + "=" + drTemp[strKeyF].ToString()).Length > 0) { continue; } DataRow drNew = frmDataTable.NewRow(); drNew.ItemArray = drTemp.ItemArray; frmDataTable.Rows.InsertAt(drNew, 0); if (IsAddChildGv && dsTemp.Tables.Count == 2) { string strRelationsKeyId = drBtn["RelationsKeyId"].ToString(); DataRow[] drInfos = dsTemp.Tables[1].Select(strRelationsKeyId + "=" + drTemp[strRelationsKeyId].ToString()); foreach (DataRow drInfo in drInfos) { dtInfoInfo.ImportRow(drInfo); } } } } } StaticFunctions.SetControlEmpty(gcQuery, drBtn["FrmNoNullCtrlIds"].ToString()); if (!frmDataTable.Columns.Contains("Icon")) { DataColumn newColumn = frmDataTable.Columns.Add("Icon", Type.GetType("System.Byte[]")); newColumn.AllowDBNull = true; } frmDataTable.AcceptChanges(); gridCInfo.DataSource = frmDataTable.DefaultView; gridVInfo.BestFitColumns(); if (drBtn["FrmShowPicEdit"].ToString() == "True") { DataRow dr = frmDataTable.Rows[0]; picEdit.EditValue = ServerRefManager.PicFileRead(dr["StylePic"].ToString(), dr["Pic_Version"].ToString()); picEdit.Visible = true; } blInitBound = true; btnChkItem.Checked = false; btnPreview.Checked = false; frmDataTable.DefaultView.RowFilter = string.Empty; blInitBound = false; }
private void DoQuery() { if (gcQuery.Visible) { string strSpParmName = string.Empty; List <string> lisSpParmValue = StaticFunctions.GetPassSpParmValue(gcQuery, dtShow, out strSpParmName); if (strSpParmName != string.Empty) { strSpParmName += ","; } string[] strKey = (strSpParmName + "Ord_Id,EUser_Id,EDept_Id,Fy_Id,flag").Split(",".ToCharArray()); lisSpParmValue.AddRange(new string[] { strKeyId, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), drBtn["AddFromOrdSpLoadFlag"].ToString() }); DataTable dtTemp = this.DataRequest_By_DataTable(strSpName, strKey, lisSpParmValue.ToArray()); if (dtTemp == null) { return; } if (frmDataTable == null) { frmDataTable = dtTemp; } else { foreach (DataRow drTemp in dtTemp.Rows) { DataRow drNew = frmDataTable.NewRow(); drNew.ItemArray = drTemp.ItemArray; frmDataTable.Rows.InsertAt(drNew, 0); } } if (!frmDataTable.Columns.Contains("Icon")) { DataColumn newColumn = frmDataTable.Columns.Add("Icon", Type.GetType("System.Byte[]")); newColumn.AllowDBNull = true; } if (drBtn["AddFromOrdShowPic"].ToString() == "True") { foreach (DataRow dr in frmDataTable.Rows) { dr["Icon"] = ServerRefManager.PicFileRead(dr["StylePic"].ToString(), dr["Pic_Version"].ToString()); } } blInitBound = true; frmDataTable.AcceptChanges(); gridCInfo.DataSource = frmDataTable.DefaultView; gridVInfo.BestFitColumns(); blInitBound = false; if (drBtn["ShowPicEditAllow"].ToString() == "True") { DataRow dr = frmDataTable.Rows[0]; picEdit.EditValue = ServerRefManager.PicFileRead(dr["StylePic"].ToString(), dr["Pic_Version"].ToString()); } } else { string[] strKey = "Ord_Id,EUser_Id,EDept_Id,Fy_Id,flag".Split(",".ToCharArray()); string[] strVal = new string[] { strKeyId, CApplication.App.CurrentSession.UserId.ToString(), CApplication.App.CurrentSession.DeptId.ToString(), CApplication.App.CurrentSession.FyId.ToString(), drBtn["AddFromOrdSpLoadFlag"].ToString() }; frmDataTable = this.DataRequest_By_DataTable(strSpName, strKey, strVal); DataColumn newColumn = frmDataTable.Columns.Add("Icon", Type.GetType("System.Byte[]")); newColumn.AllowDBNull = true; if (drBtn["AddFromOrdShowPic"].ToString() == "True") { foreach (DataRow dr in frmDataTable.Rows) { dr["Icon"] = ServerRefManager.PicFileRead(dr["StylePic"].ToString(), dr["Pic_Version"].ToString()); } } blInitBound = true; frmDataTable.AcceptChanges(); gridCInfo.DataSource = frmDataTable.DefaultView; gridVInfo.BestFitColumns(); blInitBound = false; gridCInfo.Select(); gridVInfo.FocusedColumn = gridVInfo.Columns["AmountWait"]; gridVInfo.ShowEditor(); } }