private void SendMailInvitation(string email) { MailServices MailServ = new MailServices(); ITemplate factory = new TemplateMessagesFactory(); CompanyServices csrv = new CompanyServices(); var company = csrv.Get(new CompanyModel() { CompanyId = UserCompanyId }).FirstOrDefault(); Dictionary <string, string[]> parsm = new Dictionary <string, string[]>(); parsm.Add("{Enfasis}", new string[] { company.CompanyName }); MailServ.SendMail(factory.GetTemplate(email, "InvitationCompany", parsm)); }
private void SendNotificationsInvite(int?personId, int?companyId) { AlertServices alertServices = new AlertServices(); CompanyServices csrv = new CompanyServices(); var company = csrv.Get(new CompanyModel() { CompanyId = companyId }).FirstOrDefault(); AlertModel alert = alertServices.GetWithValues(2, null); alert.To = personId; alert.Body = string.Format(alert.Body, company.CompanyName); alertServices.InsUpd(alert); var context = GlobalHost.ConnectionManager.GetHubContext <AlertHub>(); context.Clients.Group(string.Format("P{0}", personId.ToString())) .newAlert(alert); }
public ActionResult Valid_RFC(string rfc) { CompanyServices cs = new CompanyServices(); var c = cs.Get(new CompanyModel() { RFC = rfc }).FirstOrDefault(); if (c != null && c.CompanyId != UserCompanyId) { Response.StatusCode = (int)HttpStatusCode.BadRequest; Response.StatusDescription = "the rfc is not unique"; } return(Json(new RequestResult <object>() { Status = Status.Error, Message = "the company is not unique" }, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int id) { if (!HasCompany()) { return(RedirectToAction("Index")); } CompanyServices csrv = new CompanyServices(); var company = csrv.Get(new CompanyModel() { CompanyId = id }).FirstOrDefault(); if (company == null) { return(HttpNotFound()); } return(View(company)); }
public ActionResult Index() { SystemVariableServices SystemVariableServ = new SystemVariableServices(); UserServices userServ = new UserServices(); var role = userServ.GetRole(new User { UserId = (int)SessionWeb.User.UserId }); CompanyServices CompServ = new CompanyServices(); CompanyModel company = new CompanyModel(); ViewData["isOwner"] = role != null?role.RoleId.ToString().Equals(SystemVariableServ.GetSystemVariableValue("RolAdminCompany")) : false; ViewData["invitations"] = UserPerson.InvitationsCompanies; if (HasCompany()) { company = CompServ.Get(new CompanyModel() { CompanyId = UserCompanyId }).FirstOrDefault(); } return(View(company)); }
public IHttpActionResult GetById(CompanyViewModel obj) { var getCompany = service.Get(obj.Id); return(Ok(getCompany)); }