private bool IsBillLocked(DbContext conn, string branchCode, int billType, long billId) { return(conn.ExistsPrimitive($"SELECT 'Y' FROM {BillLockTableName} where FBranchCode=#BranchCode# and FBillType=#BillType# and FBillId=#BillId#", RequestBase.FromKV("BranchCode", branchCode) .SetValue("BillType", billType) .SetValue("BillId", billId))); }
/// <summary> /// 是否存在相应的主键 /// </summary> /// <param name="Conn"></param> /// <param name="TableName"></param> /// <param name="dr"></param> /// <param name="keyFields"></param> /// <param name="pars"></param> /// <param name="ConnType"></param> /// <returns></returns> private static bool ExistsDataRow(DbContext connInfo, string TableName, DataRow dr, string[] keyFields, RequestBase pars) { StringBuilder strbld = new StringBuilder(256); strbld.AppendFormat("select 'Y' From {0} where ", TableName); int count = keyFields.Length; //pars.Clear(); for (int i = 0; i < count; i++) { if (0 != i) { strbld.Append(" and "); } string fieldName = keyFields[i]; object obj = null; strbld.AppendFormat(" {0}={1} ", fieldName, connInfo.TreatParaName(fieldName)); obj = GetDataFieldValue(dr[fieldName], connInfo.DbType); pars.SetValue(fieldName, obj); } return(connInfo.ExistsPrimitive(strbld.ToString(), pars)); }
public bool IsExists() { return(_connInfo.ExistsPrimitive(GetSql(), param)); }