public ActionResult DeleteConfirmed(long id) { companyDetail companyDetail = db.companyDetails.Find(id); db.companyDetails.Remove(companyDetail); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult savecompanyDetails(companyDetail companyDetail, HttpPostedFileBase files) { try { int companyID = Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.companyID.ToString())); companyDetail cmpdetail = new companyDetail(); cmpdetail = db.companyDetails.Where(ex => ex.companyID == companyDetail.companyID).FirstOrDefault(); cmpdetail.companyName = companyDetail.companyName; String fileName = ""; if (files != null) { fileName = Guid.NewGuid() + "_" + Path.GetFileName(files.FileName); var path = Path.Combine(Server.MapPath("~/Logo/"), fileName); files.SaveAs(path); cmpdetail.logo = "https://spotaneedle.com/Logo/" + fileName; } cmpdetail.city = companyDetail.city; cmpdetail.address = companyDetail.address; cmpdetail.website = companyDetail.website; cmpdetail.companyDescription = companyDetail.companyDescription; cmpdetail.gstNo = companyDetail.gstNo; cmpdetail.tinNo = companyDetail.tinNo; cmpdetail.ctsNo = companyDetail.ctsNo; cmpdetail.dataIsUpdated = BaseUtil.GetCurrentDateTime(); cmpdetail.employerTypeID = companyDetail.employerTypeID; cmpdetail.modifiedBy = Convert.ToInt64(BaseUtil.GetSessionValue(AdminInfo.UserID.ToString())); cmpdetail.streetNo = companyDetail.streetNo; cmpdetail.state = companyDetail.state; cmpdetail.country = companyDetail.country; cmpdetail.zipCode = companyDetail.zipCode; cmpdetail.latitude = companyDetail.latitude; cmpdetail.companyIndustry = companyDetail.companyIndustry; cmpdetail.longitude = companyDetail.longitude; if (ModelState.IsValid) { db.Entry(cmpdetail).State = EntityState.Modified; db.SaveChanges(); } ViewBag.employerTypeID = new SelectList(db.employerTypes, "employerTypeID", "employerType1", companyDetail.employerTypeID); ViewBag.companyIndustry = new SelectList(db.industries, "industryID", "industryName"); TempData["saveResult"] = "Success"; } catch (Exception e) { BaseUtil.CaptureErrorValues(e); TempData["saveResult"] = ""; } return(RedirectToAction("empedit")); }
public ActionResult _partialEditCompany() { companyDetail companyDetail = new companyDetail(); try { int companyID = Convert.ToInt32(BaseUtil.GetSessionValue(AdminInfo.companyID.ToString())); companyDetail = db.companyDetails.Where(ex => ex.companyID == companyID).FirstOrDefault(); ViewBag.employerTypeID = new SelectList(db.employerTypes, "employerTypeID", "employerType1", companyDetail.employerTypeID); ViewBag.companyIndustry = new SelectList(db.industries, "industryID", "industryName"); } catch (Exception e) { BaseUtil.CaptureErrorValues(e); } return(PartialView("_partialEditCompany", companyDetail)); }
// GET: companyDetails/Delete/5 public ActionResult Delete(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } companyDetail companyDetail = null; try { companyDetail = db.companyDetails.Find(id); } catch (Exception e) { BaseUtil.CaptureErrorValues(e); } return(View(companyDetail)); }
public ActionResult Edit([Bind(Include = "companyID,companyName,cityID,address,website,companyIndustry,companyDescription,gstNo,tinNo,ctsNo,logo,createdDate,isActive,isDeleted,modifiedBy,modifiedDate,employerTypeID")] companyDetail companyDetail) { try { if (ModelState.IsValid) { db.Entry(companyDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } } catch (Exception e) { BaseUtil.CaptureErrorValues(e); } //ViewBag.cityID = new SelectList(db.cities, "cityID", "city1", companyDetail.cityID); ViewBag.modifiedBy = new SelectList(db.EmployerDetails, "EmployerID", "Name", companyDetail.modifiedBy); ViewBag.employerTypeID = new SelectList(db.employerTypes, "employerTypeID", "employerType1", companyDetail.employerTypeID); return(View(companyDetail)); }
// GET: companyDetails/Edit/5 public ActionResult Edit(long?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } companyDetail companyDetail = null; try { companyDetail = db.companyDetails.Find(id); } catch (Exception e) { BaseUtil.CaptureErrorValues(e); } ViewBag.modifiedBy = new SelectList(db.EmployerDetails, "EmployerID", "Name", companyDetail.modifiedBy); ViewBag.employerTypeID = new SelectList(db.employerTypes, "employerTypeID", "employerType1", companyDetail.employerTypeID); return(View(companyDetail)); }
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")); }