public ActionResult RegisteredApplicants(string FromDate, string ToDate)
        {
            DreamJobsBAL        DJBAL  = new DreamJobsBAL();
            List <Registration> lstReg = DJBAL.GetRegistrations(FromDate, ToDate);

            return(View(lstReg));
        }
        public ActionResult RegisteredApplicants()
        {
            DreamJobsBAL        DJBAL  = new DreamJobsBAL();
            List <Registration> lstReg = DJBAL.GetRegistrations("", "");

            return(View(lstReg));
        }
Beispiel #3
0
        public JsonResult GetQuestionSetForApplicant(int?ApplicantID)
        {
            ApplicantExamAttempt d;

            using (var usersContext = new UsersContext())
            {
                d = usersContext.GetApplicantExamAttempts(ApplicantID);
            }
            DreamJobsBAL    DJBAL            = new DreamJobsBAL();
            ApplicantExamVM _ApplicantExamVM = DJBAL.GetQuestionSetForApplicant(new ApplicantExamVM {
                ApplicantAttempt = new ApplicantExamAttempt {
                    AttemptID = d == null ? 0 : d.AttemptID, Applicant = new Applicant {
                        ApplicantID = ApplicantID
                    }
                }
            });
            string strPartialView = RenderPartialToStringExtensions.RenderPartialToString(this.ControllerContext, "_PartialQuestions", _ApplicantExamVM);

            if (_ApplicantExamVM.ApplicantAttempt == null)
            {
                return(Json(new JsonReurnData {
                    ReturnStatus = 0, ReturnMessage = "No question set available for you at this moment!", ReturnData = strPartialView
                }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new JsonReurnData {
                ReturnStatus = 1, ReturnMessage = "", ReturnData = strPartialView
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public ActionResult AppliedJob()
        {
            DreamJobsBAL        DJBAL  = new DreamJobsBAL();
            List <Registration> lstReg = DJBAL.GetRegistrations("", "", User.Identity.Name);

            return(View(lstReg));
        }
        public ActionResult GetJobType()
        {
            DreamJobsBAL DJBAL = new DreamJobsBAL();
            List <Jobs>  lstSM = DJBAL.fillDropDown("Jobs", "1", "").Tables[0].AsEnumerable().Select(d => new Jobs {
                JobID = (int)d["JobID"], JobTitle = Convert.ToString(d["JobTitle"])
            }).ToList();
            string ddlHtml = "<option value='0'>-Select Job Type-</option>";

            ddlHtml += string.Join("", lstSM.Select(t => string.Format("<option value='{0}'>{1}</option>", t.JobID, t.JobTitle)));
            return(Json(ddlHtml, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Upload(HttpPostedFileBase upload, FormCollection frm)
        {
            string JobID;

            JobID = frm["CampaignType"];
            //ProfileID = frm["ProfileType"];
            //return View();
            //http://techbrij.com/read-excel-xls-xlsx-asp-net-mvc-upload
            if (ModelState.IsValid)
            {
                if (string.IsNullOrEmpty(JobID) || JobID == "0")
                {
                    ModelState.AddModelError("File", "Please select Job Type");
                }
                else
                {
                    if (upload != null && upload.ContentLength > 0)
                    {
                        // ExcelDataReader works with the binary Excel file, so it needs a FileStream
                        // to get started. This is how we avoid dependencies on ACE or Interop:
                        Stream stream = upload.InputStream;

                        // We return the interface, so that
                        IExcelDataReader reader = null;


                        if (upload.FileName.EndsWith(".xls"))
                        {
                            reader = ExcelReaderFactory.CreateBinaryReader(stream);
                        }
                        else if (upload.FileName.EndsWith(".xlsx"))
                        {
                            reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
                        }
                        else
                        {
                            ModelState.AddModelError("File", "This file format is not supported");
                            return(View());
                        }

                        reader.IsFirstRowAsColumnNames = true;

                        DataSet result = reader.AsDataSet();
                        reader.Close();

                        DataSet ds = new DataSet();
                        ds.Tables.Add(result.Tables[0].Copy());
                        ds.Tables[0].TableName = "QSet";
                        string xmlCustomers = ds.GetXml();

                        DreamJobsBAL DJBAL = new DreamJobsBAL();
                        ViewBag.Data = result.Tables[0].Copy();
                        ds           = new DataSet();
                        ds           = DJBAL.uploadExccel(upload.FileName, xmlCustomers, User.Identity.Name, Convert.ToInt32(JobID));

                        if (ds != null)
                        {
                            if (ds.Tables.Count > 0)
                            {
                                ViewBag.Message = ds.Tables[0].Rows[0][1].ToString();
                            }
                        }

                        //return View(result.Tables[0]);
                        return(View(ViewBag.Data));
                    }
                    else
                    {
                        ModelState.AddModelError("File", "Please Upload Your file");
                    }
                }
            }
            return(View());
        }
Beispiel #7
0
        public ActionResult SubmitPaper(FormCollection form, string IsSubmit = "1")
        {
            DataTable dtSummary = new DataTable();

            dtSummary.TableName = "ExamSummary";
            dtSummary.Columns.Add("IsSubmit");
            dtSummary.Columns.Add("IpAddress");
            DataRow sDrow = dtSummary.NewRow();

            sDrow["IsSubmit"]  = IsSubmit;
            sDrow["IpAddress"] = System.Web.HttpContext.Current.Request.UserHostAddress;
            dtSummary.Rows.Add(sDrow);


            //if (Request.IsAjaxRequest())
            //{
            //    return Json(new ReturnStatus { ErrorStatus = 0, ErrorMessage = "Success" }, JsonRequestBehavior.AllowGet);
            //}

            try
            {
                if (ModelState.IsValid)
                {
                    ViewBag.ErrorMessage = "You're already registered!";
                    //return View("RegistrationSuccess", ViewBag.ErrorMessage);

                    // TODO: Add insert logic here

                    int count = form.Keys.Count;
                    List <ApplicantAnswer> kv = new List <ApplicantAnswer>();
                    string[] strKv;
                    foreach (string key in form.Keys)
                    {
                        if (key.StartsWith("_"))
                        {
                            continue;
                        }

                        strKv = form[key].Split(new char[] { '_' });
                        if (strKv.Length > 1)
                        {
                            kv.Add(new ApplicantAnswer {
                                AttemptID = Convert.ToInt64(form["ApplicantAttempt.AttemptID"]), QuestionID = Convert.ToInt64(strKv[1]), AnswerByApplicant = strKv[2]
                            });
                        }
                    }
                    DataTable dt = new DJ_Utilities.ListtoDataTableConverter().ToDataTable(kv);
                    DataSet   ds = new DataSet();
                    ds.Tables.Add(dt);
                    ds.Tables[0].TableName = "ExamAttempt";
                    ds.Tables.Add(dtSummary);
                    string strXml = ds.GetXml();

                    DreamJobsBAL DJBAL    = new DreamJobsBAL();
                    DataSet      dsResult = DJBAL.SubmitPaper(strXml);

                    if (Request.IsAjaxRequest())
                    {
                        return(Json(new ReturnStatus {
                            ErrorStatus = 0, ErrorMessage = "Answersheet saved successfully as draft"
                        }, JsonRequestBehavior.AllowGet));
                    }
                    return(View("Result"));
                }

                return(View());
            }
            catch
            {
                if (Request.IsAjaxRequest())
                {
                    return(Json(new ReturnStatus {
                        ErrorStatus = 1, ErrorMessage = "Error in saving draft"
                    }, JsonRequestBehavior.AllowGet));
                }
                return(View());
            }
        }