private void GetLoyaltyInfoFromDB(LoyaltyItem loyaltyItem) { SqlSelect sql = new SqlSelect("RETAILLOYALTYMSRCARDTABLE M " + "INNER JOIN RETAILLOYALTYCUSTTABLE C ON M.LOYALTYCUSTID = C.LOYALTYCUSTID " + "INNER JOIN RETAILLOYALTYSCHEMESTABLE S ON S.LOYALTYSCHEMEID = M.LOYALTYSCHEMEID "); sql.Select("M.LOYALTYSCHEMEID"); sql.Select("M.LOYALTYCUSTID"); sql.Select("ACCOUNTNUM"); sql.Select("EXPIRATIONTIMEUNIT"); sql.Select("EXPIRATIONTIMEVALUE"); sql.Where("M.DATAAREAID", Application.Settings.Database.DataAreaID, true); sql.Where("M.CARDNUMBER", loyaltyItem.LoyaltyCardNumber, true); // Sale Unit of Measure DataTable dataTable = new DBUtil(Application.Settings.Database.Connection).GetTable(sql); if (dataTable.Rows.Count > 0) { loyaltyItem.SchemeID = Utility.ToString(dataTable.Rows[0]["LOYALTYSCHEMEID"]); loyaltyItem.LoyaltyCustID = Utility.ToString(dataTable.Rows[0]["LOYALTYCUSTID"]); loyaltyItem.CustID = Utility.ToString(dataTable.Rows[0]["ACCOUNTNUM"]); loyaltyItem.ExpireUnit = Utility.ToInt(dataTable.Rows[0]["EXPIRATIONTIMEUNIT"]); loyaltyItem.ExpireValue = Utility.ToInt(dataTable.Rows[0]["EXPIRATIONTIMEVALUE"]); } }
private DataTable GetLoyaltyPointsSchemeFromDB(string schemeID) { try { SqlSelect sqlSelect = new SqlSelect("RETAILLOYALTYPOINTSTABLE"); sqlSelect.Select("*"); sqlSelect.Where("LOYALTYSCHEMEID", schemeID, true); sqlSelect.Where("DATAAREAID", Application.Settings.Database.DataAreaID, true); return(new DBUtil(Application.Settings.Database.Connection).GetTable(sqlSelect)); } catch (Exception ex) { NetTracer.Warning(ex, "Loyalty::GetLoyaltyPointsSchemeFromDB failed for schemeID {0}. Returning null.", schemeID); return(null); } }
private string GetComponent() { SqlSelect sqlSelect = new SqlSelect("TAXTABLE T1 left join TAXCOMPONENTTABLE_IN T2 on T1.TAXCOMPONENTTABLE_IN=T2.RECID"); sqlSelect.Select("ISNULL(T2.COMPONENT, '') as TAX_COMPONENT"); sqlSelect.Where("T1.TAXCODE", Code, true); DBUtil dbUtil = new DBUtil(ApplicationSettings.Database.LocalConnection); DataTable dt = dbUtil.GetTable(sqlSelect); return(dt.Rows.Count > 0 ? dt.Rows[0]["TAX_COMPONENT"].ToString() : String.Empty); }
private DataRow GetRetailGroupLineMember(Int64 recId) { try { SqlSelect sqlSelect = new SqlSelect("RETAILGROUPMEMBERLINE"); sqlSelect.Select("*"); sqlSelect.Where("RECID", recId, true); DataTable groupLineMember = new DBUtil(Application.Settings.Database.Connection).GetTable(sqlSelect); if (groupLineMember.Rows.Count == 1) { return(groupLineMember.Rows[0]); } else { return(null); } } catch (Exception ex) { NetTracer.Warning(ex, "Loyalty::GetRetailGroupLineMember failed for recId {0}. Returning null.", recId); return(null); } }