public void GetUnitIndexInPeriod(Action <UnitIndexInPeriodDTO, Exception> action, long periodId, long abstractId, string columnNames)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) + "?abstractId=" + abstractId);

            url += !string.IsNullOrWhiteSpace(columnNames) ? "&SelectedColumns=" + columnNames : "";
            WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
        public void GetAllEmployees(Action <PageResultDTO <EmployeeDTOWithActions>, Exception> action, long periodId, EmployeeCriteria employeeCriteria, int pageSize, int pageIndex)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) + "?PageSize=" + pageSize + "&PageIndex=" + pageIndex +
                                    getFilterEmployee(employeeCriteria, "&"));

            WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #3
0
        public void GetCalculationException(Action <CalculationExceptionDTO, Exception> action, long periodId, long calculationId, long exceptionId)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) + "/" + calculationId + "/Exceptions/" + exceptionId);

            WebClientHelper.Get(new Uri(url, UriKind.Absolute),
                                action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #4
0
        private bool isHoldingReportAccessibleByCurrentUser()
        {
            var url = System.Configuration.ConfigurationManager.AppSettings["WebApiFuel"] + "/apiArea/Fuel/Users/0/CurrentUserAccessToHolding";

            var syncEvent = new AutoResetEvent(false);

            bool hasAccess = false;


            WebClientHelper.Get <bool>(new Uri(url, UriKind.Absolute),
                                       (res, exception) =>
            {
                if (exception == null)
                {
                    hasAccess = res;
                }
                else
                {
                    hasAccess = false;
                }

                syncEvent.Set();
            }, MITD.Presentation.WebClientHelper.MessageFormat.Json, httpHeaders);

            syncEvent.WaitOne();

            return(hasAccess);
        }
        public void GetAllEmployeeNo(Action <List <string>, Exception> action, long periodId, EmployeeCriteria employeeCriteria)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) +
                                    getFilterEmployee(employeeCriteria, "?"));

            WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #6
0
        public void GetClaim(Action <ClaimDTO, Exception> action, long periodId, long claimId)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) + "?Id=" + claimId);

            WebClientHelper.Get(new Uri(url, UriKind.Absolute),
                                action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
        public ActionResult Request(string method, string url, string data)
        {
            ResponseResult result = new ResponseResult();

            if (!string.IsNullOrWhiteSpace(method) && !string.IsNullOrWhiteSpace(url))
            {
                url = HttpUtility.UrlDecode(url);
            }

            var requestData = new RequestData();

            if (!string.IsNullOrWhiteSpace(data))
            {
                data = HttpUtility.UrlDecode(data);

                requestData = SerializeHelper.Deserialize <RequestData>(data);
            }

            string headers = "";
            string body    = "";

            if (method == "POST")
            {
                body = WebClientHelper.Post(url, requestData.Header, requestData.Body, out headers);
            }
            else
            {
                body = WebClientHelper.Get(url, requestData.Header, out headers);
            }
            result.Headers = headers;
            result.Body    = body;
            result.Code    = string.IsNullOrEmpty(headers) ? 0 : 1;
            return(Json(result));
        }
Exemple #8
0
        public void GetEmployeeSummaryCalculationResult(Action <JobIndexPointSummaryDTOWithAction, Exception> action, long periodId, long calculationId, string employeeNo)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) + "/" + calculationId + "/JobIndexPoints" + "?EmployeeNo=" + employeeNo + "&ResultType=summary");

            WebClientHelper.Get <JobIndexPointSummaryDTOWithAction>(new Uri(url, UriKind.Absolute),
                                                                    action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #9
0
        public void GetPeriodCopyBasicDataStatus(Action <PeriodStateWithCopyingSummaryDTO, Exception> action, long periodId)
        {
            var url = string.Format(baseAddress) + "/" + periodId + "/State/?sumaryType=DataCopying";

            WebClientHelper.Get(new Uri(url, UriKind.Absolute),
                                action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #10
0
        public void GetAllPeriods(Action <PageResultDTO <PeriodDTOWithAction>, Exception> action, int pageSize, int pageIndex)
        {
            var url = string.Format(baseAddress + "?PageSize={0}&PageIndex={1}", pageSize, pageIndex);

            WebClientHelper.Get(new Uri(url, UriKind.Absolute), action, PMSClientConfig.MsgFormat,
                                PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #11
0
        public void GetPeriodStatus(Action <PeriodStateWithIntializeInquirySummaryDTO, Exception> action, long periodId)
        {
            var url = string.Format(baseAddress) + "/" + periodId + "/State";

            WebClientHelper.Get(new Uri(url, UriKind.Absolute),
                                action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #12
0
        public void GetAllClaimStateList(Action <List <ClaimStateDTO>, Exception> action, long periodId)
        {
            var url = string.Format(baseAddress + makeApiAdressClaimStates(periodId));

            WebClientHelper.Get(new Uri(url, UriKind.Absolute),
                                action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #13
0
        public void GetAllClaim(Action <PageResultDTO <ClaimDTOWithAction>, Exception> action, long periodId, string employeeNo, int pageSize, int pageIndex)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) + "?EmployeeNo=" + employeeNo + "&PageSize=" + pageSize + "&PageIndex=" + pageIndex);

            WebClientHelper.Get(new Uri(url, UriKind.Absolute), action,
                                WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #14
0
        public void GetAllJobInPeriodWithPagination(Action <PageResultDTO <JobInPeriodDTOWithActions>, Exception> action, long periodId, int pageSize, int pageIndex, string columnNames)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) + "?PageSize=" + pageSize + "&PageIndex=" + pageIndex);

            url += !string.IsNullOrWhiteSpace(columnNames) ? "&SelectedColumns=" + columnNames : "";
            WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #15
0
        public void GetEmployeeJobPositionsCalculationResult(Action <List <JobPositionValueDTO>, Exception> action, long periodId, long calculationId, string employeeNo)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) + "/" + calculationId + "/JobIndexPoints" + "?employeeNo=" + employeeNo);

            WebClientHelper.Get <List <JobPositionValueDTO> >(new Uri(url, UriKind.Absolute),
                                                              action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #16
0
        public void GetRuleTrail(Action <RuleTrailDTO, Exception> action, long policyId, long ruleId, long trailId)
        {
            var url = PMSClientConfig.BaseApiAddress + "Policies/" + policyId + "/Rules/" + ruleId + "/Trails/" +
                      trailId;

            WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #17
0
        public void GetAllCalculationException(Action <PageResultDTO <CalculationExceptionBriefDTOWithAction>, Exception> action, long periodId, long calculationId, int pageSize, int pageIndex)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) + "/" + calculationId + "/Exceptions" + "?PageSize=" + pageSize + "&PageIndex=" + pageIndex);

            WebClientHelper.Get(new Uri(url, UriKind.Absolute),
                                action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #18
0
        public void GetLog(Action <LogDTO, Exception> action, Guid id)
        {
            var url = string.Format(baseAddress + "?Id=" + id);

            WebClientHelper.Get(new Uri(url, UriKind.Absolute),
                                action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #19
0
        public void GetAllLogs(Action <List <LogDTO>, Exception> action)
        {
            var url = string.Format(baseAddress);

            WebClientHelper.Get(new Uri(url, UriKind.Absolute),
                                action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #20
0
        public void GetAllLogs(Action <PageResultDTO <LogDTOWithActions>, Exception> action, int pageSize, int pageIndex)
        {
            var url = string.Format(baseAddress + "?PageSize=" + pageSize + "&PageIndex=" + pageIndex);

            WebClientHelper.Get(new Uri(url, UriKind.Absolute),
                                action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #21
0
        public void GetCustomFieldEntityList(Action <List <CustomFieldEntity>, Exception> action)
        {
            var url = string.Format(apiEntityTypeAddress);

            WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat
                                , PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #22
0
        //public void GetCalculationResultDetails(Action<EmployeeCalculationResultDetailsDTO, Exception> action, long calculationId,
        //    string employeeNo, int pageSize, int pageIndex)
        //{
        //    action(
        //        new EmployeeCalculationResultDetailsDTO
        //        {
        //        }, null);
        //}

        public void GetCalculationState(Action <CalculationStateWithRunSummaryDTO, Exception> action, long periodId, long id)
        {
            var url = string.Format(baseAddress + makeApiAdress(periodId) + "/" + id + "/State");

            WebClientHelper.Get <CalculationStateWithRunSummaryDTO>(new Uri(url, UriKind.Absolute),
                                                                    (res, exp) => action(res, exp),
                                                                    WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #23
0
        public void GetAllUsers(Action <PageResultDTO <UserDTOWithActions>, Exception> action, int pageSize, int pageIndex, Dictionary <string, string> sortBy, UserCriteria criteria)
        {
            var url = baseAddressUsers + "?PageSize=" + pageSize + "&PageIndex=" + pageIndex + getFilterUser(criteria);

            if (sortBy.Count > 0)
            {
                url += "&SortBy=" + QueryConditionHelper.GetSortByQueryString(sortBy);
            }
            WebClientHelper.Get(new Uri(url, UriKind.Absolute), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
        //By index
        public void GetInquirerInquiryIndices(Action <List <InquiryIndexDTO>, Exception> action, long periodId, string inquirerEmployeeNo)
        {
            if (periodId == -1)
            {
                action(new List <InquiryIndexDTO>(), null);
            }

            var url = string.Format(baseAddress + makeInquirerInquiryIndexApiAdress(periodId, inquirerEmployeeNo));

            WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #25
0
        public void GetAllUserActionTypes(Action <List <ActionType>, Exception> action, string userName, bool isGroup, string groupId)
        {
            if (groupId.IsNullOrEmpty())
            {
                groupId = "0";
            }

            var url = baseAddressActionTypes + "?userName="******"&isGroup=" + isGroup + "&groupId=" + groupId;

            WebClientHelper.Get(new Uri(url, UriKind.Absolute),
                                action, WebClientHelper.MessageFormat.Json, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
        public void GetUnitIndexGroupInPeriod(Action <UnitIndexGroupInPeriodDTO, Exception> action, long periodId, long abstractId, string columnNames)
        {
            //var c = TestData.abstractIndexInPeriodDtoWithActionses.Single(j => j.Id == id);
            //action(new UnitIndexGroupInPeriodDTO
            //    {
            //        Id = c.Id,
            //        Name = c.Name,
            //        ParentId = c.ParentId
            //    }, null);

            var url = string.Format(baseAddress + makeApiAdress(periodId) + "?abstractId=" + abstractId);

            url += !string.IsNullOrWhiteSpace(columnNames) ? "&SelectedColumns=" + columnNames : "";
            WebClientHelper.Get(new Uri(url, PMSClientConfig.UriKind), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
        public void GetAllPermittedUsersToMyTasks(Action <PageResultDTO <UserDTOWithActions>, Exception> action, string username, int pageSize, int pageIndex)
        {
            //action(new PageResultDTO<UserDTOWithActions>()
            //    {
            //        PageSize = 10,
            //        CurrentPage=1,
            //        TotalCount=1,
            //        TotalPages =1,
            //        Result = new Collection<UserDTOWithActions>()
            //            {
            //                new UserDTOWithActions() { FirstName = "پدارم", LastName = "احسانی", PartyName = "*****@*****.**", ActionCodes = new List<int>() { 1411 ,1412,1413} },
            //                new UserDTOWithActions() { FirstName = "فرزاد", LastName = "محمدی", PartyName = "*****@*****.**", ActionCodes = new List<int>() { 1411 ,1412,1413} }
            //            }
            //    }, null);

            var url = string.Format(baseAddress + makeApiAdress(username)) + "?PageSize=" + pageSize + "&PageIndex=" + pageIndex;

            WebClientHelper.Get(new Uri(url, UriKind.Absolute), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #28
0
        public void GetAllCustomFieldes(Action <PageResultDTO <CustomFieldDTOWithActions>, Exception> action, int pageSize,
                                        int pageIndex, Dictionary <string, string> sortBy, CustomFieldCriteria criteria)
        {
            var url = string.Format(apiCustomFieldAddress + "?PageSize={0}&PageIndex={1}&EntityId={2}",
                                    pageSize, pageIndex, criteria.EntityId,
                                    UriKind.Absolute);

            if (criteria.EntityId != null && criteria.EntityId != 0)
            {
                url += "&Filter=" + GetFilterQueryString(criteria);
            }

            if (sortBy.Count > 0)
            {
                url += "&SortBy=" + QueryConditionHelper.GetSortByQueryString(sortBy);
            }

            WebClientHelper.Get(new Uri(url), action, PMSClientConfig.MsgFormat, PMSClientConfig.CreateHeaderDic(userProvider.Token));
        }
Exemple #29
0
        public ActionResult Request(string method, string url, string data)
        {
            var result = string.Empty;

            if (!string.IsNullOrWhiteSpace(method) && !string.IsNullOrWhiteSpace(url))
            {
                url = SAEA.Http.HttpUtility.UrlDecode(url);
            }

            if (!string.IsNullOrWhiteSpace(data))
            {
                data = SAEA.Http.HttpUtility.UrlDecode(data);
            }

            if (method == "POST")
            {
                result = WebClientHelper.Post(url, data);
            }
            else
            {
                result = WebClientHelper.Get(url);
            }
            return(Content(result));
        }
Exemple #30
0
        public long GetCurrentFuelUser()
        {
            var url = System.Configuration.ConfigurationManager.AppSettings["WebApiFuel"] + "/apiArea/Fuel/Users/0/CurrentCompanyId";

            var syncEvent = new AutoResetEvent(false);

            long fuelUserCompanyId = 0;


            WebClientHelper.Get <long>(new Uri(url, UriKind.Absolute),
                                       (res, exception) =>
            {
                if (exception == null)
                {
                    fuelUserCompanyId = res;
                }

                syncEvent.Set();
            }, MITD.Presentation.WebClientHelper.MessageFormat.Json, httpHeaders);

            syncEvent.WaitOne();

            return(fuelUserCompanyId);
        }