Exemplo n.º 1
0
        public static Dictionary <string, string> MasterCodeSearchById(string id)
        {
            using (ApiClient client = new ApiClient())
            {
                var result = client.MasterCode_Search(new MasterCodeSearchParams
                {
                    country  = Consts.GetApiCountry(),
                    id       = id,
                    language = Consts.GetApiCountry(),
                    code     = "%"
                });
                if (string.IsNullOrWhiteSpace(result.ErrorMessage) && result.ReturnValue != null)
                {
                    return(result.ReturnValue.ToDictionary(code => code.ZZ03_CODE, desc => desc.ZZ03_CDC1));
                }

                return(null);
            }
        }
Exemplo n.º 2
0
        public static Dictionary <string, string> GetLeaveType(string lang)
        {
            using (ApiClient client = new ApiClient())
            {
                var result = client.MasterCode_Search(new MasterCodeSearchParams
                {
                    country  = Consts.GetApiCountry(),
                    id       = "WFLVTY0",
                    language = "ENG",
                    code     = "%"
                });
                var result1 = client.MasterCode_Search(new MasterCodeSearchParams
                {
                    country  = Consts.GetApiCountry(),
                    id       = "WFLVTY0",
                    language = Codehelper.GetCountryByLang(lang),
                    code     = "%"
                });
                if (string.IsNullOrWhiteSpace(result.ErrorMessage) && result.ReturnValue != null &&
                    string.IsNullOrWhiteSpace(result1.ErrorMessage) &&
                    result1.ReturnValue != null)
                {
                    Dictionary <string, string> finalResult = new Dictionary <string, string>();
                    foreach (var item in result.ReturnValue)
                    {
                        var item1 = result1.ReturnValue.FirstOrDefault(p => p.ZZ03_CODE == item.ZZ03_CODE);
                        if (item1 != null)
                        {
                            finalResult.Add(item.ZZ03_CDC1, item1.ZZ03_CDC1);
                        }
                    }

                    return(finalResult);
                }

                return(null);
            }
        }
Exemplo n.º 3
0
        public static Dictionary <string, string> GetDeptTypes()
        {
            var data = GetData(() =>
            {
                using (ApiClient client = new ApiClient())
                {
                    var result = client.MasterCode_Search(new MasterCodeSearchParams
                    {
                        country  = Consts.GetApiCountry(),
                        id       = "ZADEPT0",
                        language = "ENG",
                        code     = "%"
                    });
                    if (string.IsNullOrWhiteSpace(result.ErrorMessage) && result.ReturnValue != null)
                    {
                        return(result.ReturnValue.ToDictionary(k => k.ZZ03_CODE, v => v.ZZ03_CDC1));
                    }
                    return(new Dictionary <string, string>());
                }
            }, "DetpTypes");

            return(data);
        }