private void UpdateVacancySync(VacancyInfo value, int VacacnyID)
        {
            string conStr = configuration.GetSection("Data").GetSection("ConntectionString").Value;

            RTS.JobStation.Controller.Vacancy VacancyController = new RTS.JobStation.Controller.Vacancy();

            MySql.Data.MySqlClient.MySqlConnection  con    = null;
            MySql.Data.MySqlClient.MySqlTransaction MyTran = null;


            try
            {
                con    = RTS.JobStation.DatabaseCommands.OpenConnection();
                MyTran = RTS.JobStation.DatabaseCommands.OpenTransaction(ref con);

                //Get Candidate Basic Info  GetCandidateBasicInfo
                RTS.JobStation.Models.Vacancy vacancy = new RTS.JobStation.Models.Vacancy();
                vacancy.VacancyID       = VacacnyID;
                vacancy.ProcessID       = value.ProcessID;
                vacancy.OpenPositions   = value.OpenPositions;
                vacancy.DesignationID   = value.DesignationID;
                vacancy.Title           = value.JobTitle;
                vacancy.JobDescription  = value.JobDescription;
                vacancy.JobSkill        = value.JobSkill;
                vacancy.JobSkill        = value.JobDuty;
                vacancy.EducationInfo   = value.EducationInfo;
                vacancy.NationalityInfo = value.NationalityInfo;
                vacancy.UpdatedBy       = Request.Headers["userid"];
                vacancy.UpdatedOn       = DateTime.Now;

                string result = VacancyController.Update_vacancy_UpdateVacancy(vacancy, ref con, ref MyTran);

                RTS.JobStation.Controller.Employeerequest EmpReqController = new RTS.JobStation.Controller.Employeerequest();
                RTS.JobStation.Models.Employeerequest     EmpReqModel      = new RTS.JobStation.Models.Employeerequest();

                EmpReqModel.RequestedByUserID    = value.RequestedByUserID;
                EmpReqModel.RequestingDepartment = value.RequestingDepartmentID;
                EmpReqModel.PositionName         = value.JobTitle;
                EmpReqModel.PositionTypeID       = value.PositionTypeID;
                EmpReqModel.NoOfEmployeeRequired = value.OpenPositions;
                EmpReqModel.UpdatedBy            = Request.Headers["userid"];
                EmpReqModel.UpdatedOn            = DateTime.Now;
                EmpReqModel.EmployeeRequestID    = EmpReqController.GetEmployeeRequestID(ref con, ref MyTran, VacacnyID);
                EmpReqController.Update(EmpReqModel, ref con, ref MyTran);



                // return Ok("Vacancy Created");
            }
            catch
            {
                //  return StatusCode(500);
            }

            finally
            {
                RTS.JobStation.DatabaseCommands.CloseTransaction(ref MyTran);
                RTS.JobStation.DatabaseCommands.CloseConnection(ref con);
            }
        }
        public ActionResult <string> CloseJob(int vacancyid, bool isClosed = true)
        {
            if (AuthenticateUser() == false)
            {
                return(Unauthorized());
            }

            string conStr = configuration.GetSection("Data").GetSection("ConntectionString").Value;

            RTS.JobStation.Controller.Vacancy Jobs = new RTS.JobStation.Controller.Vacancy();

            MySql.Data.MySqlClient.MySqlConnection  con    = null;
            MySql.Data.MySqlClient.MySqlTransaction MyTran = null;
            try
            {
                con    = RTS.JobStation.DatabaseCommands.OpenConnection();
                MyTran = RTS.JobStation.DatabaseCommands.OpenTransaction(ref con);
                Jobs.CloseJob(ref con, ref MyTran, vacancyid, isClosed);
                return(Ok());
            }
            catch (System.IO.IOException e)
            {
                return(StatusCode(501, "Error : " + e.Message.ToString()));
            }

            finally
            {
                RTS.JobStation.DatabaseCommands.CloseTransaction(ref MyTran);
                RTS.JobStation.DatabaseCommands.CloseConnection(ref con);
            }
        }
        public ActionResult <string> GetJobListingSummaryOld()
        {
            string jsonResult = "";

            if (AuthenticateUser() == false)
            {
                return(Unauthorized());
            }

            string conStr = configuration.GetSection("Data").GetSection("ConntectionString").Value;

            RTS.JobStation.Controller.Vacancy Jobs = new RTS.JobStation.Controller.Vacancy();
            // DataSet ds = new DataSet("CandidateTimeline");
            DataSet ds = new DataSet();

            MySql.Data.MySqlClient.MySqlConnection  con    = null;
            MySql.Data.MySqlClient.MySqlTransaction MyTran = null;
            try
            {
                con    = RTS.JobStation.DatabaseCommands.OpenConnection();
                MyTran = RTS.JobStation.DatabaseCommands.OpenTransaction(ref con);
                ds     = Jobs.GetJobInfoSummary(ref con, ref MyTran);

                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        string      xml = ds.GetXml();
                        XmlDocument doc = new XmlDocument();
                        doc.LoadXml(xml);
                        //string json2 = JsonConvert.SerializeObject(doc.GetElementsByTagName("Parents"));
                        jsonResult = JsonConvert.SerializeObject(doc);
                    }
                    else
                    {
                        return(NoContent());
                    }
                }
                else
                {
                    return(NoContent());
                }


                // jsonResult = JsonConvert.SerializeObject(ds);
            }
            catch (System.IO.IOException e)
            {
            }

            finally
            {
                RTS.JobStation.DatabaseCommands.CloseTransaction(ref MyTran);
                RTS.JobStation.DatabaseCommands.CloseConnection(ref con);
            }


            return(Ok(jsonResult));
        }
Exemple #4
0
        public ActionResult <string> GetVacancyList()
        {
            string jsonResult = "";

            if (AuthenticateUser() == false)
            {
                return(Unauthorized());
            }

            string conStr = configuration.GetSection("Data").GetSection("ConntectionString").Value;

            RTS.JobStation.Controller.Vacancy Jobs = new RTS.JobStation.Controller.Vacancy();
            // DataSet ds = new DataSet("CandidateTimeline");
            DataSet ds = new DataSet();

            MySql.Data.MySqlClient.MySqlConnection  con    = null;
            MySql.Data.MySqlClient.MySqlTransaction MyTran = null;
            try
            {
                con            = RTS.JobStation.DatabaseCommands.OpenConnection();
                MyTran         = RTS.JobStation.DatabaseCommands.OpenTransaction(ref con);
                ds             = Jobs.GetVacancyListActiveForCareerPortal(ref con, ref MyTran);
                ds.DataSetName = "Vacancies";
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        ds.Tables[0].TableName = "VacancyDetails";
                        jsonResult             = JsonConvert.SerializeObject(ds);
                    }
                    else
                    {
                        return(NoContent());
                    }
                }
                else
                {
                    return(NoContent());
                }


                // jsonResult = JsonConvert.SerializeObject(ds);
            }
            catch (System.IO.IOException e)
            {
            }

            finally
            {
                RTS.JobStation.DatabaseCommands.CloseTransaction(ref MyTran);
                RTS.JobStation.DatabaseCommands.CloseConnection(ref con);
            }


            return(Ok(jsonResult));
        }
        private void AddVacancySync(VacancyInfo value)
        {
            string conStr = configuration.GetSection("Data").GetSection("ConntectionString").Value;

            RTS.JobStation.Controller.Vacancy VacancyController = new RTS.JobStation.Controller.Vacancy();

            MySql.Data.MySqlClient.MySqlConnection  con    = null;
            MySql.Data.MySqlClient.MySqlTransaction MyTran = null;


            try
            {
                con    = RTS.JobStation.DatabaseCommands.OpenConnection();
                MyTran = RTS.JobStation.DatabaseCommands.OpenTransaction(ref con);

                //Get Candidate Basic Info  GetCandidateBasicInfo
                RTS.JobStation.Models.Vacancy vacancy = new RTS.JobStation.Models.Vacancy();
                vacancy.ProcessID       = value.ProcessID;
                vacancy.OpenPositions   = value.OpenPositions;
                vacancy.DesignationID   = value.DesignationID;
                vacancy.Title           = value.JobTitle;
                vacancy.JobDescription  = value.JobDescription;
                vacancy.JobSkill        = value.JobSkill;
                vacancy.JobSkill        = value.JobDuty;
                vacancy.EducationInfo   = value.EducationInfo;
                vacancy.NationalityInfo = value.NationalityInfo;
                vacancy.UpdatedBy       = Request.Headers["userid"];
                vacancy.UpdatedOn       = DateTime.Now;

                string result    = VacancyController.Insert_vacancy_AddVacancy(vacancy, ref con, ref MyTran);
                int    VacancyID = Int32.Parse(JobStation.DatabaseCommands.GetLastInsertedID(ref con, ref MyTran).ToString());

                RTS.JobStation.Controller.Employeerequest EmpReqController = new RTS.JobStation.Controller.Employeerequest();
                RTS.JobStation.Models.Employeerequest     EmpReqModel      = new RTS.JobStation.Models.Employeerequest();

                EmpReqModel.RequestedByUserID    = value.RequestedByUserID;
                EmpReqModel.RequestingDepartment = value.RequestingDepartmentID;
                EmpReqModel.PositionName         = value.JobTitle;
                EmpReqModel.PositionTypeID       = value.PositionTypeID;
                EmpReqModel.NoOfEmployeeRequired = value.OpenPositions;
                EmpReqModel.UpdatedBy            = Request.Headers["userid"];
                EmpReqModel.UpdatedOn            = DateTime.Now;
                EmpReqController.Insert(EmpReqModel, ref con, ref MyTran);
                int EmployeeRequestID = Int32.Parse(JobStation.DatabaseCommands.GetLastInsertedID(ref con, ref MyTran).ToString());

                RTS.JobStation.Controller.Jobrequestederf JobReqController = new RTS.JobStation.Controller.Jobrequestederf();
                RTS.JobStation.Models.Jobrequestederf     JobReqModel      = new RTS.JobStation.Models.Jobrequestederf();

                JobReqModel.VacancyID         = VacancyID;
                JobReqModel.EmployeeRequestID = EmployeeRequestID;
                JobReqModel.UpdatedBy         = Request.Headers["userid"];
                JobReqModel.UpdatedOn         = DateTime.Now;
                JobReqController.Insert(JobReqModel, ref con, ref MyTran);


                AddJobInterviewerInfo(value.JobInterviewerList, VacancyID, ref con, ref MyTran);

                // return Ok("Vacancy Created");

                //Add to JobDepartment and JobEntity

                RTS.JobStation.Controller.Jobentity JobEntityController = new RTS.JobStation.Controller.Jobentity();
                RTS.JobStation.Models.Jobentity     JobEntityModel      = new RTS.JobStation.Models.Jobentity();

                JobEntityModel.EntityID  = value.RequestingEntityID;
                JobEntityModel.VacancyID = VacancyID;
                JobEntityModel.UpdatedBy = Request.Headers["userid"];
                JobEntityController.Insert(JobEntityModel, ref con, ref MyTran);



                RTS.JobStation.Controller.Jobdepartment JobDepartmentController = new RTS.JobStation.Controller.Jobdepartment();
                RTS.JobStation.Models.Jobdepartment     JobDepartmentModel      = new RTS.JobStation.Models.Jobdepartment();

                JobDepartmentModel.DepartmentID = value.RequestingDepartmentID;

                JobDepartmentModel.VacancyID = VacancyID;
                JobDepartmentModel.UpdatedBy = Request.Headers["userid"];
                JobDepartmentController.Insert(JobDepartmentModel, ref con, ref MyTran);
            }
            catch
            {
                //  return StatusCode(500);
            }

            finally
            {
                RTS.JobStation.DatabaseCommands.CloseTransaction(ref MyTran);
                RTS.JobStation.DatabaseCommands.CloseConnection(ref con);
            }
        }
        public ActionResult <string> GetJobListingSummary([FromQuery] int VacancyID = 0, [FromQuery] int DepartmentID = 0, [FromQuery] int EntityID = 0, [FromQuery] string JobTitle = "", [FromQuery] bool isClosed = false)
        {
            string jsonResult = "";

            if (AuthenticateUser() == false)
            {
                return(Unauthorized());
            }

            string conStr = configuration.GetSection("Data").GetSection("ConntectionString").Value;

            RTS.JobStation.Controller.Vacancy Jobs = new RTS.JobStation.Controller.Vacancy();
            // DataSet ds = new DataSet("CandidateTimeline");
            DataSet ds = new DataSet();

            MySql.Data.MySqlClient.MySqlConnection  con    = null;
            MySql.Data.MySqlClient.MySqlTransaction MyTran = null;
            try
            {
                con    = RTS.JobStation.DatabaseCommands.OpenConnection();
                MyTran = RTS.JobStation.DatabaseCommands.OpenTransaction(ref con);
                ds     = Jobs.GetJobListSummary(ref con, ref MyTran, VacancyID, DepartmentID, EntityID, JobTitle, isClosed);

                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        ds.DataSetName = "JobListSummary";
                        string      xml = ds.GetXml();
                        XmlDocument doc = new XmlDocument();

                        doc.LoadXml(xml);

                        var xTag = doc.GetElementsByTagName("JobInfo");
                        if (xTag.Count == 2)
                        {
                            var attribute = doc.CreateAttribute("json", "Array", "http://james.newtonking.com/projects/json");
                            attribute.InnerText = "true";
                            attribute.Value     = "true";

                            var node = xTag.Item(0) as XmlElement;
                            node.Attributes.Append(attribute);
                        }


                        //string json2 = JsonConvert.SerializeObject(doc.GetElementsByTagName("Parents"));
                        jsonResult = JsonConvert.SerializeObject(doc);
                    }
                    else
                    {
                        return(NoContent());
                    }
                }
                else
                {
                    return(NoContent());
                }


                // jsonResult = JsonConvert.SerializeObject(ds);
            }
            catch (System.IO.IOException e)
            {
                return(StatusCode(501, "Error :" + e.Message.ToString()));
            }

            finally
            {
                RTS.JobStation.DatabaseCommands.CloseTransaction(ref MyTran);
                RTS.JobStation.DatabaseCommands.CloseConnection(ref con);
            }


            return(Ok(jsonResult));
        }