Esempio n. 1
0
 public bool AddAuditor(Auditor auditor)
 {
     try
     {
         auditor.State = ObjectState.Added;
         auditorRep.AddOperation(auditor);
         return true;
     }
     catch (Exception ex)
     {
         var rr = ex.Message;
         return false;
     }
 }
Esempio n. 2
0
        public ActionResult AddAuditor(Auditor ad)
        {
            var etype = Request.Form.GetValues("etype")[0] ;
            int type = Int32.Parse(etype);
            if (type == 1)
            {
                ad.AuditorType = EnumAuditorType.Internal;
            }
            else if (type == 2)
            {
                ad.AuditorType = EnumAuditorType.External;
            }
            else
            {
                return Content("Type Problem");
            }
            var user = uService.GetSingleUserByEmail(HttpContext.User.Identity.Name);
            var AccSet = sService.GetAllByUserId(user.Id);
            int companyId = AccSet.Companies.Id;

            ad.CompanyId = companyId;
            if (aService.AddAuditor(ad))
            {
                if (type == 1)
                {
                    TempData.Add("succMsg", "Internal Auditor Added Successfully");
                    return RedirectToAction("InternalAuditor", "Auditor", new { area = "OrgSettings" });
                }
                else
                {
                    TempData.Add("succMsg", "External Auditor Added Successfully");
                    return RedirectToAction("ExternalAuditor", "Auditor", new { area = "OrgSettings" });
                }
            }
            else
            {
                return Content("Failed");
            }
        }