private void HandlePageRequest() { var context = new HireMeEntities(); RequestedCv obj = new RequestedCv(); var User = Membership.GetUser().UserName; var comapnyId = context.aspnet_Membership.Where(x => x.aspnet_Users.UserName == User).FirstOrDefault().UserId; Guid userId = new Guid(Request.QueryString["UserId"]); var request = context.RequestedCvs.Where(x => x.IndividualId == userId && x.CompanyId == comapnyId).FirstOrDefault(); if (request != null) { if (request.IsUnlocked == false) { divUnderProcess.Style.Add("display", "block"); divUnlockAcount.Style.Add("display", "none"); divContactInfo.Style.Add("display", "none"); } else { divUnderProcess.Style.Add("display", "none"); divUnlockAcount.Style.Add("display", "none"); divContactInfo.Style.Add("display", "block"); } } }
public int GetSkillPercentage(Guid userId) { var context = new HireMeEntities(); var lstUserSkils = context.UserSkills.Where(att => att.UserId == userId).ToList(); if (lstUserSkils.Count() > 0) { var lstUserSkilsId = lstUserSkils.Select(x => x.SkillId); var lstSelectedSkils = new List <int>(); foreach (ListItem item in lstSkils.Items) { if (item.Selected) { lstSelectedSkils.Add(Convert.ToInt32(item.Value)); } } if (lstSelectedSkils.Count() > 0) { var resultSet = lstUserSkilsId.Intersect <int>(lstSelectedSkils); var xx = Convert.ToDouble(resultSet.Count()); var yy = Convert.ToDouble(lstSelectedSkils.Count()); double myPercentage = xx / yy * 100; return(Convert.ToInt32(myPercentage)); } else { return(0); } } else { return(0); } }
private void FillGridView(string Name = "") { try { var context = new HireMeEntities(); var list = context.RequestedCvs.ToList(); //if (Name != "") //{ // listCompany = listCompany.Where(x => x.UserName.Contains(Name)).ToList(); //} var query = from emp in list select new { Status = emp.IsUnlocked == false ? "Loced" : "Unlocked ", CompanyName = context.Companies.Where(x => x.UserId == emp.CompanyId).FirstOrDefault().Name, IndividualName = context.Individuals.Where(x => x.UserId == emp.IndividualId).FirstOrDefault().Name, Id = emp.Id }; grdCompany.PageSize = 1000000000; grdCompany.DataSource = query.ToList(); grdCompany.DataBind(); } catch (Exception ex) { //WebAPIWrapper.LogExceptionWithElmah(ex); } }
private void FillGridView(string Name = "") { try { var context = new HireMeEntities(); var CompanyIds = context.UserTypes.Where(x => x.UserType_lookupId == 220).ToList().Select(x => x.aspnet_Users.UserId); CompanyIds.Count(); var listCompany = context.aspnet_Users.Where(p => CompanyIds.Contains(p.UserId)).ToList(); if (Name != "") { listCompany = listCompany.Where(x => x.UserName.Contains(Name)).ToList(); } var query = from emp in listCompany select new { Status = emp.aspnet_Membership.IsApproved == true ? "Active" : "Unactive ", UserName = emp.aspnet_Membership.aspnet_Users.UserName, Email = emp.aspnet_Membership.Email, Id = emp.UserId }; grdCompany.PageSize = 100000; grdCompany.DataSource = query.ToList(); grdCompany.DataBind(); } catch (Exception ex) { //WebAPIWrapper.LogExceptionWithElmah(ex); } }
protected void Page_Load(object sender, EventArgs e) { var context = new HireMeEntities(); /// jobtype ddlJobType.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 5).ToList();; ddlJobType.DataTextField = "Name"; ddlJobType.DataValueField = "Id"; ddlJobType.DataBind(); /// level of experience ddlExperienceLevel.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 4).ToList();; ddlExperienceLevel.DataTextField = "Name"; ddlExperienceLevel.DataValueField = "Id"; ddlExperienceLevel.DataBind(); ddlRole.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 3).ToList(); ddlRole.DataTextField = "Name"; ddlRole.DataValueField = "Id"; ddlRole.DataBind(); }
protected void btnLogIn_Click(object sender, EventArgs e) { string UsernName = txtuserName.Text; string PassWord = txtpassword.Text; MembershipUser mu = Membership.GetUser(UsernName); if (mu.IsApproved) { if (Membership.ValidateUser(UsernName, PassWord)) { var context = new HireMeEntities(); Session["user"] = HttpContext.Current.User.Identity; FormsAuthentication.RedirectFromLoginPage(UsernName, true); //FormsAuthentication.SetAuthCookie("UsernName", true); //var User = Membership.GetUser().UserName; //var userId = context.aspnet_Membership.Where(x => x.aspnet_Users.UserName == User).FirstOrDefault().UserId; //var userType = context.UserTypes.Where(x => x.UserId == userId).FirstOrDefault().UserType_lookupId; //ltrUserName.Text = User; //if (userType == 221) //{ // Response.Redirect("../../Pages/Company/MyFavorite"); //} Response.Redirect("../../Pages/Common/HomePage"); } else { lblLogInError.Text = "wrong password or username"; } } else { lblLogInError.Text = "you SHOULD BE ABROVID"; } }
private void BindRepeater() { var context = new HireMeEntities(); //var listIndividuals = context.Individuals.ToList(); var user = Membership.GetUser().UserName; var CompanyId = context.aspnet_Users.Where(x => x.UserName == user).FirstOrDefault().UserId; var lisIds = context.CompanyFavourites.Where(x => x.CompanyId == CompanyId).ToList().Select(x => x.IndividualId).ToList(); var listIndividuals = context.Individuals.Where(x => lisIds.Contains(x.UserId)).ToList(); var query = from emp in listIndividuals select new { Name = emp.Name, Percentage = 0, ImageUrl = "data:image/png;base64," + GetIMageBase64(emp.ImageUrl), CoverLetter = emp.CoverLetter, //UserName = emp.aspnet_Membership.aspnet_Users.UserName, //Email = emp.aspnet_Membership.Email, Id = emp.UserId }; //grdCompany.PageSize = pagesize; rptUsers.DataSource = query.ToList().OrderBy(x => x.Percentage);; rptUsers.DataBind(); }
//protected void Deactivate_Command(object sender, CommandEventArgs e) //{ // var context = new HireMeEntities(); // var userId = new Guid(e.CommandArgument.ToString()); // var user = context.aspnet_Membership.Where(x => x.UserId == userId).FirstOrDefault(); // user.IsApproved = false; // context.SaveChanges(); // //send Eamil // EmailDTO dto = new EmailDTO(); // dto.AddressTo = user.Email; // dto.Body = "Dear :" + user.aspnet_Users.UserName + "your acount is Deactivate "; // dto.Subject = "HireMe"; // EmailHelper emailHelper = new EmailHelper(); // if (emailHelper.SendEmail(dto)) // { // FillGridView(); // } //} //protected void grdCompany_RowDataBound(object sender, GridViewRowEventArgs e) //{ // if (e.Row.RowType == DataControlRowType.DataRow) // { // string Status = Convert.ToString(DataBinder.Eval(e.Row.DataItem, "Status")); // if (Status == "Active") // { // LinkButton lnkDeactivate = (LinkButton)e.Row.FindControl("Actevaite"); // lnkDeactivate.Visible = false; // } // else // { // LinkButton lnkDeactivate = (LinkButton)e.Row.FindControl("Deactivate"); // lnkDeactivate.Visible = false; // } // } //} //protected void grdCompany_PageIndexChanging(object sender, GridViewPageEventArgs e) //{ //} //protected void Edit_Command(object sender, CommandEventArgs e) //{ // var userId = new Guid(e.CommandArgument.ToString()); // Response.Redirect("~/Pages/Admin/ViewIndividual.aspx?UserId=" + userId); //} //private void FillGridView(string Name = "") //{ // try // { // var context = new HireMeEntities(); // var UserIds = context.UserTypes.Where(x => x.UserType_lookupId == 220).ToList().Select(x => x.aspnet_Users.UserId); // var listIndividuals = context.Individuals.Where(p => UserIds.Contains(p.UserId)).ToList(); // if (Name != "") // { // listIndividuals = listIndividuals.Where(x => x.Name.Contains(Name)).ToList(); // } // var query = from emp in listIndividuals // select new // { // GraduationUniversity = context.Lookups.Where(p => p.Id == emp.GraduationUniversity).Select(x => x.Name).FirstOrDefault(), // GraduationCountry = context.Lookups.Where(p => p.Id == emp.GraduationCountry).Select(x => x.Name).FirstOrDefault(), // Nationality= context.Lookups.Where(p => p.Id == emp.GraduationCountry).Select(x => x.Name).FirstOrDefault(), // //UserName = emp.aspnet_Membership.aspnet_Users.UserName, // //Email = emp.aspnet_Membership.Email, // Id = emp.UserId // }; // //grdCompany.PageSize = pagesize; // grdCompany.DataSource = query.ToList(); // grdCompany.DataBind(); // } // catch (Exception ex) // { // //WebAPIWrapper.LogExceptionWithElmah(ex); // } //} //protected void Actevaite_Command(object sender, CommandEventArgs e) //{ // var context = new HireMeEntities(); // var userId = new Guid(e.CommandArgument.ToString()); // var user = context.aspnet_Membership.Where(x => x.UserId == userId).FirstOrDefault(); // user.IsApproved = true; // context.SaveChanges(); // //send Eamil // EmailDTO dto = new EmailDTO(); // dto.AddressTo = user.Email; // dto.Body = "Dear :" + user.Email + "your acount is Actevaite "; // dto.Subject = "HireMe"; // EmailHelper emailHelper = new EmailHelper(); // if (emailHelper.SendEmail(dto)) // { // FillGridView(); // } //} protected void btnSearch_Click(object sender, EventArgs e) { var context = new HireMeEntities(); var listIndividuals = context.Individuals.ToList(); int FieldOfBusinesId = Convert.ToInt32(ddlFieldOfBusiness.SelectedValue); listIndividuals = listIndividuals.Where(x => x.FieldOfBusiness == FieldOfBusinesId).ToList(); var query = from emp in listIndividuals select new { Name = emp.Name, CoverLetter = emp.CoverLetter, Percentage = GetSkillPercentage(emp.UserId), ImageUrl = "data:image/png;base64," + GetIMageBase64(emp.ImageUrl), //UserName = emp.aspnet_Membership.aspnet_Users.UserName, //Email = emp.aspnet_Membership.Email, Id = emp.UserId }; //grdCompany.PageSize = pagesize; rptUsers.DataSource = query.ToList().OrderByDescending(x => x.Percentage); rptUsers.DataBind(); }
protected void btnDownload_Click(object sender, EventArgs e) { var context = new HireMeEntities(); var User = Membership.GetUser(); var user = context.Individuals.Where(aat => aat.aspnet_Users.UserName == User.UserName).FirstOrDefault(); if (user.CvAttachment != null) { string path = user.CvAttachment; //get physical file path from server string name = Path.GetFileName(path); //get file name string ext = Path.GetExtension(path); //get file extension string type = ""; // set known types based on file extension if (ext != null) { switch (ext.ToLower()) { case ".htm": case ".html": type = "text/HTML"; break; case ".txt": type = "text/plain"; break; case ".GIF": type = "image/GIF"; break; case ".pdf": type = "Application/pdf"; break; case ".doc": case ".rtf": type = "Application/msword"; break; Default: type = ""; break; } } Response.AppendHeader("content-disposition", "attachment; filename=" + name); if (type != "") { Response.ContentType = type; } Response.WriteFile(path); Response.End(); //give POP to user for file downlaod } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FillUserData(); FillDropDowns(); var context = new HireMeEntities(); } }
protected void ddlRole_SelectedIndexChanged(object sender, EventArgs e) { var context = new HireMeEntities(); lstSkils.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 3).ToList(); lstSkils.DataTextField = "Name"; lstSkils.DataValueField = "Id"; lstSkils.DataBind(); }
private void FillDlls() { var context = new HireMeEntities(); ddlFieldOfBusiness.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 3).ToList();; ddlFieldOfBusiness.DataTextField = "Name"; ddlFieldOfBusiness.DataValueField = "Id"; ddlFieldOfBusiness.DataBind(); ddlExperience.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 4).ToList();; ddlExperience.DataTextField = "Name"; ddlExperience.DataValueField = "Id"; ddlExperience.DataBind(); ddlGraduationCountry.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 18).ToList();; ddlGraduationCountry.DataTextField = "Name"; ddlGraduationCountry.DataValueField = "Id"; ddlGraduationCountry.DataBind(); ddlTypeOfEmployment.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 5).ToList();; ddlTypeOfEmployment.DataTextField = "Name"; ddlTypeOfEmployment.DataValueField = "Id"; ddlTypeOfEmployment.DataBind(); ddlAcademicDegree.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 6).ToList();; ddlAcademicDegree.DataTextField = "Name"; ddlAcademicDegree.DataValueField = "Id"; ddlAcademicDegree.DataBind(); ddlNationality.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 17).ToList();; ddlNationality.DataTextField = "Name"; ddlNationality.DataValueField = "Id"; ddlNationality.DataBind(); ddlAbilityToTravel.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 24).ToList();; ddlAbilityToTravel.DataTextField = "Name"; ddlAbilityToTravel.DataValueField = "Id"; ddlAbilityToTravel.DataBind(); ddlFieldOfBusiness.Items.Insert(0, "Please select"); ddlExperience.Items.Insert(0, "Please select"); ddlGraduationCountry.Items.Insert(0, "Please select"); ddlTypeOfEmployment.Items.Insert(0, "Please select"); ddlAcademicDegree.Items.Insert(0, "Please select"); ddlNationality.Items.Insert(0, "Please select"); ddlAbilityToTravel.Items.Insert(0, "Please select"); ddlFieldOfBusiness.Items.Insert(0, "Please select"); }
private void FillUserData() { var User = Membership.GetUser().UserName; var context = new HireMeEntities(); var user = context.Individuals.Where(x => x.aspnet_Users.UserName == User).FirstOrDefault(); if (user != null) { //fill user Data } }
protected void ddlGraduationCountry_SelectedIndexChanged(object sender, EventArgs e) { var context = new HireMeEntities(); //ddlGraduationUniversity.Enabled = true; //int parentId = Convert.ToInt32(ddlGraduationCountry.SelectedValue); //ddlGraduationUniversity.DataSource = context.Lookups.Where(x => x.ParentId == parentId).ToList(); ; //ddlGraduationUniversity.DataTextField = "Name"; //ddlGraduationUniversity.DataValueField = "Id"; //ddlGraduationUniversity.DataBind(); }
protected void lnkLock_Command(object sender, CommandEventArgs e) { var context = new HireMeEntities(); var id = Convert.ToInt32(e.CommandArgument.ToString()); var user = context.RequestedCvs.Where(x => x.Id == id).FirstOrDefault(); user.IsUnlocked = false; context.SaveChanges(); FillGridView(); }
protected void ddlFieldOfBusiness_SelectedIndexChanged(object sender, EventArgs e) { ddlSkiles.Enabled = true; var context = new HireMeEntities(); int parentId = Convert.ToInt32(ddlFieldOfBusiness.SelectedValue); ddlSkiles.DataSource = context.Lookups.Where(x => x.ParentId == parentId).ToList();; ddlSkiles.DataTextField = "Name"; ddlSkiles.DataValueField = "Id"; ddlSkiles.DataBind(); }
protected void Actevaite_Command(object sender, CommandEventArgs e) { var context = new HireMeEntities(); var userId = new Guid(e.CommandArgument.ToString()); var user = context.aspnet_Membership.Where(x => x.UserId == userId).FirstOrDefault(); user.IsApproved = true; context.SaveChanges(); FillGridView(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FillDropDowns(); divSuccess.Visible = false; Guid userId = new Guid(Request.QueryString["UserId"]); var context = new HireMeEntities(); txtCompanyEmail.Text = context.aspnet_Membership.Where(x => x.aspnet_Users.UserId == userId).FirstOrDefault().Email; txtCompanyEmail.Enabled = false; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FillDropDowns(); var User = Membership.GetUser().UserName; var context = new HireMeEntities(); FilluserData(); txtCompanyEmail.Text = context.aspnet_Membership.Where(x => x.aspnet_Users.UserName == User).FirstOrDefault().Email; txtCompanyEmail.Enabled = false; } }
protected void btnUnlockAcount_Click(object sender, EventArgs e) { var context = new HireMeEntities(); RequestedCv obj = new RequestedCv(); var User = Membership.GetUser().UserName; var comapnyId = context.aspnet_Membership.Where(x => x.aspnet_Users.UserName == User).FirstOrDefault().UserId; Guid userId = new Guid(Request.QueryString["UserId"]); obj.CompanyId = comapnyId; obj.IndividualId = userId; obj.IsUnlocked = false; context.RequestedCvs.Add(obj); context.SaveChanges(); }
protected void Page_Load(object sender, EventArgs e) { btnDownload.Visible = false; divSuccess.Visible = false; if (!IsPostBack) { FillDropDowns(); FillUserData(); var context = new HireMeEntities(); } }
private void FillDropDowns() { var context = new HireMeEntities(); ///Industry ddlIndustry.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 3).ToList();; ddlIndustry.DataTextField = "Name"; ddlIndustry.DataValueField = "Id"; ddlIndustry.DataBind(); /// countrys ddlCountry.DataSource = context.Lookups.Where(x => x.LookupCategoryId == 20).ToList();; ddlCountry.DataTextField = "Name"; ddlCountry.DataValueField = "Id"; ddlCountry.DataBind(); }
protected void lnkAddToFavorite_Command(object sender, CommandEventArgs e) { var User = Membership.GetUser().UserName; var context = new HireMeEntities(); Guid indvId = new Guid(e.CommandArgument.ToString()); CompanyFavourite obj = new CompanyFavourite(); obj.IndividualId = indvId; obj.CompanyId = context.aspnet_Membership.Where(x => x.aspnet_Users.UserName == User).FirstOrDefault().UserId; context.CompanyFavourites.Add(obj); context.SaveChanges(); btnSearch_Click(sender, e); }
/// <summary> /// ابعث user nsmr /// </summary> /// <param name="userName"></param> /// <param name="userTypeId"></param> private void AddUserType(string userName, int userTypeId) { var context = new HireMeEntities(); Guid UserId = context.aspnet_Users.Where(x => x.UserName == userName).FirstOrDefault().UserId; var obj = new UserType(); obj.UserId = UserId; obj.UserType_lookupId = userTypeId; context.UserTypes.Add(obj); context.SaveChanges(); if (userTypeId == 221) { Response.Redirect("~/Pages/Company/CompanyRegister.aspx?UserId=" + UserId); } }
private void FillUserData(Guid userId) { var context = new HireMeEntities(); var user = context.Individuals.Where(aat => aat.UserId == userId).FirstOrDefault(); txtEmail.Text = user.aspnet_Users.aspnet_Membership.Email; if (user != null) { txtFullName.Text = user.Name; txtPhone.Text = user.Phone.ToString(); ddlDay.SelectedValue = user.BdDDay.ToString(); ddlMonth.SelectedValue = user.BobMonth; ddlYear.SelectedValue = user.BobYear.ToString(); ddlYearsOfExperience.SelectedValue = user.YearsOfExperience.ToString(); ddlTypeOfEmployment.SelectedValue = user.TypeOfEmployment.ToString(); } }
protected void rptUsers_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var context = new HireMeEntities(); var User = Membership.GetUser().UserName; Guid CompanyId = context.aspnet_Membership.Where(x => x.aspnet_Users.UserName == User).FirstOrDefault().UserId; HiddenField hfIndividualId = e.Item.FindControl("hfIndividualId") as HiddenField; Guid IndividualId = new Guid(hfIndividualId.Value); HtmlGenericControl divControl = e.Item.FindControl("divFavorite") as HtmlGenericControl; var IsFavorite = context.CompanyFavourites.Any(x => x.CompanyId == CompanyId && x.IndividualId == IndividualId); if (IsFavorite) { divControl.Visible = false; } } }
protected void btnSave_Click(object sender, EventArgs e) { var User = Membership.GetUser().UserName; var context = new HireMeEntities(); DAL.Company obj = new DAL.Company(); obj.Name = txtCompanyName.Text; obj.Industry = Convert.ToInt32(ddlIndustry.SelectedValue); obj.PhoneNumber = Convert.ToInt32(txtPhoneNumber.Text); //obj.co = Convert.ToInt32(txtCompanyEmail.Text); obj.Country = Convert.ToInt32(ddlCountry.SelectedValue); obj.City = Convert.ToInt32(ddlCity.SelectedValue); obj.WebSite = txtWebSite.Text; obj.UserId = context.aspnet_Membership.Where(x => x.aspnet_Users.UserName == User).FirstOrDefault().UserId; context.Companies.Add(obj); context.SaveChanges(); }
private void FillUserData(Guid userId) { var context = new HireMeEntities(); var user = context.Individuals.Where(aat => aat.UserId == userId).FirstOrDefault(); if (user != null) { ltrName.Text = user.Name; imgProfile.ImageUrl = "data:image/png;base64," + GetIMageBase64(user.ImageUrl); ltrCover.Text = user.CoverLetter; lblBirthOfDate.Text = user.BobMonth + "/" + user.BdDDay + "/" + user.BobYear; lblLocation.Text = context.Lookups.Where(x => x.Id == user.Location).FirstOrDefault().Name; lblNationality.Text = context.Lookups.Where(x => x.Id == user.Location).FirstOrDefault().Name; lblNationality.Text = context.Lookups.Where(x => x.Id == user.Nationality).FirstOrDefault().Name; lblGender.Text = context.Lookups.Where(x => x.Id == user.Gender).FirstOrDefault().Name; lblRelationshipStatus.Text = context.Lookups.Where(x => x.Id == user.RelationshipStatus).FirstOrDefault().Name; lblAbilityToTravel.Text = context.Lookups.Where(x => x.Id == user.AbilityToTravel).FirstOrDefault().Name; lblFieldOfBusiness.Text = context.Lookups.Where(x => x.Id == user.FieldOfBusiness).FirstOrDefault().Name; var lstSkills = context.UserSkills.Where(x => x.UserId == user.UserId).ToList(); string Skillstxt = ""; foreach (var item in lstSkills) { var skill = context.Lookups.Where(x => x.Id == item.SkillId).FirstOrDefault().Name; Skillstxt += "<span class=\"label label-info\">" + skill + "</span> "; lblSkiles.Text = Skillstxt; } lblGraduationCountry.Text = context.Lookups.Where(x => x.Id == user.GraduationCountry).FirstOrDefault().Name; lblGraduationUniversity.Text = context.Lookups.Where(x => x.Id == user.GraduationUniversity).FirstOrDefault().Name; lblPhone.Text = user.Phone.ToString(); LblTypeOfEmployment.Text = context.Lookups.Where(x => x.Id == user.TypeOfEmployment).FirstOrDefault().Name; lblYearsOfExperience.Text = context.Lookups.Where(x => x.Id == user.YearsOfExperience).FirstOrDefault().Name; lblMinimumSalary.Text = user.MinimumSalary.ToString(); lblEmoloymentHistory.Text = user.EmploymentHistory; lblEmil.Text = context.aspnet_Membership.Where(x => x.UserId == user.UserId).FirstOrDefault().Email; //txtPhone.Text = user.Phone.ToString(); //ddlDay.SelectedValue = user.BdDDay.ToString(); //ddlMonth.SelectedIndex = Convert.ToInt32(user.BobMonth); //ddlYear.SelectedValue = user.BobYear.ToString(); //ddlYearsOfExperience.SelectedValue = user.YearsOfExperience.ToString(); //ddlTypeOfEmployment.SelectedValue = user.TypeOfEmployment.ToString(); } //throw new NotImplementedException(); }
private void FilluserData() { var context = new HireMeEntities(); var User = Membership.GetUser().UserName; var UserId = context.aspnet_Membership.Where(x => x.aspnet_Users.UserName == User).FirstOrDefault().UserId; var obj = context.Companies.Where(x => x.UserId == UserId).FirstOrDefault(); txtCompanyName.Text = obj.Name; txtPhoneNumber.Text = obj.PhoneNumber.ToString(); txtWebSite.Text = obj.WebSite; ddlCountry.SelectedValue = obj.Country.ToString(); ddlCity.DataSource = context.Lookups.Where(x => x.ParentId == obj.Country).ToList();; ddlCity.DataTextField = "Name"; ddlCity.DataValueField = "Id"; ddlCity.DataBind(); ddlCity.SelectedValue = obj.City.ToString(); ddlIndustry.SelectedValue = obj.Industry.ToString(); }
protected void btnSave_Click(object sender, EventArgs e) { Guid userId = new Guid(Request.QueryString["UserId"]); var context = new HireMeEntities(); DAL.Company obj = new DAL.Company(); obj.Name = txtCompanyName.Text; obj.Industry = Convert.ToInt32(ddlIndustry.SelectedValue); obj.PhoneNumber = Convert.ToInt32(txtPhoneNumber.Text); //obj.co = Convert.ToInt32(txtCompanyEmail.Text); obj.Country = Convert.ToInt32(ddlCountry.SelectedValue); obj.City = Convert.ToInt32(ddlCity.SelectedValue); obj.WebSite = txtWebSite.Text; obj.UserId = userId; context.Companies.Add(obj); context.SaveChanges(); divSuccess.Visible = true; }