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"));
            }
        }
示例#2
0
        public async Task <ActionResult> Create([Bind(Include = "SlotID,slotTime")] slot slot)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.slots.Add(slot);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                TempData["msg"] = ex.Message.ToString();
                BaseUtil.CaptureErrorValues(ex);
                return(RedirectToAction("Error"));
            }

            return(View(slot));
        }
示例#3
0
        public async Task <ActionResult> Create([Bind(Include = "qenSkillsID,qenID,skillsID,yearOfExp")] qenSkill qenSkill)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.qenSkills.Add(qenSkill);
                    await db.SaveChangesAsync();

                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                TempData["msg"] = ex.Message.ToString();
                BaseUtil.CaptureErrorValues(ex);
                return(RedirectToAction("Error"));
            }

            ViewBag.qenID    = new SelectList(db.qendidateLists, "qenID", "qenName", qenSkill.qenID);
            ViewBag.skillsID = new SelectList(db.skills, "skillsID", "skillName", qenSkill.skillsID);
            return(View(qenSkill));
        }
示例#4
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"));
        }