public static int Update(Minigame o) { int iReturn = -1; //assume the worst SqlParameter[] arrParams = new SqlParameter[23]; arrParams[0] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode())); arrParams[1] = new SqlParameter("@MiniGameType", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameType, o.MiniGameType.GetTypeCode())); arrParams[2] = new SqlParameter("@MiniGameTypeName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameTypeName, o.MiniGameTypeName.GetTypeCode())); arrParams[3] = new SqlParameter("@AdminName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode())); arrParams[4] = new SqlParameter("@GameName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.GameName, o.GameName.GetTypeCode())); arrParams[5] = new SqlParameter("@isActive", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.isActive, o.isActive.GetTypeCode())); arrParams[6] = new SqlParameter("@NumberPoints", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode())); arrParams[7] = new SqlParameter("@AwardedBadgeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AwardedBadgeID, o.AwardedBadgeID.GetTypeCode())); arrParams[8] = new SqlParameter("@Acknowledgements", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Acknowledgements, o.Acknowledgements.GetTypeCode())); arrParams[9] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())); arrParams[10] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())); arrParams[11] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())); arrParams[12] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())); arrParams[13] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())); arrParams[14] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())); arrParams[15] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())); arrParams[16] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())); arrParams[17] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())); arrParams[18] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())); arrParams[19] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())); arrParams[20] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())); arrParams[21] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())); arrParams[22] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())); try { iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Minigame_Update", arrParams); } catch (SqlException exx) { System.Diagnostics.Debug.Write(exx.Message); } return(iReturn); }
public static int Delete(Minigame o) { int iReturn = -1; //assume the worst SqlParameter[] arrParams = new SqlParameter[1]; arrParams[0] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode())); try { iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Minigame_Delete", arrParams); } catch (SqlException exx) { System.Diagnostics.Debug.Write(exx.Message); } return(iReturn); }
public void LoadControl() { if (PatronPointsID != "") { // Update: var o = PatronPoints.FetchObject(int.Parse(PatronPointsID)); AwardReasonCd.SelectedValue = o.AwardReasonCd.ToString(); AwardDate.Text = FormatHelper.ToNormalDate(o.AwardDate); NumPoints.Text = FormatHelper.ToInt(o.NumPoints); if (o.BadgeAwardedFlag) { pnlEditOnly.Visible = true; BadgeAwarded.Text = DAL.Badge.GetBadge(o.BadgeID).AdminName; } EventCode.Text = o.EventCode; if (o.isBookList) { pnlBook.Visible = true; } if (o.isEvent) { pnlEvent.Visible = true; } if (o.isGame) { pnlGame.Visible = true; } if (o.isGameLevelActivity) { pnlMini.Visible = true; var mg = Minigame.FetchObject(o.GameLevelActivityID); if (mg != null) { lblMGame.Text = mg.AdminName; } } } }
public static int InsertBaseOnly(Minigame o) { SqlParameter[] arrParams = new SqlParameter[23]; arrParams[0] = new SqlParameter("@MiniGameType", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameType, o.MiniGameType.GetTypeCode())); arrParams[1] = new SqlParameter("@MiniGameTypeName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameTypeName, o.MiniGameTypeName.GetTypeCode())); arrParams[2] = new SqlParameter("@AdminName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode())); arrParams[3] = new SqlParameter("@GameName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.GameName, o.GameName.GetTypeCode())); arrParams[4] = new SqlParameter("@isActive", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.isActive, o.isActive.GetTypeCode())); arrParams[5] = new SqlParameter("@NumberPoints", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode())); arrParams[6] = new SqlParameter("@AwardedBadgeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AwardedBadgeID, o.AwardedBadgeID.GetTypeCode())); arrParams[7] = new SqlParameter("@Acknowledgements", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Acknowledgements, o.Acknowledgements.GetTypeCode())); arrParams[8] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())); arrParams[9] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())); arrParams[10] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())); arrParams[11] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())); arrParams[12] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())); arrParams[13] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())); arrParams[14] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())); arrParams[15] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())); arrParams[16] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())); arrParams[17] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())); arrParams[18] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())); arrParams[19] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())); arrParams[20] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())); arrParams[21] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())); arrParams[22] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode())); arrParams[22].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Minigame_Insert", arrParams); o.MGID = int.Parse(arrParams[22].Value.ToString()); return(o.MGID); }
public static int InsertBaseOnly(Minigame o) { SqlParameter[] arrParams = new SqlParameter[23]; arrParams[0] = new SqlParameter("@MiniGameType", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameType, o.MiniGameType.GetTypeCode())); arrParams[1] = new SqlParameter("@MiniGameTypeName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameTypeName, o.MiniGameTypeName.GetTypeCode())); arrParams[2] = new SqlParameter("@AdminName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode())); arrParams[3] = new SqlParameter("@GameName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.GameName, o.GameName.GetTypeCode())); arrParams[4] = new SqlParameter("@isActive", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.isActive, o.isActive.GetTypeCode())); arrParams[5] = new SqlParameter("@NumberPoints", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode())); arrParams[6] = new SqlParameter("@AwardedBadgeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AwardedBadgeID, o.AwardedBadgeID.GetTypeCode())); arrParams[7] = new SqlParameter("@Acknowledgements", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Acknowledgements, o.Acknowledgements.GetTypeCode())); arrParams[8] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())); arrParams[9] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())); arrParams[10] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())); arrParams[11] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())); arrParams[12] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())); arrParams[13] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())); arrParams[14] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())); arrParams[15] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())); arrParams[16] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())); arrParams[17] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())); arrParams[18] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())); arrParams[19] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())); arrParams[20] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())); arrParams[21] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())); arrParams[22] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode())); arrParams[22].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Minigame_Insert", arrParams); o.MGID = int.Parse(arrParams[22].Value.ToString()); return o.MGID; }
public static int Insert(Minigame o) { SqlParameter[] arrParams = new SqlParameter[23]; arrParams[0] = new SqlParameter("@MiniGameType", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameType, o.MiniGameType.GetTypeCode())); arrParams[1] = new SqlParameter("@MiniGameTypeName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameTypeName, o.MiniGameTypeName.GetTypeCode())); arrParams[2] = new SqlParameter("@AdminName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode())); arrParams[3] = new SqlParameter("@GameName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.GameName, o.GameName.GetTypeCode())); arrParams[4] = new SqlParameter("@isActive", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.isActive, o.isActive.GetTypeCode())); arrParams[5] = new SqlParameter("@NumberPoints", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode())); arrParams[6] = new SqlParameter("@AwardedBadgeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AwardedBadgeID, o.AwardedBadgeID.GetTypeCode())); arrParams[7] = new SqlParameter("@Acknowledgements", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Acknowledgements, o.Acknowledgements.GetTypeCode())); arrParams[8] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())); arrParams[9] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())); arrParams[10] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())); arrParams[11] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())); arrParams[12] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())); arrParams[13] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())); arrParams[14] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())); arrParams[15] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())); arrParams[16] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())); arrParams[17] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())); arrParams[18] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())); arrParams[19] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())); arrParams[20] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())); arrParams[21] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())); arrParams[22] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode())); arrParams[22].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Minigame_Insert", arrParams); o.MGID = int.Parse(arrParams[22].Value.ToString()); if (o.MiniGameType == 1) { var o2 = new MGOnlineBook {MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate,LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 2) { var o2 = new MGMixAndMatch() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 3) { var o2 = new MGCodeBreaker() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 4) { var o2 = new MGWordMatch() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 5) { var o2 = new MGMatchingGame() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 6) { var o2 = new MGHiddenPic() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 7) { var o2 = new MGChooseAdv() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } return o.MGID; }
public static int Delete(Minigame o) { int iReturn = -1; //assume the worst SqlParameter[] arrParams = new SqlParameter[1]; arrParams[0] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode())); try { iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Minigame_Delete", arrParams); } catch (SqlException exx) { System.Diagnostics.Debug.Write(exx.Message); } return iReturn; }
public static int Update(Minigame o) { int iReturn = -1; //assume the worst SqlParameter[] arrParams = new SqlParameter[23]; arrParams[0] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode())); arrParams[1] = new SqlParameter("@MiniGameType", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameType, o.MiniGameType.GetTypeCode())); arrParams[2] = new SqlParameter("@MiniGameTypeName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameTypeName, o.MiniGameTypeName.GetTypeCode())); arrParams[3] = new SqlParameter("@AdminName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode())); arrParams[4] = new SqlParameter("@GameName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.GameName, o.GameName.GetTypeCode())); arrParams[5] = new SqlParameter("@isActive", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.isActive, o.isActive.GetTypeCode())); arrParams[6] = new SqlParameter("@NumberPoints", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode())); arrParams[7] = new SqlParameter("@AwardedBadgeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AwardedBadgeID, o.AwardedBadgeID.GetTypeCode())); arrParams[8] = new SqlParameter("@Acknowledgements", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Acknowledgements, o.Acknowledgements.GetTypeCode())); arrParams[9] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())); arrParams[10] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())); arrParams[11] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())); arrParams[12] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())); arrParams[13] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())); arrParams[14] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())); arrParams[15] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())); arrParams[16] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())); arrParams[17] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())); arrParams[18] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())); arrParams[19] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())); arrParams[20] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())); arrParams[21] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())); arrParams[22] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())); try { iReturn = SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Minigame_Update", arrParams); } catch (SqlException exx) { System.Diagnostics.Debug.Write(exx.Message); } return iReturn; }
public bool Fetch(int MGID) { // declare reader SqlDataReader dr; SqlParameter[] arrParams = new SqlParameter[1]; arrParams[0] = new SqlParameter("@MGID", MGID); dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, "app_Minigame_GetByID", arrParams); if (dr.Read()) { // declare return value Minigame result = new Minigame(); DateTime _datetime; int _int; //decimal _decimal; if (int.TryParse(dr["MGID"].ToString(), out _int)) this.MGID = _int; if (int.TryParse(dr["MiniGameType"].ToString(), out _int)) this.MiniGameType = _int; this.MiniGameTypeName = dr["MiniGameTypeName"].ToString(); this.AdminName = dr["AdminName"].ToString(); this.GameName = dr["GameName"].ToString(); this.isActive = bool.Parse(dr["isActive"].ToString()); if (int.TryParse(dr["NumberPoints"].ToString(), out _int)) this.NumberPoints = _int; if (int.TryParse(dr["AwardedBadgeID"].ToString(), out _int)) this.AwardedBadgeID = _int; this.Acknowledgements = dr["Acknowledgements"].ToString(); if (DateTime.TryParse(dr["LastModDate"].ToString(), out _datetime)) this.LastModDate = _datetime; this.LastModUser = dr["LastModUser"].ToString(); if (DateTime.TryParse(dr["AddedDate"].ToString(), out _datetime)) this.AddedDate = _datetime; this.AddedUser = dr["AddedUser"].ToString(); if (int.TryParse(dr["TenID"].ToString(), out _int)) this.TenID = _int; if (int.TryParse(dr["FldInt1"].ToString(), out _int)) this.FldInt1 = _int; if (int.TryParse(dr["FldInt2"].ToString(), out _int)) this.FldInt2 = _int; if (int.TryParse(dr["FldInt3"].ToString(), out _int)) this.FldInt3 = _int; this.FldBit1 = bool.Parse(dr["FldBit1"].ToString()); this.FldBit2 = bool.Parse(dr["FldBit2"].ToString()); this.FldBit3 = bool.Parse(dr["FldBit3"].ToString()); this.FldText1 = dr["FldText1"].ToString(); this.FldText2 = dr["FldText2"].ToString(); this.FldText3 = dr["FldText3"].ToString(); dr.Close(); return true; } dr.Close(); return false; }
public static int Insert(Minigame o) { SqlParameter[] arrParams = new SqlParameter[23]; arrParams[0] = new SqlParameter("@MiniGameType", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameType, o.MiniGameType.GetTypeCode())); arrParams[1] = new SqlParameter("@MiniGameTypeName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MiniGameTypeName, o.MiniGameTypeName.GetTypeCode())); arrParams[2] = new SqlParameter("@AdminName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AdminName, o.AdminName.GetTypeCode())); arrParams[3] = new SqlParameter("@GameName", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.GameName, o.GameName.GetTypeCode())); arrParams[4] = new SqlParameter("@isActive", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.isActive, o.isActive.GetTypeCode())); arrParams[5] = new SqlParameter("@NumberPoints", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.NumberPoints, o.NumberPoints.GetTypeCode())); arrParams[6] = new SqlParameter("@AwardedBadgeID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AwardedBadgeID, o.AwardedBadgeID.GetTypeCode())); arrParams[7] = new SqlParameter("@Acknowledgements", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.Acknowledgements, o.Acknowledgements.GetTypeCode())); arrParams[8] = new SqlParameter("@LastModDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModDate, o.LastModDate.GetTypeCode())); arrParams[9] = new SqlParameter("@LastModUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.LastModUser, o.LastModUser.GetTypeCode())); arrParams[10] = new SqlParameter("@AddedDate", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedDate, o.AddedDate.GetTypeCode())); arrParams[11] = new SqlParameter("@AddedUser", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.AddedUser, o.AddedUser.GetTypeCode())); arrParams[12] = new SqlParameter("@TenID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.TenID, o.TenID.GetTypeCode())); arrParams[13] = new SqlParameter("@FldInt1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt1, o.FldInt1.GetTypeCode())); arrParams[14] = new SqlParameter("@FldInt2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt2, o.FldInt2.GetTypeCode())); arrParams[15] = new SqlParameter("@FldInt3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldInt3, o.FldInt3.GetTypeCode())); arrParams[16] = new SqlParameter("@FldBit1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit1, o.FldBit1.GetTypeCode())); arrParams[17] = new SqlParameter("@FldBit2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit2, o.FldBit2.GetTypeCode())); arrParams[18] = new SqlParameter("@FldBit3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldBit3, o.FldBit3.GetTypeCode())); arrParams[19] = new SqlParameter("@FldText1", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText1, o.FldText1.GetTypeCode())); arrParams[20] = new SqlParameter("@FldText2", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText2, o.FldText2.GetTypeCode())); arrParams[21] = new SqlParameter("@FldText3", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.FldText3, o.FldText3.GetTypeCode())); arrParams[22] = new SqlParameter("@MGID", GRA.SRP.Core.Utilities.GlobalUtilities.DBSafeValue(o.MGID, o.MGID.GetTypeCode())); arrParams[22].Direction = ParameterDirection.Output; SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, "app_Minigame_Insert", arrParams); o.MGID = int.Parse(arrParams[22].Value.ToString()); if (o.MiniGameType == 1) { var o2 = new MGOnlineBook { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 2) { var o2 = new MGMixAndMatch() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 3) { var o2 = new MGCodeBreaker() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 4) { var o2 = new MGWordMatch() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 5) { var o2 = new MGMatchingGame() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 6) { var o2 = new MGHiddenPic() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } if (o.MiniGameType == 7) { var o2 = new MGChooseAdv() { MGID = o.MGID, AddedDate = o.AddedDate, AddedUser = o.AddedUser, LastModDate = o.LastModDate, LastModUser = o.LastModUser }; o2.Insert(); } return(o.MGID); }
public bool Fetch(int MGID) { // declare reader SqlDataReader dr; SqlParameter[] arrParams = new SqlParameter[1]; arrParams[0] = new SqlParameter("@MGID", MGID); dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, "app_Minigame_GetByID", arrParams); if (dr.Read()) { // declare return value Minigame result = new Minigame(); DateTime _datetime; int _int; //decimal _decimal; if (int.TryParse(dr["MGID"].ToString(), out _int)) { this.MGID = _int; } if (int.TryParse(dr["MiniGameType"].ToString(), out _int)) { this.MiniGameType = _int; } this.MiniGameTypeName = dr["MiniGameTypeName"].ToString(); this.AdminName = dr["AdminName"].ToString(); this.GameName = dr["GameName"].ToString(); this.isActive = bool.Parse(dr["isActive"].ToString()); if (int.TryParse(dr["NumberPoints"].ToString(), out _int)) { this.NumberPoints = _int; } if (int.TryParse(dr["AwardedBadgeID"].ToString(), out _int)) { this.AwardedBadgeID = _int; } this.Acknowledgements = dr["Acknowledgements"].ToString(); if (DateTime.TryParse(dr["LastModDate"].ToString(), out _datetime)) { this.LastModDate = _datetime; } this.LastModUser = dr["LastModUser"].ToString(); if (DateTime.TryParse(dr["AddedDate"].ToString(), out _datetime)) { this.AddedDate = _datetime; } this.AddedUser = dr["AddedUser"].ToString(); if (int.TryParse(dr["TenID"].ToString(), out _int)) { this.TenID = _int; } if (int.TryParse(dr["FldInt1"].ToString(), out _int)) { this.FldInt1 = _int; } if (int.TryParse(dr["FldInt2"].ToString(), out _int)) { this.FldInt2 = _int; } if (int.TryParse(dr["FldInt3"].ToString(), out _int)) { this.FldInt3 = _int; } this.FldBit1 = bool.Parse(dr["FldBit1"].ToString()); this.FldBit2 = bool.Parse(dr["FldBit2"].ToString()); this.FldBit3 = bool.Parse(dr["FldBit3"].ToString()); this.FldText1 = dr["FldText1"].ToString(); this.FldText2 = dr["FldText2"].ToString(); this.FldText3 = dr["FldText3"].ToString(); dr.Close(); return(true); } dr.Close(); return(false); }
protected void DvItemCommand(object sender, DetailsViewCommandEventArgs e) { string returnURL = "~/ControlRoom/Modules/Setup/MinigameList.aspx"; if (e.CommandName.ToLower() == "back") { Response.Redirect(returnURL); } //if (e.CommandName.ToLower() == "refresh") //{ // try // { // odsData.DataBind(); // dv.DataBind(); // dv.ChangeMode(DetailsViewMode.Edit); // var masterPage = (IControlRoomMaster)Master; // if (masterPage != null) masterPage.PageMessage = SRPResources.RefreshOK; // } // catch (Exception ex) // { // var masterPage = (IControlRoomMaster)Master; // masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message); // } //} if (e.CommandName.ToLower() == "add" || e.CommandName.ToLower() == "addandback") { try { var obj = new Minigame(); obj.MiniGameType = FormatHelper.SafeToInt(((DropDownList) ((DetailsView) sender).FindControl("MiniGameType")).SelectedValue); obj.MiniGameTypeName = ((DropDownList) ((DetailsView) sender).FindControl("MiniGameType")).SelectedItem.Text; obj.AdminName = ((TextBox)((DetailsView)sender).FindControl("AdminName")).Text; obj.GameName = ((TextBox)((DetailsView)sender).FindControl("GameName")).Text; obj.isActive = ((CheckBox)((DetailsView)sender).FindControl("isActive")).Checked; obj.NumberPoints = FormatHelper.SafeToInt(((TextBox)((DetailsView)sender).FindControl("NumberPoints")).Text); obj.AwardedBadgeID = FormatHelper.SafeToInt(((DropDownList) ((DetailsView) sender).FindControl("AwardedBadgeID")).SelectedValue); obj.AddedDate = DateTime.Now; obj.AddedUser = ((SRPUser)Session[SessionData.UserProfile.ToString()]).Username; //"N/A"; // Get from session obj.LastModDate = obj.AddedDate; obj.LastModUser = obj.AddedUser; if (obj.IsValid(BusinessRulesValidationMode.INSERT)) { obj.Insert(); Cache[CacheKey.AdventuresActive] = true; if (e.CommandName.ToLower() == "addandback") { Response.Redirect(returnURL); } //lblPK.Text = obj.MGID.ToString(); Session["MGID"] = obj.MGID; Response.Redirect(Minigame.GetEditPage(obj.MiniGameType)); //odsData.DataBind(); //dv.DataBind(); //dv.ChangeMode(DetailsViewMode.Edit); //var masterPage = (IControlRoomMaster)Master; //masterPage.PageMessage = SRPResources.AddedOK; } else { var masterPage = (IControlRoomMaster)Master; string message = String.Format(SRPResources.ApplicationError1, "<ul>"); foreach (BusinessRulesValidationMessage m in obj.ErrorCodes) { message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage); } message = string.Format("{0}</ul>", message); masterPage.PageError = message; } } catch (Exception ex) { var masterPage = (IControlRoomMaster)Master; masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message); } } //if (e.CommandName.ToLower() == "save" || e.CommandName.ToLower() == "saveandback") //{ // try // { // var obj = new Minigame(); // int pk = int.Parse(((DetailsView)sender).Rows[0].Cells[1].Text); // obj.Fetch(pk); // //obj.MiniGameType = FormatHelper.SafeToInt(((DropDownList) ((DetailsView) sender).FindControl("MiniGameType")).SelectedValue); // obj.MiniGameType = FormatHelper.SafeToInt(((TextBox)((DetailsView)sender).FindControl("MiniGameType")).Text); // obj.MiniGameTypeName = ((TextBox)((DetailsView)sender).FindControl("MiniGameTypeName")).Text; // obj.AdminName = ((TextBox)((DetailsView)sender).FindControl("AdminName")).Text; // obj.GameName = ((TextBox)((DetailsView)sender).FindControl("GameName")).Text; // obj.isActive = ((CheckBox)((DetailsView)sender).FindControl("isActive")).Checked; // //obj.NumberPoints = FormatHelper.SafeToInt(((DropDownList) ((DetailsView) sender).FindControl("NumberPoints")).SelectedValue); // obj.NumberPoints = FormatHelper.SafeToInt(((TextBox)((DetailsView)sender).FindControl("NumberPoints")).Text); // //obj.AwardedBadgeID = FormatHelper.SafeToInt(((DropDownList) ((DetailsView) sender).FindControl("AwardedBadgeID")).SelectedValue); // obj.AwardedBadgeID = FormatHelper.SafeToInt(((TextBox)((DetailsView)sender).FindControl("AwardedBadgeID")).Text); // obj.LastModDate = DateTime.Now; // obj.LastModUser = ((SRPUser)Session[SessionData.UserProfile.ToString()]).Username; //"N/A"; // Get from session // if (obj.IsValid(BusinessRulesValidationMode.UPDATE)) // { // obj.Update(); // if (e.CommandName.ToLower() == "saveandback") // { // Response.Redirect(returnURL); // } // odsData.DataBind(); // dv.DataBind(); // dv.ChangeMode(DetailsViewMode.Edit); // var masterPage = (IControlRoomMaster)Master; // masterPage.PageMessage = SRPResources.SaveOK; // } // else // { // var masterPage = (IControlRoomMaster)Master; // string message = String.Format(SRPResources.ApplicationError1, "<ul>"); // foreach (BusinessRulesValidationMessage m in obj.ErrorCodes) // { // message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage); // } // message = string.Format("{0}</ul>", message); // masterPage.PageError = message; // } // } // catch (Exception ex) // { // var masterPage = (IControlRoomMaster)Master; // masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message); // } //} }
protected void GvRowCommand(object sender, GridViewCommandEventArgs e) { string editpage = "~/ControlRoom/Modules/Setup/MinigameAddEdit.aspx"; if (e.CommandName.ToLower() == "addrecord") { Session["MGID"]= string.Empty; Response.Redirect(editpage); } if (e.CommandName.ToLower() == "editrecord") { int key = Convert.ToInt32(e.CommandArgument); var obj = Minigame.FetchObject(key); //Response.Redirect(Minigame.GetEditPage(obj.MiniGameType) + "?PK=" + obj.MGID.ToString()); Session["MGID"] = obj.MGID; Response.Redirect(Minigame.GetEditPage(obj.MiniGameType)); } if (e.CommandName.ToLower() == "deleterecord") { var key = Convert.ToInt32(e.CommandArgument); try { var obj = new Minigame(); if (obj.IsValid(BusinessRulesValidationMode.DELETE)) { Minigame.FetchObject(key).Delete(); LoadData(); var masterPage = (IControlRoomMaster)Master; if (masterPage != null) masterPage.PageMessage = SRPResources.DeleteOK; } else { var masterPage = (IControlRoomMaster)Master; string message = String.Format(SRPResources.ApplicationError1, "<ul>"); foreach (BusinessRulesValidationMessage m in obj.ErrorCodes) { message = string.Format(String.Format("{0}<li>{{0}}</li>", message), m.ErrorMessage); } message = string.Format("{0}</ul>", message); if (masterPage != null) masterPage.PageError = message; } } catch (Exception ex) { var masterPage = (IControlRoomMaster)Master; if (masterPage != null) masterPage.PageError = String.Format(SRPResources.ApplicationError1, ex.Message); } } }