public string InsertNewJob(DetailJob dj)
 {
     string stt = facade.InsertNewJob(dj.Title, dj.Description, dj.Username, dj.Category, dj.Category2, dj.Category3, dj.Citizenship, dj.JobLevel, dj.EduRequirement, dj.EmploymentType, dj.Workplace, dj.Workplace2, dj.Workplace3, dj.SalaryType, dj.Salary, dj.SalaryTo, dj.SalaryCurrency, dj.SalaryPaymentType, dj.ClosingDate, dj.ExecutiveJob, dj.Contact, dj.EmailForEmployer);
     return stt;
 }
 public List<DetailJob> GetSearchResult(string keyword, string st, string cate, string wp, string ci, string jl, string empt, string ot, Boolean ad)
 {
     List<DetailJob> jlist = new List<DetailJob>();
     DataRow[] tbl = facade.GetSearchResult(keyword, st, cate, wp, ci, jl, empt, ot, ad);
     foreach (DataRow r in tbl)
     {
         DetailJob dj = new DetailJob(Convert.ToInt16(r[0].ToString()), r[1].ToString(), r[2].ToString(), r[3].ToString(), r[4].ToString(), Convert.ToDecimal(r[5].ToString()), r[6].ToString(), r[7].ToString(), r[8].ToString(), r[9].ToString(), r[10].ToString(), r[11].ToString(), r[12].ToString(), Convert.ToDateTime(r[13].ToString()), Convert.ToDateTime(r[14].ToString()), r[15].ToString(), r[16].ToString(), Convert.ToInt32(r[17].ToString()));
         jlist.Add(dj);
     }
     return jlist;
 }
 //trang executive job
 public List<DetailJob> GetTop5NewExecutiveJob()
 {
     List<DetailJob> jobList = new List<DetailJob>();
     DataTable tbl = facade.GetTop5NewExecutiveJob();
     foreach (DataRow r in tbl.Rows)
     {
         DetailJob dj = new DetailJob(Convert.ToInt16(r[0].ToString()), r[1].ToString(), r[2].ToString(), r[3].ToString(), Convert.ToDateTime(r[4].ToString()), Convert.ToDateTime(r[5].ToString()));
         jobList.Add(dj);
     }
     return jobList;
 }
 //------------------------------------------------EMployer---------------------------------
 public List<DetailJob> GetPostedJobByUser(string userId)
 {
     List<DetailJob> jobListByUser = new List<DetailJob>();
     DataTable tbl = facade.GetPostedJobByUser(userId);
     foreach (DataRow r in tbl.Rows)
     {
         DetailJob dj = new DetailJob(Convert.ToInt32(r[0].ToString()), r[1].ToString(), Convert.ToDateTime(r[2].ToString()), Convert.ToDateTime(r[3].ToString()), Convert.ToInt32(r[4].ToString()));
         jobListByUser.Add(dj);
     }
     return jobListByUser;
 }
 public List<DetailJob> GetSearchResult(string keyword)
 {
     List<DetailJob> jlist = new List<DetailJob>();
     DataTable tbl = facade.GetSearchResult(keyword);
     foreach (DataRow r in tbl.Rows)
     {
         DetailJob dj = new DetailJob(Convert.ToInt16(r[0].ToString()), r[1].ToString(), r[2].ToString(), r[3].ToString(), r[4].ToString(), Convert.ToDecimal(r[5].ToString()), r[6].ToString(), r[7].ToString(), r[8].ToString(), r[9].ToString(), r[10].ToString(), r[11].ToString(), r[12].ToString(), Convert.ToDateTime(r[13].ToString()), Convert.ToDateTime(r[14].ToString()), r[15].ToString(), r[16].ToString(), Convert.ToInt32(r[17].ToString()));
         jlist.Add(dj);
     }
     return jlist;
 }
 public List<DetailJob> GetJobBySameCate(String cate1,String cate2,String cate3)
 {
     List<DetailJob> jobListByUser = new List<DetailJob>();
     DataTable tbl = facade.GetJobBySameCate(cate1,cate2,cate3);
     foreach (DataRow r in tbl.Rows)
     {
         DetailJob dj = new DetailJob(Convert.ToInt32(r[0].ToString()), r[1].ToString(), Convert.ToDateTime(r[2].ToString()), Convert.ToDateTime(r[3].ToString()), Convert.ToInt32(r[4].ToString()));
         jobListByUser.Add(dj);
     }
     return jobListByUser;
 }
 public List<DetailJob> GetJobList(string orderBy, string orderUpdown)
 {
     List<DetailJob> jobList = new List<DetailJob>();
     DataTable tbl = facade.GetJobList(orderBy, orderUpdown);
     foreach (DataRow r in tbl.Rows)
     {
         DetailJob dj = new DetailJob(Convert.ToInt32(r[0].ToString()), r[1].ToString(), r[2].ToString(), r[3].ToString(), r[4].ToString(), Convert.ToDecimal(r[5].ToString()), r[6].ToString(), Convert.ToDateTime(r[7].ToString()), Convert.ToDateTime(r[8].ToString()), r[9].ToString(), r[10].ToString(), r[11].ToString(), Convert.ToInt32(r[12].ToString()));
         jobList.Add(dj);
     }
     return jobList;
 }
 public DetailJob GetDetailJobById(int id)
 {
     DataTable tbl = facade.GetDetailJobById(id);
     foreach (DataRow r in tbl.Rows)
     {
         string salaryType = r[19].ToString();
         if (salaryType == "" || salaryType == null)
         {
             salaryType = "false";
         }
         DetailJob dj = new DetailJob(Convert.ToInt32(r[0].ToString()), r[1].ToString(), r[2].ToString(), r[3].ToString(), r[4].ToString(), r[5].ToString(), r[6].ToString(), r[7].ToString(), r[8].ToString(), r[9].ToString(), Convert.ToDateTime(r[10].ToString()), Convert.ToDateTime(r[11].ToString()), r[12].ToString(), r[13].ToString(), r[14].ToString(), r[15].ToString(), r[16].ToString(), r[17].ToString(), r[18].ToString(), Convert.ToBoolean(salaryType), Convert.ToDecimal(r[20].ToString()), Convert.ToDecimal(r[21].ToString()), r[22].ToString(), r[23].ToString(), r[24].ToString(), r[25].ToString(), r[26].ToString(), r[27].ToString(), r[28].ToString(), Convert.ToInt32(r[29].ToString()),r[30].ToString(),r[31].ToString());
         return dj;
     }
     return null;
 }
 public List<DetailJob> getJobAlert(string cate1, string cate2, string cate3, string lo1, string lo2, string lo3)
 {
     List<DetailJob> djList = new List<DetailJob>();
     DataTable tbl = facade.getJobAlert(cate1, cate2, cate3, lo1, lo2, lo3);
     foreach (DataRow r in tbl.Rows)
     {
         DetailJob dj = new DetailJob(r[0].ToString(), r[1].ToString(), r[2].ToString(), r[3].ToString());
         djList.Add(dj);
     }
     if (!djList.Equals(null))
     {
         return djList;
     }
     else
     {
         return null;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            facade = new BusinessFacade(myConn);
            if (!IsPostBack)
            {
                try
                {
                    if (Request.Params["view"] == "preview")
                    {
                        Job = (DetailJob)Session["Preview"];
                        ViewState["dj"] = Job;
                        if (Session["execJob"] != null)
                        {
                            ViewState["execJob"] = Session["execJob"];
                        }
                        btn_Apply.Visible = false;
                        hpl_PreviousUrl.Visible = false;
                        btn_SaveJob.Visible = false;
                        btn_Edit.Visible = true;
                        Panel_Additional.Visible = false;
                    }
                    else
                    {
                        id = Convert.ToInt16(Request.QueryString["jId"]);
                        Job = facade.GetDetailJobById(id);

                        Repeater_SameEmployerJob.DataSource = facade.GetJobByEmployer(facade.GetGuidByJobId(id));
                        Repeater_SameEmployerJob.DataBind();
                        Repeater_InterestedJob.DataSource = facade.GetJobBySameCate(Job.Category, Job.Category2, Job.Category3);
                        Repeater_InterestedJob.DataBind();

                        ViewState["detailedJob"] = Job;
                        ViewState["jid"] = id;
                        facade.PlusView(id);            //Plus 1 for viewcount
                    }
                }
                catch (NullReferenceException ex)
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "PopupScript", "<script>alert('"+ex.Message+"');</script>");
                    //Response.Redirect("~/publicArea/errorpages/Error404.aspx");
                }
                catch (IndexOutOfRangeException outofrange)
                {
                    Page.ClientScript.RegisterClientScriptBlock(GetType(), "PopupScript", "<script>alert('" + outofrange.Message + "');</script>");
                    //Response.Redirect("~/publicArea/errorpages/Error404.aspx");
                }
            }
            if (!IsPostBack)
            {
                try
                {
                    if (Job.OrgLogo != "" && Job.OrgLogo != null)
                    {
                        OrgLogo_img.ImageUrl = General.EMP_LOGO + Job.Username + "/" + Job.OrgLogo;
                    }
                    else
                    {
                        OrgLogo_img.ImageUrl = "~/images/companyLogo/no_image.jpg";
                    }

                    TimeSpan addago = DateTime.Now.Subtract(Job.UploadDate);
                    if (addago.Days == 0 || addago.Days == 1)
                    {
                        UploadDate_lbl.Text = Convert.ToString(addago.Days) + " day ago";
                    }
                    else
                    {
                        UploadDate_lbl.Text = Convert.ToString(addago.Days) + " days ago";
                    }
                    ClosingDate_lbl.Text = string.Format("{0:MMM} {0:dd}, {0:yyyy}", Job.ClosingDate);

                    //Description
                    lbl_Description.Text = HttpUtility.HtmlDecode(Job.Description.ToString().Replace(Environment.NewLine, "<br />"));
                    lbl_BriefInfo.Text = HttpUtility.HtmlDecode(Job.OrgInfo.ToString().Replace(Environment.NewLine, "<br />"));
                    //Salary
                    if (job.SalaryType == false)
                    {
                        lbl_Salary.Text = "negotiable";
                    }
                    else if (Job.Salary == 0 && Job.SalaryTo == 0)
                    {
                        lbl_Salary.Text = "negotiable";
                    }
                    else
                    {
                        lbl_Salary.Text = Job.Salary + " - " + Job.SalaryTo + " " + Job.SalaryCurrency + "/" + Job.SalaryPaymentType;
                    }
                }
                catch (Exception)
                { }
            }
            if (!IsPostBack)
            {
                try
                {
                    ViewState["PreviousPageUrl"] = Request.UrlReferrer.ToString();
                    hpl_PreviousUrl.NavigateUrl = ViewState["PreviousPageUrl"].ToString();
                }
                catch (Exception)
                {
                }
            }
        }
 protected void savejob_Click(object sender, EventArgs e)
 {
     Job = (DetailJob)ViewState["detailedJob"];
     if (User.IsInRole("Employee"))
     {
         try
         {
             MembershipUser mu = Membership.GetUser();
             facade.SaveJob2(mu.ProviderUserKey.ToString(), Job.Id);
             Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('You have successfully saved this job.');</script>");
         }
         catch (Exception ex)
         {
             throw ex;
         }
     }
     else if (User.IsInRole("organization"))
     {
         Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", "<script>alert('Sorry, recruiter can not save this job.\\nPlease login as job seeker.');</script>");
     }
     else
     {
         FormsAuthentication.RedirectToLoginPage("authen=false");
     }
 }
Example #12
0
        protected void btnPostJob_Click(object sender, EventArgs e)
        {
            Boolean salaryType;
            string _salarytype = Request.Form["salaryType"].ToString();
            if (_salarytype == "Negotiable")
            {
                salaryType = false;
            }
            else
            {
                salaryType = true;
            }
            Boolean executiveJob = false;
            if (cb_ExecutiveJob.Checked)
            {
                executiveJob = true;
            }

            if (txt_SalaryFrom.Text == "") { txt_SalaryFrom.Text = "0"; }  //2 thang salary khi insert no la decimal nen phai
            if (txt_SalaryTo.Text == "") { txt_SalaryTo.Text = "0"; }   // gan gia tri cho no =0 moi run dc
            if (txtJobClosingDate.Text == "") { txtJobClosingDate.Text = string.Empty; }

            DetailJob dj = new DetailJob(txtJobTitle.Text.Trim(), txtJobDescription.Text.Trim(), mu.ProviderUserKey.ToString(), Category.SelectedValue, Category2.SelectedValue, Category3.SelectedValue, ddlCitizenship.SelectedValue, ddlJobLevel.SelectedValue, ddl_EducationRequirement.SelectedValue, ddlJobEmploymentType.SelectedValue, ddlJobLocation.SelectedValue, ddlJobLocation2.SelectedValue, ddlJobLocation3.SelectedValue, salaryType, Convert.ToDecimal(txt_SalaryFrom.Text.Trim()), Convert.ToDecimal(txt_SalaryTo.Text.Trim()), ddl_SalaryCurrency.SelectedValue, ddl_SalaryPaidType.SelectedValue, Convert.ToDateTime(txtJobClosingDate.Text.Trim()), executiveJob, Contact.Text.Trim(), txt_Email.Text.Trim());
            string stt = facade.InsertNewJob(dj);
            if (stt == "done")
            {
                string bodyMail = "";
                bodyMail += "Dear HR Manager";
                bodyMail += "("+dj.OrgName+")";
                bodyMail += "We deeply appreciate your placement of advertisement in the job vacancies with Teachinvietnam.org. Your ad was published and is available at this link: ";
                bodyMail += "This job will be deleted automatically in " + dj.ClosingDate.ToString("MM/dd/YYYY") + ".<br/>";
                bodyMail += "We look forward to sharing your success in the near future.";
                StringBuilder sb = new StringBuilder();
                MailUtils mailUtils = new MailUtils(Request);
                sb.Append(mailUtils.MailHeader());
                sb.Append(bodyMail );
                sb.Append(mailUtils.MailFooter());
                Utils.SendMail(dj.EmailForEmployer,"New job", sb.ToString(), "", "");
                Response.Redirect("~/memberArea/PostJobSuccess.aspx");
            }
        }
Example #13
0
        protected void Preview_OnClick(object sender, EventArgs e)
        {
            if (txt_SalaryFrom.Text == "") { txt_SalaryFrom.Text = "0"; }  //2 thang salary khi insert no la decimal nen phai
            if (txt_SalaryTo.Text == "") { txt_SalaryTo.Text = "0"; }   // gan gia tri cho no =0 moi run dc

            int id = 0;
            string orgname = Context.Profile.GetPropertyValue("Organization.OrganizationName").ToString();
            string orgInfo = Context.Profile.GetPropertyValue("Organization.BriefInfo").ToString();
            string orglogo;
            try
            {
                orglogo = Context.Profile.GetPropertyValue("Organization.Logo").ToString();
            }
            catch (NullReferenceException)
            {
                orglogo = "";
            }
            string orgAdd = Context.Profile.GetPropertyValue("Organization.Address1").ToString();
            string phone = Context.Profile.GetPropertyValue("Organization.PhoneNumber1").ToString();
            string website = Context.Profile.GetPropertyValue("Organization.Website").ToString();
            string orgtype = Context.Profile.GetPropertyValue("Organization.OrganizationType").ToString();
            string schoolType = Context.Profile.GetPropertyValue("Organization.SchoolType").ToString();
            string usernameMail = mu.UserName;
            string jtitle = txtJobTitle.Text.Trim();
            DateTime uploaddate = DateTime.Now;
            DateTime closing = Convert.ToDateTime(txtJobClosingDate.Text.Trim());
            string description = txtJobDescription.Text.Trim();
            string cate1 = Category.SelectedValue.Trim();
            string cate2 = Category2.SelectedValue;
            string cate3 = Category3.SelectedValue;
            string workplace1 = ddlJobLocation.SelectedValue;
            string workplace2 = ddlJobLocation2.SelectedValue;
            string workplace3 = ddlJobLocation3.SelectedValue;
            Boolean salaryType = false;
            string salarytype = Request.Form["salaryType"].ToString();
            if (salarytype == "Negotiable")
            {
                salaryType = false;
            }
            else
            {
                salaryType = true;
            }

            if (cb_ExecutiveJob.Checked)
            {
                Session["execJob"] = "true";
            }
            else
            {
                Session["execJob"] = null;
            }
            Decimal salaryFrom = Convert.ToDecimal(txt_SalaryFrom.Text);
            Decimal salaryTo = Convert.ToDecimal(txt_SalaryTo.Text);
            string salarycurrency = ddl_SalaryCurrency.SelectedValue;
            string salarypayment = ddl_SalaryPaidType.SelectedValue;
            string citizenship = ddlCitizenship.SelectedValue;
            string joblevel = ddlJobLevel.SelectedValue;
            string eduredquire = ddl_EducationRequirement.SelectedValue;
            string empType = ddlJobEmploymentType.SelectedValue;
            string contact = Contact.Text.Trim();
            int viewcount = 0;
            string emailToApplicants = txt_Email.Text.Trim();
            Boolean executivejob = cb_ExecutiveJob.Checked;
            dj = new DetailJob(id, orgname, orgInfo, orglogo, orgAdd, phone, website, mu.UserName, emailToApplicants, jtitle, uploaddate, closing, description, cate1, cate2, cate3, workplace1, workplace2, workplace3, salaryType, salaryFrom, salaryTo, salarycurrency, salarypayment, citizenship, joblevel, eduredquire, empType, contact, viewcount, orgtype, schoolType);
            Session["Preview"] = dj;
            Response.Redirect("~/publicArea/JobDetails.aspx?view=preview");
        }
Example #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            facade = new BusinessFacade(myConn);
            mu = Membership.GetUser();
            UserID = mu.ProviderUserKey.ToString();

            //Page.Form.DefaultButton = btnPostJob.UniqueID;

            if (!IsPostBack)
            {
                //ddl_OrgType.DataBind();
                //ddl_SchoolType.DataBind();
                ddlJobLevel.DataBind();
                ddl_EducationRequirement.DataBind();
                ddlJobEmploymentType.DataBind();
                ddlJobLocation.DataBind();
                ddlJobLocation2.DataBind();
                ddlJobLocation3.DataBind();
                ddlCitizenship.DataBind();
                Category.DataBind();
                Category2.DataBind();
                Category3.DataBind();
                txt_Email.Text = mu.Email;

                CalendarExtender1.StartDate = DateTime.Now;
                CalendarExtender1.EndDate = DateTime.Now.AddDays(General.CLOSING_DATE_PERIOD);
                //If we have premium employer, set closing date longer.
                if (User.IsInRole("PremiumEmp"))
                {
                    CalendarExtender1.EndDate = DateTime.Now.AddDays(General.CLOSING_DATE_PERIOD * 2);
                }
                if (Thread.CurrentThread.CurrentCulture.Name == "en-US")
                {
                    CalendarExtender1.Format = "MM/dd/yyyy";
                }
                else
                {
                    CalendarExtender1.Format = "dd/MM/yyyy";
                }

                string contactperson = HttpContext.Current.Profile.GetPropertyValue("Employer.Salutation").ToString() + " " + HttpContext.Current.Profile.GetPropertyValue("Employer.FirstName").ToString() + " " + HttpContext.Current.Profile.GetPropertyValue("Employer.MiddleName").ToString() + " " + HttpContext.Current.Profile.GetPropertyValue("Employer.LastName").ToString();
                Contact.Text = contactperson;
            }
            if (!IsPostBack)
            {
                try
                {
                    ViewState["PreviousPageUrl"] = Request.UrlReferrer.ToString();
                }
                catch (Exception)
                {
                    Response.Redirect("~/Employer/EmployerSite.aspx?r=e");
                }

                if (Request.Params["stt"] == "edit")
                {
                    if (Session["Preview"] != null)
                    {
                        Dj = (DetailJob)Session["Preview"];

                        BindingTxtControl(txtJobTitle, Dj.Title);
                        BindingDDlControl(Category, Dj.Category);
                        BindingDDlControl(Category2, Dj.Category2);
                        BindingDDlControl(Category3, Dj.Category3);
                        BindingDDlControl(ddlCitizenship, Dj.Citizenship);
                        if (Dj.JobLevel != "")
                        {
                            ListItem sJobLevel = ddlJobLevel.Items.FindByValue(Dj.JobLevel);
                            if (sJobLevel != null) { sJobLevel.Selected = true; }
                        }
                        BindingDDlControl(ddl_EducationRequirement, Dj.EduRequirement);
                        BindingDDlControl(ddlJobEmploymentType, Dj.EmploymentType);
                        BindingDDlControl(ddlJobLocation, Dj.Workplace);
                        BindingDDlControl(ddlJobLocation2, Dj.Workplace2);
                        BindingDDlControl(ddlJobLocation3, Dj.Workplace3);
                        BindingTxtControl(txtJobDescription,Dj.Description);
                        BindingTxtControl(txtJobClosingDate, Dj.ClosingDate.ToShortDateString());
                        BindingTxtControl(Contact, Dj.Contact);
                        BindingTxtControl(txt_Email, Dj.EmailForEmployer);
                        BindingTxtControl(txt_SalaryFrom, Dj.Salary.ToString());
                        BindingTxtControl(txt_SalaryTo, Dj.SalaryTo.ToString());
                        BindingDDlControl(ddl_SalaryCurrency, Dj.SalaryCurrency);
                        BindingDDlControl(ddl_SalaryPaidType, Dj.SalaryPaymentType);

                        if (Session["execJob"] != null && Session["execJob"].ToString() == "true")
                        {
                            cb_ExecutiveJob.Checked = true;
                        }
                        else { cb_ExecutiveJob.Checked = false; }
                    }
                }
            }
        }