public void AddSurvey() { if (!string.IsNullOrEmpty(SelectedSurveyName)) { m_Repository.SaveCompleted += RepositoryOnSaveCompleted; var filename = string.Empty; var binarySourceDocument = FileHelpers.GetByeArrayFromUserSelectedFile(string.Empty, out filename); var newSurvey = new SurveyType(); if (binarySourceDocument != null) { newSurvey.SurveyTypeDocx = (new Document { DocumentSource = new DocumentSource { BinarySource = binarySourceDocument }, Name = filename }); } newSurvey.Name = SelectedSurveyName; m_Repository.SurveyTypes.Add(newSurvey); m_Repository.Save(); m_SettingsProvider.Refresh(); } else { Dialogs.ShowMessageBox("Bitte vergeben Sie einen Namen", "Kein Name"); } }
public ActionResult DeleteSurveyType(SurveyTypeViewModel item) { try { SurveyType c = db.SurveyTypes.Find(item.ToModel().Id); if (c != null) { c.IsDeleted = true; c.DeletionDate = DateTime.Now; db.SaveChanges(); } return(new HttpStatusCodeResult(200)); } catch { LogViewModel l = new LogViewModel { Id = Guid.NewGuid(), CreatedDate = DateTime.Now, Type = "Deletion", Message = "failed to delete survey type " + this.Type + " to database" }; l.AddLog(l); return(new HttpStatusCodeResult(400)); } }
/// <summary> /// The update survey details. /// </summary> /// <param name="surveyId"> /// The survey id. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="description"> /// The description. /// </param> /// <param name="type"> /// The type. /// </param> /// <param name="estimatedTime"> /// The survey estimated time to complete survey. /// </param> /// <returns> /// The <see cref="SurveyRoot"/>. /// </returns> public SurveyRoot UpdateSurvey( long surveyId, string name, string description, SurveyType type, short estimatedTime) { if (surveyId < 1 || string.IsNullOrEmpty(name) || string.IsNullOrEmpty(description)) { return(_result.ErrorToObject(new SurveyRoot(), "Invalid parameter(s)")); } var requestArg = JsonConvert.SerializeObject( new { SurveyID = surveyId, Name = name, Description = description, SurveyChannel = (short)type, EstimateSurvey = estimatedTime }); requestArg = JsonConvert.SerializeObject(new { Data = requestArg }); Task <Result> x = RequestHandler.SendRequestAsync( string.Empty, "api/UserSurvey/UpdateSurvey", HttpMethod.Put, RouteStyle.Rpc, requestArg); x.Wait(); return(x.Result.JsonToObject(new SurveyRoot(), "Surveys")); }
public ActionResult UpdateSurveyType(SurveyTypeViewModel item) { try { SurveyType c = db.SurveyTypes.Find(item.ToModel().Id); if (c != null) { c.Id = item.Id; c.DeletionDate = item.DeletionDate; c.DeletionUserId = item.DeletionUserId; c.IsDeleted = item.IsDeleted; c.ModifiedDate = DateTime.Now; c.ModifiedUserId = item.ModifiedUserId; c.Surveys = this.GetSurveyList(item.Surveys); c.Type = item.Type; //c.CreatedDate = item.CreatedDate; c.CreatedUserId = item.CreatedUserId; db.SaveChanges(); } return(new HttpStatusCodeResult(200)); } catch { LogViewModel l = new LogViewModel { Id = Guid.NewGuid(), CreatedDate = DateTime.Now, Type = "Update", Message = "failed to update survey type " + this.Type + " to database" }; l.AddLog(l); return(new HttpStatusCodeResult(400)); } }
void InitRiveScript() { if (!PlayerPrefs.HasKey("UUID")) { PlayerPrefs.SetString("UUID", System.Guid.NewGuid().ToString()); } quizType = PlayerPrefs.GetString(SurveyUtil.surveyTypeKey); age = PlayerPrefs.GetString(SurveyUtil.ageKey); gender = PlayerPrefs.GetString(SurveyUtil.genderKey); SurveyType surveyType = (SurveyType)Enum.Parse(typeof(SurveyType), quizType); switch (surveyType) { case SurveyType.TypeGA: riveScript.SetRiveScriptText(riveScriptFileArray.GetRiveScriptAsset(0)); break; case SurveyType.TypeNA: riveScript.SetRiveScriptText(riveScriptFileArray.GetRiveScriptAsset(1)); break; case SurveyType.TypeDA: riveScript.SetRiveScriptText(riveScriptFileArray.GetRiveScriptAsset(2)); break; case SurveyType.TypeRA: riveScript.SetRiveScriptText(riveScriptFileArray.GetRiveScriptAsset(3)); break; default: break; } riveScript.InitRiveScript(); }
public static void SaveWordCounts(SurveyType surveyType, int recordID, Dictionary <string, int> wordCounts) { SQLDatabase sql = new SQLDatabase(); sql.CommandTimeout = 120; StringBuilder query = new StringBuilder(); SQLParamList sqlParams = new SQLParamList(); int i = 1; sqlParams.Add("@RecordID", recordID); foreach (string key in wordCounts.Keys) { i += 2; query.AppendFormat("INSERT INTO [tblSurveyWords] VALUES ({0}, @RecordID, @Word{1}, @Count{1});\n", (int)surveyType, i); sqlParams.Add("@Word" + i, key).Add("@Count" + i, wordCounts[key]); if (i >= 2097) { //Only ~2100 parameters are allowed query.Append("DELETE FROM [tblSurveyWords] WHERE Word IN (SELECT [Word] FROM [tblSurveyWords_Banned]);"); sql.NonQuery(query.ToString(), sqlParams); i = 1; sqlParams = new SQLParamList().Add("@RecordID", recordID); } } if (i > 1) { query.Append("DELETE FROM [tblSurveyWords] WHERE Word IN (SELECT [Word] FROM [tblSurveyWords_Banned]);"); sql.NonQuery(query.ToString(), sqlParams); } if (sql.HasError) { ErrorHandler.WriteLog("SharedClasses.SurveyTools.SaveWordCounts", String.Format("Unable to save word counts for {0} record ID {1}", surveyType.ToString(), recordID), ErrorHandler.ErrorEventID.SQLError, sql.ExceptionList[0]); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,SurveyTypeName")] SurveyType surveyType) { if (id != surveyType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(surveyType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SurveyTypeExists(surveyType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(ListSurveyTypes))); } return(View(surveyType)); }
public async Task <IActionResult> Create([Bind("Id,SurveyTypeName")] SurveyType surveyType) { if (ModelState.IsValid) { _context.Add(surveyType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(ListSurveyTypes))); } return(View(surveyType)); }
public ICollection<QuestionDto> GetBySurveyType(SurveyType surveyType) { if (surveyType >= 0) { var result = _repository.GetBySurveyType(surveyType); return Mapper.Map<List<QuestionDto>>(result); } return null; }
private static string GetSurveyTypeDescription(SurveyType item) { switch (item) { case SurveyType.CheckBox: return("Check Box"); case SurveyType.FreeText: return("Free Text"); default: return(item.ToString()); } }
public SurveyTypeViewModel(SurveyType surveyType) { this.Id = surveyType.Id; this.ModifiedDate = surveyType.ModifiedDate; this.ModifiedUserId = surveyType.ModifiedUserId; this.Type = surveyType.Type; this.Surveys = this.GetSurveyViewList(surveyType.Surveys); this.SurveyTotal = db.Surveys.Where(x => x.SurveyTypeId == Id).Count(); this.CreatedDate = surveyType.CreatedDate; this.CreatedUserId = surveyType.CreatedUserId; this.DeletionDate = surveyType.DeletionDate; this.DeletionUserId = surveyType.DeletionUserId; this.IsDeleted = surveyType.IsDeleted; }
/// <summary> /// Them moi 1 surveytype /// </summary> /// <param name="entity"></param> /// <returns></returns> public bool CreateSurveyType(SurveyTypeEntities entity) { SurveyType newItem = new SurveyType() { IdSurType = entity.IdSurType, TypeName = entity.TypeName, Descriptions = entity.Descriptions, Status = entity.Status, LastEditedAt = entity.LastEditedAt }; _unit.SurveyTypeGenericType.Insert(newItem); _unit.Save(); return(true); }
public override string ToString() => string.Join(',', new string[] { SurveyType.ToString(), WaterDepth.ToString(), X.ToString(), Y.ToString(), GNSSAltitude.ToString(), GNSSHeading.ToString(), GNSSSpeed.ToString(), MagneticHeading.ToString(), MinRange.ToString(), MaxRange.ToString(), WaterTemperature.ToString(), WaterSpeed.ToString(), HardwareTime.ToString(), Frequency.ToString(), Milliseconds.ToString() + '\n' });
public SurveyType ToModel() { SurveyType s = new SurveyType { Id = this.Id, DeletionDate = this.DeletionDate, DeletionUserId = this.DeletionUserId, IsDeleted = this.IsDeleted, ModifiedDate = this.ModifiedDate, ModifiedUserId = this.ModifiedUserId, Surveys = this.GetSurveyList(this.Surveys), Type = this.Type, CreatedDate = this.CreatedDate, CreatedUserId = this.CreatedUserId }; return(s); }
public void LoadSurvey(string path, string type) { dateString = "Date of " + type + ":{0}\r\n"; if (path.EndsWith("csv")) { if (!Types.TryGetValue(type, out SurveyType Type)) { CreateFormat(path, type); Type = Types[type]; } string text = File.ReadAllText(path); var matches = Type.Regex.ToDictionaries(text.Substring(text.IndexOf("\"1\""))); text = null; this.responses = new ConcurrentDictionary <string, KeyValuePair <string[], string[]> >( matches.Where( m => m.TryGetValue("LocationCode", out string grpValue) && !Missing.Contains(grpValue) && !Uploaded.Contains(grpValue + " -:- " + m["Date"]) ).ToDictionary( m => m["ResponseNumber"], m => new KeyValuePair <string[], string[]>( m.Where( g => !Char.IsDigit(g.Key[0]) ).Select(g => g.Value).ToArray(), m.Skip(1).Take(Type.Questions.Length).Select( g => g.Value ).ToArray() ) ) ); Form1.prgThread.RunWorkerAsync(this.responses.Count); Form1.prgCounter += (matches.Count() - this.responses.Count); matches = null; GC.Collect(); } }
/// <summary> /// The add new survey to a project. /// </summary> /// <param name="name"> /// The name. /// </param> /// <param name="description"> /// The description. /// </param> /// <param name="reference"> /// The unique reference for survey identification. /// </param> /// <param name="projectId"> /// The project id, to which to add new survey. /// </param> /// <param name="type"> /// The type of survey. /// </param> /// <param name="estimatedTime"> /// The survey estimated time to complete survey. /// </param> /// <param name="offline"> /// The offline, indicates the survey is offline. /// </param> /// <returns> /// The <see cref="SurveyRoot"/>. /// </returns> public SurveyRoot AddSurvey( string name, string description, string reference, long projectId, SurveyType type = SurveyType.App, short estimatedTime = 1, bool offline = false) { if (string.IsNullOrEmpty(name) || string.IsNullOrEmpty(description) || string.IsNullOrEmpty(reference) || projectId == 0) { return(_result.ErrorToObject(new SurveyRoot(), "Invalid parameter(s)")); } var requestArg = JsonConvert.SerializeObject( new { SurveyName = name, SurveyDescription = description, SurveyChannel = (short)type, SurveyReference = reference, ProjectID = projectId, IsOffline = offline, EstimateSurvey = estimatedTime }); requestArg = JsonConvert.SerializeObject(new { Data = requestArg }); Task <Result> x = RequestHandler.SendRequestAsync( string.Empty, "api/UserSurvey/AddSurvey", HttpMethod.Post, RouteStyle.Rpc, requestArg); x.Wait(); return(x.Result.JsonToObject(new SurveyRoot(), "Surveys")); }
public static Survey Get(SurveyType surveyType) { switch (surveyType) { case SurveyType.Valid: return new Survey( SurveysConstants.ValidName, SurveysConstants.ValidActiveFromDateAndTime, SurveysConstants.ValidActiveToDateAndTime); case SurveyType.ValidEdited: return new Survey( SurveysConstants.ValidEditedName, SurveysConstants.ValidEditedActiveFromDateAndTime, SurveysConstants.ValidEditedActiveToDateAndTime); case SurveyType.InvalidWithEmptyName: return new Survey( string.Empty, SurveysConstants.ValidEditedActiveFromDateAndTime, SurveysConstants.ValidEditedActiveToDateAndTime); case SurveyType.InvalidWithTooPastActiveFrom: return new Survey( SurveysConstants.ValidName, SurveysConstants.InvalidTooPastActiveFromDateAndTime, string.Empty); case SurveyType.InvalidWithTooFutureActiveFrom: return new Survey( SurveysConstants.ValidName, SurveysConstants.InvalidTooFutureActiveFromDateAndTime, string.Empty); default: throw new ArgumentException(); } }
void Init() { string quizType = PlayerPrefs.GetString(SurveyUtil.surveyTypeKey); SurveyType surveyType = (SurveyType)Enum.Parse(typeof(SurveyType), quizType); switch (surveyType) { case SurveyType.TypeGA: case SurveyType.TypeNA: questionaires[1].SetActiveState(false); break; case SurveyType.TypeDA: case SurveyType.TypeRA: questionaires[1].SetActiveState(true); break; } resultSaveFormat = new ResultSaveFormat(); if (!Directory.Exists(SurveyUtil.GetFolderPath)) { Directory.CreateDirectory(SurveyUtil.GetFolderPath); } filePath = SurveyUtil.GetSurveyAddtionalQuestionPath; }
public ActionResult AddSurveyType(SurveyTypeViewModel item) { try { SurveyType c = item.ToModel(); c.Surveys = item.GetSurveyList(item.Surveys); c.CreatedDate = DateTime.Now; db.SurveyTypes.Add(c); db.SaveChanges(); return(new HttpStatusCodeResult(200)); } catch { LogViewModel l = new LogViewModel { Id = Guid.NewGuid(), CreatedDate = DateTime.Now, Type = "Insertion", Message = "failed to insert survey type " + this.Type + " to database" }; l.AddLog(l); return(new HttpStatusCodeResult(400)); } }
public SurveyTypeViewModel(SurveyType model) { m_Model = model; }
public bool Delete(SurveyType element) { throw new NotImplementedException(); }
//public SurveyTypeViewModel CreateSurveyTypeViewModelFromExisting(SurveyType model) //{ // return new SurveyTypeViewModel(model); //} SurveyTypeViewModel ISurveyTypeViewModelFactory.CreateSurveyTypeViewModelFromExisting(SurveyType model) { return(new SurveyTypeViewModel(model)); }
//20170116 adding commentws for email notification //public static void SendNotifications<T>( HttpServerUtility server, GCCPropertyShortCode property, SurveyType surveyType, NotificationReason reason, T replacementModel, string emailAddress, string subjectPrefix ) public static void SendNotifications <T>(HttpServerUtility server, GCCPropertyShortCode property, SurveyType surveyType, NotificationReason reason, string Comments, T replacementModel, string emailAddress, string subjectPrefix, int operationsArea) where T : class { string template = String.Empty; string title = String.Empty; string propertyName = PropertyTools.GetCasinoName((int)property); if (property == GCCPropertyShortCode.GAG) { PropertyInfo nameProp = replacementModel.GetType().GetProperty("CasinoName"); if (nameProp != null) { string name = nameProp.GetValue(replacementModel) as string; if (!String.IsNullOrWhiteSpace(name)) { propertyName = name; } } } switch (surveyType) { case SurveyType.GEI: if (reason == NotificationReason.ThankYou) { title = "Thank You For Your Feedback"; template = "GEIThankYou"; } else { template = "GEITemplate"; title = String.Format("{0}GEI Feedback Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy")); } break; case SurveyType.GEIProblemResolution: if (reason == NotificationReason.ThankYou) { title = "Thank You For Your Feedback"; template = "GEIThankYou"; } else { if (replacementModel.ToString().Contains("FeedbackCategory")) { template = "GEIFeedbackCategoryTemplate"; title = String.Format("{0}GEI Feedback Category Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy")); } else { template = "GEITemplate"; title = String.Format("{0}GEI Problem Resolution Feedback Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy")); } } break; case SurveyType.Hotel: if (reason == NotificationReason.ThankYou) { title = "Thank You For Your Feedback"; template = "HotelThankYou"; } else { template = "HotelTemplate"; title = String.Format("{0}Hotel Survey Notification - {1}", subjectPrefix, DateTime.Now.ToString("MMMM dd, yyyy")); } break; case SurveyType.Feedback: if (reason == NotificationReason.ThankYou) { title = "Thank You For Your Feedback"; template = "FeedbackThankYou"; } else if (reason == NotificationReason.Tier3Alert) { title = String.Format("{0}Tier 3 Alert for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy")); template = "Tier3Alert"; } else { template = "FeedbackTemplate"; title = String.Format("{0}Feedback Follow-up Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy")); } break; case SurveyType.Donation: template = "DonationTemplate"; title = String.Format("{0}Sponsorship / Donation Request Notification for {1} - {2}", subjectPrefix, propertyName, DateTime.Now.ToString("MMMM dd, yyyy")); break; } if (template.Equals(String.Empty)) { return; } MailMessage msg = null; try { string path = server.MapPath("~/Content/notifications/"); msg = EmailManager.CreateEmailFromTemplate( Path.Combine(path, template + ".htm"), Path.Combine(path, template + ".txt"), replacementModel); PropertyInfo attachmentProp = replacementModel.GetType().GetProperty("Attachments"); if (attachmentProp != null) { SurveyAttachmentDetails[] attachments = attachmentProp.GetValue(replacementModel) as SurveyAttachmentDetails[]; foreach (SurveyAttachmentDetails att in attachments) { LinkedResource lr = new LinkedResource(server.MapPath(att.Path)); lr.ContentId = att.ContentID; msg.AlternateViews[0].LinkedResources.Add(lr); } } msg.From = new MailAddress("*****@*****.**"); msg.Subject = title; //Add high priority flag to tier 3 alerts if (reason == NotificationReason.Tier3Alert) { msg.Priority = MailPriority.High; } bool hasAddress = false; if (!String.IsNullOrEmpty(emailAddress)) { msg.To.Add(emailAddress); hasAddress = true; } else { SQLDatabase sql = new SQLDatabase(); sql.CommandTimeout = 120; DataTable dt = sql.QueryDataTable(@" SELECT [SendType], u.[FirstName], u.[LastName], u.[Email] FROM [tblNotificationUsers] ne INNER JOIN [tblNotificationPropertySurveyReason] psr ON ne.[PropertySurveyReasonID] = psr.[PropertySurveyReasonID] INNER JOIN [tblCOM_Users] u ON ne.UserID = u.UserID WHERE psr.PropertyID = @PropertyID AND psr.SurveyTypeID = @SurveyID AND psr.ReasonID = @ReasonID ;", //AND ( ( @OperationsAreaID < 0 AND psr.OperationsAreaID IS NULL ) OR psr.OperationsAreaID = @OperationsAreaID ) new SQLParamList() .Add("@PropertyID", (int)property) .Add("@SurveyID", (int)surveyType) .Add("@ReasonID", (int)reason) .Add("@OperationsAreaID", operationsArea) ); if (!sql.HasError && dt.Rows.Count > 0) { StringBuilder addrs = new StringBuilder(); foreach (DataRow dr in dt.Rows) { switch (dr["SendType"].ToString()) { case "1": msg.To.Add(dr["Email"].ToString()); //201701 Testing Email error //msg.Bcc.Add("*****@*****.**"); addrs.Append(dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n"); hasAddress = true; break; case "2": msg.CC.Add(dr["Email"].ToString()); //201701 Testing Email error //msg.Bcc.Add("*****@*****.**"); //Colin requested that CC addresses not show on the call Aug 10,2015 //addrs.Append( dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n" ); hasAddress = true; break; case "3": msg.Bcc.Add(dr["Email"].ToString()); //201701 Testing Email error // msg.Bcc.Add("*****@*****.**"); hasAddress = true; break; } } using (StreamReader sr = new StreamReader(msg.AlternateViews[0].ContentStream)) { msg.AlternateViews[0] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", server.HtmlEncode(addrs.ToString()).Replace("\n", "<br />")).Replace("{Business}", server.HtmlEncode(reason.ToString()).Replace("\n", "<br />")).Replace("{Comments}", server.HtmlEncode(Comments.ToString()).Replace("\n", "<br />")), null, MediaTypeNames.Text.Html); } using (StreamReader sr = new StreamReader(msg.AlternateViews[1].ContentStream)) { msg.AlternateViews[1] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", addrs.ToString()).Replace("{Business}", reason.ToString()).Replace("{Comments}", Comments.ToString()), null, MediaTypeNames.Text.Plain); } } } if (hasAddress) { msg.Send(); } } catch (Exception ex) { } finally { if (msg != null) { msg.Dispose(); msg = null; } } }
public void ConfigureCell(IXLWorksheet worksheet, SurveyType surveyType) { #region SetUp int numberOfCells = 0; int detailColumns = 1; // Inicialized in one because the last column switch (surveyType) { case SurveyType.CareTeam: detailColumns += 5; numberOfCells = QuestionKey.CareTeamSurvey.NumberOfKeys() + detailColumns; break; case SurveyType.PCP: detailColumns += 7; numberOfCells = QuestionKey.PCPSurvey.NumberOfKeys() + detailColumns; break; case SurveyType.Specialist: detailColumns += 7; numberOfCells = QuestionKey.SpecialistSurvey.NumberOfKeys() + detailColumns; break; } #endregion #region Headers for (int x = 1; x <= numberOfCells; x++) { worksheet.Cell(1, x).Style.Font.Bold = true; worksheet.Cell(1, x).Style.Alignment.WrapText = true; worksheet.Cell(1, x).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; worksheet.Cell(1, x).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; worksheet.Cell(1, x).Style.Fill.BackgroundColor = XLColor.LightCyan; worksheet.Cell(1, x).Style.Font.FontSize = 11; worksheet.Cell(1, x).Style.Border.BottomBorder = XLBorderStyleValues.Thin; worksheet.Cell(1, x).Style.Border.LeftBorder = XLBorderStyleValues.Thin; worksheet.Cell(1, x).Style.Border.TopBorder = XLBorderStyleValues.Thin; worksheet.Cell(1, x).Style.Border.RightBorder = XLBorderStyleValues.Thin; if (x > detailColumns) { if (x == numberOfCells) worksheet.Column(x).Width = 55; else worksheet.Column(x).Width = 30; } else worksheet.Column(x).Width = 20; } #endregion #region Rows for (int x = 1; x <= numberOfCells; x++) { worksheet.Cell(2, x).Style.Alignment.WrapText = true; worksheet.Cell(2, x).Style.Alignment.Vertical = XLAlignmentVerticalValues.Center; worksheet.Cell(2, x).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Left; worksheet.Cell(2, x).Style.Font.FontSize = 11; worksheet.Cell(2, x).Style.Border.BottomBorder = XLBorderStyleValues.Thin; worksheet.Cell(2, x).Style.Border.LeftBorder = XLBorderStyleValues.Thin; worksheet.Cell(2, x).Style.Border.TopBorder = XLBorderStyleValues.Thin; worksheet.Cell(2, x).Style.Border.RightBorder = XLBorderStyleValues.Thin; } #endregion }
protected string GetURL(int page, int redirDir) { bool isReset = (page == -1); if (isReset) { page = 1; } return(String.Format("/GSEI{5}/{0}/{1}/{2}{3}{4}", Master.PropertyShortCode.ToString(), Master.EmailPIN.ToString(), page, (redirDir == -1 ? "/-1" : String.Empty), (isReset ? "?r=1" : String.Empty), SurveyType.ToString())); }
public static void SendNotifications <T>(HttpServerUtility server, GCCPropertyShortCode property, SurveyType surveyType, NotificationReason reason, string Comments, T replacementModel) where T : class { SendNotifications(server, property, surveyType, reason, Comments, replacementModel, String.Empty); }
protected void btnSaveTier_Click(object sender, EventArgs e) { //Prevent refresh from re-submitting form data if (Session["CheckRefresh"].ToString() == ViewState["CheckRefresh"].ToString()) { Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); } else { //Catch refresh and wipe the value again Session["CheckRefresh"] = Server.UrlDecode(System.DateTime.Now.ToString()); return; } //Don't do anything if the tier hasn't changed if (ddlTier.SelectedValue.Equals(hdnOldTier.Value)) { return; } //Update the tier SQLDatabase sql = new SQLDatabase(); sql.CommandTimeout = 120; sql.ExecStoredProcedureDataTable("spFeedback_ChangeTier", new SQLParamList() .Add("@UID", GUID) .Add("@Tier", Conversion.StringToInt(ddlTier.SelectedValue, 1)) .Add("@UserID", User.UserID)); //Send tier 3 notifications if (ddlTier.SelectedValue.Equals("3")) { SQLParamList sqlParams = new SQLParamList(); sqlParams.Add("@GUID", GUID); DataSet ds = sql.ExecStoredProcedureDataSet("[spFeedback_GetItem]", sqlParams); if (sql.HasError) { TopMessage.ErrorMessage = "Unable to load the feedback item."; return; } DataRow fr = ds.Tables[0].Rows[0]; //Feedback row DataRow sr = ds.Tables[2].Rows[0]; //Survey row GCCPropertyShortCode sc = (GCCPropertyShortCode)fr["PropertyID"].ToString().StringToInt(1); SurveyType st = (SurveyType)fr["SurveyTypeID"].ToString().StringToInt(1); //Get the GAG location string gagLocation = String.Empty; switch (st) { case SurveyType.GEI: gagLocation = sr["Q3"].ToString(); break; case SurveyType.Feedback: gagLocation = sr["GAGProperty"].ToString(); break; } if (gagLocation.Length > 0) { gagLocation = " - " + gagLocation; } //Send the notification SurveyTools.SendNotifications(Server, sc, SurveyType.Feedback, NotificationReason.Tier3Alert, string.Empty, new { Date = DateTime.Now.ToString("MMMM dd, yyyy"), CasinoName = fr["CasinoName"].ToString() + gagLocation, FeedbackLink = GCCPortalUrl + "Admin/Feedback/" + fr["UID"].ToString(), SurveyLink = String.Format(GCCPortalUrl + "Display/{0}/{1}", st.ToString(), fr["RecordID"]) }); } if (sql.HasError) { TopMessage.ErrorMessage = "Oops! It looks like something went wrong trying to change the tier. Please try again. (EFB120)"; } }
public static void SendNotifications <T>(HttpServerUtility server, GCCPropertyShortCode property, SurveyType surveyType, NotificationReason reason, string Comments, T replacementModel, string emailAddress, string subjectPrefix) where T : class { SendNotifications(server, property, surveyType, reason, Comments, replacementModel, emailAddress, subjectPrefix, -1); }
/// <summary> /// Survey Constructor /// </summary> /// <param name="surveyType">Type of the survey</param> public Survey(SurveyType surveyType) { SurveyType = surveyType; }
public override int GetHashCode() { return(key.GetHashCode() ^ CoordComp.GetHashCode() ^ OverallComp.GetHashCode() ^ CommunicationComp.GetHashCode() ^ CourtesyComp.GetHashCode() ^ ResponsivenessComp.GetHashCode() ^ InterviewDate.GetHashCode() ^ SampleDate.GetHashCode() ^ LoadDate.GetHashCode() ^ SurveyRound.GetHashCode() ^ RegionCode.GetHashCode() ^ WesId.GetHashCode() ^ SurveyOutcome.GetHashCode() ^ q1.GetHashCode() ^ q2.GetHashCode() ^ q3.GetHashCode() ^ q4.GetHashCode() ^ q5.GetHashCode() ^ q6.GetHashCode() ^ q7.GetHashCode() ^ q8.GetHashCode() ^ q9.GetHashCode() ^ q10.GetHashCode() ^ q11.GetHashCode() ^ q12.GetHashCode() ^ q13.GetHashCode() ^ q14.GetHashCode() ^ q15.GetHashCode() ^ q16.GetHashCode() ^ q17.GetHashCode() ^ q18.GetHashCode() ^ q19.GetHashCode() ^ q20.GetHashCode() ^ SurveyQuarter.GetHashCode() ^ SurveyType.GetHashCode()); }
public SelectionIdWithType(int selectionId, SurveyType type) { SelectionId = selectionId; Type = type; }
public static void SendFeedbackNotifications(HttpServerUtility server, string feedbackUID, bool toGuest) { SQLDatabase sql = new SQLDatabase(); sql.CommandTimeout = 120; SQLParamList sqlParams = new SQLParamList().Add("GUID", feedbackUID); DataSet ds = sql.ExecStoredProcedureDataSet("spFeedback_GetItem", sqlParams); string GCCPortalUrl = ConfigurationManager.AppSettings["GCCPortalURL"].ToString(); if (!sql.HasError && ds.Tables[0].Rows.Count > 0) { DataRow fbkDR = ds.Tables[0].Rows[0]; GCCPropertyShortCode property = (GCCPropertyShortCode)fbkDR["PropertyID"].ToString().StringToInt(); SurveyType surveyType = (SurveyType)fbkDR["SurveyTypeID"].ToString().StringToInt(); NotificationReason reason = (NotificationReason)fbkDR["ReasonID"].ToString().StringToInt(); string emailAddress = String.Empty; if (toGuest) { if (ds.Tables[2].Columns.Contains("ContactEmail")) { emailAddress = ds.Tables[2].Rows[0]["ContactEmail"].ToString(); } if (String.IsNullOrWhiteSpace(emailAddress) && ds.Tables[2].Columns.Contains("Email")) { emailAddress = ds.Tables[2].Rows[0]["Email"].ToString(); } if (String.IsNullOrWhiteSpace(emailAddress) && ds.Tables[2].Columns.Contains("Q5Email")) { emailAddress = ds.Tables[2].Rows[0]["Q5Email"].ToString(); } if (String.IsNullOrWhiteSpace(emailAddress)) { //Nothing to do return; } } string template = String.Empty; string title = String.Empty; object replacementModel; title = PropertyTools.GetCasinoName((int)property) + " - Feedback Reply Notification"; if (toGuest) { template = "GuestFeedbackNotification"; replacementModel = new { CasinoName = PropertyTools.GetCasinoName((int)property), Link = GCCPortalUrl + "F/" + feedbackUID, Attachments = new SurveyTools.SurveyAttachmentDetails[] { new SurveyTools.SurveyAttachmentDetails() { Path = "~/Images/headers/" + PropertyTools.GetCasinoHeaderImage(property), ContentID = "HeaderImage" } } }; } else { template = "StaffFeedbackNotification"; replacementModel = new { Date = DateTime.Now.ToString("yyyy-MM-dd"), CasinoName = PropertyTools.GetCasinoName((int)property), Link = GCCPortalUrl + "Admin/Feedback/" + feedbackUID }; } MailMessage msg = null; try { string path = server.MapPath("~/Content/notifications/"); msg = EmailManager.CreateEmailFromTemplate( Path.Combine(path, template + ".htm"), Path.Combine(path, template + ".txt"), replacementModel); PropertyInfo attachmentProp = replacementModel.GetType().GetProperty("Attachments"); if (attachmentProp != null) { SurveyAttachmentDetails[] attachments = attachmentProp.GetValue(replacementModel) as SurveyAttachmentDetails[]; foreach (SurveyAttachmentDetails att in attachments) { LinkedResource lr = new LinkedResource(server.MapPath(att.Path)); lr.ContentId = att.ContentID; msg.AlternateViews[0].LinkedResources.Add(lr); } } msg.From = new MailAddress("*****@*****.**"); msg.Subject = title; bool hasAddress = false; if (!String.IsNullOrWhiteSpace(emailAddress)) { msg.To.Add(emailAddress); hasAddress = true; } else { sql = new SQLDatabase(); DataTable dt = sql.QueryDataTable(@" SELECT [SendType], u.[FirstName], u.[LastName], u.[Email] FROM [tblNotificationUsers] ne INNER JOIN [tblNotificationPropertySurveyReason] psr ON ne.[PropertySurveyReasonID] = psr.[PropertySurveyReasonID] INNER JOIN [tblCOM_Users] u ON ne.UserID = u.UserID WHERE psr.PropertyID = @PropertyID AND psr.SurveyTypeID = @SurveyID AND psr.ReasonID = @ReasonID ;", new SQLParamList() .Add("@PropertyID", (int)property) .Add("@SurveyID", (int)surveyType) .Add("@ReasonID", (int)reason) ); if (!sql.HasError && dt.Rows.Count > 0) { StringBuilder addrs = new StringBuilder(); foreach (DataRow dr in dt.Rows) { switch (dr["SendType"].ToString()) { case "1": msg.To.Add(dr["Email"].ToString()); addrs.Append(dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n"); hasAddress = true; break; case "2": msg.CC.Add(dr["Email"].ToString()); //Colin requested that CC addresses not show on the call Aug 10,2015 //addrs.Append( dr["FirstName"].ToString() + " " + dr["LastName"].ToString() + " <" + dr["Email"].ToString() + ">" + "\n" ); hasAddress = true; break; case "3": msg.Bcc.Add(dr["Email"].ToString()); hasAddress = true; break; } } using (StreamReader sr = new StreamReader(msg.AlternateViews[0].ContentStream)) { msg.AlternateViews[0] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", server.HtmlEncode(addrs.ToString()).Replace("\n", "<br />")), null, MediaTypeNames.Text.Html); } using (StreamReader sr = new StreamReader(msg.AlternateViews[1].ContentStream)) { msg.AlternateViews[1] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", addrs.ToString()), null, MediaTypeNames.Text.Plain); } //using (StreamReader sr = new StreamReader(msg.AlternateViews[0].ContentStream)) //{ // msg.AlternateViews[0] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", server.HtmlEncode(addrs.ToString()).Replace("\n", "<br />")).Replace("{Business}", server.HtmlEncode(reason.ToString()).Replace("\n", "<br />")).Replace("{Comments}", server.HtmlEncode(Comments.ToString()).Replace("\n", "<br />")), null, MediaTypeNames.Text.Html); //} //using (StreamReader sr = new StreamReader(msg.AlternateViews[1].ContentStream)) //{ // msg.AlternateViews[1] = AlternateView.CreateAlternateViewFromString(sr.ReadToEnd().Replace("{Recipients}", addrs.ToString()).Replace("{Business}", reason.ToString()).Replace("{Comments}", Comments.ToString()), null, MediaTypeNames.Text.Plain); //} } } if (hasAddress) { msg.Send(); } } catch (Exception ex) { } finally { if (msg != null) { msg.Dispose(); msg = null; } } } }