/// <summary> /// This method will call the Event Resource class method to Add the event in the database /// And send the email to all admin about the event insertion for all public event /// </summary> /// <param name="objEvent">An Event Object which contain Event information</param> public void SaveEvent(Events objEvent) { try { EventResource objEventRes = new EventResource(); object identity = objEventRes.SaveEvent(objEvent); // Send the email to all the adminstrator if event is public that event has been created if ((objEvent != null) && (objEvent.CustomError == null) && (identity != null) && (int.Parse(identity.ToString()) != 0) && (objEvent.IsPrivate == false)) { string EmailSubject = objEvent.FirstName + " " + objEvent.LastName + " added a new event on Your " + WebConfig.ApplicationWordForInternalUse.ToString() + "..."; string EmailBody = "<font style='font-size: 12px; font-family:Lucida Sans;'><p>" + objEvent.FirstName + " " + objEvent.LastName + " added a new event in the " + objEvent.TributeName + " " + objEvent.TributeType + " " + WebConfig.ApplicationWordForInternalUse.ToString() + ".</p><p> To view the event, follow the link below: <br/> " + objEvent.ServerURL + " </p>" + "<p>----" + "<br/>" + "Your " + WebConfig.ApplicationWord.ToString() + " Team</p></font>"; SendEmail(objEvent.TributeId, EmailSubject, EmailBody.Replace("##", identity.ToString())); } // If an event name an event type combination already exist in database then // return an error message if (int.Parse(identity.ToString()) == 0) { Errors objError = new Errors(); objError.ErrorMessage = "This Event Name '" + objEvent.EventName + "' with this Event Type already exist"; objEvent.CustomError = objError; } else // otherwise return the eventid { objEvent.EventID = int.Parse(identity.ToString()); } SessionValue objSessionValue = null; StateManager objStateManager = StateManager.Instance; objSessionValue = (SessionValue)objStateManager.Get(PortalEnums.SessionValueEnum.objSessionvalue.ToString(), StateManager.State.Session); if ((objEvent != null) && (objEvent.CustomError == null) && (identity != null) && (int.Parse(identity.ToString()) != 0)) { object value = objEventRes.SaveRsvpForCreator(objEvent,objSessionValue); if (value != null) { if (int.Parse(value.ToString()) != 0) { //Insert the Hashcode for the Guest string Hashcode = GetHashCode(int.Parse(value.ToString())); objEventRes.InsertHashCodeForGuest(int.Parse(value.ToString()), Hashcode); } } } } catch (Exception ex) { throw ex; } }