Ejemplo n.º 1
0
        private List <InvitationCompanyModel> GetInvitationsCompany(string email)
        {
            InvitationCompanyModel filters = new InvitationCompanyModel();
            var collection = serviceIn.Get(new PagerModel(0, 10, "", "", email), filters);

            return(collection);
        }
Ejemplo n.º 2
0
        private List <InvitationCompanyModel> GetInvitationsCompany(DatatableModel dt, InvitationCompanyModel filters)
        {
            filters.CompanyId = UserCompanyId;
            InvitationCompanyServices service = new InvitationCompanyServices();
            PagerModel pager = dt.ToPager();

            return(service.Get(pager, filters));
        }
Ejemplo n.º 3
0
        private bool HasInvitation(string email, int?companyId)
        {
            InvitationCompanyModel filters = new InvitationCompanyModel()
            {
                Email = email, CompanyId = companyId
            };
            DatatableModel dt = new DatatableModel()
            {
                iColumns       = 5,
                iDisplayLength = 10,
                iDisplayStart  = 0,
                iSortCol_0     = 3,
                iSortingCols   = 1,
                iTotalRecords  = 0,
                sSearch        = email
            };
            InvitationCompanyServices service = new InvitationCompanyServices();
            PagerModel pager      = dt.ToPager();
            var        collection = service.Get(pager, filters).FirstOrDefault();

            HasRejectedInvitation = (collection != null && collection.Status == 2);
            return(collection != null);
        }
Ejemplo n.º 4
0
        public ActionResult DeleteInvivtation(int id, string email)
        {
            try
            {
                PersonServices persnServ = new PersonServices();
                var            p         = persnServ.getFirstUserPerson(new UserPersonModel()
                {
                    Email = email
                });
                InvitationCompanyServices cs = new InvitationCompanyServices();
                InvitationCompanyModel    cm = new InvitationCompanyModel()
                {
                    CompanyInvitationId = id,
                    From = p.PersonId
                };
                PagerModel pager       = new PagerModel(0, 100, "", "");
                var        invitations = cs.Get(pager, cm);
                cm = invitations.Find(x => x.To == p.PersonId);
                var result = (p != null && p.CompanyId == UserCompanyId) ? cs.RemoveCompanyInvitation(cm, p.ToPerson()) : cs.Del(cm);
                if (p != null && cm.Status != 2)
                {
                    SendNotificationsInvite(p.PersonId, 3);
                }
                if (result.Status != Status.Success)
                {
                    throw new Exception(string.Format("{0}: {1}", localResource.txt_error_remove_invitation, result.Message));
                }
                return(Json(result));
            }
            catch (Exception ex)
            {
                Response.StatusCode        = (int)HttpStatusCode.BadRequest;
                Response.StatusDescription = ex.Message;

                return(Json(ex.Message, JsonRequestBehavior.AllowGet));
            }
        }