Пример #1
0
		public string SalesCallToString(SalesCall sc)
		{
			StringBuilder sb = new StringBuilder();

			if (sc.IsImportant)
				sb.Append("<b>");
			else
				sb.Append("<small>");

			sb.Append(sc.Usr.Link());
			sb.Append(", ");
			sb.Append(Cambro.Misc.Utility.FriendlyDate(sc.DateTimeStart, false));
			sb.Append(", ");
			if (!sc.IsCall)
				sb.Append("note");
			else if (sc.Direction.Equals(SalesCall.Directions.Incoming))
				sb.Append("incoming call");
			else
			{
				sb.Append("outgoing");

				if (sc.Type.Equals(SalesCall.Types.Cold))
					sb.Append(" cold call");
				else if (sc.Type.Equals(SalesCall.Types.ProactiveFollowUp))
					sb.Append(" follow up call");
				else
					sb.Append(" active call");
			}
			if (sc.Note.Length > 0)
			{
				sb.Append(":");
				if(!sc.IsImportant)
					sb.Append("</small>");

				sb.Append("<br>");
				sb.Append(sc.Note.Replace("\n", "<br>"));
			}
			else if (!sc.IsImportant)
				sb.Append("</small>");

			if (sc.IsImportant)
				sb.Append("</b>");

			return sb.ToString();
		}
Пример #2
0
		public void SalesCallToString(SalesCall sc, StringBuilder sb)
		{
			if (!doneOne || lastTime.Hour != sc.DateTimeStart.Hour)
			{
				if (doneOne)
					sb.Append("</div>");
				if (!ContainerPage.Url.HasDayFilter && lastTime.Day != sc.DateTimeStart.Day)
				{
					sb.Append("<h2 style=\"padding:2px 8px 2px 8px;\">" + sc.DateTimeStart.ToString("ddd dd") + "</h2>");
				}
				sb.Append("<div style=\"padding:2px 8px 2px 8px; background-color:#" + (lastColor ? "FECA26" : "FED551") + ";\">");
				lastColor = !lastColor;
			}
			lastTime = sc.DateTimeStart;
			doneOne = true;
			sb.Append("<p>");
			
			sb.Append("<small>");

			sb.Append(sc.Promoter.Link());
			sb.Append(", ");
			if (ContainerPage.Url.HasDayFilter)
				sb.Append(sc.DateTimeStart.ToString("HH:mm"));
			else
				sb.Append(sc.DateTimeStart.ToString("ddd dd HH:mm"));
			//sb.Append(Cambro.Misc.Utility.FriendlyDate(sc.DateTimeStart, false));
			sb.Append(", ");
			if (!sc.IsCall)
				sb.Append("note");
			else if (sc.Direction.Equals(SalesCall.Directions.Incoming))
				sb.Append("incoming call");
			else
			{
				if (sc.Effective)
					sb.Append("</small><b>effective</b> <small>");

				sb.Append("outgoing");

				if (sc.Type.Equals(SalesCall.Types.Cold))
					sb.Append(" cold call");
				else if (sc.Type.Equals(SalesCall.Types.ProactiveFollowUp))
					sb.Append(" follow up call");
				else
					sb.Append(" active call");
			}

			if (sc.IsCall)
			{
				sb.Append(", " + sc.Duration.ToString("0") + " min ");
				int stars = int.Parse(sc.Duration.ToString("0"));
				if (stars > 60)
					stars = 60;
				for (int i = 0; i < stars; i++)
					sb.Append("*");
			}

			if (sc.Note.Length > 0)
			{
				sb.Append("</small>");

				sb.Append("<br>");
				sb.Append(sc.Note.Replace("\n", "<br>"));
			}
			else
				sb.Append("</small>");

			sb.Append("</p>");
		}
Пример #3
0
		protected void ImportantSalesCallCheckBox_CheckedChanged(object sender, EventArgs e)
		{
			CheckBox checkbox = (CheckBox)sender;
			GridViewRow row = (GridViewRow)checkbox.NamingContainer;
			SalesCall sc = new SalesCall(Convert.ToInt32(((Label)row.FindControl("SalesCallKLabel")).Text));
			sc.IsImportant = checkbox.Checked;
			sc.Update();
			BindNotes();
		}
Пример #4
0
		public void MakeCall(bool sales)
		{
			if (Usr.Current.IsAdmin)
			{
				string number;
				if (AdminPhoneNumbersDropDown.SelectedValue.Equals("0"))
					number = CurrentPromoter.PhoneNumber;
				else
				{
					Usr u = new Usr(int.Parse(AdminPhoneNumbersDropDown.SelectedValue));
					number = u.MobileDial;
				}

				if (number.Length>0)
				{
					Query qCurrent = new Query();
					qCurrent.QueryCondition = new And(
						new Q(SalesCall.Columns.PromoterK, CurrentPromoter.K),
						new Q(SalesCall.Columns.InProgress, true),
						new Q(SalesCall.Columns.IsCall, true));
					SalesCallSet scsCurrent = new SalesCallSet(qCurrent);
					if (scsCurrent.Count > 0)
					{
						SalesCallError.Text = "<br>" + scsCurrent[0].Usr.NickName + " has a current call with this promoter. Please get them to hang up, or try again later.";
						SalesCallError.Visible = true;
						return;
					}


					if (sales)
					{
						Query qDup = new Query();
						qDup.QueryCondition = new Q(SalesCall.Columns.DuplicateGuid, (Guid)this.ViewState["SalesCallDuplicateGuid"]);
						SalesCallSet scsDup = new SalesCallSet(qDup);
						if (scsDup.Count == 0)
						{

                            //com.dontstayin.hoth.Phone Phone = new Spotted.com.dontstayin.hoth.Phone();
							Phone p = Bobs.Phone.GetFromUsrK(Usr.Current.K);
							p.MakeCall(number);


							SalesCall sc = new SalesCall();
							sc.DuplicateGuid = (Guid)this.ViewState["SalesCallDuplicateGuid"];
							sc.UsrK = Usr.Current.K;
							sc.PromoterK = CurrentPromoter.K;
							sc.DateTimeStart = DateTime.Now;
							sc.Dismissed = false;
							sc.InProgress = true;
							sc.IsCallToNewLead = CurrentPromoter.IsNewLead;
							sc.Direction = SalesCall.Directions.Outgoing;
							if (CurrentPromoter.EffectiveSalesStatus.Equals(Promoter.SalesStatusEnum.Active))
								sc.Type = SalesCall.Types.Active;
							else if (CurrentPromoter.EffectiveSalesStatus.Equals(Promoter.SalesStatusEnum.Proactive))
								sc.Type = SalesCall.Types.ProactiveFollowUp;
							else
								sc.Type = SalesCall.Types.Cold;
							sc.Effective = false;
							sc.IsCall = true;
							sc.Update();
							CurrentPromoter.UpdateSalesCallCount(true);
							Response.Redirect(CurrentPromoter.Url());
						}
					}
					else
					{
                        //com.dontstayin.hoth.Phone Phone = new Spotted.com.dontstayin.hoth.Phone();
						Phone p = Bobs.Phone.GetFromUsrK(Usr.Current.K);
						p.MakeCall(number);
					}
				}
			}
		}
Пример #5
0
		protected void TakeIncomingCall(object sender, EventArgs eventArgs)
		{
			if (Usr.Current.IsAdmin)
			{

				Query qDup = new Query();
				qDup.QueryCondition = new Q(SalesCall.Columns.DuplicateGuid, (Guid)this.ViewState["SalesCallDuplicateGuid"]);
				SalesCallSet scsDup = new SalesCallSet(qDup);
				if (scsDup.Count == 0)
				{
					SalesCall sc = new SalesCall();
					sc.DuplicateGuid = (Guid)this.ViewState["SalesCallDuplicateGuid"];
					sc.UsrK = Usr.Current.K;
					sc.PromoterK = CurrentPromoter.K;
					sc.DateTimeStart = DateTime.Now;
					sc.Dismissed = false;
					sc.InProgress = true;
					sc.IsCallToNewLead = CurrentPromoter.IsNewLead;
					sc.Direction = SalesCall.Directions.Incoming;
					if (CurrentPromoter.EffectiveSalesStatus.Equals(Promoter.SalesStatusEnum.Active))
						sc.Type = SalesCall.Types.Active;
					else if (CurrentPromoter.EffectiveSalesStatus.Equals(Promoter.SalesStatusEnum.Proactive))
						sc.Type = SalesCall.Types.ProactiveFollowUp;
					else
						sc.Type = SalesCall.Types.Cold;
					sc.Effective = true;
					sc.IsCall = true;
					sc.Update();
					sc.EffectiveAction();
					CurrentPromoter.UpdateSalesCallCount(true);
					Response.Redirect(CurrentPromoter.Url());
				}
			}
		}
Пример #6
0
		public void SortPromoterNotes(object o, System.EventArgs e)
		{
			Cambro.Web.Helpers.WriteAlertHeader();

			Cambro.Web.Helpers.WriteAlert("Selecting Promoters...", 1);
			Query q = new Query();
			//q.QueryCondition=???
			PromoterSet bs = new PromoterSet(q);
			for (int count = 0; count < bs.Count; count++)
			{
				Promoter c = bs[count];

				try
				{
					if (c.ManualNote.Length > 0)
					{
						SalesCall scNote = new SalesCall();
						scNote.DuplicateGuid = Guid.NewGuid();
						scNote.UsrK = Usr.Current.K;
						scNote.PromoterK = c.K;
						scNote.DateTimeStart = DateTime.Now;
						scNote.DateTimeEnd = scNote.DateTimeStart;
						scNote.Duration = 0;
						scNote.Dismissed = true;
						scNote.InProgress = false;
						scNote.Direction = SalesCall.Directions.Outgoing;
						if (c.EffectiveSalesStatus.Equals(Promoter.SalesStatusEnum.Active))
							scNote.Type = SalesCall.Types.Active;
						else if (c.EffectiveSalesStatus.Equals(Promoter.SalesStatusEnum.Proactive))
							scNote.Type = SalesCall.Types.ProactiveFollowUp;
						else
							scNote.Type = SalesCall.Types.Cold;
						scNote.IsCall = false;
						scNote.Note = c.ManualNote;
						scNote.Effective = true;
						scNote.Update();
					}
					// Do work here!
					//c.Update();

					if (count % 10 == 0)
						Cambro.Web.Helpers.WriteAlert("Done " + count + "/" + bs.Count, 2);

				}
				catch(Exception ex)
				{
					Cambro.Web.Helpers.WriteAlert("Exception " + count + "/" + bs.Count + " - " + ex.ToString(), 3);
				}

				bs.Kill(count);

			}
			Cambro.Web.Helpers.WriteAlert("Done!", 3);
			Cambro.Web.Helpers.WriteAlertFooter();
		}
Пример #7
0
		public bool AddNote(string Note, Guid DuplicateGuid, Usr CurrentUsr, bool isImportant)
		{
			Query qDup = new Query();
			qDup.QueryCondition = new Q(SalesCall.Columns.DuplicateGuid, DuplicateGuid);
			SalesCallSet scsDup = new SalesCallSet(qDup);
			if (scsDup.Count == 0)
			{
				SalesCall scNote = new SalesCall();
				scNote.DuplicateGuid = DuplicateGuid;
				scNote.UsrK = CurrentUsr.K;
				scNote.PromoterK = this.K;
				scNote.DateTimeStart = DateTime.Now;
				scNote.DateTimeEnd = scNote.DateTimeStart;
				scNote.Duration = 0;
				scNote.Dismissed = true;
				scNote.InProgress = false;
				scNote.Direction = SalesCall.Directions.Outgoing;
				if (this.EffectiveSalesStatus.Equals(Promoter.SalesStatusEnum.Active))
					scNote.Type = SalesCall.Types.Active;
				else if (this.EffectiveSalesStatus.Equals(Promoter.SalesStatusEnum.Proactive))
					scNote.Type = SalesCall.Types.ProactiveFollowUp;
				else
					scNote.Type = SalesCall.Types.Cold;
				scNote.IsCall = false;
				scNote.Note = Note;
				scNote.Effective = true;
				scNote.IsImportant = isImportant;
				scNote.Update();

				this.ManualNote = Note + " [" + CurrentUsr.NickName + " " + DateTime.Now.ToShortDateString() + "]\n" + this.ManualNote;

				this.UpdateSalesCallCount(false);

				this.Update();


				return true;
			}
			return false;
		}