public void GetData(CDTData ParentData) { ConditionForPackage(); string extrasql = string.Empty; if (_drTable.Table.Columns.Contains("ExtraSql")) { if (_drTable["ExtraSql"] != null) { extrasql = _drTable["Extrasql"].ToString(); } } string queryData = "select * from " + _drTable["TableName"].ToString(); if (_condition != string.Empty && !(_condition.Contains("@"))) { queryData += " where " + _condition; if (extrasql != string.Empty) { queryData += " and (" + extrasql + ")"; } } else if (extrasql != string.Empty) { queryData += " where " + extrasql; } string lkCondition = GenConditionForLookup(ParentData); if (lkCondition != string.Empty) { if ((_condition == string.Empty && extrasql == string.Empty) || (_condition != string.Empty && _condition.Contains("@"))) { queryData += " where " + lkCondition; } else { queryData += " and ( " + lkCondition + ")"; } } if (_drTable["SortOrder"].ToString() != string.Empty) { queryData += " order by " + DrTable["SortOrder"].ToString(); } DsData = DbData.GetDataSet(queryData); if (DsData != null) { DsData.Tables[0].TableName = _drTable["TableName"].ToString(); _dsDataTmp = DsData.Copy(); } }
public override void GetData() { ConditionForPackage(); string extrasql = string.Empty; //xét trường hợp phân toàn quyền // string extraWs = string.Empty; if (DrTable["sysUserID"] != null) { string adminList = DrTable["sysUserID"].ToString().Trim(); if (adminList != string.Empty) { if (adminList != Config.GetValue("sysUserID").ToString().Trim()) { string dk = NotAdminListCondition(); dk = UpdateSpecialCondition(dk); extraWs = " (charindex('_" + Config.GetValue("sysUserID").ToString().Trim() + "_',ws)>0 or charindex('_" + Config.GetValue("sysUserGroupID").ToString().Trim() + "_',Grws)>0)"; if (dk != string.Empty) { extraWs += " or " + dk; } extraWS = dk; } } } // if (_drTable.Table.Columns.Contains("ExtraSql")) { if (_drTable["ExtraSql"] != null) { extrasql = _drTable["Extrasql"].ToString(); } } if (extraWs != string.Empty) { if (extrasql == string.Empty) { extrasql = extraWs; } else { extrasql += " and (" + extraWs + ")"; } } string queryData = "select * from " + _drTable["TableName"].ToString(); if (_condition != string.Empty && !(_condition.Contains("@"))) { queryData += " where " + _condition; if (extrasql != string.Empty) { queryData += " and (" + extrasql + ")"; } } else { fullData = true; if (extrasql != string.Empty) { queryData += " where " + extrasql; } } if (_drTable["SortOrder"].ToString() != string.Empty) { queryData += " order by " + DrTable["SortOrder"].ToString(); } DsData = DbData.GetDataSet(queryData); if (DsData != null) { string fkName = _drTable["Pk"].ToString(); DsData.Tables[0].Columns[fkName].Unique = true; DsData.Tables[0].PrimaryKey = new DataColumn[] { DsData.Tables[0].Columns[fkName] }; DsData.Tables[0].TableName = _drTable["TableName"].ToString(); _dsDataTmp = DsData.Copy(); } if (DataSoureChanged != null && fullData) { DataSoureChanged(this, new EventArgs()); } }
public void GetData4Lookup() { ConditionForPackage(); string extrasql = string.Empty; //xét trường hợp phân toàn quyền // string extraWs = string.Empty; if (DrTable["sysUserID"] != null) { string adminList = DrTable["sysUserID"].ToString().Trim(); if (adminList != string.Empty) { if (adminList != Config.GetValue("sysUserID").ToString().Trim()) { string dk = NotAdminListCondition(); dk = UpdateSpecialCondition(dk); extraWs = "( ws like '%_" + Config.GetValue("sysUserID").ToString().Trim() + "_%' or Grws like '%_" + Config.GetValue("sysUserGroupID").ToString().Trim() + "_%')"; if (dk != string.Empty) { extraWs += " or " + dk; } extraWS = dk; } } } // if (_drTable.Table.Columns.Contains("ExtraSql")) { if (_drTable["ExtraSql"] != null) { extrasql = _drTable["Extrasql"].ToString(); } } if (extraWs != string.Empty) { if (extrasql == string.Empty) { extrasql = extraWs; } else { extrasql += " and (" + extraWs + ")"; } } string fieldList = "*"; if (DrTable.Table.Columns.Contains("RefFList") && DrTable["RefFList"] != DBNull.Value && DrTable["RefFList"].ToString() != string.Empty) { fieldList = DrTable["RefFList"].ToString(); } string queryData = "select " + fieldList + " from " + _drTable["TableName"].ToString() + " (nolock) "; if (_condition != string.Empty && !(_condition.Contains("@"))) { queryData += " where " + _condition; if (extrasql != string.Empty) { queryData += " and (" + extrasql + ")"; } } else { fullData = true; if (extrasql != string.Empty) { queryData += " where " + extrasql; } } if (_drTable["SortOrder"].ToString() != string.Empty) { queryData += " order by " + DrTable["SortOrder"].ToString(); } DsData = DbData.GetDataSet(queryData); if (DsData != null) { string fkName = _drTable["Pk"].ToString(); if (DsData.Tables[0].Columns[fkName].DataType != typeof(int)) { DsData.Tables[0].Columns[fkName].Unique = true; DsData.Tables[0].PrimaryKey = new DataColumn[] { DsData.Tables[0].Columns[fkName] }; } DsData.Tables[0].TableName = _drTable["TableName"].ToString(); //_dsDataTmp = DsData.Copy(); } if (DataSoureChanged != null && fullData) { DataSoureChanged(this, new EventArgs()); } }
public override void GetData() { ConditionForPackage(); string extrasql = string.Empty; //xét trường hợp phân toàn quyền // string extraWs = string.Empty; if (DrTable["sysUserID"] != null) { string adminList = DrTable["sysUserID"].ToString().Trim(); if (adminList != string.Empty) { if (adminList != Config.GetValue("sysUserID").ToString().Trim()) { string dk = NotAdminListCondition(); extraWs = " charindex('" + Config.GetValue("sysUserID").ToString().Trim() + "_',ws)>0"; if (dk != string.Empty) { extraWs += " or " + dk; } extraWS = dk; } } } // if (_drTable.Table.Columns.Contains("ExtraSql")) { if (_drTable["ExtraSql"] != null) { extrasql = _drTable["Extrasql"].ToString(); } } if (extraWs != string.Empty) { if (extrasql == string.Empty) { extrasql = extraWs; } else { extrasql += " and " + extraWs; } } string queryData = "select * from " + _drTable["TableName"].ToString(); if (_condition != string.Empty && !(_condition.Contains("@"))) { queryData += " where " + _condition; if (extrasql != string.Empty) { queryData += " and (" + extrasql + ")"; } } else { fullData = true; if (extrasql != string.Empty) { queryData += " where " + extrasql; } } if (_drTable["SortOrder"].ToString() != string.Empty) { queryData += " order by " + DrTable["SortOrder"].ToString(); } DsData = DbData.GetDataSet(queryData); if (DsData != null) { _dsDataTmp = DsData.Copy(); } }