示例#1
0
        public void Scheduleinterview(InterviewSchedule schedule)
        {
            string sql = string.Format(Constants.InsertScheduledInterviewInfo, schedule.CandidateId, schedule.UserId, schedule.ArriveStatus, schedule.Date, schedule.Time, schedule.RoomId);

            using (IDbConnection connection = new SqlConnection(Constants.connectionstring))
            {
                var result = connection.Query <InterviewSchedule>(sql).AsList();
            }
        }
        public HttpResponseMessage ScheduleTime([FromBody] InterviewSchedule Schedule)
        {
            var responseCode = HttpStatusCode.OK;

            try
            {
                InterviewProcess cc = new InterviewProcess();
                cc.ScheduleInterview(Schedule);
            }
            catch (Exception e)
            {
                responseCode = HttpStatusCode.BadRequest;
            }
            return(new HttpResponseMessage {
                StatusCode = responseCode
            });
        }
示例#3
0
        public string SaveInterviewSchedule(InterviewSchedule schedule)
        {
            List <string> emails  = new List <string>();
            bool          success = this.DataContext.SaveInterviewSchedule(schedule);

            if (success)
            {
                string[] users = schedule.ScheduledInterviewers.Split(',');
                foreach (string user in users)
                {
                    Users u = this.DataContext.GetUserDetailsByName(user);
                    if (u != null)
                    {
                        emails.Add(u.Email);
                    }
                }
            }
            return(string.Join("; ", emails.ToArray()));
        }
示例#4
0
 public bool SaveInterviewSchedule(InterviewSchedule schedule)
 {
     try
     {
         var existingCount = this.InterviewSchedule.Count(a => a.InterviewScheduleID.Equals(schedule.InterviewScheduleID));
         if (existingCount == 0)
         {
             // insert user
             schedule.CreatedDate = DateTime.UtcNow;
             InterviewSchedule.Add(schedule);
         }
         else
         {
             InterviewSchedule u = this.InterviewSchedule.Where(a => a.InterviewScheduleID.Equals(schedule.InterviewScheduleID)).FirstOrDefault <InterviewSchedule>();
             // change contact in disconnected mode (out of DBContext scope)
             if (u != null)
             {
                 u.InverviewRound        = schedule.InverviewRound;
                 u.ScheduledInterviewers = schedule.ScheduledInterviewers;
                 u.Subject      = schedule.Subject;
                 u.Description  = schedule.Description;
                 u.StartTime    = schedule.StartTime;
                 u.EndTime      = schedule.EndTime;
                 u.AttachResume = schedule.AttachResume;
                 u.ModifiedDate = DateTime.UtcNow;
             }
             this.Entry(u).State = EntityState.Modified;
         }
         this.SaveChanges();
         return(true);
     }
     catch
     {
         throw;
     }
 }
        public HttpResponseMessage CreateCandidate([FromBody] Candidate value)
        {
            var responseCode = HttpStatusCode.OK;;

            try
            {
                InterviewProcess cc = new InterviewProcess();
                int id         = cc.CreateCandidate(value);
                var interSched = new InterviewSchedule();
                interSched.CandidateId = id;
                interSched.RoomId      = value.interviewSchedule.RoomId;
                interSched.UserId      = value.interviewSchedule.UserId;
                interSched.Date        = value.interviewSchedule.Date;
                interSched.Time        = value.interviewSchedule.Time;
                cc.ScheduleInterview(interSched);
            }
            catch (Exception e)
            {
                responseCode = HttpStatusCode.BadRequest;
            }
            return(new HttpResponseMessage {
                StatusCode = responseCode
            });
        }
        public HttpResponseMessage Post(InterviewSchedule schedule)
        {
            try
            {
                if (schedule != null)
                {
                    string user = iRecruit.Security.Extensions.FetchUserFromRequestHeader(this.ActionContext);
                    if (schedule.InterviewScheduleID == 0)
                    {
                        schedule.CreatedBy = user;
                    }
                    else
                    {
                        schedule.ModifiedBy = user;
                    }
                    string emailNotifications = this._repo.SaveInterviewSchedule(schedule);

                    if (!string.IsNullOrWhiteSpace(emailNotifications))
                    {
                        EmailHelper helper  = new EmailHelper();
                        string      calPath = HttpContext.Current.Server.MapPath("~/Schedules/Interview Schedule.ics");
                        new System.IO.FileInfo(calPath).Directory.Create();
                        try
                        {
                            helper.CreateCalenderEvent("", schedule.Subject, schedule.Description, schedule.StartTime, schedule.EndTime, ref calPath);

                            EmailMessage message = new EmailMessage()
                            {
                                To = emailNotifications, Subject = "Technical Interview - #" + schedule.CandidateID
                            };
                            List <string> mailAttachment     = new List <string>();
                            string        resumePhysicalPath = "";
                            if (schedule.AttachResume.Equals("1"))
                            {
                                Resumes resume = this._repo.GetResume(schedule.CandidateID);
                                if (!string.IsNullOrWhiteSpace(resume.ResumePath))
                                {
                                    string f = resume.ResumePath.Substring(resume.ResumePath.LastIndexOf("\\") + 1);
                                    resumePhysicalPath = HttpContext.Current.Server.MapPath("~/Resumes/" + resume.CandidateID + "/" + f);
                                    mailAttachment.Add(resumePhysicalPath);
                                }
                            }

                            helper.Send(message, mailAttachment, calPath, false);
                        }
                        finally
                        {
                            if (!string.IsNullOrWhiteSpace(calPath))
                            {
                                try
                                {
                                    File.Delete(calPath);
                                }catch { }
                            }
                        }
                        // cleanup temp files
                    }

                    HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, true);
                    return(response);
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NoContent, new Exception("No data found to save")));
                }
            }
            catch (Exception ex)
            {
                _tracer.Error(Request, this.ControllerContext.ControllerDescriptor.ControllerType.FullName, ex.StackTrace);
                return(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent(ex.Message)
                });
            }
        }
 public void ScheduleInterview(InterviewSchedule schedule)
 {
     d.Scheduleinterview(schedule);
 }