public Boolean Save(string UserName, int UserID) { MethodBase lmth = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; Boolean blnReturn = false; try { SortedList slParams = new SortedList(); slParams.Add("@UserID", UserID); slParams.Add("@PlayerOccasionExceptionID", PlayerOccasionExceptionID); slParams.Add("@PlayerProfileID", PlayerProfileID); slParams.Add("@CampaignID", CampaignID); slParams.Add("@OccasionID", OccasionID); slParams.Add("@AttendPartial", AttendPartial); slParams.Add("@PlayerComments", PlayerComments); slParams.Add("@Comments", Comments); blnReturn = cUtilities.PerformNonQueryBoolean("uspInsUpdPLPlayerOccasionExceptions", slParams, "LARPortal", UserName); } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); blnReturn = false; } return(blnReturn); }
public static DataSet ReturnDataTableFromExcelWorksheet(string strSheetLocation, string strSheetName, string strUserName) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; DataSet dsUnUpdated = new DataSet(); try { IExcelDataReader iExcelDataReader = null; FileStream oStream = File.Open(strSheetLocation, FileMode.Open, FileAccess.Read); iExcelDataReader = ExcelReaderFactory.CreateBinaryReader(oStream); iExcelDataReader.IsFirstRowAsColumnNames = true; dsUnUpdated = iExcelDataReader.AsDataSet(); iExcelDataReader.Close(); } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, strUserName); throw; } return(dsUnUpdated); }
public cPlayerOccasionExceptions(Int32 intPlayerOcassionExceptionID, Int32 intPlayerProfileID, string UserName, Int32 UserID) { MethodBase lmth = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; PlayerOccasionExceptionID = intPlayerOcassionExceptionID; PlayerProfileID = intPlayerProfileID; SortedList slParams = new SortedList(); slParams.Add("@PlayerOccasionExceptionID", PlayerOccasionExceptionID); try { DataTable ldt = cUtilities.LoadDataTable("uspGetPlayerOccasionExceptionByID", slParams, "LarpPortal", UserName, lsRoutineName); if (ldt.Rows.Count > 0) { PlayerProfileID = ldt.Rows[0]["PlayerProfileID"].ToString().ToInt32(); CampaignID = ldt.Rows[0]["CampaignID"].ToString().ToInt32(); OccasionID = ldt.Rows[0]["OccasionID"].ToString().ToInt32(); AttendPartial = ldt.Rows[0]["AttendPartial"].ToString().ToBoolean(); PlayerComments = ldt.Rows[0]["PlayerComments"].ToString(); Comments = ldt.Rows[0]["Comments"].ToString(); DateAdded = Convert.ToDateTime(ldt.Rows[0]["DateAdded"].ToString()); DateChanged = Convert.ToDateTime(ldt.Rows[0]["DateChanged"].ToString()); } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); } }
public void Delete(string UserName, int UserID) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; if (RecordStatus == RecordStatuses.Active) { Save(UserName, UserID); } else { try { SortedList slParams = new SortedList(); slParams.Add("@UserID", UserID); slParams.Add("@RecordID", PlayerSkillID); cUtilities.PerformNonQuery("uspDelPLPlayerSkills", slParams, "LARPortal", UserName); } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); } } }
public Boolean Save() { MethodBase lmth = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; Boolean blnReturn = false; try { SortedList slParams = new SortedList(); slParams.Add("@UserID", _UserID); slParams.Add("@SitePolicyID", _SitePolicyID); slParams.Add("@SiteID", _SitePolicyID); slParams.Add("@PolicyID", _PolicyID); slParams.Add("@Policy", _Policy); slParams.Add("@Comments", _Comments); cUtilities.PerformNonQuery("Uspinsupdstsitepolicies", slParams, "LarpPortal", _UserName); blnReturn = true; } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, _UserName + lsRoutineName); } return(blnReturn); }
private void LoadEmails() { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; try { _PrimaryEmailAddress = new cEMail(_PrimaryEmailID, _LoginName, _UserID); _UserEmails = new List <cEMail>(); SortedList slParams = new SortedList(); slParams.Add("@intKeyID", _UserID); slParams.Add("@strKeyType", "MDBUsers"); DataTable ldt = cUtilities.LoadDataTable("uspGetEmailsByKeyInfo", slParams, "LARPortal", _LoginName, lsRoutineName); if (ldt.Rows.Count > 0) { foreach (DataRow ldr in ldt.Rows) { cEMail cPh = new cEMail(ldr["EmailID"].ToString().Trim().ToInt32(), _LoginName, _UserID); _UserEmails.Add(cPh); } } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, _LoginName + lsRoutineName); } }
public void Save(string UserName, int UserID) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; if (RecordStatus == RecordStatuses.Delete) { Delete(UserName, UserID); } else { try { SortedList slParams = new SortedList(); slParams.Add("@UserID", UserID); slParams.Add("@PlayerAffiliationID", PlayerAffiliationID); slParams.Add("@PlayerProfileID", PlayerProfileID); slParams.Add("@AffiliationName", AffiliationName); slParams.Add("@AffiliationRole", AffiliationRole); slParams.Add("@PlayerComments", PlayerComments); slParams.Add("@Comments", Comments); cUtilities.PerformNonQuery("uspInsUpdPLPlayerAffiliations", slParams, "LARPortal", UserName); } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); } } }
public void Delete(string UserName, int UserID) { MethodBase lmth = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; if (RecordStatus == RecordStatuses.Active) { Save(UserName, UserID); } else { try { SortedList slParams = new SortedList(); slParams.Add("@UserID", UserID); slParams.Add("@RecordID", PlayerInventoryID); cUtilities.PerformNonQuery("uspDelPLPlayerInventory", slParams, "LARPortal", UserName); } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); } } }
public cPlayerAffiliation(Int32 iPlayerAffilID, string sUserName, Int32 iUserID) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; PlayerAffiliationID = iPlayerAffilID; SortedList slParams = new SortedList(); slParams.Add("@PlayerAffiliationID", iPlayerAffilID); try { DataTable ldt = cUtilities.LoadDataTable("uspGetPlayerAffiliationByID", slParams, "LARPortal", sUserName, lsRoutineName); if (ldt.Rows.Count > 0) { AffiliationName = ldt.Rows[0]["AffiliationName"].ToString(); AffiliationRole = ldt.Rows[0]["AffiliationRole"].ToString(); PlayerComments = ldt.Rows[0]["PlayerComments"].ToString(); Comments = ldt.Rows[0]["Comments"].ToString(); int iTemp; if (int.TryParse(ldt.Rows[0]["PlayerProfileID"].ToString(), out iTemp)) { PlayerProfileID = iTemp; } RecordStatus = RecordStatuses.Active; } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, sUserName + lsRoutineName); } }
public static void LoadDropDownList(DropDownList ddlList, string strStoredProc, SortedList slParam, string strTextValue, string strDataValue, string strLConn, string strUserName, string strCallingRoutine) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; DataTable ldt = new DataTable(); try { ldt = LoadDataTable(strStoredProc, slParam, strLConn, strUserName, lsRoutineName + '-' + strCallingRoutine); if (ldt.Rows.Count > 0) { ddlList.DataSource = ldt; ddlList.DataTextField = strTextValue; ddlList.DataValueField = strDataValue; ddlList.DataBind(); } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, strUserName); throw; } finally { } }
private void LoadLocations() { MethodBase lmth = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; try { SortedList slParams = new SortedList(); // I use a sortedlist wich is a C# hash table to store the paramter and value slParams.Add("@SiteID", _SiteID); DataTable ldt = cUtilities.LoadDataTable("uspGetSiteLocationsBySiteID", slParams, "LarpPortal", _UserName, lsRoutineName); if (ldt.Rows.Count > 0) { foreach (DataRow ldr in ldt.Rows) { cLocation cAdd = new cLocation(ldr["LocationID"].ToString().Trim().ToInt32(), _UserID, _UserName); _Locations.Add(cAdd); } } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, _UserName + lsRoutineName); } }
private void LoadInventory(DataTable dtInventory) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; try { foreach (DataRow ldr in dtInventory.Rows) { cPlayerInventory cItem = new cPlayerInventory { ItemName = ldr["ItemName"].ToString(), Description = ldr["Description"].ToString(), InventoryTypeDesc = ldr["InventoryTypeDescription"].ToString(), Quantity = ldr["Quantity"].ToString(), Size = ldr["Size"].ToString(), PowerNeeded = ldr["PowerNeeded"].ToString(), Location = ldr["Location"].ToString(), InventoryNotes = ldr["InventoryNotes"].ToString(), ImageURL = ldr["ImageURL"].ToString(), PlayerComments = ldr["PlayerComments"].ToString(), Comments = ldr["Comments"].ToString() }; int iTemp; bool bTemp; if (int.TryParse(ldr["PlayerInventoryID"].ToString(), out iTemp)) { cItem.PlayerInventoryID = iTemp; } if (int.TryParse(ldr["PlayerProfileID"].ToString(), out iTemp)) { cItem.PlayerProfileID = iTemp; } if (int.TryParse(ldr["InventoryTypeID"].ToString(), out iTemp)) { cItem.InventoryTypeID = iTemp; } if (int.TryParse(ldr["ImageID"].ToString(), out iTemp)) { cItem.ImageID = iTemp; cItem.InvImage.Load(iTemp, ""); cItem.ImageURL = cItem.InvImage.PictureURL; } if (bool.TryParse(ldr["WillShare"].ToString(), out bTemp)) { cItem.WillShare = bTemp; } PlayerInventoryItems.Add(cItem); } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); } }
private void LoadAddresses() { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; _PrimaryAddress = new cAddress(_PrimaryAddressID, _LoginName, _UserID); try { SortedList slParams = new SortedList(); // I use a sortedlist wich is a C# hash table to store the paramter and value slParams.Add("@intKeyID", _UserID); slParams.Add("@strKeyType", "cUser"); DataTable ldt = cUtilities.LoadDataTable("uspGetAddressByKey", slParams, "LARPortal", _LoginName, lsRoutineName); _UserAddresses = new List <cAddress>(); if (ldt.Rows.Count > 0) { foreach (DataRow ldr in ldt.Rows) { cAddress cAdd = new cAddress(ldr["AddressID"].ToString().Trim().ToInt32(), _LoginName, _UserID); _UserAddresses.Add(cAdd); } } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, _LoginName + lsRoutineName); } }
public cSitePolicy(Int32 intSitePolicyID, Int32 intUserID, string strUserName) { MethodBase lmth = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; _SitePolicyID = intSitePolicyID; _UserID = intUserID; _UserName = strUserName; //so lets say we wanted to load data into this class from a sql query called uspGetSomeData thats take two paraeters @Parameter1 and @Parameter2 SortedList slParams = new SortedList(); // I use a sortedlist wich is a C# hash table to store the paramter and value slParams.Add("@intSitePolicyID", _SitePolicyID); try { DataTable ldt = cUtilities.LoadDataTable("uspGetSTSitePoliciesByID", slParams, "LarpPortal", _UserName, lsRoutineName); if (ldt.Rows.Count > 0) { _SiteID = ldt.Rows[0]["SiteID"].ToString().ToInt32(); _PolicyID = ldt.Rows[0]["PolicyID"].ToString().ToInt32(); _Policy = ldt.Rows[0]["Policy"].ToString(); _Comments = ldt.Rows[0]["Comments"].ToString().Trim(); _DateAdded = Convert.ToDateTime(ldt.Rows[0]["DateAdded"].ToString().ToString()); _DateChanged = Convert.ToDateTime(ldt.Rows[0]["DateChanged"].ToString().ToString()); } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, _UserName + lsRoutineName); } }
public cEmptyClass(string strParameter1, Int32 intParameter2, string strUserName) { MethodBase lmth = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; //so lets say we wanted to load data into this class from a sql query called uspGetSomeData thats take two paraeters @Parameter1 and @Parameter2 SortedList slParams = new SortedList(); // I use a sortedlist wich is a C# hash table to store the paramter and value slParams.Add("@Parameter1", strParameter1); slParams.Add("@Parameter2", intParameter2); try { DataTable ldt = cUtilities.LoadDataTable("uspGetSomeData", slParams, "DefaultSQLConnection", strUserName, lsRoutineName); if (ldt.Rows.Count > 0) { _someValue = ldt.Rows[0]["SomeValue"].ToString(); } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, strUserName + lsRoutineName); } }
public void Save(string UserName, int UserID) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; try { if (RecordStatus == RecordStatuses.Delete) { Delete(UserName, UserID); } else { SortedList slParams = new SortedList(); slParams.Add("@UserID", UserID); slParams.Add("@PlayerWaiverID", PlayerWaiverID); slParams.Add("@WaiverID", WaiverID); slParams.Add("@PlayerProfileID", PlayerProfileID); if (AcceptedDate.HasValue) { slParams.Add("@AcceptedDate", AcceptedDate.Value); } else { slParams.Add("@ClearAcceptedDate", 1); } if (DeclinedDate.HasValue) { slParams.Add("@DeclinedDate", DeclinedDate.Value); } else { slParams.Add("@ClearDeclinedDate", 1); } slParams.Add("@WaiverImage", WaiverImage); if (DeclineApprovedByID.HasValue) { slParams.Add("@DeclineApprovedByID", DeclineApprovedByID.Value); } else { slParams.Add("@ClearDeclineApprovedByID", 1); } slParams.Add("@PlayerNotes", PlayerNotes); slParams.Add("@StaffNotes", StaffNotes); slParams.Add("@Comments", Comments); cUtilities.PerformNonQuery("uspInsUpdPLPlayerWaivers", slParams, "LARPortal", UserName); } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); throw ex; } }
public Boolean SaveUpdate(int userID, bool delete = false) { MethodBase lmth = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; Boolean bUpdateComplete = false; Boolean blnReturn = false; try { SortedList slParams = new SortedList(); if (delete) { slParams.Add("@RecordID", PhoneNumberID); slParams.Add("@UserID", userID); bUpdateComplete = cUtilities.PerformNonQueryBoolean("uspDelMDBPhoneNumbers", slParams, "LARPortal", _UserName + string.Empty); } else { slParams.Add("@UserID", userID); slParams.Add("@PhoneNumberID", _PhoneNumberID); slParams.Add("@KeyID", userID); slParams.Add("@KeyType", "cUser"); //I did to hard code this because the get uses this value and there is no property to set for this slParams.Add("@PhoneTypeID", _PhoneTypeID); slParams.Add("@PrimaryPhone", IsPrimary); slParams.Add("@IDD", _IDD); slParams.Add("@CountryCode", _CountryCode + string.Empty); //if null insert empty string slParams.Add("@AreaCode", _AreaCode + string.Empty); slParams.Add("@PhoneNumber", _PhoneNumber + string.Empty); slParams.Add("@Extension", _Extension + string.Empty); if (_ProviderID.HasValue) { int iMobileType = PhoneTypes.First(x => x.PhoneType.ToUpper().StartsWith("MOBIL")).PhoneTypeID; if (iMobileType == _PhoneTypeID) { slParams.Add("@ProviderID", _ProviderID.Value); } else { slParams.Add("@ClearProviderID", 1); } } else { slParams.Add("@ClearProviderID", 1); } slParams.Add("@Comments", _Comments + string.Empty); blnReturn = cUtilities.PerformNonQueryBoolean("uspInsUpdMDBPhoneNumbers", slParams, "LARPortal", _UserName); } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, _UserName + lsRoutineName); blnReturn = false; } return(blnReturn); }
public void Load(string UserName, Int32 intUserID) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; SortedList slParams = new SortedList(); slParams.Add("@PlayerLARPResumeID", PlayerLARPResumeID); try { DataTable ldt = cUtilities.LoadDataTable("uspGetPlayerLARPResumeByID", slParams, "LARPortal", UserName, lsRoutineName); if (ldt.Rows.Count > 0) { int iTemp; DateTime dtTemp; DataRow dRow = ldt.Rows[0]; if (int.TryParse(dRow["PlayerProfileID"].ToString(), out iTemp)) { PlayerProfileID = iTemp; } GameSystem = dRow["GameSystem"].ToString(); Campaign = dRow["Campaign"].ToString(); AuthorGM = dRow["AuthorGM"].ToString(); Style = dRow["Style"].ToString(); if (int.TryParse(dRow["StyleID"].ToString(), out iTemp)) { StyleID = iTemp; } Genre = dRow["Genre"].ToString(); if (int.TryParse(dRow["GenreID"].ToString(), out iTemp)) { GenreID = iTemp; } Role = dRow["Role"].ToString(); if (int.TryParse(dRow["RoleID"].ToString(), out iTemp)) { RoleID = iTemp; } if (DateTime.TryParse(dRow["StartDate"].ToString(), out dtTemp)) { StartDate = dtTemp; } if (DateTime.TryParse(dRow["EndDate"].ToString(), out dtTemp)) { EndDate = dtTemp; } PlayerComments = dRow["PlayerComments"].ToString(); Comments = dRow["Comments"].ToString(); } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); } }
public Boolean Save() { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; Boolean blnReturn = false; try { string stStoredProc = "uspInsUpdMDBUsers"; SortedList slParams = new SortedList(); slParams.Add("@UserID", UserID); slParams.Add("@LoginUsername", LoginName); slParams.Add("@EmailID", PrimaryEmailID); slParams.Add("@SecurityRoleID", SecurityRoleID); slParams.Add("@FirstName", FirstName); slParams.Add("@MiddleName", MiddleName); slParams.Add("@LastName", LastName); slParams.Add("@Nickname", NickName); slParams.Add("@PrimaryPhoneID", PrimaryPhoneNumberID); slParams.Add("@PrimaryAddressID", PrimaryAddressID); slParams.Add("@ForumUsername", ForumUserName); slParams.Add("@NotificationPreferenceID", NotificationPreference); slParams.Add("@DeliveryPreferenceID", DeliveryPreferenceID); // TODO: Fix the LastLoggedInLocation if (LastLoggedInLocation == null) { LastLoggedInLocation = "MemberDemographics.aspx"; } //slParams.Add("@LastLoggedInLocation", LastLoggedInLocation); //if (_LastLoggedInCampaign == null) // _LastLoggedInCampaign = 0; slParams.Add("@LastLoggedInCampaign", LastLoggedInCampaign); slParams.Add("@LastLoggedInCharacter", LastLoggedInCharacter); //JLB 07/11/2015 Save the last character selected. slParams.Add("@LastLoggedInMyCharOrCamp", LastLoggedInMyCharOrCamp); //RGP 5/27/2017 slParams.Add("@LastLoggedInSkillSetID", LastLoggedInSkillSetID); // 5/8/2019 JLB Needed for multiple skill sets. slParams.Add("@XRefNumber", XRefNumber); slParams.Add("@Comments", Comments); slParams.Add("@LogonPassword", LoginPassword); if (LoginEmail == null) { LoginEmail = ""; } slParams.Add("@EmailAddress", LoginEmail); blnReturn = cUtilities.PerformNonQueryBoolean(stStoredProc, slParams, "LARPortal", LoginName); blnReturn = true; } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, LoginName + lsRoutineName); blnReturn = false; } return(blnReturn); }
public static DataSet LoadDataSetWithOpenConnection(string strStoredProc, SortedList slParameters, SqlConnection Conn, string strUserName, string strCallingMethod) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; SqlCommand lcmd = new SqlCommand(); lcmd.CommandText = strStoredProc; lcmd.CommandType = CommandType.StoredProcedure; lcmd.CommandTimeout = 0; lcmd.Connection = Conn; if (slParameters.Count > 0) { for (int i = 0; i < slParameters.Count; i++) { // Original code // lcmd.Parameters.Add(new SqlParameter(slParameters.GetKey(i).ToString().Trim(), slParameters.GetByIndex(i).ToString().Trim())); // New code - JLB (via Rick) 7/16/2016 SqlParameter NewParam = new SqlParameter(); NewParam.ParameterName = slParameters.GetKey(i).ToString().Trim(); if (slParameters.GetByIndex(i) != null) { NewParam.Value = slParameters.GetByIndex(i).ToString().Trim(); } lcmd.Parameters.Add(NewParam); // End new code 7/16/2016 } } SqlDataAdapter ldsa = new SqlDataAdapter(lcmd); DataSet lds = new DataSet(); try { if (Conn.State != ConnectionState.Open) { Conn.Open(); } ldsa.Fill(lds); } catch (SqlException exSQL) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(exSQL, lsRoutineName + ":" + strStoredProc, lcmd, strUserName + strCallingMethod); throw; } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, strUserName + strCallingMethod); throw; } //finally //{ // lconn.Close(); //} return(lds); }
public void Load(Int32 intPlayerLimitationID, string UserName) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; PlayerLimitationID = intPlayerLimitationID; SortedList slParams = new SortedList(); slParams.Add("@PlayerLimitationID", intPlayerLimitationID); try { DataTable ldt = cUtilities.LoadDataTable("uspGetPlayerLimitationsByID", slParams, "LARPortal", UserName, lsRoutineName); if (ldt.Rows.Count > 0) { int iTemp; bool bTemp; DateTime dtTemp; DataRow dRow = ldt.Rows[0]; if (int.TryParse(dRow["PlayerLimitationID"].ToString(), out iTemp)) { PlayerLimitationID = iTemp; } if (int.TryParse(dRow["PlayerProfileID"].ToString(), out iTemp)) { PlayerProfileID = iTemp; } Description = dRow["Description"].ToString(); if (bool.TryParse(dRow["ShareInfo"].ToString(), out bTemp)) { ShareInfo = bTemp; } if (bool.TryParse(dRow["PrintOnCard"].ToString(), out bTemp)) { PrintOnCard = bTemp; } if (DateTime.TryParse(dRow["StartDate"].ToString(), out dtTemp)) { StartDate = dtTemp; } if (DateTime.TryParse(dRow["EndDate"].ToString(), out dtTemp)) { EndDate = dtTemp; } Comments = dRow["Comments"].ToString(); RecordStatus = RecordStatuses.Active; } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); } }
private void LoadLimitations(DataTable dtLimitations) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; try { foreach (DataRow ldr in dtLimitations.Rows) { cPlayerLimitation cAdd = new cPlayerLimitation { Description = ldr["Description"].ToString(), Comments = ldr["Comments"].ToString(), RecordStatus = RecordStatuses.Active }; int iTemp; if (int.TryParse(ldr["PlayerLimitationID"].ToString(), out iTemp)) { cAdd.PlayerLimitationID = iTemp; } if (int.TryParse(ldr["PlayerProfileID"].ToString(), out iTemp)) { cAdd.PlayerProfileID = iTemp; } bool bTemp; if (bool.TryParse(ldr["ShareInfo"].ToString(), out bTemp)) { cAdd.ShareInfo = bTemp; } if (bool.TryParse(ldr["PrintOnCard"].ToString(), out bTemp)) { cAdd.PrintOnCard = bTemp; } DateTime dtTemp; if (DateTime.TryParse(ldr["StartDate"].ToString(), out dtTemp)) { cAdd.StartDate = dtTemp; } if (DateTime.TryParse(ldr["EndDate"].ToString(), out dtTemp)) { cAdd.EndDate = dtTemp; } PlayerLimitation.Add(cAdd); } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); } }
public static Boolean PerformNonQueryBoolean(string strStoredProc, SortedList slParameters, string strLConn, string strUserName) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; SqlConnection lconn = new SqlConnection(ConfigurationManager.ConnectionStrings[strLConn].ConnectionString); SqlCommand lcmd = new SqlCommand(); lcmd.CommandText = strStoredProc; lcmd.CommandType = CommandType.StoredProcedure; lcmd.CommandTimeout = 0; lcmd.Connection = lconn; Boolean blnReturn = false; if (slParameters.Count > 0) { for (int i = 0; i < slParameters.Count; i++) { // Original code // lcmd.Parameters.Add(new SqlParameter(slParameters.GetKey(i).ToString().Trim(), slParameters.GetByIndex(i).ToString().Trim())); // New code - JLB (via Rick) 7/16/2016 SqlParameter NewParam = new SqlParameter(); NewParam.ParameterName = slParameters.GetKey(i).ToString().Trim(); if (slParameters.GetByIndex(i) != null) { NewParam.Value = slParameters.GetByIndex(i).ToString().Trim(); } lcmd.Parameters.Add(NewParam); // End new code 7/16/2016 } } try { lconn.Open(); lcmd.ExecuteNonQuery(); WriteSQLAuditRecord(lconn, strStoredProc, slParameters, strUserName, ""); blnReturn = true; } catch (SqlException exSQL) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(exSQL, lsRoutineName, lcmd, strUserName); throw; } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, strUserName); throw; } finally { lconn.Close(); } return(blnReturn); }
public cLocation(Int32 intLocationID, Int32 intUserID, string strUserName) { MethodBase lmth = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; _LocationID = intLocationID; _UserID = intUserID; _UserName = strUserName; //so lets say we wanted to load data into this class from a sql query called uspGetSomeData thats take two paraeters @Parameter1 and @Parameter2 SortedList slParams = new SortedList(); // I use a sortedlist wich is a C# hash table to store the paramter and value slParams.Add("@LocationID", _SiteID); try { DataTable ldt = cUtilities.LoadDataTable("uspGetLocationByID", slParams, "LarpPortal", _UserName, lsRoutineName); if (ldt.Rows.Count > 0) { _SiteID = ldt.Rows[0]["SiteID"].ToString().ToInt32(); _LocationName = ldt.Rows[0]["SiteName"].ToString(); _LocationTypeID = ldt.Rows[0]["LocationTypeID"].ToString().ToInt32(); _Dimensions = ldt.Rows[0]["Dimensions"].ToString(); _NumberOfMovableBeds = ldt.Rows[0]["NumberOfMovableBeds"].ToString().ToInt32(); _NumberOfUnmovableBeds = ldt.Rows[0]["NumberOfUnmovableBeds"].ToString().ToInt32(); _NumberOfTopBunks = ldt.Rows[0]["NumberTopBunks"].ToString().ToInt32(); _NumberOfDoors = ldt.Rows[0]["NumberDoors"].ToString().ToInt32(); _Status = ldt.Rows[0]["Status"].ToString().ToInt32(); _Heated = ldt.Rows[0]["Heated"].ToString().ToBoolean(); _Electricity = ldt.Rows[0]["Electricity"].ToString().ToBoolean(); _RunningWater = ldt.Rows[0]["RunningWater"].ToString().ToBoolean(); _CookingFacilities = ldt.Rows[0]["CookingFacilities"].ToString().ToBoolean(); _NumberOfToilets = ldt.Rows[0]["NumberOfToilets"].ToString().ToInt32(); _NumberOfShowers = ldt.Rows[0]["NumberOfShowers"].ToString().ToInt32(); _HandicappedAccessible = ldt.Rows[0]["HandicappedAccessble"].ToString().ToBoolean(); _CamperHookup = ldt.Rows[0]["CamperHookup"].ToString().ToBoolean(); _SmokingAllowed = ldt.Rows[0]["SmokingAllowed"].ToString().ToBoolean(); _NumberParkingSpaces = ldt.Rows[0]["NumberParkingSpaces"].ToString().ToInt32(); _UnavilableStartDate = Convert.ToDateTime(ldt.Rows[0]["UnavailableStartDate"].ToString()); _UnavailableEndDate = Convert.ToDateTime(ldt.Rows[0]["UnavailableEndDate"].ToString()); _ResourcesAvailable = ldt.Rows[0]["ResourcesAvalable"].ToString(); _LocationNotes = ldt.Rows[0]["LocationNotes"].ToString(); _Comments = ldt.Rows[0]["Comments"].ToString().Trim(); _DateAdded = Convert.ToDateTime(ldt.Rows[0]["DateAdded"].ToString().ToString()); _DateChanged = Convert.ToDateTime(ldt.Rows[0]["DateChanged"].ToString().ToString()); } _LocationTypeInfo = new cLocationType(_LocationTypeID, _UserID, _UserName); } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, _UserName + lsRoutineName); } }
/// <summary> /// Given the error, this will attempt to format it and save it into the database. /// </summary> /// <param name="pvsComputerName">The name of the computer where the error happened.</param> /// <param name="pvExceptionText">The actual exception that happened.</param> /// <param name="pvsLocation">The location of the error.</param> /// <param name="pvsAddInfo">Any additional info to be added to the record.</param> public void ProcessError(string pvsComputerName, string pvExceptionText, string pvsLocation, string pvsAddInfo) { try { string lsErrorText = pvExceptionText; ErrorAtServer lobjError = new ErrorAtServer(); lobjError.HandleError("Client Error", pvExceptionText, pvsLocation, pvsAddInfo, pvsComputerName); } catch { // Can't really do anything because if we can't connect to the home server, then we're screwed. } }
public void Save(string UserName, int UserID) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; if (RecordStatus == RecordStatuses.Delete) { Delete(UserName, UserID); } else { try { SortedList slParams = new SortedList(); slParams.Add("@UserID", UserID); slParams.Add("@PlayerMedicalID", PlayerMedicalID); slParams.Add("@PlayerProfileID", PlayerProfileID); slParams.Add("@MedicalTypeID", MedicalTypeID); slParams.Add("@Description", Description); slParams.Add("@Medication", Medication); slParams.Add("@ShareInfo", ShareInfo); slParams.Add("@PrintOnCard", PrintOnCard); if (StartDate.HasValue) { slParams.Add("@StartDate", StartDate.Value); } else { slParams.Add("@ClearStartDate", "1"); } if (EndDate.HasValue) { slParams.Add("@EndDate", EndDate.Value); } else { slParams.Add("@ClearEndDate", "1"); } slParams.Add("@Comments", Comments); cUtilities.PerformNonQueryBoolean("uspInsUpdPLPlayerMedical", slParams, "LARPortal", UserName); } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); } } }
private void LoadOccasionExceptions(DataTable dtOccasionExcept) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; try { foreach (DataRow ldr in dtOccasionExcept.Rows) { cPlayerOccasionExceptions cAdd = new cPlayerOccasionExceptions { PlayerComments = ldr["PlayerComments"].ToString(), Comments = ldr["Comments"].ToString(), RecordStatus = RecordStatuses.Active }; int iTemp; if (int.TryParse(ldr["PlayerOccasionExceptionID"].ToString(), out iTemp)) { cAdd.PlayerOccasionExceptionID = iTemp; } if (int.TryParse(ldr["PlayerProfileID"].ToString(), out iTemp)) { cAdd.PlayerProfileID = iTemp; } if (int.TryParse(ldr["CampaignID"].ToString(), out iTemp)) { cAdd.CampaignID = iTemp; } if (int.TryParse(ldr["OccasionID"].ToString(), out iTemp)) { cAdd.OccasionID = iTemp; } bool bTemp; if (bool.TryParse(ldr["AttendPartial"].ToString(), out bTemp)) { cAdd.AttendPartial = bTemp; } PlayerOccasionExceptions.Add(cAdd); } } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); } }
public Boolean Save(string UserName, int UserID) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; Boolean blnReturn = false; if (RecordStatus == RecordStatuses.Delete) { Delete(UserName, UserID); } else { try { SortedList slParams = new SortedList(); slParams.Add("@UserID", UserID); slParams.Add("@PlayerInventoryID", PlayerInventoryID); slParams.Add("@PlayerProfileID", PlayerProfileID); slParams.Add("@ItemName", ItemName); slParams.Add("@Description", Description); slParams.Add("@InventoryTypeID", InventoryTypeID); slParams.Add("@Quantity", Quantity); slParams.Add("@Size", Size); slParams.Add("@PowerNeeded", PowerNeeded); slParams.Add("@Location", Location); if (WillShare) { slParams.Add("@WillShare", 1); } else { slParams.Add("@WillShare", 0); } slParams.Add("@InventoryNotes", InventoryNotes); slParams.Add("@InventoryImage", ImageURL); slParams.Add("@ImageID", ImageID); slParams.Add("@PlayerComments", PlayerComments); slParams.Add("@Comments", Comments); blnReturn = cUtilities.PerformNonQueryBoolean("uspInsUpdPLPlayerInventory", slParams, "LARPortal", UserName); } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, UserName + lsRoutineName); blnReturn = false; } } return(blnReturn); }
public Boolean Save() { MethodBase lmth = MethodBase.GetCurrentMethod(); // this is where we use refelection to store the name of the method and class to use it to report errors string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; Boolean blnReturn = false; try { SortedList slParams = new SortedList(); slParams.Add("@UserID", _UserID); slParams.Add("@LocationID", _LocationID); slParams.Add("@SiteID", _SiteID); slParams.Add("@LocationName", _LocationName); slParams.Add("@LocationTypeID", _LocationTypeID); slParams.Add("@Dimensions", _Dimensions); slParams.Add("@NumberOfMovableBeds", _NumberOfMovableBeds); slParams.Add("@NumberOfUnmovableBeds", _NumberOfUnmovableBeds); slParams.Add("@NumberTopBunks", _NumberOfTopBunks); slParams.Add("@NumberDoors", _NumberOfDoors); slParams.Add("@Status", _Status); slParams.Add("@Heated", _Heated); slParams.Add("@Electricity", _Electricity); slParams.Add("@RunningWater", _RunningWater); slParams.Add("@CookingFacilities", _CookingFacilities); slParams.Add("@NumberOfToilets", _NumberOfToilets); slParams.Add("@NumberOfShowers", _NumberOfShowers); slParams.Add("@HandicappedAccessble", _HandicappedAccessible); slParams.Add("@CamperHookup", _CamperHookup); slParams.Add("@SmokingAllowed", _SmokingAllowed); slParams.Add("@NumberParkingSpaces", _NumberParkingSpaces); slParams.Add("@UnavailableStartDate", _UnavilableStartDate); slParams.Add("@UnavailableEndDate", _UnavailableEndDate); slParams.Add("@ResourcesAvalable", _ResourcesAvailable); slParams.Add("@LocationNotes", _LocationNotes); slParams.Add("@Comments", _Comments); cUtilities.PerformNonQuery("uspInsUpdSTLocations", slParams, "LarpPortal", _UserName); blnReturn = true; } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, _UserName + lsRoutineName); } return(blnReturn); }
public cUser(string strLoginName, string strLoginPassword) { MethodBase lmth = MethodBase.GetCurrentMethod(); string lsRoutineName = lmth.DeclaringType + "." + lmth.Name; _LoginName = strLoginName; _LoginPassword = strLoginPassword; SortedList slParams = new SortedList(); slParams.Add("@LoginUserName", _LoginName); try { DataTable ldt = cUtilities.LoadDataTable("uspGetUserByLoginName", slParams, "LARPortal", _LoginName, lsRoutineName); if (ldt.Rows.Count > 0) { _UserID = ldt.Rows[0]["UserID"].ToString().ToInt32(); _PrimaryEmailID = ldt.Rows[0]["EmailID"].ToString().ToInt32(); _SecurityRoleID = ldt.Rows[0]["SecurityRoleID"].ToString().ToInt32(); _FirstName = ldt.Rows[0]["FirstName"].ToString(); _MiddleName = ldt.Rows[0]["MiddleName"].ToString(); _LastName = ldt.Rows[0]["LastName"].ToString(); _NickName = ldt.Rows[0]["NickName"].ToString(); _PrimaryPhoneNumberID = ldt.Rows[0]["PrimaryPhoneID"].ToString().ToInt32(); _PrimaryAddressID = ldt.Rows[0]["PrimaryAddressID"].ToString().ToInt32(); _ForumUserName = ldt.Rows[0]["ForumUsername"].ToString(); _NotificationPreference = ldt.Rows[0]["NotificationPreferenceID"].ToString().ToInt32(); _DeliveryPreferenceID = ldt.Rows[0]["DeliveryPreferenceID"].ToString().ToInt32(); _LastLoggedInLocation = ldt.Rows[0]["LastLoggedInLocation"].ToString(); _LastLoggedInCampaign = ldt.Rows[0]["LastLoggedInCampaign"].ToString().ToInt32(); _LastLoggedInCharacter = ldt.Rows[0]["LastLoggedInCharacter"].ToString().ToInt32(); _LastLoggedInMyCharOrCamp = ldt.Rows[0]["LastLoggedInMyCharOrCamp"].ToString(); _XRefNumber = ldt.Rows[0]["XRefNumber"].ToString().ToInt32(); _DateAdded = Convert.ToDateTime(ldt.Rows[0]["DateAdded"].ToString()); _DateChanged = Convert.ToDateTime(ldt.Rows[0]["DateChanged"].ToString()); } LoadAddresses(); LoadPhones(); LoadEmails(); } catch (Exception ex) { ErrorAtServer lobjError = new ErrorAtServer(); lobjError.ProcessError(ex, lsRoutineName, _LoginName + lsRoutineName); } }