本文整理汇总了C#中Params.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Params.SetValue方法的具体用法?C# Params.SetValue怎么用?C# Params.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Params
的用法示例。
在下文中一共展示了Params.SetValue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _addRptParams
private static void _addRptParams(IDbConnection conn, String rptUID, Params prms, String userUID, String remoteIP) {
var v_prms = new Params();
v_prms.SetValue("p_rpt_uid", rptUID);
var v_sql = "begin xlr.clear_rparams(:p_rpt_uid); end;";
SQLCmd.ExecuteScript(conn, v_sql, v_prms, 120);
v_sql = "begin xlr.add_rparam(:p_rpt_uid, :p_prm_name, :p_prm_type, :p_prm_val, :p_usr_uid, :p_remote_ip); end;";
foreach (var v_prm in prms) {
v_prms.SetValue("p_prm_name", v_prm.Name);
String v_prmValue;
var v_prmTypeStr = "A";
if (v_prm.Value != null) {
var v_prmType = v_prm.ParamType ?? v_prm.Value.GetType();
if (Utl.TypeIsNumeric(v_prmType)) {
v_prmTypeStr = "N";
v_prmValue = "" + v_prm.Value;
v_prmValue = v_prmValue.Replace(",", ".");
} else if (v_prmType == typeof(DateTime)) {
v_prmTypeStr = "D";
v_prmValue = ((DateTime)v_prm.Value).ToString("yyyy.MM.dd HH:mm:ss");
} else
v_prmValue = "" + v_prm.Value;
} else
continue;
v_prms.SetValue("p_prm_type", v_prmTypeStr);
v_prms.SetValue("p_prm_val", v_prmValue);
v_prms.SetValue("p_usr_uid", userUID);
v_prms.SetValue("p_remote_ip", remoteIP);
SQLCmd.ExecuteScript(conn, v_sql, v_prms, 120);
}
}
示例2: _doOnAfterDBConnect
private void _doOnAfterDBConnect(Object sender, DBConnAfterEventArgs args) {
var v_sqlParams = new Params();
var v_sql = String.Format("begin {0}.set_context_value(:par_name, :par_value); end;", BIO_LOGIN_PKG);
if (this.CurUser != null) {
v_sqlParams.SetValue("par_name", this._getCtxParamName(BioDbSessionContextParams.UserUID));
v_sqlParams.SetValue("par_value", this.CurUser.UID);
SQLCmd.ExecuteScript(args.Connection, v_sql, v_sqlParams, DEFAULT_SQL_TIMEOUT);
v_sqlParams.SetValue("par_name", this._getCtxParamName(BioDbSessionContextParams.UserIP));
v_sqlParams.SetValue("par_value", this.CurUser.AddressIP);
SQLCmd.ExecuteScript(args.Connection, v_sql, v_sqlParams, DEFAULT_SQL_TIMEOUT);
v_sqlParams.SetValue("par_name", this._getCtxParamName(BioDbSessionContextParams.UserRoles));
v_sqlParams.SetValue("par_value", this.CurUser.Roles);
SQLCmd.ExecuteScript(args.Connection, v_sql, v_sqlParams, DEFAULT_SQL_TIMEOUT);
v_sqlParams.SetValue("par_name", this._getCtxParamName(BioDbSessionContextParams.OrgID));
v_sqlParams.SetValue("par_value", this.CurUser.OrgID);
SQLCmd.ExecuteScript(args.Connection, v_sql, v_sqlParams, DEFAULT_SQL_TIMEOUT);
}
v_sqlParams.SetValue("par_name", this._getCtxParamName(BioDbSessionContextParams.AppTitle));
v_sqlParams.SetValue("par_value", this.BioSysTitle);
SQLCmd.ExecuteScript(args.Connection, v_sql, v_sqlParams, DEFAULT_SQL_TIMEOUT);
}
示例3: Init
public void Init(
JsonStoreData packet,
Params bioParams,
JsonStoreFilter filter,
JsonStoreSort sorter,
String selection,
Int32 timeout
) {
this.rqPacket = packet;
this._rq_bioParams = bioParams;
this._rq_filter = filter;
this._rq_sorter = sorter;
this._rq_selection = selection;
if (this.rqPacket == null)
this.rqPacket = this._creJSData();
XmlElement SQLtext = detectSQLTextElement(this.CursorIniDoc, this.bioCode);
_applyParamsTypes((XmlElement)SQLtext.ParentNode, this.rqBioParams);
this.InitCursorFields();
if (this.rqBioParams == null)
this._rq_bioParams = new Params();
base.Init(SQLtext.InnerText, this.rqBioParams);
String vSQL = this.preparedSQL;
Boolean v_filterIsDefined = this._applyFilter(this._rq_filter, ref this._rq_bioParams, ref vSQL);
Boolean v_sorterIsDefined = this._applySorter(this._rq_sorter, ref vSQL);
if (String.IsNullOrEmpty(this._rq_selection)) {
JsonStoreFilter vLocate = (this.rqPacket != null) ? this.rqPacket.Locate : null;
if (vLocate != null) {
// ищем запрошенную запись
var v_min_start = vLocate.FromPosition;
String vSQLStr = null;
var v_lprms = new Params();
vLocate.BuildSQLConditions(ref vSQLStr, v_lprms);
if (!String.IsNullOrEmpty(vSQLStr))
vSQLStr = vSQLStr + " AND";
v_lprms = v_lprms.Merge(this.rqBioParams, true);
v_lprms.SetValue("loc_start_from", v_min_start);
vSQLStr = String.Format(csLocateNextSQLTemplate, vSQL, vSQLStr);
int rnum = Convert.ToInt32(SQLCmd.ExecuteScalarSQL(this.Connection, vSQLStr, v_lprms, timeout));
if (this.rqPacket.Limit > 0)
this.rqPacket.Start = Math.Max(((rnum - 1) / this.rqPacket.Limit) * this.rqPacket.Limit, 0);
}
this._applyPagging(this.rqPacket, !v_filterIsDefined && !v_sorterIsDefined, ref this._rq_bioParams, ref vSQL, timeout);
} else {
this._buildSelectSelectionSQL(this._rq_selection, this.rqBioParams, ref vSQL);
}
this.preparedSQL = vSQL;
}
示例4: _buildSelectSelectionSQL
/// <summary>
/// Возвращает запрос для выбора записей указанных в параметре selection
/// </summary>
/// <param name="selection"></param>
/// <param name="bioParams"></param>
/// <param name="vSQL"></param>
private void _buildSelectSelectionSQL(String selection, Params bioParams, ref String vSQL) {
String v_selection = selection;
if (!String.IsNullOrEmpty(v_selection) && this.PKFields.Count > 0) {
Boolean v_inversion = false;
String v_pks = null;
String[] v_parts = Utl.SplitString(v_selection, "||");
if (v_parts.Length == 1)
v_pks = v_parts[0];
else if (v_parts.Length == 2) {
v_inversion = String.Equals(v_parts[0], "1");
v_pks = v_parts[1];
}
if (!String.IsNullOrEmpty(v_pks)) {
var v_pk_fld = this.PKFields.FirstOrDefault().Value.FieldName;
String v_not = v_inversion ? "not " : null;
var v_cond = String.Format("{0} {1}in (select item from table(biosys.ai_utl.trans_list(:pklist4get, ';')))", v_pk_fld, v_not);
vSQL = String.Format("select * from ({0}) where {1}", vSQL, v_cond);
bioParams.SetValue("pklist4get", v_pks);
} else {
if (!v_inversion)
vSQL = String.Format("select * from ({0}) where 1=2", vSQL);
}
} else
vSQL = String.Format("select * from ({0}) where 1=2", vSQL);
}