示例#1
0
        public JsonResult Get(DatatableModel dt, NotificationModel filters)
        {
            try
            {
                NotificationServices service = new NotificationServices();
                PagerModel           pager   = dt.ToPager();
                var collection = service.Get(pager, filters);

                return(Json(new
                {
                    status = UI.Status.Success,
                    sEcho = dt.sEcho,
                    iTotalRecords = pager.TotalRecords,
                    iTotalDisplayRecords = pager.TotalRecords,
                    aaData = collection
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(new JsonResult
                {
                    Data = new { status = UI.Status.Error, data = ex.Message },
                });
            }
        }
示例#2
0
        public JsonResult Get(DatatableModel dt, ProjectModel parameters)
        {
            try
            {
                SystemVariableServices SystemVariableServ = new SystemVariableServices();
                var ActiveProject = Convert.ToInt32(SystemVariableServ.GetSystemVariableValue("EstatusActiveProject"));

                ProjectServices ProjectServ = new ProjectServices();
                PagerModel      pager       = dt.ToPager();

                parameters.CompanyId = SessionWeb.User.CompanyId ?? -1;
                var collection = ProjectServ.GetProjectCollection(parameters, pager);

                return(Json(new
                {
                    status = UI.Status.Success,
                    sEcho = dt.sEcho,
                    iTotalRecords = pager.TotalRecords,
                    iTotalDisplayRecords = pager.TotalRecords,
                    aaData = collection.Data
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                return(new JsonResult
                {
                    Data = new { status = UI.Status.Error,
                                 data = ex.Message },
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
        }
示例#3
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));
        }
示例#4
0
        public JsonResult List(DatatableModel dt, VesselModel filters)
        {
            VesselServices services = new VesselServices();
            PagerModel     pager    = dt.ToPager();

            filters.Company.CompanyId = SessionWeb.User.CompanyId;
            var collection = services.Get(pager, filters);

            return(Json(new
            {
                status = UI.Status.Success,
                sEcho = dt.sEcho,
                iTotalRecords = pager.TotalRecords,
                iTotalDisplayRecords = pager.TotalRecords,
                aaData = collection
            }, JsonRequestBehavior.AllowGet));
        }
示例#5
0
        public JsonResult GetTable(DatatableModel dt, AlertModel filters)
        {
            filters.To = SessionWeb.User.PersonId;
            AlertServices services = new AlertServices();
            PagerModel    pager    = dt.ToPager();

            filters.Body = dt.sSearch;

            var collection = services.Get(pager, filters);

            return(Json(new
            {
                status = UI.Status.Success,
                sEcho = dt.sEcho,
                iTotalRecords = pager.TotalRecords,
                iTotalDisplayRecords = pager.TotalRecords,
                aaData = collection
            }, JsonRequestBehavior.AllowGet));
        }
示例#6
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);
        }
示例#7
0
        public ActionResult GetInvitation(DatatableModel dt, InvitationCompanyModel filters)
        {
            try
            {
                PagerModel pager      = dt.ToPager();
                var        collection = GetInvitationsCompany(dt, filters);

                return(Json(new
                {
                    status = UI.Status.Success,
                    sEcho = dt.sEcho,
                    iTotalRecords = pager.TotalRecords,
                    iTotalDisplayRecords = pager.TotalRecords,
                    aaData = collection
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Response.StatusCode        = (int)HttpStatusCode.BadRequest;
                Response.StatusDescription = ex.Message;

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