private string GetCodeInfo(string id, out string cop, out int counter) { cop = ""; counter = -1; if (!string.IsNullOrEmpty(id)) { string strSQL = "select * from thc_codes where cid='" + id + "'"; DB.DataBaseControl dbCtl = new DB.DataBaseControl(); dbCtl.Open(); System.Data.IDataReader dataReader = dbCtl.GetReader(strSQL, null); string strResult = ""; if (dataReader.Read()) { strResult = dataReader["link"].ToString().Trim(); cop = dataReader["cop"].ToString().Trim(); counter = int.Parse(dataReader["counter"].ToString()); } dataReader.Close(); if (cop.Length > 0) { strSQL = "update thc_codes set counter=counter+1 where cid='" + id + "'"; dbCtl.ExecuteCommad(strSQL, null); counter++; } dbCtl.Close(); return(strResult); } else { return(""); } }
public static void RefreshRewardType() { rwdTypes.Clear(); DB.DataBaseControl dbCtl = new DB.DataBaseControl(); string strSQL = "select * from reward_type order by RT001,RT003"; try { dbCtl.Open(); DataTable rwdTable = dbCtl.GetDataTable(strSQL, null); DataTable keyTable = rwdTable.DefaultView.ToTable(true, "RT001"); DataRow[] proRows; foreach (DataRow keyRow in keyTable.Rows) { proRows = rwdTable.Select("RT001=" + keyRow[0].ToString()); NameValueCollection proPair = new NameValueCollection(proRows.Length); for (short i = 0; i < proRows.Length; i++) { proPair.Add(proRows[i]["RT004"].ToString(), proRows[i]["RT002"].ToString()); } rwdTypes.Add(short.Parse(keyRow[0].ToString()), proPair); } } catch (Exception ex) { //error.Number = 900001; //error.ErrorMessage = ex.ToString(); } finally { dbCtl.Close(); } }
private string GetCodeInfo(string id) { if (!string.IsNullOrEmpty(id)) { string strSQL = "select * from codes where cid='" + id + "'"; DB.DataBaseControl dbCtl = new DB.DataBaseControl(); dbCtl.Open(); System.Data.IDataReader dataReader = dbCtl.GetReader(strSQL, null); string strResult = ""; if (dataReader.Read()) { strResult = dataReader["link"].ToString().Trim(); } dataReader.Close(); dbCtl.Close(); return(strResult); } else { return(""); } }