Ejemplo n.º 1
0
        public ActionResult SaveComments(int RS_HDRID, string Instructions, string AssignTo, string RMSJobStatus)
        {
            if (RS_HDRID > 0 && Instructions != "")
            {
                RMS_SharedReq_HDR Obj = unitOfwork.RMS_SharedReq_HDR.GetByID(RS_HDRID);
                Obj.RMS_SharedReqNotes = new List <RMS_SharedReqNotes>();

                RMS_SharedReqNotes newobj = new RMS_SharedReqNotes()
                {
                    RS_Notes     = Instructions,
                    RS_CreatedBy = User.Identity.Name,
                    RS_CreatedDt = SystemClock.US_Date
                };

                Obj.RMS_SharedReqNotes.Add(newobj);
                unitOfwork.Save();
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult Assign(int RS_HDRID, string Instructions, string AssignTo, string RMSJobStatus)
        {
            if (AssignTo != "" && RS_HDRID > 0)
            {
                //Check if already assigned.	 Or RMSJobStatus is not set to Close.
                if (unitOfwork.RMS_AssignSharedReq.Get().Where(e => e.RA_AssignedTo == AssignTo && e.RA_SharedReqHDRID == RS_HDRID).Count() == 0 && RMSJobStatus != "CLOSE")
                {
                    unitOfwork.RMS_AssignSharedReq.Insert(new RMS_AssignSharedReq
                    {
                        RA_SharedReqHDRID = RS_HDRID,
                        RA_AssignedTo     = AssignTo,
                        RA_AssignedBy     = User.Identity.Name,
                        RA_AssignedDt     = SystemClock.US_Date
                    });

                    unitOfwork.Save();
                }
            }

            if (RS_HDRID > 0 && RMSJobStatus != "")
            {
                unitOfwork.RMS_SharedReq_HDR.GetByID(RS_HDRID).RS_RMSJobStatus = RMSJobStatus;
                unitOfwork.Save();
                if (RMSJobStatus == "CLOSE")
                {
                    string error;

                    string MailBody = @"<!DOCTYPE html>
										<html lang='en'>
										<head><meta charset='UTF-8'>
										    <title>Notification</title><style>body{font-family: arial, sans-serif;font-size:16px;}#div{padding:1%;background: white;display: block;margin: 0 auto;margin-bottom: 0.5cm;box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);}table {font-family: arial, sans-serif;border-collapse: collapse;width: 100%;}td, th {border: 1px solid #dddddd;text-align: left;padding: 8px;}tr:nth-child(odd){background-color: #dddddd;}</style>
										</head>
										<body><div id='div'><p >Hi,</p><div style='padding:1%;'><p>Job as been closed in RMS shared requirement.</p><table><tr><th>Job ID</th><th>JD Ref</th><th>Title</th><th>Company</th><th>Requester</th><th>MaxSub</th></tr><tr><td><a href='https://www1.jobdiva.com/employers/myjobs/vieweditjobform.jsp?jobid=@JobID'>@JobID</a></td><td>@JDRef</td><td>@Title</td><td>@Company</td><td>@Requester</td><td>@MaxSub</td></tr></table></div><br><p>Please do not reply to this mail.<p></div></body></html>
										"                                        ;

                    var JobData = unitOfwork.RMS_SharedReq_HDR.GetByID(RS_HDRID);

                    MailBody = MailBody.Replace("@JobID", JobData.RS_JobID.ToString());
                    MailBody = MailBody.Replace("@JDRef", JobData.RS_JobDivaRef);
                    MailBody = MailBody.Replace("@Title", JobData.RMS_SharedReq_Dtl.First().RS_JobTitle);
                    MailBody = MailBody.Replace("@Company", JobData.RMS_SharedReq_Dtl.First().RS_Company);
                    MailBody = MailBody.Replace("@Requester", unitOfwork.User.GetByEmpID(User.Identity.Name).RE_Jobdiva_User_Name);
                    MailBody = MailBody.Replace("@MaxSub", JobData.RMS_SharedReq_Dtl.First().RS_MaxSubAllowed.ToString());

                    Email.SendMail(ConfigurationManager.AppSettings["SharedReq_Email"].Split(';'), "Job CLOSED In RMS", MailBody, out error);
                }
            }

            if (RS_HDRID > 0 && Instructions != "")
            {
                RMS_SharedReq_HDR Obj = unitOfwork.RMS_SharedReq_HDR.GetByID(RS_HDRID);
                Obj.RMS_SharedReqNotes = new List <RMS_SharedReqNotes>();

                RMS_SharedReqNotes newobj = new RMS_SharedReqNotes()
                {
                    RS_Notes     = Instructions,
                    RS_CreatedBy = User.Identity.Name,
                    RS_CreatedDt = SystemClock.US_Date
                };

                Obj.RMS_SharedReqNotes.Add(newobj);
                unitOfwork.Save();
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
        public ActionResult SavetoRMS(SharedReqVM SharedReqVM)
        {
            if (SharedReqVM.ListSharedReq != null && SharedReqVM.ListSharedReq.Count >= 1)
            {
                if ((from sharedReq_Hdr in unitOfwork.RMS_SharedReq_HDR.Get()
                     where sharedReq_Hdr.RS_JobDivaRef == SharedReqVM.ListSharedReq[0].JobDivaRef
                     select new
                {
                    sharedReq_Hdr.RS_JobDivaRef
                }).Count() > 0)
                {
                    SharedReqVM.Message = "This requirement already exists in RMS Database.";
                    return(View("Index", SharedReqVM));
                }

                List <RMS_SharedReq_Dtl> RMS_SharedReq_Dtl = new List <RMS_SharedReq_Dtl>();
                foreach (SharedReq sharedReq in SharedReqVM.ListSharedReq)
                {
                    RMS_SharedReq_Dtl SharedReq_Dtl = new RMS_SharedReq_Dtl()
                    {
                        RS_JobTitle     = sharedReq.JobTitle,
                        RS_JobIssueDate = sharedReq.JobIssueDate,
                        RS_Company      = sharedReq.Company,
                        RS_WorkLocation = sharedReq.WorkLocation,
                        RS_ClientID     = sharedReq.ClientID,
                        RS_Division     = sharedReq.Division,
                        RS_Priority     = sharedReq.Priority,

                        RS_Category = sharedReq.Category,
                        RS_State    = sharedReq.State,
                        RS_City     = sharedReq.City,
                        RS_BillRate = sharedReq.BillRate,
                        RS_PayRate  = sharedReq.PayRate,

                        RS_PrimaryAssigment = sharedReq.PrimaryAssigment != null?String.Join(",", sharedReq.PrimaryAssigment) : null,
                                                  RS_MaxSubAllowed = sharedReq.MaxSubAllowed,
                                                  RS_InternalSub   = sharedReq.InternalSub,
                                                  RS_ExternalSub   = sharedReq.ExternalSub,

                                                  // RS_Instructions = sharedReq.Instructions,
                                                  //
                                                  SearchJobApi_id                 = sharedReq.SearchJobApi_id,
                                                  SearchJobApi_contact_id         = sharedReq.SearchJobApi_contact_id,
                                                  SearchJobApi_company_id         = sharedReq.SearchJobApi_company_id,
                                                  SearchJobApi_company            = sharedReq.SearchJobApi_company,
                                                  SearchJobApi_reference          = sharedReq.SearchJobApi_reference,
                                                  SearchJobApi_optional_reference = sharedReq.SearchJobApi_optional_reference,
                                                  SearchJobApi_job_title          = sharedReq.SearchJobApi_job_title,
                                                  SearchJobApi_address1           = sharedReq.SearchJobApi_address1,
                                                  SearchJobApi_address2           = sharedReq.SearchJobApi_address2,
                                                  SearchJobApi_city               = sharedReq.SearchJobApi_city,
                                                  SearchJobApi_state              = sharedReq.SearchJobApi_state,
                                                  SearchJobApi_country            = sharedReq.SearchJobApi_country,
                                                  SearchJobApi_zipcode            = sharedReq.SearchJobApi_zipcode,
                                                  SearchJobApi_first_name         = sharedReq.SearchJobApi_first_name,
                                                  SearchJobApi_last_name          = sharedReq.SearchJobApi_last_name,
                                                  SearchJobApi_department         = sharedReq.SearchJobApi_department,
                                                  SearchJobApi_job_status         = sharedReq.SearchJobApi_job_status,
                                                  SearchJobApi_job_type           = sharedReq.SearchJobApi_job_type,
                                                  SearchJobApi_issue_date         = sharedReq.SearchJobApi_issue_date,
                                                  SearchJobApi_start_date         = sharedReq.SearchJobApi_start_date,
                                                  SearchJobApi_end_date           = sharedReq.SearchJobApi_end_date,
                                                  SearchJobApi_minimum_rate       = sharedReq.SearchJobApi_minimum_rate,
                                                  SearchJobApi_maximum_rate       = sharedReq.SearchJobApi_maximum_rate,
                                                  SearchJobApi_minimum_bill_rate  = sharedReq.SearchJobApi_minimum_bill_rate,
                                                  SearchJobApi_maximum_bill_rate  = sharedReq.SearchJobApi_maximum_bill_rate,

                                                  GetBIDataApi_JobDetails_ID                    = sharedReq.GetBIDataApi_JobDetails_ID,
                                                  GetBIDataApi_JobDetails_DATEISSUED            = sharedReq.GetBIDataApi_JobDetails_DATEISSUED,
                                                  GetBIDataApi_JobDetails_DATEUPDATED           = sharedReq.GetBIDataApi_JobDetails_DATEUPDATED,
                                                  GetBIDataApi_JobDetails_DATEUSERFIELDUPDATED  = sharedReq.GetBIDataApi_JobDetails_DATEUSERFIELDUPDATED,
                                                  GetBIDataApi_JobDetails_JOBSTATUS             = sharedReq.GetBIDataApi_JobDetails_JOBSTATUS,
                                                  GetBIDataApi_JobDetails_CUSTOMERID            = sharedReq.GetBIDataApi_JobDetails_CUSTOMERID,
                                                  GetBIDataApi_JobDetails_COMPANYID             = sharedReq.GetBIDataApi_JobDetails_COMPANYID,
                                                  GetBIDataApi_JobDetails_ADDRESS1              = sharedReq.GetBIDataApi_JobDetails_ADDRESS1,
                                                  GetBIDataApi_JobDetails_ADDRESS2              = sharedReq.GetBIDataApi_JobDetails_ADDRESS2,
                                                  GetBIDataApi_JobDetails_CITY                  = sharedReq.GetBIDataApi_JobDetails_CITY,
                                                  GetBIDataApi_JobDetails_STATE                 = sharedReq.GetBIDataApi_JobDetails_STATE,
                                                  GetBIDataApi_JobDetails_ZIPCODE               = sharedReq.GetBIDataApi_JobDetails_ZIPCODE,
                                                  GetBIDataApi_JobDetails_PRIORITY              = sharedReq.GetBIDataApi_JobDetails_PRIORITY,
                                                  GetBIDataApi_JobDetails_DIVISION              = sharedReq.GetBIDataApi_JobDetails_DIVISION,
                                                  GetBIDataApi_JobDetails_REFNO                 = sharedReq.GetBIDataApi_JobDetails_REFNO,
                                                  GetBIDataApi_JobDetails_JOBDIVANO             = sharedReq.GetBIDataApi_JobDetails_JOBDIVANO,
                                                  GetBIDataApi_JobDetails_STARTDATE             = sharedReq.GetBIDataApi_JobDetails_STARTDATE,
                                                  GetBIDataApi_JobDetails_ENDDATE               = sharedReq.GetBIDataApi_JobDetails_ENDDATE,
                                                  GetBIDataApi_JobDetails_POSITIONS             = sharedReq.GetBIDataApi_JobDetails_POSITIONS,
                                                  GetBIDataApi_JobDetails_FILLS                 = sharedReq.GetBIDataApi_JobDetails_FILLS,
                                                  GetBIDataApi_JobDetails_MAXALLOWEDSUBMITTALS  = sharedReq.GetBIDataApi_JobDetails_MAXALLOWEDSUBMITTALS,
                                                  GetBIDataApi_JobDetails_BILLRATEMIN           = sharedReq.GetBIDataApi_JobDetails_BILLRATEMIN,
                                                  GetBIDataApi_JobDetails_BILLRATEMAX           = sharedReq.GetBIDataApi_JobDetails_BILLRATEMAX,
                                                  GetBIDataApi_JobDetails_BILLRATEPER           = sharedReq.GetBIDataApi_JobDetails_BILLRATEPER,
                                                  GetBIDataApi_JobDetails_AYRATEMIN             = sharedReq.GetBIDataApi_JobDetails_AYRATEMIN,
                                                  GetBIDataApi_JobDetails_PAYRATEMAX            = sharedReq.GetBIDataApi_JobDetails_PAYRATEMAX,
                                                  GetBIDataApi_JobDetails_AYRATEPER             = sharedReq.GetBIDataApi_JobDetails_AYRATEPER,
                                                  GetBIDataApi_JobDetails_POSITIONTYPE          = sharedReq.GetBIDataApi_JobDetails_POSITIONTYPE,
                                                  GetBIDataApi_JobDetails_SKILLS                = sharedReq.GetBIDataApi_JobDetails_SKILLS,
                                                  GetBIDataApi_JobDetails_JOBTITLE              = sharedReq.GetBIDataApi_JobDetails_JOBTITLE,
                                                  GetBIDataApi_JobDetails_JOBDESCRIPTION        = sharedReq.GetBIDataApi_JobDetails_JOBDESCRIPTION,
                                                  GetBIDataApi_JobDetails_REMARKS               = sharedReq.GetBIDataApi_JobDetails_REMARKS,
                                                  GetBIDataApi_JobDetails_SUBMITTALINSTRUCTION  = sharedReq.GetBIDataApi_JobDetails_SUBMITTALINSTRUCTION,
                                                  GetBIDataApi_JobDetails_POSTTOPORTAL          = sharedReq.GetBIDataApi_JobDetails_POSTTOPORTAL,
                                                  GetBIDataApi_JobDetails_POSTING_TITLE         = sharedReq.GetBIDataApi_JobDetails_POSTING_TITLE,
                                                  GetBIDataApi_JobDetails_POSTING_DATE          = sharedReq.GetBIDataApi_JobDetails_POSTING_DATE,
                                                  GetBIDataApi_JobDetails_POSTINGDESCRIPTION    = sharedReq.GetBIDataApi_JobDetails_POSTINGDESCRIPTION,
                                                  GetBIDataApi_JobDetails_CRITERIA_DEGREE       = sharedReq.GetBIDataApi_JobDetails_CRITERIA_DEGREE,
                                                  GetBIDataApi_JobDetails_JOBCATALOGID          = sharedReq.GetBIDataApi_JobDetails_JOBCATALOGID,
                                                  GetBIDataApi_JobDetails_CATALOGCOMPANYID      = sharedReq.GetBIDataApi_JobDetails_CATALOGCOMPANYID,
                                                  GetBIDataApi_JobDetails_CATALOGTITLE          = sharedReq.GetBIDataApi_JobDetails_CATALOGTITLE,
                                                  GetBIDataApi_JobDetails_CATALOGREFNO          = sharedReq.GetBIDataApi_JobDetails_CATALOGREFNO,
                                                  GetBIDataApi_JobDetails_CATALOGNAME           = sharedReq.GetBIDataApi_JobDetails_CATALOGNAME,
                                                  GetBIDataApi_JobDetails_CATALOGACTIVE         = sharedReq.GetBIDataApi_JobDetails_CATALOGACTIVE,
                                                  GetBIDataApi_JobDetails_CATALOGEFFECTIVEDATE  = sharedReq.GetBIDataApi_JobDetails_CATALOGEFFECTIVEDATE,
                                                  GetBIDataApi_JobDetails_CATALOGEXPIRATIONDATE = sharedReq.GetBIDataApi_JobDetails_CATALOGEXPIRATIONDATE,
                                                  GetBIDataApi_JobDetails_CATALOGCATEGORY       = sharedReq.GetBIDataApi_JobDetails_CATALOGCATEGORY,
                                                  GetBIDataApi_JobDetails_CATALOGBILLRATELOW    = sharedReq.GetBIDataApi_JobDetails_CATALOGBILLRATELOW,
                                                  GetBIDataApi_JobDetails_CATALOGBILLRATEHIGH   = sharedReq.GetBIDataApi_JobDetails_CATALOGBILLRATEHIGH,
                                                  GetBIDataApi_JobDetails_CATALOGBILLRATEPER    = sharedReq.GetBIDataApi_JobDetails_CATALOGBILLRATEPER,
                                                  GetBIDataApi_JobDetails_CATALOGPAYRATELOW     = sharedReq.GetBIDataApi_JobDetails_CATALOGPAYRATELOW,
                                                  GetBIDataApi_JobDetails_CATALOGPAYRATEHIGH    = sharedReq.GetBIDataApi_JobDetails_CATALOGPAYRATEHIGH,
                                                  GetBIDataApi_JobDetails_CATALOGPAYRATEPER     = sharedReq.GetBIDataApi_JobDetails_CATALOGPAYRATEPER,
                                                  GetBIDataApi_JobDetails_POSITIONREFNO         = sharedReq.GetBIDataApi_JobDetails_POSITIONREFNO,
                                                  GetBIDataApi_JobDetails_PREVENTLOWERPAY       = sharedReq.GetBIDataApi_JobDetails_PREVENTLOWERPAY,
                                                  GetBIDataApi_JobDetails_PREVENTHIGHERBILL     = sharedReq.GetBIDataApi_JobDetails_PREVENTHIGHERBILL,
                                                  GetBIDataApi_JobDetails_CATALOGNOTES          = sharedReq.GetBIDataApi_JobDetails_CATALOGNOTES,
                                                  //
                    };

                    if (sharedReq.File != null)
                    {
                        SharedReq_Dtl.RS_FileName = sharedReq.JobDivaRef + Path.GetExtension(sharedReq.File.FileName);
                        SharedReq_Dtl.RS_FileType = sharedReq.File.ContentType;
                        using (Stream fs = sharedReq.File.InputStream)
                        {
                            using (BinaryReader br = new BinaryReader(fs))
                            {
                                SharedReq_Dtl.RS_FileData = br.ReadBytes((Int32)fs.Length);
                            }
                        }
                    }
                    RMS_SharedReq_Dtl.Add(SharedReq_Dtl);

                    List <RMS_SharedReqNotes> RMS_SharedReqNotes = new List <RMS_SharedReqNotes>();
                    RMS_SharedReqNotes        SharedReqNotes     = new RMS_SharedReqNotes()
                    {
                        RS_Notes     = sharedReq.Instructions,
                        RS_CreatedBy = User.Identity.Name,
                        RS_CreatedDt = SystemClock.US_Date
                    };
                    RMS_SharedReqNotes.Add(SharedReqNotes);

                    RMS_SharedReq_HDR Shared_HDR = new RMS_SharedReq_HDR()
                    {
                        RS_JobID           = sharedReq.JobId,
                        RS_JobDivaRef      = sharedReq.JobDivaRef,
                        RS_CreatedDt       = SystemClock.US_Date,
                        RS_Req             = "Shared",
                        RS_CreatedBy       = User.Identity.Name,
                        RS_RMSJobStatus    = "OPEN",
                        RS_JobDivaStatus   = sharedReq.JobDivaStatus,
                        RMS_SharedReq_Dtl  = RMS_SharedReq_Dtl,
                        RMS_SharedReqNotes = RMS_SharedReqNotes
                    };

                    unitOfwork.RMS_SharedReq_HDR.Insert(Shared_HDR);
                    unitOfwork.Save();

                    // Send mail..
                    string error;

                    string MailBody = @"<!DOCTYPE html>
										<html lang='en'>
										<head><meta charset='UTF-8'>
										    <title>Notification</title><style>body{font-family: arial, sans-serif;font-size:16px;}#div{padding:1%;background: white;display: block;margin: 0 auto;margin-bottom: 0.5cm;box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);}table {font-family: arial, sans-serif;border-collapse: collapse;width: 100%;}td, th {border: 1px solid #dddddd;text-align: left;padding: 8px;}tr:nth-child(odd){background-color: #dddddd;}</style>
										</head>
										<body><div id='div'><p >Hi,</p><div style='padding:1%;'><p> New job as been added to RMS shared requirement.</p><table><tr><th>Job ID</th><th>JD Ref</th><th>Title</th><th>Company</th><th>Requester</th><th>MaxSub</th></tr><tr><td><a href='https://www1.jobdiva.com/employers/myjobs/vieweditjobform.jsp?jobid=@JobID'>@JobID</a></td><td>@JDRef</td><td>@Title</td><td>@Company</td><td>@Requester</td><td>@MaxSub</td></tr></table></div><br><p>Please do not reply to this mail.<p></div></body></html>
										"                                        ;

                    MailBody = MailBody.Replace("@JobID", sharedReq.JobId.ToString());
                    MailBody = MailBody.Replace("@JDRef", sharedReq.JobDivaRef);
                    MailBody = MailBody.Replace("@Title", sharedReq.JobTitle);
                    MailBody = MailBody.Replace("@Company", sharedReq.Company);
                    MailBody = MailBody.Replace("@Requester", unitOfwork.User.GetByEmpID(User.Identity.Name).RE_Jobdiva_User_Name);
                    MailBody = MailBody.Replace("@MaxSub", sharedReq.MaxSubAllowed.ToString());

                    //Email.SendMail(ConfigurationManager.AppSettings["SharedReq_Email"].Split(';'), "New Job Added To RMS", MailBody, out error);
                }
                //		if (string.IsNullOrEmpty(error))
                //return Content(("<script language='javascript' type='text/javascript'> alert('Password reset link sent to your registered email ');window.location = '" + Url.Action("Login") + "';</script>"));
                //			else
                //					return Content(("<script language='javascript' type='text/javascript'> alert('" + error + "');window.location = '" + Request.UrlReferrer.ToString() + "';</script>"));
                //
            }
            SharedReqVM.Message = "Sucessfully saved to RMS Database.";
            return(View("Index", SharedReqVM));
        }