Example #1
0
        public ActionResult editEmployer(EmployerDetail employerDetail)
        {
            EmployerDetail empdetail = new EmployerDetail();

            try
            {
                int companyID  = Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.companyID.ToString()));
                int employerID = Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.employerID.ToString()));

                empdetail                 = db.EmployerDetails.Where(ex => ex.EmployerID == employerDetail.EmployerID).FirstOrDefault();
                empdetail.Name            = employerDetail.Name;
                empdetail.Mobile          = employerDetail.Mobile;
                empdetail.Email           = employerDetail.Email;
                empdetail.dataIsUpdated   = BaseUtil.GetCurrentDateTime();
                db.Entry(empdetail).State = EntityState.Modified;
                db.SaveChanges();

                TempData["saveResult"] = "empSuccess";
            }

            catch (Exception e)
            {
                BaseUtil.CaptureErrorValues(e);
                TempData["saveResult"] = "";
            }
            return(RedirectToAction("empedit"));
        }
Example #2
0
        public string EforgotPassword(string email)
        {
            EmployerDetail empdetail = new EmployerDetail();

            //await db.SaveChangesAsync();
            empdetail = db.EmployerDetails.Where(e => e.Email == email).FirstOrDefault();

            if (empdetail != null)
            {
                //----------------------------use below code to send emailer------------------------------------------------------------

                StreamReader sr              = new StreamReader(Server.MapPath("/Emailer/ForgetPassword.html"));
                string       HTML_Body       = sr.ReadToEnd();
                string       final_Html_Body = HTML_Body.Replace("#name", empdetail.Name).Replace("#REFID", BaseUtil.encrypt(empdetail.EmployerID.ToString())).Replace("#role", BaseUtil.encrypt("2"));
                sr.Close();
                string To           = email.ToString();
                string mail_Subject = "Reset password request recieved";


                string result = BaseUtil.sendEmailer(To, mail_Subject, final_Html_Body, "");
                //----------------------------end to send emailer------------------------------------------------------------
                if (result == "ok")
                {
                    //ViewBag.success = "ok";
                }
                //return View("Employerlogin");
                return("Yes");
            }
            else
            {
                //ViewBag.message = "User not Found ";
                return("No");
                //return View("_partailEforgotPassword");
            }
        }
        // GET: NewEmployee/Details/5
        public async Task <ActionResult> Details(long?id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                EmployerDetail employerDetail = await db.EmployerDetails.FindAsync(id);

                if (employerDetail == null)
                {
                    return(HttpNotFound());
                }
                var role_ = db.roles.Where(e => e.roleID == employerDetail.roleID).Select(e => new { e.role1 }).FirstOrDefault();
                ViewBag.role = role_.role1.ToString();
                return(View(employerDetail));
            }
            catch (Exception ex)
            {
                TempData["msg"] = ex.Message.ToString();
                BaseUtil.CaptureErrorValues(ex);
                return(RedirectToAction("Error"));
            }
        }
        public async Task <ActionResult> Create(EmployeeDetailValidation oEmployeeDetailValidation)
        {
            try
            {
                EmployerDetail employerDetail = new EmployerDetail();
                employerDetail.Name          = oEmployeeDetailValidation.Name;
                employerDetail.Email         = oEmployeeDetailValidation.Email;
                employerDetail.Mobile        = oEmployeeDetailValidation.Mobile;
                employerDetail.isActive      = false;
                employerDetail.isDelete      = false;
                employerDetail.dataIsCreated = BaseUtil.GetCurrentDateTime();
                employerDetail.dataIsUpdated = BaseUtil.GetCurrentDateTime();
                Int64 roleid = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.role_id.ToString()));
                employerDetail.password  = baseClass.GetRandomPasswordString(10);
                employerDetail.companyID = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.companyID.ToString()));
                if (roleid == 2)
                {
                    employerDetail.roleID = 3;
                }
                if (roleid == 1)
                {
                    employerDetail.roleID = 4;
                }

                if (ModelState.IsValid)
                {
                    db.EmployerDetails.Add(employerDetail);
                    await db.SaveChangesAsync();

                    var encryptedID = BaseUtil.encrypt(employerDetail.EmployerID.ToString());

                    StreamReader sr = new StreamReader(Server.MapPath("/Emailer/toEmployerRegistrationSuccess.html"));

                    string HTML_Body = sr.ReadToEnd();
                    string newString = HTML_Body.Replace("#name", employerDetail.Name).Replace("#EMPID", encryptedID).Replace("#password", employerDetail.password);
                    sr.Close();
                    string            To                   = employerDetail.Email.ToString();
                    string            mail_Subject         = "Employer Registration Confirmation ";
                    profileController objprofileController = new profileController();
                    BaseUtil.sendEmailer(To, mail_Subject, newString, "");
                    return(RedirectToAction("Index"));
                }


                return(View(employerDetail));
            }
            catch (Exception ex)
            {
                TempData["msg"] = ex.Message.ToString();
                BaseUtil.CaptureErrorValues(ex);
                return(RedirectToAction("Error"));
            }
        }
        // GET: NewEmployee/Edit/5
        public async Task <ActionResult> Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EmployerDetail employerDetail = await db.EmployerDetails.FindAsync(id);

            if (employerDetail == null)
            {
                return(HttpNotFound());
            }

            return(View(employerDetail));
        }
Example #6
0
        public ActionResult _partialEditEmployer()
        {
            EmployerDetail employerDetail = new EmployerDetail();

            try {
                int employerID = Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.employerID.ToString()));

                employerDetail = db.EmployerDetails.Where(ex => ex.EmployerID == employerID).FirstOrDefault();
            }
            catch (Exception e)
            {
                BaseUtil.CaptureErrorValues(e);
                TempData["saveResult"] = "";
            }
            return(PartialView("_partialEditEmployer", employerDetail));
        }
        public async Task <ActionResult> Edit(EmployerDetail employerDetail)
        {
            try
            {
                employerDetail.dataIsUpdated = BaseUtil.GetCurrentDateTime();
                if (ModelState.IsValid)
                {
                    db.Entry(employerDetail).State = EntityState.Modified;
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }

                return(View(employerDetail));
            }
            catch (Exception ex)
            {
                TempData["msg"] = ex.Message.ToString();
                BaseUtil.CaptureErrorValues(ex);
                return(RedirectToAction("Error"));
            }
        }
Example #8
0
        public ActionResult Edit([Bind(Include = "isActive")] EmployerDetail employerDetail)
        {
            try
            {
                var s = repo.Single(employerDetail.EmployerID);
                if (s == null)
                {
                    return(HttpNotFound());
                }

                s.dataIsUpdated = BaseUtil.GetCurrentDateTime();
                s.isActive      = employerDetail.isActive;
                if (ModelState.IsValid)
                {
                    repo.Update(s);
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception e)
            {
                BaseUtil.CaptureErrorValues(e);
            }
            return(View(employerDetail));
        }
Example #9
0
        public async Task <ActionResult> partialEmployerReg(empRegistration empRegistartion)
        {
            companyDetail  cmpdetails = new companyDetail();
            EmployerDetail empdetails = new EmployerDetail();

            cmpdetails.companyName        = empRegistartion.companyName;
            cmpdetails.city               = " Not specified ";
            cmpdetails.state              = " Not specified ";
            cmpdetails.country            = " Not specified ";
            empdetails.Email              = empRegistartion.Email;
            cmpdetails.website            = empRegistartion.website;
            cmpdetails.employerTypeID     = empRegistartion.employerTypeID;
            cmpdetails.address            = " Not specified ";
            cmpdetails.companyDescription = " Not specified ";
            cmpdetails.dataIsCreated      = BaseUtil.GetCurrentDateTime();
            cmpdetails.dataIsUpdated      = BaseUtil.GetCurrentDateTime();
            cmpdetails.zipCode            = "------";
            cmpdetails.companyIndustry    = 0;
            db.companyDetails.Add(cmpdetails);
            try
            {
                await db.SaveChangesAsync();

                empdetails.companyID     = cmpdetails.companyID;
                empdetails.dataIsCreated = BaseUtil.GetCurrentDateTime();
                empdetails.dataIsUpdated = BaseUtil.GetCurrentDateTime();
                empRegistartion.password = baseClass.GetRandomPasswordString(10);
                empdetails.Name          = empRegistartion.companyName;
                empdetails.Mobile        = empRegistartion.mobile;
                empdetails.isActive      = false;
                empdetails.isDelete      = false;
                empdetails.roleID        = 2;
                empdetails.password      = empRegistartion.password;
                db.EmployerDetails.Add(empdetails);
                await db.SaveChangesAsync();

                empRegistartion.employerID = empdetails.EmployerID;
                var emailresult = db.EmployerDetails.Where(ex => ex.EmployerID == empRegistartion.employerID).FirstOrDefault();
                var encryptedID = BaseUtil.encrypt(emailresult.EmployerID.ToString());

                StreamReader sr = new StreamReader(Server.MapPath("/Emailer/toEmployerRegistrationSuccess.html"));

                string HTML_Body = sr.ReadToEnd();
                string newString = HTML_Body.Replace("#name", emailresult.Name).Replace("#EMPID", encryptedID).Replace("#password", emailresult.EmployerDetail1.password);
                sr.Close();
                string            To                   = emailresult.Email.ToString();
                string            mail_Subject         = "Employer Registration Confirmation ";
                profileController objprofileController = new profileController();
                BaseUtil.sendEmailer(To, mail_Subject, newString, "");

                TempData["result"] = "Registred";
            }
            catch (Exception ex)
            {
                BaseUtil.CaptureErrorValues(ex);
                TempData["result"] = "Registration failed.";
            }
            ViewBag.employerTypeID  = new SelectList(db.employerTypes, "employerTypeID", "employerType1");
            ViewBag.companyIndustry = new SelectList(db.industries, "industryID", "industryName");
            return(RedirectToAction("Employerlogin"));
        }