protected void Add(object sender, EventArgs eventArgs)
		{
			int errors = 0;
			string[] promoters = Csv.Text.Split('\n');
			foreach (string s in promoters)
			{
				try
				{
					string[] parts = s.Split(',');
					string name = parts[0].Trim();
					string number = parts[1].Trim();
					string notes = "";
					if (parts.Length > 2)
					{
						for (int i = 2; i < parts.Length; i++)
							notes += (notes.Length > 0 ? "\n" : "") + parts[i].Trim();
					}
					Bobs.Promoter CurrentPromoter = new Bobs.Promoter();
					CurrentPromoter.DateTimeSignUp = DateTime.Now;
					CurrentPromoter.AddedByUsrK = Usr.Current.K;
					CurrentPromoter.Status = Promoter.StatusEnum.Enabled;
					CurrentPromoter.PricingMultiplier = 1.0;
					CurrentPromoter.AddedMethod = Promoter.AddedMedhods.SalesUser;

					CurrentPromoter.Name = name;
					CurrentPromoter.PhoneNumber = number;
					CurrentPromoter.ClientSector = (Promoter.ClientSectorEnum)Convert.ToInt32(Sector.SelectedValue);
					CurrentPromoter.SalesCampaignK = int.Parse(SalesCampaignDropDown.SelectedValue);
					CurrentPromoter.IsSkeleton = true;
					CurrentPromoter.SalesStatus = Promoter.SalesStatusEnum.New;
					CurrentPromoter.SalesUsrK = Usr.Current.K;
					CurrentPromoter.SalesStatusExpires = DateTime.Today.AddMonths(3);
					CurrentPromoter.SalesNextCall = DateTime.Now;

					CurrentPromoter.CreateUniqueUrlName();

					CurrentPromoter.Update();

					if (notes.Length > 0)
					{
						CurrentPromoter.AddNote(notes, Guid.NewGuid(), Usr.Current);
						CurrentPromoter.SalesCallCount = 0;
						CurrentPromoter.Update();
					}
				}
				catch
				{
					errors++;
					Error.InnerHtml += "FAILED on \"" + s + "\" <br/>";
				}
			}
			if (errors == 0)
				Response.Redirect("/admin/salesnew");
		}
示例#2
0
		protected void SalesUsrAlarmGridView_RowCommand(object sender, GridViewCommandEventArgs e)
		{
			if (e.CommandName.ToUpper().Equals("DELETEALL"))
			{
				try
				{
					//GridViewRow row = (GridViewRow)dropDownList.NamingContainer;
					foreach (GridViewRow row in this.SalesUsrAlarmGridView.Rows)
					{
						Promoter promoter = new Promoter(Convert.ToInt32(((Label)row.FindControl("PromoterKLabel")).Text));
						promoter.Alarm = false;
						promoter.Update();
					}
					SalesUsrAlarmPanelSetup();
				}
				catch
				{ }
			}
		}
示例#3
0
		protected void SnoozeAllDropDownList_SelectedIndexChanged(object sender, EventArgs e)
		{
			DropDownList dropDownList = (DropDownList)sender;
			if (dropDownList.SelectedValue != "")
			{
				//GridViewRow row = (GridViewRow)dropDownList.NamingContainer;
				foreach (GridViewRow row in this.SalesUsrAlarmGridView.Rows)
				{
					Promoter promoter = new Promoter(Convert.ToInt32(((Label)row.FindControl("PromoterKLabel")).Text));
					promoter.SalesNextCall = DateTime.Now.AddMinutes(Convert.ToInt32(dropDownList.SelectedValue));
					promoter.Alarm = true;
					promoter.Update();
				}
				SalesUsrAlarmPanelSetup();
			}
		}
示例#4
0
		protected void SalesUsrAlarmGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
		{
			try
			{
				Promoter promoter = new Promoter(Convert.ToInt32(((Label)this.SalesUsrAlarmGridView.Rows[e.RowIndex].FindControl("PromoterKLabel")).Text));
				promoter.Alarm = false;
				promoter.Update();
				SalesUsrAlarmPanelSetup();
			}
			catch
			{ }
		}
		public void RemovePromoter(DataGridCommandEventArgs eventArgs)
		{
			if (eventArgs.CommandName.Equals("Remove"))
			{
				Promoter p = new Promoter(int.Parse(eventArgs.CommandArgument.ToString()));
				p.SalesUsrK = 0;
				p.SalesStatusExpires = null;
				p.SalesStatus = Promoter.SalesStatusEnum.Idle;
				p.Update();
				p.FixQuestionsThreadUsrs();
			}
		}