示例#1
0
 private void SetObj()
 {
     //tblProfile prof = GoProGo.Data.GoProGoDC.ProfileDC.tblProfiles.First(pro => pro.UserID.ToString() == MembershipUser.ProviderUserKey.ToString());
     //This will trigger Initialize function
     //ObjProfile = prof;
     ObjProfile = SessionBag.Profile;
 }
示例#2
0
 public AddEditViewModel(AddEdit addEditOpen, string username)
 {
     addEdit = addEditOpen;
     Profile = new tblProfile();
     //Profile = tool.FindTblProfile(username);
     Username = username;
 }
示例#3
0
    public static string Return_Full_Name(int profile_id)
    {
        string full_name = string.Empty;

        tblProfile p = ModelLayer.GetProfile(profile_id);

        full_name = p.vLastname + ", " + p.vFirstname;

        return(full_name);
    }
 private void ParseProperties()
 {
     if (int.TryParse(_ProfileID, out _ProfID))
     {
         _ObjProfile = GoProGo.Data.GoProGoDC.ProfileDC.GetProfileByID(_ProfID).FirstOrDefault <tblProfile>();
     }
     else
     {
         throw new Exception("Invalid ProfileID provided. ProfileID:" + _ProfileID);
     }
 }
示例#5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //Scenario of postback is handled when ObjProfile Property is set
     if (!IsPostBack)
     {
         tblProfile prof = GoProGo.Data.GoProGoDC.ProfileDC.tblProfiles.First(pro => pro.UserID.ToString() == MembershipUser.ProviderUserKey.ToString());
         //ucProfile11.ObjProfile = prof;
         //ucProfile11a.ObjProfile = prof;
         //ucProfile21.ObjProfile = prof;
         //ucProfile31.ObjProfile = prof;
         //ucProfile41.ObjProfile = prof;
     }
 }
示例#6
0
        public static tblProfile GetProfileByUser(MembershipUser user)
        {
            tblProfile prof = null;

            try
            {
                prof = GoProGoDC.ProfileDC.GetProfileByUserID(new Guid(user.ProviderUserKey.ToString())).SingleOrDefault <tblProfile>();
            }
            catch (Exception ex)
            {
                //TODO: Log Exception
            }
            return(prof);
        }
示例#7
0
        public static tblProfile GetProfileByID(int id)
        {
            tblProfile prof = null;

            try
            {
                prof = GoProGoDC.ProfileDC.GetProfileByID(id).SingleOrDefault <tblProfile>();
            }
            catch (Exception ex)
            {
                //TODO: Log Exception
            }
            return(prof);
        }
    private void BindCombobox()
    {
        //Find out if user has consumed free plantypes or if he can

        _Profile = _Campaign.tblProfile;

        PlanType expectedPlansType = _Profile.GetConsumedDiscountedPlanTypes();


        ddlPaymentOption.DataSource = tblPlan.GetPlansAfterFilter(expectedPlansType);

        ddlPaymentOption.DataTextField  = "PlanDisplayName";
        ddlPaymentOption.DataValueField = "ID";

        ddlPaymentOption.DataBind();
    }
        public string Age(string username)
        {
            try
            {
                using (Entity context = new Entity())
                {
                    tblUser userToFind = (from r in context.tblUsers where r.Username == username select r).FirstOrDefault();

                    tblProfile profileToFind = (from r in context.tblProfiles where r.UserID == userToFind.UserID select r).FirstOrDefault();
                    return(profileToFind.Age.ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
                return(null);
            }
        }
    private void SetObj()
    {
        try
        {
            string profileID = Request.QueryString["ProfileID"];
            int    profID    = int.Parse(profileID);

            ObjProfile = GoProGoDC.ProfileDC.GetProfileByID(profID).Single <tblProfile>();
        }
        catch (Exception ex)
        {
            if (OnError != null)
            {
                OnError(this, new ControlErrorArgs()
                {
                    InnerException = ex, Message = "Invalid Profile.", Severity = 2
                });
            }
        }
    }
 private void ParseProperties()
 {
     try
     {
         if (int.TryParse(_ProfileID, out _ProfID))
         {
             _ObjProfile = GoProGo.Data.GoProGoDC.ProfileDC.GetProfileByID(_ProfID).FirstOrDefault <tblProfile>();
         }
         else
         {
             throw new Exception("Invalid ProfileID provided. ProfileID:" + _ProfileID);
         }
     }
     catch (Exception ex)
     {
         //Logging here
         ClearMessage();
         ShowMessage("Invalid page request.", MessageType.Error);
     }
 }
示例#12
0
    private void LoadDataFromProfile()
    {
        tblProfile prof = SessionBag.Profile;

        if (prof != null)
        {
            Phone         = prof.Phone1;
            Phone2        = prof.Phone2;
            Fax           = prof.Fax;
            StreetAddress = prof.StreetAddress;
            Appartment    = prof.Apartment;
            CountryID     = prof.CountryID;
            Region        = prof.Region;
            City          = prof.City;
            Zip           = prof.PostalCode;
            FirstName     = prof.FirstName;
            MI            = prof.MiddleInitials;
            LastName      = prof.LastName;
        }
    }
示例#13
0
        private void SaveExecute()
        {
            try
            {
                int        userId  = (from r in context.tblUsers where r.Username == Username select r.UserID).FirstOrDefault();
                tblProfile profile = new tblProfile();
                profile.About     = Profile.About;
                profile.Interests = Profile.Interests;
                profile.Age       = Profile.Age;
                profile.UserID    = userId;

                if (profile.Age < 10)
                {
                    MessageBox.Show("User must be at least 10 years old");
                }
                else
                {
                    List <tblProfile> profileList = context.tblProfiles.ToList();
                    foreach (tblProfile item in profileList)
                    {
                        if (item.UserID == userId)
                        {
                            context.tblProfiles.Remove(item);
                        }
                        else
                        {
                            continue;
                        }
                    }
                    context.tblProfiles.Add(profile);
                    context.SaveChanges();
                    MessageBox.Show("Personal informations are saved.");
                    addEdit.Close();
                    Update = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#14
0
    private void LoadProfile(int iAccount)
    {
        if (iAccount != 0)
        {
            tblAccount     a  = ModelLayer.GetAccount(iAccount);
            tblProfile     p  = ModelLayer.GetProfile(a.iProfile);
            tblAccountType at = ModelLayer.GetAccountType(a.iAccountType);

            label_name.Text         = p.vLastname + ", " + p.vFirstname;
            label_country.Text      = p.vCountry;
            label_account_type.Text = at.vAccountType;
            label_age.Text          = p.vAge;
            label_sex.Text          = p.vSex;
        }
        else
        {
            label_name.Text         = "Admin";
            label_country.Text      = "Admin";
            label_account_type.Text = "Admin";
            label_age.Text          = "Admin";
            label_sex.Text          = "Admin";
        }
    }
示例#15
0
    public void btnCreateUser_Click(object sender, EventArgs e)
    {
        if (OnBeforeUserCreate != null)
        {
            OnBeforeUserCreate(this, new EventArgs());
        }

        string userName     = UserName.Trim();
        string email        = Email.Trim();
        string password     = Password.Trim();
        string confPassword = ConfirmPassword.Trim();
        MembershipCreateStatus createStatus = MembershipCreateStatus.UserRejected;
        MembershipUser         user;

        try
        {
            if (password == confPassword)
            {
                if (password == confPassword)
                {
                    user = Membership.CreateUser(userName, password, email, null, null, false, out createStatus);
                    if (createStatus != MembershipCreateStatus.Success)
                    {
                        throw new Exception("User creation failed: " + createStatus.ToString());
                    }
                }
                else
                {
                    throw new Exception("Password Comparison failed.");
                }

                Roles.AddUsersToRole(new string[] { userName }, "Members");

                if (OnAfterUserCreate != null)
                {
                    OnAfterUserCreate(this, new EventArgs());
                }

                //Right after creating user create a new profile for this user
                if (OnBeforeProfileCreate != null)
                {
                    OnBeforeProfileCreate(this, null);
                }

                tblProfile prof = new tblProfile()
                {
                    UserID = new Guid(user.ProviderUserKey.ToString())
                    ,
                    RegistrationDate = DateTime.Parse(DateTime.Now.ToShortDateString())
                    ,
                    IsActive = false
                    ,
                    IsCompleted = false
                    ,
                    IsPublic = false
                    ,
                    MemberShipTypeID = (int)GoProGo.Business.Entities.MemberShipType.Standard
                    ,
                    Longitude = 0
                    ,
                    Latitude = 0
                };
                GoProGoDC.ProfileDC.tblProfiles.InsertOnSubmit(prof);
                GoProGoDC.ProfileDC.SubmitChanges();

                tblActivationRequest activation = new tblActivationRequest()
                {
                    ActivationID = Guid.NewGuid()
                    ,
                    Email = this.Email
                    ,
                    IsFulfilled = false
                    ,
                    ProfileID = prof.ID
                    ,
                    CreationDate = DateTime.Now
                };
                prof.tblActivationRequests.Add(activation);
                GoProGoDC.ProfileDC.SubmitChanges();


                pnlConfirmationMessage.Visible = true;
                pnlCreateUser.Visible          = false;
                lblEmail.Text = Email;

                //if (OnAfterProfileCreate != null)
                //    OnAfterProfileCreate(this, null);
            }
            else
            {
                throw new Exception("Password comparison failed.");
            }
        }
        catch (SqlException ex)
        {
            if (createStatus == MembershipCreateStatus.Success)
            {
                Membership.DeleteUser(userName);
            }
            if (this.OnError != null)
            {
                OnError(this, new ControlErrorArgs()
                {
                    Severity = 10, Message = "General sql exception."
                });
            }
        }
        catch (Exception ex)
        {
            if (createStatus == MembershipCreateStatus.Success)
            {
                Membership.DeleteUser(userName);
            }
            if (this.OnError != null)
            {
                OnError(this, new ControlErrorArgs()
                {
                    InnerException = ex
                });
            }
        }
    }
 private void FetchCampaign()
 {
     _Profile = _Campaign.tblProfile;
 }
 private void SetObj()
 {
     ObjProfile = SessionBag.Profile;
 }
示例#18
0
        private Company SyncCompany(Data.Models.Company company, out bool commitNewContext)
        {
            commitNewContext = false;

            var oldCompany = OldContext.Companies
                             .Select(c => new
            {
                company  = c,
                contacts = c.Contacts,
                profiles = c.tblProfiles
            })
                             .Where(c => c.company.Company_IA == company.Name)
                             .ToList()
                             .Select(c => c.company)
                             .FirstOrDefault();

            if (oldCompany == null)
            {
                oldCompany = new Company
                {
                    Company_IA = company.Name,
                    EntryDate  = company.TimeStamp.ConvertUTCToLocal().RoundMillisecondsForSQL(),
                    s_GUID     = Guid.NewGuid(),
                };
                OldContext.Companies.AddObject(oldCompany);
            }

            oldCompany.CType      = GetCType(company.CompanyTypes.Select(c => c.CompanyTypeEnum));
            oldCompany.InActive   = !company.Active;
            oldCompany.EmployeeID = company.EmployeeId;
            oldCompany.Serialized = SerializableCompany.Serialize(company);

            var oldIds           = new List <int?>();
            var contactsToRemove = oldCompany.Contacts == null ? new List <Contact>() : oldCompany.Contacts.ToList();

            foreach (var contact in company.Contacts)
            {
                foreach (var address in contact.Addresses.DefaultIfEmpty(new ContactAddress
                {
                    Address = new Address(),
                    OldContextID = contact.OldContextID
                }))
                {
                    var oldContact = contactsToRemove.FirstOrDefault(c => c.ID == address.OldContextID);
                    if (oldContact != null)
                    {
                        contactsToRemove.Remove(oldContact);
                    }
                    else
                    {
                        oldContact = new Contact
                        {
                            Company_IA = company.Name,
                            Broker     = company.Customer == null ? null : company.Customer.Broker.Name,
                            EntryDate  = DateTime.Now.RoundMillisecondsForSQL(),
                            s_GUID     = Guid.NewGuid()
                        };
                        OldContext.Contacts.AddObject(oldContact);
                        OldContext.SaveChanges();

                        address.OldContextID = oldContact.ID;
                        commitNewContext     = true;
                    }
                    oldIds.Add(oldContact.ID);

                    oldContact.Contact_IA      = contact.Name;
                    oldContact.Phone_IA        = contact.PhoneNumber;
                    oldContact.EmailAddress_IA = contact.EMailAddress;

                    oldContact.AddrType    = address.AddressDescription;
                    oldContact.Address1_IA = address.Address.AddressLine1;
                    oldContact.Address2_IA = address.Address.AddressLine2;
                    oldContact.Address3_IA = address.Address.AddressLine3;
                    oldContact.City_IA     = address.Address.City;
                    oldContact.State_IA    = address.Address.State;
                    oldContact.Zip_IA      = address.Address.PostalCode;
                    oldContact.Country_IA  = address.Address.Country;
                }

                if (!oldIds.Contains(contact.OldContextID))
                {
                    contact.OldContextID = oldIds.FirstOrDefault();
                    commitNewContext     = true;
                }
            }

            contactsToRemove.ForEach(c => OldContext.Contacts.DeleteObject(c));

            if (company.Customer != null)
            {
                var entryDate     = OldContext.tblProfiles.Select(n => n.EntryDate).DefaultIfEmpty(DateTime.Now.RoundMillisecondsForSQL()).Max();
                var notesToRemove = (oldCompany.tblProfiles == null ? new List <tblProfile>() : oldCompany.tblProfiles.ToList()).ToDictionary(p => p.EntryDate);
                foreach (var note in company.Customer.Notes)
                {
                    tblProfile oldNote;
                    if (note.EntryDate != null && notesToRemove.TryGetValue(note.EntryDate.Value, out oldNote))
                    {
                        notesToRemove.Remove(oldNote.EntryDate);
                    }
                    else
                    {
                        entryDate = entryDate.AddSeconds(1);
                        oldNote   = new tblProfile
                        {
                            EntryDate  = entryDate,
                            Company_IA = oldCompany.Company_IA,
                            s_GUID     = Guid.NewGuid()
                        };
                        OldContext.tblProfiles.AddObject(oldNote);
                        note.EntryDate   = oldNote.EntryDate;
                        commitNewContext = true;
                    }

                    oldNote.Boldit      = note.Bold;
                    oldNote.ProfileType = note.Type;
                    oldNote.ProfileText = note.Text;
                }

                notesToRemove.Values.ForEach((n, i) => OldContext.tblProfiles.DeleteObject(n));
            }

            return(oldCompany);
        }
示例#19
0
    public static tblProfile GetProfile(int iProfile)
    {
        tblProfile p = new tblProfile();

        return(p);
    }