private async Task ShowPerDiem(IDialogContext context, Location storloc) { string imageurl = await BingQuery.GetImageURL(storloc); HeroCard addcard = await CardController.AddressCard(storloc, imageurl); Attachment adattach = addcard.ToAttachment(); var cmessage = context.MakeMessage(); cmessage.Attachments.Add(adattach); await context.PostAsync(cmessage); if (storloc.Address.CountryRegionIso2.ToLower().Contains("us")) { Double mealrate = await PQuery.GetMealLoc(storloc.Address); string drate = String.Format("{0:C}", Convert.ToInt32(mealrate)); string dtrate = String.Format("{0:C}", Convert.ToInt32((mealrate * .75))); await context.PostAsync($"Daily meal rate: Full Day - {drate} and Travel Day - {dtrate}"); } else { await context.PostAsync("Sorry international locations are not currently supported for Per Diem!"); } }
public bool Insert(PQuery pQuery) { try { if (pQuery.IDQuery == -1) { pQuery.IDQuery = ConcreteDb.Instance.getNextSysId("SystemQuery"); } string SQL = ""; if (pQuery.QueryString == "") { pQuery.QueryString = "Empty"; } SQL += "INSERT INTO SystemQuery VALUES ("; SQL += pQuery.IDQuery + ","; SQL += "'" + pQuery.QueryName + "'" + ","; SQL += "'" + pQuery.QueryString + "'"; SQL += " );"; if (!(ConcreteDb.Instance.Update(SQL) > 0)) { throw new Exception(ConcreteDb.Instance.errorMessage); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Notification"); return(false); } return(true); }
public IList <PQuery> getAllQuery() { var probQueries = new List <PQuery>(); DataSet dts = dts = new DataSet(); try { dts.Tables.Add(ConcreteDb.Instance.getDataTable("SELECT * FROM SystemQuery", "system_query")); foreach (DataRow queryRow in dts.Tables["system_query"].Rows) { var NewQuery = new PQuery(); NewQuery.IDQuery = Convert.ToInt16(queryRow[0].ToString()); NewQuery.QueryName = queryRow[1].ToString(); if (queryRow[2].ToString() != "Empty") { NewQuery.QueryString = queryRow[2].ToString(); } else { NewQuery.QueryString = ""; } probQueries.Add(NewQuery); } } catch { } return(probQueries); }
public int Update(PQuery pQuery) { string SQL = ""; SQL += "Update SystemQuery SET "; SQL += " QueryName = '" + pQuery.QueryName + "'"; SQL += " , QueryString = '" + pQuery.QueryString.Replace("'", "''") + "'"; SQL += " Where ID = " + pQuery.IDQuery; return(ConcreteDb.Instance.Update(SQL)); }
public bool DeleteById(PQuery pQuery) { try { if (!(ConcreteDb.Instance.Update("DELETE FROM SystemQuery where ID = " + pQuery.IDQuery) > 0)) { throw new Exception(ConcreteDb.Instance.errorMessage); } } catch (Exception ex) { MessageBox.Show(ex.Message, ContantCls.lblNotice, MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } return(true); }
public IList <PQuery> getQueryByName(PQuery pQuery) { var dts = new DataSet(); dts.Tables.Add(ConcreteDb.Instance.getDataTable("SELECT * FROM SystemQuery where QueryName = '" + pQuery.QueryName + "'", "system_query")); var queryList = new List <PQuery>(); foreach (DataRow queryRow in dts.Tables["system_query"].Rows) { var newQuery = new PQuery(); newQuery.IDQuery = Convert.ToInt16(queryRow[0].ToString()); newQuery.QueryName = queryRow[1].ToString(); newQuery.QueryString = queryRow[2].ToString(); queryList.Add(newQuery); } return(queryList); }