예제 #1
0
        public bool createJob(string recordid, string jobtitle, string skills, int noofvacancies, string remarks, bool isActive)
        {
            bool flagSucess = false;
            //bool isActiveTest = true;
            int userId = 0;

            if (Session["adminuser"] != null)
            {
                string currentUser = Session["adminuser"].ToString();

                if (currentUser != null)
                {
                    userId = int.Parse(currentUser.Split('|')[0]);
                }
            }


            using (HREntities db = new HREntities())
            {
                try
                {
                    jobPost jobpost = new jobPost();
                    if (recordid == "")
                    {
                        jobpost.createDate    = DateTime.Now;
                        jobpost.jobTilte      = jobtitle;
                        jobpost.skills        = skills;
                        jobpost.noOfVacancies = noofvacancies;
                        jobpost.remarks       = remarks;
                        jobpost.userId        = userId;
                        jobpost.isActive      = isActive;
                        db.jobPosts.Add(jobpost);
                    }
                    else
                    {
                        long id = long.Parse(recordid);
                        jobpost               = db.jobPosts.Where(x => x.jobId == id).SingleOrDefault();
                        jobpost.createDate    = DateTime.Now;
                        jobpost.jobTilte      = jobtitle;
                        jobpost.skills        = skills;
                        jobpost.noOfVacancies = noofvacancies;
                        jobpost.remarks       = remarks;
                        jobpost.userId        = userId;
                        jobpost.isActive      = isActive;
                    }
                    flagSucess = true;
                    db.SaveChanges();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(flagSucess);
        }
예제 #2
0
        public bool SaveTask(string Taskname, string gitUrl, int timeTaken, string recordid)
        {
            bool flagSucess = false;

            using (HREntities db = new HREntities())
            {
                if (recordid == "")
                {
                    Task tsk = new Task()
                    {
                        taskName    = Taskname,
                        gitUrl      = gitUrl,
                        timeTaken   = timeTaken,
                        createdDate = DateTime.UtcNow
                    };

                    if (Session["user"] != null)
                    {
                        string currentUser = Session["user"].ToString();

                        if (currentUser != null)
                        {
                            tsk.userId = long.Parse(currentUser.Split('|')[0]);
                        }
                    }


                    db.Tasks.Add(tsk);
                }
                else
                {
                    long Taskid = long.Parse(recordid);

                    var data = db.Tasks.Where(j => j.taskId == Taskid);
                    if (data.Any())
                    {
                        var d = data.FirstOrDefault();
                        d.taskName  = Taskname;
                        d.gitUrl    = gitUrl;
                        d.timeTaken = timeTaken;
                    }
                }

                db.SaveChanges();


                flagSucess = true;
            }


            return(flagSucess);
        }
예제 #3
0
        public bool createAdminUser(string fname, string lname, string email, string password, string phNumber, string gender, string address, string dob, string grade, string branch, string role, string reportingTo)
        {
            Boolean flag = false;

            using (HREntities db = new HREntities())
            {
                try
                {
                    var Candidate = db.Set <UserManagement>();
                    Candidate.Add(new UserManagement {
                        firstName = fname, LastName = lname, email = email, password = password, phone = phNumber, gender = gender, address1 = address, dob = Convert.ToDateTime(dob), grade = grade, branchId = Convert.ToInt32(branch), roles = role, reportingTo = Convert.ToInt32(reportingTo)
                    });
                    db.SaveChanges();
                    flag = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(flag);
        }
예제 #4
0
        public bool updateCandidate(string skillset, int experience, string biodata)
        {
            bool flagSucess = false;
            int  userId     = 0;

            if (Session["adminuser"] != null)
            {
                string currentUser = Session["adminuser"].ToString();

                if (currentUser != null)
                {
                    userId = int.Parse(currentUser.Split('|')[0]);
                }
            }


            Candidate candidate = new Candidate();

            using (HREntities db = new HREntities())
            {
                try
                {
                    candidate = db.Candidates.Where(x => x.id == userId).FirstOrDefault();
                    if (candidate != null)
                    {
                        candidate.skillset          = skillset;
                        candidate.overallexperience = experience;
                        candidate.biodatapath       = biodata;
                    }
                    db.SaveChanges();
                    flagSucess = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }
            return(flagSucess);
        }
예제 #5
0
        public bool createUser(string fname, string lname, string email, string password, string phNumber, string gender)
        {
            Boolean flag = false;

            using (HREntities db = new HREntities())
            {
                try
                {
                    var Candidate = db.Set <Candidate>();
                    Candidate.Add(new Candidate {
                        firstname = fname, lastname = lname, emialid = email, password = password, contact = phNumber, gender = gender
                    });
                    db.SaveChanges();
                    flag = true;
                }
                catch (Exception)
                {
                    throw;
                }
            }

            return(flag);
        }
예제 #6
0
        public bool SaveEmpProjManagement(int userid, int projectid, string modules, string position, DateTime estimatedclosedate)
        {
            bool flagSucess = false;

            try
            {
                using (HREntities db = new HREntities())
                {
                    EmployeeProjectManagement tsk = new EmployeeProjectManagement();

                    var cId = db.Projects.Where(a => a.projectId == projectid).Select(a => a.clientId).FirstOrDefault();
                    var bId = db.UserManagements.Where(a => a.userId == userid).Select(a => a.branchId).FirstOrDefault();

                    tsk.userid             = userid;
                    tsk.clientid           = cId;
                    tsk.projectid          = projectid;
                    tsk.modules            = modules;
                    tsk.branchid           = bId == null ? 1 : bId;
                    tsk.position           = position;
                    tsk.estimatedclosedate = estimatedclosedate;
                    tsk.status             = "Added";
                    tsk.updatedby          = 2;
                    tsk.createddate        = DateTime.UtcNow;

                    db.EmployeeProjectManagements.Add(tsk);
                    db.SaveChanges();
                    flagSucess = true;
                }
            }
            catch (Exception)
            {
                throw;
            }

            return(flagSucess);
        }
예제 #7
0
        public string ApplyForJob(string jobId)
        {
            try
            {
                //bool flagSucess = false;
                int userId = 0;

                if (Session["candidateuser"] != null)
                {
                    string currentUser = Session["candidateuser"].ToString();

                    if (currentUser != null)
                    {
                        userId = int.Parse(currentUser.Split('|')[0]);
                    }
                    else
                    {
                        // HttpContext.Current.Response.Redirect("~/User/Signin.aspx");
                        return("unauthorised");
                    }
                }
                else
                {
                    //HttpContext.Current.Response.Redirect("~/User/Signin.aspx");
                    return("unauthorised");
                }

                using (HREntities db = new HREntities())
                {
                    long lngJobid = long.Parse(jobId);

                    var data = db.JobsAppliedFors.Where(x => x.candidateid == userId && x.jobpostid == lngJobid).ToList();
                    if (data.Count > 0)
                    {
                        return("Already Applied");
                    }
                    else
                    {
                        var job = db.jobPosts.Where(x => x.jobId == lngJobid).FirstOrDefault();

                        JobsAppliedFor objJob = new JobsAppliedFor()
                        {
                            applydate   = DateTime.Today,
                            branchid    = job.branchid,
                            jobpostid   = Convert.ToInt32(jobId),
                            candidateid = Convert.ToInt32(userId),
                            createddate = DateTime.Today
                        };
                        db.JobsAppliedFors.Add(objJob);
                        db.SaveChanges();


                        return(JsonConvert.SerializeObject(objJob));
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }