Ejemplo n.º 1
0
		private void AddUser()
		{
			if (Page.IsValid)
			{
				if (Membership.GetUser(txtLoginName.Text) == null)
				{
					UserInformation userInfo = new UserInformation
					{
						Login = txtLoginName.Text,
						FirstName = txtFirstName.Text,
						LastName = txtLastName.Text
					};
					try
					{
						Membership.CreateUser(txtLoginName.Text, txtPasswordName.Text, txtEmail.Text);
						DataManager.AddUserInformation(userInfo);
						if (chkAdmin.Checked)
						{
							Roles.AddUserToRole(txtLoginName.Text, _admin);
						}
            //lblCongratulate.Visible = true;
            //lblCongratulate.Text = "User succesfully created!";
            Response.Redirect(PageConstants.AdministrationPage);
					}
					catch (Exception ex)
					{
            //lblCongratulate.Text = ex.Message;
            //lblCongratulate.Visible = true;
						throw ex;
					}
				}
				else
				{
          //lblCongratulate.Text = "User is already exists!";
          //lblCongratulate.Visible = true;
          Response.Redirect(PageConstants.AdministrationPage);
					return;
				}
			}
		}
Ejemplo n.º 2
0
		public static void UpdateUserInformation(UserInformation entity)
		{
			_dataProvider.UpdateUserInformation(entity);
		}
Ejemplo n.º 3
0
		private void UpdateUserInfo()
		{
			UserInformation userInfo = new UserInformation
			{
				Login = txtLoginName.Text,
				FirstName = txtFirstName.Text,
				LastName = txtLastName.Text
			};
			MembershipUser mu = Membership.GetUser(txtLoginName.Text);
			mu.Email = txtEmail.Text;
			Membership.UpdateUser(mu);
			DataManager.UpdateUserInformation(userInfo);

			if (chkAdmin.Checked)
			{
				if (!Roles.IsUserInRole(txtLoginName.Text, _admin))
					Roles.AddUserToRole(txtLoginName.Text, _admin);
			}
			else
			{
				if (Roles.IsUserInRole(txtLoginName.Text, _admin))
					Roles.RemoveUserFromRole(txtLoginName.Text, _admin);
			}
      //lblCongratulate.Text = "User's information has been changed!";
      //lblCongratulate.Visible = true;
      Response.Redirect(PageConstants.AdministrationPage);
		}
Ejemplo n.º 4
0
		private static Activity GetActivityEntity(T_Activity tActivity)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				UserInformation createdBy = new UserInformation { FirstName = tActivity.T_UserInformation.usrFirstName, LastName = tActivity.T_UserInformation.usrLastName, Login = tActivity.T_UserInformation.Login };
				UserInformation owner = new UserInformation { FirstName = tActivity.T_UserInformation1.usrFirstName, LastName = tActivity.T_UserInformation1.usrLastName, Login = tActivity.T_UserInformation1.Login };
				UserInformation sender = new UserInformation { FirstName = tActivity.T_UserInformation2.usrFirstName, LastName = tActivity.T_UserInformation2.usrLastName, Login = tActivity.T_UserInformation2.Login };

				var tActivityLeads = dc.T_ActivityLeads.Where(al => al.ActivityID == tActivity.ActivityID);
				var tLeads = dc.T_Leads.Where(l => tActivityLeads.Any(ac => ac.LeadID == l.LeadID));
				CCTLeadProvider leadProvider = new CCTLeadProvider();
				List<Lead> recipients = new List<Lead>();
				foreach (var lead in tLeads)
				{
					var recipient = leadProvider.GetLeadEntity(lead);
					recipients.Add(recipient);
				}

				Priority priority = new Priority { PriorityID = tActivity.T_Priority.PriorityID, Type = tActivity.T_Priority.prType };
				ActivityType activityType = new ActivityType { Type = tActivity.T_ActivityType.atType, TypeID = tActivity.T_ActivityType.TypeID };

				DateTime createdDate = tActivity.actCreationDate;
				DateTime? dueDate = tActivity.actDue;

				List<Note> notes = new List<Note>();
				var tActivityNotes = dc.T_ActivityNotes.Where(e => e.ActivityID == tActivity.ActivityID);
				foreach (var tActivityNote in tActivityNotes)
				{
					notes.Add(leadProvider.GetNoteEntity(tActivityNote.T_Note));
				}


				//Activity activity = new Activity()
				//{
				//  ActivityID = tActivity.ActivityID,
				//  CreatedBy = createdBy,
				//  ActivityType = activityType,
				//  CreatedOn = createdDate,
				//  Due = dueDate,
				//  Notes = notes,
				//  Owner = owner,
				//  Post = tActivity.actPost,
				//  Priority = priority,
				//  Recipient = recipient,
				//  Sender = sender,
				//  Subject = tActivity.actSubject
				//};

				ActivityStatus status = new ActivityStatus();
				status.StatusID = tActivity.StatusID;
				var stat = dc.T_ActivityStatus.Where(st => st.StatusID == status.StatusID).Select(s => s.asStatus).First();
				status.Status = stat;
				Activity activity = new Activity();
				activity.ActivityID = tActivity.ActivityID;
				activity.CreatedBy = createdBy;
				activity.ActivityType = activityType;
				activity.CreatedOn = createdDate;
				activity.Due = dueDate;
				activity.Notes = notes;
				activity.Owner = owner;
				activity.Post = tActivity.actPost;
				activity.Priority = priority;
				activity.Recipient = recipients;
				activity.Sender = sender;
				activity.Subject = tActivity.actSubject;
				activity.Status = status;

				if (tActivity.actPhone != null)
				{
					activity.Phone = tActivity.actPhone;
				}
				if (tActivity.actAddress != null)
				{
					activity.Address = tActivity.actAddress;
				}

				return activity;
			}
		}
Ejemplo n.º 5
0
		public static void AddUserInformation(UserInformation entity)
		{
			_dataProvider.AddUserInformation(entity);
		}
Ejemplo n.º 6
0
		public List<UserInformation> GetUsersInfo()
		{
			using (EngageCCTDataClassesDataContext dc = new EngageCCTDataClassesDataContext())
			{
				var listUsersInfo = new List<UserInformation>();
				var query = dc.T_UserInformations.AsQueryable();
				foreach (T_UserInformation item in query)
				{
					UserInformation userInfo = new UserInformation();
					userInfo.Login = item.Login;
					userInfo.FirstName = item.usrFirstName;
					userInfo.LastName = item.usrLastName;
					listUsersInfo.Add(userInfo);
				}
				return listUsersInfo;
			}
		}
Ejemplo n.º 7
0
		public static IEnumerable<UserInformation> GetUsersPage(int rowIndex, int pageSize, string sortExpression)
		{
			using (EngageCCTDataClassesDataContext dc = new EngageCCTDataClassesDataContext())
			{
				int totalRows;
				int pageIndex = rowIndex / pageSize;

				List<UserInformation> users = new List<UserInformation>();
				IEnumerable<T_UserInformation> usersPage;

				bool asc = !sortExpression.Contains("DESC");
				switch (sortExpression.Split(' ')[0])
				{
					case "Login":
						usersPage = dc.T_UserInformations.Page(pageIndex, pageSize, u => u.Login, asc, out totalRows);
						break;
					case "FirstName":
						usersPage = dc.T_UserInformations.Page(pageIndex, pageSize, u => u.usrFirstName, asc, out totalRows);
						break;
					case "LastName":
						usersPage = dc.T_UserInformations.Page(pageIndex, pageSize, u => u.usrLastName, asc, out totalRows);
						break;
					default:
						usersPage = dc.T_UserInformations.Page(pageIndex, pageSize, u => u.Login, asc, out totalRows);
						break;
				}

				foreach (var user in usersPage)
				{
					UserInformation userInform = new UserInformation();
					userInform.Login = user.Login;
					userInform.FirstName = user.usrFirstName;
					userInform.LastName = user.usrLastName;
					users.Add(userInform);
				}

				return users;
			}
		}
Ejemplo n.º 8
0
		//public void CancelOrRestoreLead(int leadId, int newstatusId)
		//{
		//  using (EngageCCTDataClassesDataContext dc = new EngageCCTDataClassesDataContext())
		//  {
		//    var leads = dc.T_Leads;
		//    var lead = leads.FirstOrDefault(l => l.LeadID == leadId);
		//    if (lead == null)
		//      throw new ApplicationException("There are no this lead!");
		//    else
		//    {
		//      if (lead.ldIsCancelled == true)
		//      {
		//        lead.ldIsCancelled = false;
		//      }
		//      else
		//      {
		//        lead.ldIsCancelled = true;
		//      }
		//      dc.SubmitChanges();
		//    }
		//  }
		//}

		public void UpdateUserInformation(UserInformation entity)
		{
			using (EngageCCTDataClassesDataContext dc = new EngageCCTDataClassesDataContext())
			{
				var user = dc.T_UserInformations.FirstOrDefault(u => u.Login == entity.Login);
				if (user != null)
				{
					user.usrFirstName = entity.FirstName;
					user.usrLastName = entity.LastName;
					dc.SubmitChanges();
				}
				else
					throw new ApplicationException("User is not found!");
			}
		}
Ejemplo n.º 9
0
		internal UserInformation GetUserInformationEntity(T_UserInformation tUserInfo)
		{
			UserInformation userInfo = new UserInformation();
			userInfo.Login = tUserInfo.Login;
			userInfo.FirstName = tUserInfo.usrFirstName;
			userInfo.LastName = tUserInfo.usrLastName;
			return userInfo;
		}
Ejemplo n.º 10
0
		public UserInformation GetUserInformation(string login)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				var tableUserInfo = dc.T_UserInformations.FirstOrDefault(u => u.Login == login);
				if (tableUserInfo != null)
				{
					UserInformation userInfo = new UserInformation();
					userInfo.Login = tableUserInfo.Login;
					userInfo.FirstName = tableUserInfo.usrFirstName;
					userInfo.LastName = tableUserInfo.usrLastName;
					return userInfo;
				}
				else
					throw new ApplicationException("Login not found!");
			}
		}
Ejemplo n.º 11
0
		public void AddUserInformation(UserInformation entity)
		{
			using (var dc = new EngageCCTDataClassesDataContext())
			{
				var userInfo = new T_UserInformation();
				userInfo.Login = entity.Login;
				userInfo.usrFirstName = entity.FirstName;
				userInfo.usrLastName = entity.LastName;
				dc.T_UserInformations.InsertOnSubmit(userInfo);
				dc.SubmitChanges();
			}
		}
Ejemplo n.º 12
0
        protected int ValidateLead(Lead lead, UserInformation userInfo)
        {
            ValidationLead validation = new ValidationLead();
            validation.Lead = lead;
            validation.User = userInfo;

            List<ValidationResult> listResults = new List<ValidationResult>();

            bool ofac = true;
            bool freddie = true;

            var results = LeadValidationManager.CheckValidationsSource();
            foreach (var item in results)
            {
                switch (item.Type.Type)
                {
                    case ValidationConstants.OFAC:
                        if (item.Status.Status == ValidationConstants.StatusError)
                        {
                            ofac = false;
                        }

                        break;
                    case ValidationConstants.FreddieList:
                        if (item.Status.Status == ValidationConstants.StatusError)
                        {
                            freddie = false;
                        }
                        break;
                    default:
                        break;
                }
            }

            var typeOFAC = new ValidationType();
            var statusOFAC = new ValidationStatus();

            var typeAddress = new ValidationType();
            var statusAddress = new ValidationStatus();

            var typeFreddie = new ValidationType();
            var statusFreddie = new ValidationStatus();

            typeOFAC.Type = ValidationConstants.OFAC;
            if (ofac)
            {
                statusOFAC.Status = ValidationConstants.StatusPassed;
            }
            else
            {
                statusOFAC.Status = ValidationConstants.StatusNoInformation;
            }
            listResults.Add(new ValidationResult { Type = typeOFAC, Status = statusOFAC });


            typeFreddie.Type = ValidationConstants.FreddieList;
            if (freddie)
            {
                statusFreddie.Status = ValidationConstants.StatusPassed;
            }
            else
            {
                statusFreddie.Status = ValidationConstants.StatusNoInformation;
            }
            listResults.Add(new ValidationResult { Type = typeFreddie, Status = statusFreddie });


            typeAddress.Type = ValidationConstants.Address;
            statusAddress.Status = ValidationConstants.StatusNoInformation;
            listResults.Add(new ValidationResult { Type = typeAddress, Status = statusAddress });

            validation.Results = listResults;

            return LeadValidationManager.SaveValidationLead(validation);

        }