public void UpdateDB(DBReply dbReply) { dbReply.Comment = Comment; dbReply.Created = Created; dbReply.AppUserId = AppUserID; dbReply.ReviewId = ReviewID; }
void HandleDBQueryBulk(DBQueryBulk dbQuery) { IDB2Storage store = Global.DB2Mgr.GetStorage(dbQuery.TableHash); if (store == null) { Log.outError(LogFilter.Network, "CMSG_DB_QUERY_BULK: {0} requested unsupported unknown hotfix type: {1}", GetPlayerInfo(), dbQuery.TableHash); return; } foreach (DBQueryBulk.DBQueryRecord record in dbQuery.Queries) { DBReply dbReply = new DBReply(); dbReply.TableHash = dbQuery.TableHash; dbReply.RecordID = record.RecordID; if (store.HasRecord(record.RecordID)) { dbReply.Allow = true; dbReply.Timestamp = (uint)GameTime.GetGameTime(); store.WriteRecord(record.RecordID, GetSessionDbcLocale(), dbReply.Data); } else { Log.outTrace(LogFilter.Network, "CMSG_DB_QUERY_BULK: {0} requested non-existing entry {1} in datastore: {2}", GetPlayerInfo(), record.RecordID, dbQuery.TableHash); dbReply.Timestamp = (uint)Time.UnixTime; } SendPacket(dbReply); } }
void HandleDBQueryBulk(DBQueryBulk dbQuery) { IDB2Storage store = Global.DB2Mgr.GetStorage(dbQuery.TableHash); foreach (DBQueryBulk.DBQueryRecord record in dbQuery.Queries) { DBReply dbReply = new DBReply(); dbReply.TableHash = dbQuery.TableHash; dbReply.RecordID = record.RecordID; if (store != null && store.HasRecord(record.RecordID)) { dbReply.Status = 1; dbReply.Timestamp = (uint)GameTime.GetGameTime(); store.WriteRecord(record.RecordID, GetSessionDbcLocale(), dbReply.Data); var optionalDataEntries = Global.DB2Mgr.GetHotfixOptionalData(dbQuery.TableHash, record.RecordID, GetSessionDbcLocale()); foreach (HotfixOptionalData optionalData in optionalDataEntries) { dbReply.Data.WriteUInt32(optionalData.Key); dbReply.Data.WriteBytes(optionalData.Data); } } else { Log.outTrace(LogFilter.Network, "CMSG_DB_QUERY_BULK: {0} requested non-existing entry {1} in datastore: {2}", GetPlayerInfo(), record.RecordID, dbQuery.TableHash); dbReply.Timestamp = (uint)Time.UnixTime; } SendPacket(dbReply); } }
public DBReply BatchNonQuery(ArrayList arSQL) { DBReply dr = new DBReply(); //SqlTransaction transaction = conn.BeginTransaction("BeginTransaction"); try { foreach (string strSQL in arSQL) { objCmd = new MySqlCommand(); objCmd.Connection = objConn; objCmd.Transaction = Trans; objCmd.CommandType = CommandType.Text; objCmd.CommandText = strSQL; dr.iUpdate_Count = objCmd.ExecuteNonQuery(); } Trans.Commit(); } catch (Exception ex) { Trans.Rollback(); dr.ex = ex; } return(dr); }
public DBReply QueryDS(String strSQL) //Query DataSet { DBReply dr = new DBReply(); try { MySqlDataAdapter dtAdapter = new MySqlDataAdapter(); objConn = new MySqlConnection(); objConn.ConnectionString = strConnString; objConn.Open(); objCmd = new MySqlCommand(); objCmd.Connection = objConn; objCmd.CommandText = strSQL; objCmd.CommandType = CommandType.Text; dtAdapter.SelectCommand = objCmd; dr.dsDataSet = new DataSet(); dtAdapter.Fill(dr.dsDataSet); } catch (Exception ex) { dr.ex = ex; } return(dr); }
public Reply(DBReply dbReply) { Comment = dbReply.Comment; Created = dbReply.Created; AppUserID = dbReply.AppUserId; ReviewID = dbReply.ReviewId; AppUser = new AppUser(dbReply.DBAppUser); Review = new Review(dbReply.DBReview); }
public IActionResult CreateReply([FromBody] JObject reply) { using (var context = new RevojiDataContext()) { DBReply dBReply = new DBReply(reply); context.Add(dBReply); context.Save(); return(Ok()); } }
public IActionResult DeleteReply(int id, int appUserId) { using (var context = new RevojiDataContext()) { DBReply dBReply = context.Replies .Where(l => l.ReviewId == id && l.AppUserId == appUserId) .FirstOrDefault(); if (dBReply == null) { return(new NotFoundResult()); } context.Remove(dBReply); context.Save(); return(Ok()); } }
public DBReply Query(string strSQL) //Query DataTable { DBReply dr = new DBReply(); try { MySqlDataAdapter dtAdapter; objConn = new MySqlConnection(); objConn.ConnectionString = strConnString; objConn.Open(); dtAdapter = new MySqlDataAdapter(strSQL, objConn); dr.dtDataTable = new DataTable(); dtAdapter.Fill(dr.dtDataTable); } catch (Exception ex) { dr.ex = ex; } return(dr); }