Exemplo n.º 1
0
    void LoadClientUser(int userId)
    {
        var user = new ClientUsers().GetClientUser(userId);
        //validate
        if (user == null)
            Response.Redirect("/");

        if (user != null)
        {
            txtProfileImageLink.Text = "";
            lblUserID.Text = user.ClientUserId.ToString();
            txtForename.Text = user.Forename;
            txtSurname.Text = user.Surname;
            txtJobTitle.Text = user.JobTitle;
            txtMobile.Text = user.Mobile;
            txtTelephone.Text = user.Telephone;   
            txtEmail.Text = user.Email;
            //password won't display
            if (user.IsActive) rbtnActivatedYes.Checked = true; else rbtnActivatedNo.Checked = true;
            if (user.ProfileImage != null)
            {
                div_uploaded_profile_image.Attributes.Remove("class");
                div_uploaded_profile_image.Attributes.Add("class", "uploaded_profile_image");
                img_uploaded_profile_image.Attributes.Add("src", user.ProfileImage.DownloadUrl);
                btn_delete_logo.Attributes.Add("data-name", user.ProfileImage.DocGuid);
            }
            else
            {
                div_uploaded_profile_image.Attributes.Remove("");
                div_uploaded_profile_image.Attributes.Add("class", "uploaded_profile_image hide");
                img_uploaded_profile_image.Attributes.Add("src", "");
                btn_delete_logo.Attributes.Add("data-name", "");
            }
            if (user.FooterTemplate != null)
            {
                txtFooterTemplateHidden.Text = user.FooterTemplate.Template;
            }
            else
            {
                LoadBasicEmailTempalte();
            }
        }
        if (user != null && user.ClientUserId == Convert.ToInt32(lblUpdatingUserId.Text))
        {
            LoginUser.CreateUserSession(user);
            navbar1.SetProfileImage();
        }

    }
Exemplo n.º 2
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        divError.Visible = false;
        bool hasError = false;

        if (txtEmail.Value == "" || txtPassword.Value == "")
        {
            divError.InnerHtml = "Please enter Login details.";
            hasError = true;
        }

        if (!Request.Url.Host.Contains("local"))
        {
            if (!ReCaptcha.ValidateCaptcha(Request["g-recaptcha-response"]))
            {
                divError.InnerHtml = "Please verify captcha code.";
                hasError = true;
            }
        }
        
        //check the db
        if (!hasError)
        {
            var objUser = new ClientUsers().ValidateClientUser(txtEmail.Value, txtPassword.Value);
            if (objUser != null && objUser.ClientUserId > 0)
            {
                //success create the session
                LoginUser.CreateUserSession(objUser);

                //get the from page
                string fromPage = Request.QueryString["from"] + "";
                if (fromPage != "") Response.Redirect(fromPage);

                //from page is null go to dashboard
                Response.Redirect("/");
            }
            else
            {
                divError.InnerHtml = "Incorrect login details.";
            }
        }

        //show error
        divError.Visible = true;

    }
    void LoadUsers()
    {
        //clear all items
        ddlRecruitmentManager.Items.Clear();
        //add empty record
        ddlRecruitmentManager.Items.Add(new ListItem("-please select-", "0"));

        //retrieve users
        ClientUsers objUser = new ClientUsers();
        IEnumerable<ClientUser> list = objUser.GetClientUsers(LoginUser.GetLoggedInUserClientId());

        foreach (ClientUser item in list)
        {
            //add recruitment manager
            ddlRecruitmentManager.Items.Add(new ListItem(item.Forename + " " + item.Surname, Convert.ToString(item.ClientUserId)));
        }

        rptUsers.DataSource = list;
        rptUsers.DataBind();
    }
Exemplo n.º 4
0
    void LoadUsers()
    {

        //bind repeater
        var list = new ClientUsers().GetClientUsers(int.Parse(lblClientId.Text)).ToList();
        rptUsers.DataSource = list;
        rptUsers.DataBind();


        //show and hide items/actions and no items
        if (list.Count > 0)
        {
            noitems.Visible = false;
            items.Visible = true;
            actions.Visible = true;
        }
        else
        {
            noitems.Visible = true;
            items.Visible = false;
            actions.Visible = false;
        }

    }
Exemplo n.º 5
0
    /// <summary>
    /// Save User
    /// </summary>
    void SaveUser()
    {
        // save basic details
        var cUser = new ClientUser
          {
              ClientId = Convert.ToInt32(lblClientID.Text),
              Email = txtEmail.Text,
              ClientUserId = Convert.ToInt32(lblUserID.Text),
              JobTitle = txtJobTitle.Text,
              Telephone = txtTelephone.Text,
              Mobile = txtMobile.Text,
              Forename = txtForename.Text,
              Surname = txtSurname.Text,
              IsActive = rbtnActivatedYes.Checked,
              Password = !string.IsNullOrEmpty(txtPassword.Text) ? txtPassword.Text : "",
              UpdatedBy = Convert.ToInt32(lblUpdatingUserId.Text),
          };
        var emailTemplate = new FooterTemplate
        {
            ClientUserId = Convert.ToInt32(lblUserID.Text),
            InUse = true,
            Template = txtFooterTemplateHidden.Text
        };
        cUser.FooterTemplate = emailTemplate;

        var userId = new ClientUsers().AddEditClientUsers(cUser);

        if (userId > 0)
        {
            lblUserID.Text = userId.ToString();
            //save profile Image
            var link = txtProfileImageLink.Text;
            if (!string.IsNullOrEmpty(link))
            {
                new Documents().SaveDocuments(new List<Document> { new Document
                {
                    UploadUrl =  link,
                    FileName = "ProfilePic.jpg",
                    RefId = userId,
                    DocumentTypeValue = 10
                }});
            } 
        }
        LoadClientUser(userId); 
    }
Exemplo n.º 6
0
 private static string GetUserIdsForJob(int jobId)
 {
     var users = new ClientUsers().GetClientUsersForJob(jobId);
     return users.Aggregate("", (current, user) => current + (user.ClientUserId + ","));
 }
Exemplo n.º 7
0
    // ReSharper restore InconsistentNaming
    /// <summary>
    /// This function returns data for dropdowns and lists
    /// </summary>
    /// <param name="control"></param>
    /// <param name="type"></param>
    /// <param name="bClear"></param>
    /// <param name="bAddEmpty"></param>
    /// <param name="jobId"></param>
    /// <param name="userId"></param>
    /// <param name="clientId"></param>
    public static void FillData(this ListControl control, Type type, bool bClear = true, bool bAddEmpty = true, int jobId = 0, int userId = 0,int clientId = 0)
    {
        if (bClear) control.Items.Clear();
        if (bAddEmpty) control.Items.Add(new ListItem("-please select-", "0"));

        switch (type)
        {
            case Type.CLIENT_USERS:
                //retrieve
                var clientUsers = new ClientUsers().GetClientUsers(clientId);
                //bind
                foreach (var item in clientUsers) control.Items.Add(new ListItem(item.Forename + " " + item.Surname, item.ClientUserId.ToString()));
                break;
            case Type.USER:
                //retrieve
                var users = new Users().GetUsers(0);
                //bind
                foreach (var item in users) control.Items.Add(new ListItem(item.Forename + " " + item.Surname, item.UserId.ToString()));
                break;
            case Type.SECTOR:
                //retrieve
                var sectors = new Sectors().GetSectors(clientId,true);
                //bind
                foreach (var item in sectors) control.Items.Add(new ListItem(item.SectorText, item.SectorId.ToString()));
                break;
            case Type.CLIENT_STATUS:
                //retrieve
                var clientStatuses = new ClientStatuses().GetClientStatuses();
                //bind
                foreach (var item in clientStatuses) control.Items.Add(new ListItem(item.ClientStatusText, item.ClientStatusId.ToString()));
                break;
            case Type.SOURCE:
                //retrieve
                var sources = new Sources().GetSources();
                //bind
                foreach (var item in sources) control.Items.Add(new ListItem(item.SourceText, item.SourceId.ToString()));
                break;
            case Type.COUNTRY:
                //retrieve
                var countries = new Countries().GetCountries();
                //bind
                foreach (var item in countries) control.Items.Add(new ListItem(item.Title, item.Title));
                break;
            case Type.SALARY:
                var salaries = new Salaries().GetSalaries();
                foreach (var item in salaries) control.Items.Add(new ListItem(item.SalaryValue.ToString("C0"), item.SalaryId.ToString()));
                break;
            case Type.HOURS:
                control.Items.Add(new ListItem("Full Time", "Full Time"));
                control.Items.Add(new ListItem("Part Time", "Part Time"));
                break;
            case Type.VACANCY_TYPE:
                control.Items.Add(new ListItem("Permanent", "Permanent"));
                control.Items.Add(new ListItem("Contract/Interim", "Contract/Interim"));
                control.Items.Add(new ListItem("Freelance", "Freelance"));
                control.Items.Add(new ListItem("Temporary/Seasonal", "Temporary/Seasonal"));
                break;
            case Type.USER_TYPE:
                var userTypes = new Users().GetUserTypes();
                foreach (var item in userTypes) control.Items.Add(new ListItem(item.UserTypeText, item.UserTypeId.ToString()));
                break;
            case Type.APPLICATION_STATUS:
                var appStatus = new ApplicationStatuses().GetApplicationStatuses(new ApplicationStatusFilter { JobId = jobId });
                foreach (var item in appStatus) control.Items.Add(new ListItem(item.StatusName, item.ApplicationStatusId.ToString()));
                break;

            case Type.CLIENT_GROUPS:
                var clientGroups = new CandidateGroups().GetGroups(new GroupFilter() { UserId = userId, Type = "CLIENT" });
                foreach (var item in clientGroups) control.Items.Add(new ListItem(item.Name, item.GroupId.ToString()));
                break;

            case Type.CONTACT_GROUPS:
                var contactGroups = new CandidateGroups().GetGroups(new GroupFilter() { UserId = userId, Type = "CONTACT" });
                foreach (var item in contactGroups) control.Items.Add(new ListItem(item.Name, item.GroupId.ToString()));
                break;
        }
    }