SVN r500
SVN-Revision: r500
This commit is contained in:
@@ -249,8 +249,9 @@ namespace Lskj.Control
|
||||
this.EditValue += rowItemText[ValueMember] + ",";
|
||||
}
|
||||
}
|
||||
this.Text = text.Trim(',');
|
||||
this.EditValue = EditValue.Trim(',');
|
||||
this.Text = text.Trim(',');
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2122,7 +2122,7 @@ namespace Lskj.Control
|
||||
//}
|
||||
if (!string.IsNullOrEmpty(model.EnableCond))
|
||||
{
|
||||
GridColumnModel[] columns = this.ColumnList.Where(x => x.EnableCond.Contains("{" + model.FieldName + "}")).ToArray();
|
||||
GridColumnModel[] columns = this.ColumnList.Where(x => x.EnableCond.Contains("{" + model.FieldName + "}")).ToArray();
|
||||
DataRow rowItem = this.gridView.GetDataRow(rowHandler);
|
||||
foreach (GridColumnModel item in columns)
|
||||
{
|
||||
@@ -2132,6 +2132,8 @@ namespace Lskj.Control
|
||||
string diaableType = item.DisableType;
|
||||
//this.gridView.Columns.ColumnByFieldName(model.FieldName).Visible = ("true".Equals(EvalHelper.Eval(ReplaceHelper.ReplaceEvalCond(disableCond)) + "", StringComparison.OrdinalIgnoreCase));
|
||||
this.gridView.Columns.ColumnByFieldName(model.FieldName).Visible = ("true".Equals(ValidateCond(disableCond, null) + "", StringComparison.OrdinalIgnoreCase));
|
||||
//设置编辑状态
|
||||
//this.gridView.Columns.ColumnByFieldName("").OptionsColumn.AllowEdit = true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@@ -8255,36 +8257,4 @@ namespace Lskj.Control
|
||||
{
|
||||
int returnIndex = 0;
|
||||
isContain = false;
|
||||
DataRow dragEndRow = sourceTab.Rows[dragEndRowIndex];
|
||||
if (selectRows.Contains(dragEndRow))
|
||||
{
|
||||
isContain = true;
|
||||
dragEndRowIndex = dragEndRowIndex - 1;
|
||||
if (dragEndRowIndex >= 0)
|
||||
{
|
||||
dragEndRow = sourceTab.Rows[dragEndRowIndex];
|
||||
if (selectRows.Contains(dragEndRow))
|
||||
{
|
||||
bool iscontain = false;
|
||||
returnIndex = GetDragEndRowIndex(sourceTab, dragEndRowIndex, selectRows, out iscontain);
|
||||
}
|
||||
else
|
||||
{
|
||||
returnIndex = dragEndRowIndex;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnIndex = -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
returnIndex = dragEndRowIndex;
|
||||
}
|
||||
return returnIndex;
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
DataRow dragEn
|
||||
@@ -250,6 +250,10 @@ namespace Lskj.Control.Model
|
||||
///显示明细条件
|
||||
/// </summary>
|
||||
public bool DetailSearch;
|
||||
/// <summary>
|
||||
///记住上下复选行(上下表都有复选框才生效)
|
||||
/// </summary>
|
||||
public bool RecordDetailsCheckbox;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -306,13 +310,4 @@ namespace Lskj.Control.Model
|
||||
this.AssociateRight = item.Table.Columns.Contains("AssociateRight") ? "1".Equals(item["AssociateRight"] + "") : false;
|
||||
this.Enablecond = item.Table.Columns.Contains("Enablecond") ? (item["Enablecond"] + ""): string.Empty;
|
||||
this.DBClickEvent = item.Table.Columns.Contains("DBClickEvent") ? "1".Equals(item["DBClickEvent"] + "") : false;
|
||||
this.ProhibitRefresh = item.Table.Columns.Contains("ProhibitRefresh") ? "1".Equals(item["ProhibitRefresh"] + "") : false;
|
||||
this.DragExecuteSql = item.Table.Columns.Contains("DragExecuteSql") ? item["DragExecuteSql"] + "" : "";
|
||||
this.QueryAgain = item.Table.Columns.Contains("QueryAgain") ? "1".Equals(item["QueryAgain"] + "") : false;
|
||||
this.BottomRefreshMain = item.Table.Columns.Contains("BottomRefreshMain") ? "1".Equals(item["BottomRefreshMain"] + "") : false;
|
||||
this.LoadFilter = item.Table.Columns.Contains("LoadFilter") ? "1".Equals(item["LoadFilter"] + "") : false;
|
||||
this.DynamicDetails = item.Table.Columns.Contains("DynamicDetails") ? "1".Equals(item["DynamicDetails"] + "") : false;
|
||||
this.DetailSearch = item.Table.Columns.Contains("DetailSearch") ? "1".Equals(item["DetailSearch"] + "") : false;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.ProhibitRefresh = item.T
|
||||
@@ -610,8 +610,8 @@ namespace Lskj.Control.Model
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
DataRow a = customTable.Rows.Cast<DataRow>().FirstOrDefault(x => col.Name.Equals(x["fieldName"] + "", StringComparison.OrdinalIgnoreCase));
|
||||
string tempSql = a == null ? string.Format(@"insert into {8}(formkey,fieldname,username,orderid,isvisible,operatorid,operatorName,operatedate,fieldWidth,IfFixColumn,FieldText {11}) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}',getdate(),'{7}','{9}','{10}' {12});",
|
||||
key, col.FieldName, col.Caption, col.VisibleIndex, Convert.ToInt32(col.Visible), ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, col.Width, ResourceKeys.SettingTableName, col.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.Left, model.FieldText, saveFieldName, fieldValue) : string.Format(@"update {6} set orderid='{0}',fieldWidth='{1}',isvisible={2},IfFixColumn='{7}' where formkey='{3}' and fieldname='{4}' and operatorid='{5}';",
|
||||
col.VisibleIndex, col.Width, Convert.ToInt32(col.Visible), key, col.FieldName, ERPInfo.Instance.UserId, ResourceKeys.SettingTableName, col.OwnerBand != null ? col.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.Left : false);
|
||||
key, col.FieldName, col.Caption, col.VisibleIndex, Convert.ToInt32(col.Visible), ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, col.Width, ResourceKeys.SettingTableName, col.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.Left, model.FieldText, saveFieldName, fieldValue) : string.Format(@"update {6} set orderid='{0}',fieldWidth='{1}',isvisible={2},IfFixColumn='{7}' {8} where formkey='{3}' and fieldname='{4}' and operatorid='{5}';",
|
||||
col.VisibleIndex, col.Width, Convert.ToInt32(col.Visible), key, col.FieldName, ERPInfo.Instance.UserId, ResourceKeys.SettingTableName, col.OwnerBand != null ? col.OwnerBand.Fixed == DevExpress.XtraGrid.Columns.FixedStyle.Left : false, updateField);
|
||||
sBuilder.Append(tempSql);
|
||||
}
|
||||
return BaseImpl.ExecSqlValue(sBuilder.ToString()) > 0;
|
||||
@@ -2683,14 +2683,14 @@ namespace Lskj.Control.Model
|
||||
//设置默认值
|
||||
if (SystemInfo.Instance.ImportDefaultValue)
|
||||
{
|
||||
foreach (GridColumn col in gridView.VisibleColumns)
|
||||
foreach (GridColumn col in gridControlEx.GridView.Columns)
|
||||
{
|
||||
if (!ImportTable.Columns.Contains(col.FieldName)) ImportTable.Columns.Add(col.FieldName);
|
||||
}
|
||||
|
||||
foreach (DataRow rowItem in ImportTable.Rows)
|
||||
{
|
||||
foreach (GridColumn col in gridView.VisibleColumns)
|
||||
foreach (GridColumn col in gridControlEx.GridView.Columns)
|
||||
{
|
||||
// 未包含字段,则使用控件默认值.
|
||||
GridColumnModel model = col.Tag as GridColumnModel;
|
||||
@@ -2957,7 +2957,7 @@ namespace Lskj.Control.Model
|
||||
|
||||
|
||||
|
||||
foreach (GridColumn gc in gridControlEx.GridView.VisibleColumns)
|
||||
foreach (GridColumn gc in gridControlEx.GridView.Columns)
|
||||
{
|
||||
if (tmpRow.Table.Columns.Contains(gc.FieldName))
|
||||
{
|
||||
@@ -3023,7 +3023,7 @@ namespace Lskj.Control.Model
|
||||
string mesage = ex.Message;
|
||||
string sqlValue = string.Format("delete from {0} where {1}='1'", SysModel.MenuTable, _importFlag);
|
||||
SqlHelper.ExecuteNonQuery(sqlValue);
|
||||
foreach (GridColumn gc in gridControlEx.GridView.VisibleColumns)
|
||||
foreach (GridColumn gc in gridControlEx.GridView.Columns)
|
||||
{
|
||||
if (ex.Message.Contains(gc.FieldName))
|
||||
{
|
||||
|
||||
@@ -775,24 +775,42 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
else
|
||||
{
|
||||
// 将sql语句组装成Parameter方式,兼容配置语句.
|
||||
List<SqlParameter> paramList = ReplaceHelper.ReplaceRowParamToSqlParameter(rowData, ref sqlValue);
|
||||
|
||||
if (this.ControlObj != null && sqlValue.Contains(ReplaceHelper.ReplaceParentLeftKey))
|
||||
if (model.SqlDirectExecution)
|
||||
{
|
||||
List<string> paramFields = ReplaceHelper.GetParamFields(sqlValue);
|
||||
foreach (string item in paramFields)
|
||||
sqlValue = ReplaceHelper.ReplaceRowParam(rowData, sqlValue);
|
||||
if(this.ControlObj != null && sqlValue.Contains(ReplaceHelper.ReplaceParentLeftKey))
|
||||
{
|
||||
string fieldValue = this.ControlObj.GetControlValue(item.Replace(ReplaceHelper.ReplaceParentLeftKey, "").Replace(ReplaceHelper.ReplaceParamEndKey, ""));
|
||||
paramList.Add(new SqlParameter(ReplaceHelper.ProcFirstKey + item, fieldValue));
|
||||
List<string> paramFields = ReplaceHelper.GetParamFields(sqlValue);
|
||||
foreach (string item in paramFields)
|
||||
{
|
||||
string fieldValue = this.ControlObj.GetControlValue(item.Replace(ReplaceHelper.ReplaceParentLeftKey, "").Replace(ReplaceHelper.ReplaceParamEndKey, ""));
|
||||
sqlValue = sqlValue.Replace(item, fieldValue);
|
||||
}
|
||||
}
|
||||
int NumberOfImpacts = MainImpl.ExecSqlValue(sqlValue);
|
||||
return NumberOfImpacts>0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// 将sql语句组装成Parameter方式,兼容配置语句.
|
||||
List<SqlParameter> paramList = ReplaceHelper.ReplaceRowParamToSqlParameter(rowData, ref sqlValue);
|
||||
|
||||
if (this.ControlObj != null && sqlValue.Contains(ReplaceHelper.ReplaceParentLeftKey))
|
||||
{
|
||||
List<string> paramFields = ReplaceHelper.GetParamFields(sqlValue);
|
||||
foreach (string item in paramFields)
|
||||
{
|
||||
string fieldValue = this.ControlObj.GetControlValue(item.Replace(ReplaceHelper.ReplaceParentLeftKey, "").Replace(ReplaceHelper.ReplaceParamEndKey, ""));
|
||||
paramList.Add(new SqlParameter(ReplaceHelper.ProcFirstKey + item, fieldValue));
|
||||
}
|
||||
}
|
||||
object text = MainImpl.GetResult(sqlValue, paramList.ToArray());
|
||||
if (model.isCopy)
|
||||
{
|
||||
Clipboard.SetDataObject(text + "");
|
||||
}
|
||||
}
|
||||
object text = MainImpl.GetResult(sqlValue, paramList.ToArray());
|
||||
if (model.isCopy)
|
||||
{
|
||||
Clipboard.SetDataObject(text + "");
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -1402,7 +1420,10 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
if (model.Mergeexec)//合并执行
|
||||
{
|
||||
if (model.ActionType == 0) actionSql = ReplaceHelper.ReplaceRowParam(rows, model.Action, "'", "'");
|
||||
if (model.ActionType == 0)
|
||||
{
|
||||
actionSql = ReplaceHelper.ReplaceRowParam(rows, model.Action, "'", "'");
|
||||
}
|
||||
|
||||
if (model.DllName.ToLower().Contains("lskj.pubbrower.dll".ToLower()))
|
||||
{
|
||||
@@ -1542,6 +1563,7 @@ namespace Lskj.Control.Model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string firstChar = fieldValue.Length > 0 ? fieldValue.Substring(0, 1) : "";
|
||||
switch (firstChar)
|
||||
{
|
||||
@@ -1565,6 +1587,35 @@ namespace Lskj.Control.Model
|
||||
string jsonStr = JsonConvert.SerializeObject(dataTable);
|
||||
handleParamList.Add(jsonStr);
|
||||
}
|
||||
else if (fieldValue.StartsWith("[Details|"))
|
||||
{
|
||||
string TagName = fieldValue.Replace("[Details|", "").Replace("]", "");
|
||||
fieldValue = "";
|
||||
if (this.ControlObj != null && this.ControlObj.DetailSelection.ContainsKey(TagName))
|
||||
{
|
||||
Dictionary<DataRow, string> dictionary = this.ControlObj.DetailSelection[TagName];
|
||||
if (rowDatas != null)
|
||||
{
|
||||
foreach (DataRow row in rowDatas)
|
||||
{
|
||||
if (dictionary.ContainsKey(row)&&!string.IsNullOrWhiteSpace(dictionary[row]))
|
||||
{
|
||||
fieldValue +=dictionary[row]+",";
|
||||
}
|
||||
}
|
||||
fieldValue = fieldValue.Trim(',');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dictionary.ContainsKey(rowData))
|
||||
{
|
||||
fieldValue = dictionary[rowData];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
handleParamList.Add(fieldValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
fieldValue = fieldValue.Replace("[", "{").Replace("]", "}");
|
||||
@@ -1628,28 +1679,4 @@ namespace Lskj.Control.Model
|
||||
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
|
||||
if (dataRows.Length == 0)
|
||||
{
|
||||
string addColSql = string.Format("alter table P_PrivateDllTab add {0} {1}", colunmField.Key, colunmField.Value);
|
||||
SqlHelper.ExecuteNonQuery(addColSql);//添加列
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
string createTabSql = "create table P_PrivateDllTab(id int IDENTITY(1,1) NOT NULL,{0})";
|
||||
string createCol = string.Empty;
|
||||
foreach (KeyValuePair<string, string> colunmField in colDic)
|
||||
{
|
||||
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
|
||||
}
|
||||
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
|
||||
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
string a
|
||||
@@ -303,6 +303,10 @@ namespace Lskj.Control.Model
|
||||
/// 右键后最小化程序
|
||||
/// </summary>
|
||||
public bool DuringExecutionMinimize;
|
||||
/// <summary>
|
||||
/// sql直接执行模式
|
||||
/// </summary>
|
||||
public bool SqlDirectExecution;
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -421,20 +425,4 @@ namespace Lskj.Control.Model
|
||||
if (item.Table.Columns.Contains("AllowNullExec"))
|
||||
this._allowNullExec = string.IsNullOrWhiteSpace(item["AllowNullExec"] + "") ? false : "1".Equals(item["AllowNullExec"] + "");
|
||||
if (item.Table.Columns.Contains("ResultSQL"))
|
||||
this._resultSQL = item["ResultSQL"] + "";
|
||||
if (item.Table.Columns.Contains("ExecuteFirstCode"))
|
||||
this.ExecuteFirstCode = item["ExecuteFirstCode"] + "";
|
||||
if (item.Table.Columns.Contains("DuringExecutionMinimize"))
|
||||
this.DuringExecutionMinimize = string.IsNullOrWhiteSpace(item["DuringExecutionMinimize"] + "") ? false : "1".Equals(item["DuringExecutionMinimize"] + "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///是否必须选中行
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance has must select row; otherwise, <c>false</c>.</value>
|
||||
public bool IsMustSelectRow()
|
||||
{
|
||||
return ParamList.Contains("{") || _beforeMsg.Contains("{") || _successMsg.Contains("{") || Action.Contains("{");
|
||||
}
|
||||
}
|
||||
}
|
||||
this._resultSQL = ite
|
||||
@@ -142,6 +142,14 @@ namespace Lskj.Control.Model
|
||||
/// </summary>
|
||||
/// <value>The control models.</value>
|
||||
public List<ControlModel> ControlModels { get { return this._models; } }
|
||||
/// <summary>
|
||||
/// 明细里复选框选中的数据(主表和明细都是复选模式才记录) <页签名, <主表选中行,明细选中行主键(,拼接)>>
|
||||
/// 如果主表刷新后还要选中之前的明细,就要存主表主键值(目前没用传进来)
|
||||
/// </summary>
|
||||
public Dictionary<string, Dictionary<DataRow, string>> DetailSelection = new Dictionary<string, Dictionary<DataRow, string>>();
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 执行查询之前验证
|
||||
/// </summary>
|
||||
@@ -3089,7 +3097,7 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
this._mainGridEx.RefreshDataSource(true);
|
||||
}
|
||||
|
||||
this.DetailSelection.Clear();
|
||||
if (string.IsNullOrWhiteSpace(this._mainGridEx.LastSearchSql))
|
||||
{
|
||||
this.SearchGrid();
|
||||
@@ -3170,6 +3178,7 @@ namespace Lskj.Control.Model
|
||||
{
|
||||
if (this._mainGridEx != null)
|
||||
{
|
||||
this.DetailSelection.Clear();
|
||||
if (this.SystemModel != null) RememberRow = (this.SystemModel.AccordingNameSelected == 0);
|
||||
int oldRowHandle = GetFocusedRowHandle();//获取上一次选中行
|
||||
sqlValue = ReplaceHelper.ReplaceUserInfo(sqlValue);
|
||||
@@ -3243,6 +3252,7 @@ namespace Lskj.Control.Model
|
||||
this.GridRowCount = sourceTable.Rows.Count;
|
||||
if (this._mainGridEx != null)
|
||||
{
|
||||
this.DetailSelection.Clear();
|
||||
int oldRowHandle = GetFocusedRowHandle();//获取上一次选中行
|
||||
if (_mainGridEx.IsHandleCreated)
|
||||
{
|
||||
|
||||
@@ -741,8 +741,36 @@ namespace Lskj.Control
|
||||
(tabPage.Tag as GridControlEx).ParentControl.SearchGrid();
|
||||
tabPage.Text = model.DetailName + "(" + (tabPage.Tag as GridControlEx).ParentControl.GridRowCount + "条)";
|
||||
}
|
||||
|
||||
}
|
||||
if (moduleGridEx != null)
|
||||
{
|
||||
moduleGridEx.ParentButtonState(rowItem);
|
||||
moduleGridEx.SelectTheSpecifiedRow();
|
||||
//主表,页签中的表格都设置了复选框,并且为第一个页签
|
||||
//if (this.ModuleGridObj.GridControlObj.GridView.OptionsSelection.MultiSelect == true && moduleGridEx.GridControlObj.GridView.OptionsSelection.MultiSelect == true && this.TabObj.TabPages[0] == tabPage)
|
||||
//{
|
||||
// if (this.SearchObj.DetailSelection.ContainsKey(model.DetailName))
|
||||
// {
|
||||
// Dictionary<DataRow, string> dictionary = this.SearchObj.DetailSelection[model.DetailName];
|
||||
// if (dictionary.ContainsKey(rowItem))
|
||||
// {
|
||||
// DataTable dataTable = moduleGridEx.GridControlObj.GridControl.DataSource as DataTable;
|
||||
// string value = dictionary[rowItem];
|
||||
// for (int rowHandle = 0; rowHandle < moduleGridEx.GridControlObj.GridView.RowCount; rowHandle++)
|
||||
// {
|
||||
// string cellValue = moduleGridEx.GridControlObj.GridView.GetRowCellValue(rowHandle, moduleGridEx.ParmaryKey) + "";
|
||||
// if (value.Split(',').Contains(cellValue))
|
||||
// {
|
||||
// moduleGridEx.GridControlObj.GridView.SelectRow(rowHandle); // 勾选
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
}
|
||||
if (moduleGridEx != null) moduleGridEx.ParentButtonState(rowItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -417,6 +417,10 @@ namespace Lskj.Control
|
||||
/// 保存结果
|
||||
/// </summary>
|
||||
private bool SaveResults = false;
|
||||
/// <summary>
|
||||
/// 作为明细时对应的标签名
|
||||
/// </summary>
|
||||
public string TagName;
|
||||
|
||||
/// <summary>
|
||||
/// 点击搜索时,判断当前表的明细是否有修改或新增状态的行
|
||||
@@ -5183,4 +5187,43 @@ namespace Lskj.Control
|
||||
int focusedRowHandle = this.gcMain.GridView.FocusedRowHandle;
|
||||
GridColumn[] Columns = this.gcMain.GridView.GetSelectedCells(focusedRowHandle);//当前选中的单元格
|
||||
//判断是否为最后一行,最后一列
|
||||
if (Columns.Length > 0 && Columns[0].VisibleIndex == this.gcMain.GridView.Columns.Co
|
||||
if (Columns.Length > 0 && Columns[0].VisibleIndex == this.gcMain.GridView.Columns.Count - 1 && focusedRowHandle == this.gcMain.GridView.RowCount - 1)
|
||||
{
|
||||
this.AddGridViewRecord();
|
||||
}
|
||||
//判断表格是否为空
|
||||
if (this.gcMain.GridView.RowCount == 0)
|
||||
{
|
||||
this.AddGridViewRecord();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 切换时保存(作为明细页签被切换时)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public bool SaveWhenSwitching()
|
||||
{
|
||||
this.SaveResults = false;
|
||||
if (this.pl_buttom.Visible && this.btnSave.Visible && this.btnSave.Enabled)
|
||||
{
|
||||
this.OnSaveClick(null, null);
|
||||
}
|
||||
return SaveResults;
|
||||
}
|
||||
|
||||
|
||||
public void SelectTheSpecifiedRow()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(this.TagName) &&ParentGridEx!=null&&ParentGridEx.GridView.OptionsSelection.MultiSelect == true&& GridControlObj.GridView.OptionsSelection.MultiSelect == true&& this.ParentControlEx.
|
||||
@@ -526,6 +526,13 @@ namespace Lskj.Control
|
||||
if (model.IsCheck == 1)//加载复选框
|
||||
{
|
||||
GridDragGrid.GridAddCheckBox(gridEx.GridControlObj.GridView);
|
||||
|
||||
//判断父表格是否是复选框
|
||||
if (model.RecordDetailsCheckbox&& ParentGridEx!=null && ParentGridEx.GridView.OptionsSelection.MultiSelect == true)
|
||||
{
|
||||
gridEx.TagName = model.DetailName;
|
||||
gridEx.GridControlObj.GridView.SelectionChanged += GridView_SelectionChanged;
|
||||
}
|
||||
}
|
||||
if (model.LoadFilter)//加载筛选行
|
||||
{
|
||||
@@ -584,6 +591,58 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 主表和当前页签中表格配置了复选框时,记录当前页签表格的选中记录
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void GridView_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
|
||||
{
|
||||
DataRow FatherTableRow = this.ParentGridEx.GridView.GetFocusedDataRow();
|
||||
if (FatherTableRow == null) return;
|
||||
|
||||
XtraTabPage RefreshPage = this.xtc_container.SelectedTabPage;
|
||||
|
||||
Object moduleObject = RefreshPage.Controls.Cast<Object>().FirstOrDefault();
|
||||
if (moduleObject is ModuleGridEx)
|
||||
{
|
||||
ModuleGridEx moduleGridEx = moduleObject as ModuleGridEx;
|
||||
DataRow[] rowArray = moduleGridEx.GridControlObj.GetViewFocusedDataRows();
|
||||
string value = string.Empty;
|
||||
foreach (DataRow item in rowArray)
|
||||
{
|
||||
value += item[moduleGridEx.ParmaryKey] + ",";
|
||||
}
|
||||
value=value.Trim(',');
|
||||
GridDetailModel model = GetGridDetailModel(RefreshPage);
|
||||
|
||||
|
||||
if (ParentControlEx.DetailSelection.ContainsKey(model.DetailName))
|
||||
{
|
||||
Dictionary<DataRow, string> dictionary = ParentControlEx.DetailSelection[model.DetailName];
|
||||
if (dictionary.ContainsKey(FatherTableRow))
|
||||
{
|
||||
dictionary[FatherTableRow] = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
dictionary.Add(FatherTableRow, value);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<DataRow, string> dictionary = new Dictionary<DataRow, string>();
|
||||
dictionary.Add(FatherTableRow, value);
|
||||
ParentControlEx.DetailSelection.Add(model.DetailName, dictionary);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取数据源缓存
|
||||
/// </summary>
|
||||
@@ -1219,6 +1278,7 @@ namespace Lskj.Control
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
gridControl.SetGridViewDataSource(table);
|
||||
dataRowCount = gridControl.GridView.DataRowCount;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user