public IEnumerable <TextResourceViewModel> GetTextResource(string screenName, string lang)
        {
            var language = _languageRepository.Query(lg => lg.LanguageCode.Equals(lang)).FirstOrDefault();
            //var screen = _screenRepository.Query(scr => scr.ScreenName.Contains(screenName)).FirstOrDefault();
            var screen = _screenRepository.Query(scr => scr.ScreenName == screenName).FirstOrDefault();

            if (screen == null && language == null)
            {
                return(null);
            }
            IEnumerable <TextResource_D> textResource = null;

            if (language != null && screen != null)
            {
                //screen TransportConfirm using textresource from order screen, dispatch screen
                if (screen.ScreenID == Convert.ToInt32(Screen.TransportConfirm))
                {
                    var dispatchScrId = Convert.ToInt32(Screen.Dispatch);
                    var orderScrId    = Convert.ToInt32(Screen.Order);
                    textResource = _textResourceRepository.Query(
                        t => t.LanguageID == language.LanguageID && (t.ScreenID == screen.ScreenID ||
                                                                     t.ScreenID == dispatchScrId ||
                                                                     t.ScreenID == orderScrId));
                }
                else
                {
                    textResource = _textResourceRepository.Query(
                        t => t.LanguageID == language.LanguageID && t.ScreenID == screen.ScreenID);
                }
            }

            if (textResource == null)
            {
                return(null);
            }
            var destination = Mapper.Map <IEnumerable <TextResource_D>, IEnumerable <TextResourceViewModel> >(textResource);

            return(destination);
        }
Beispiel #2
0
        public string CheckWhenDelete(string language, Dictionary <string, string> dictionary, List <string> paramList)
        {
            int intLanguage = 1;

            if (language == "vi")
            {
                intLanguage = 1;
            }
            else if (language == "jp")
            {
                intLanguage = 3;
            }
            else
            {
                intLanguage = 2;
            }

            foreach (var query in dictionary)
            {
                List <object> result;
                var           parameters = GetParameters(paramList);
                if (parameters.Length > 0)
                {
                    result = _textResourceRepository.ExecWithStoreProcedure(query.Value, parameters).ToList();
                }
                else
                {
                    result = _textResourceRepository.ExecWithStoreProcedure(query.Value, "").ToList();
                }

                if (result.Count > 0)
                {
                    var languages = _textResourceRepository.Query(con => (con.LanguageID == intLanguage) &&
                                                                  (con.TextKey == query.Key
                                                                  )).ToList();
                    if (languages.Count > 0)
                    {
                        return(languages[0].TextValue);
                    }
                    else
                    {
                        return("");
                    }
                }
            }

            return("OK");
        }
        public Stream GetContainSizeListForExcel(string strTypeLanguage)
        {
            Dictionary <string, string> dicLanguage;
            List <TextResource_D>       languageList;
            int intLanguage;

            // get language for report
            dicLanguage = new Dictionary <string, string>();

            if (strTypeLanguage == "vi")
            {
                intLanguage = 1;
                dicLanguage.Add("LBLTITLE", "DANH SÁCH KÍCH THƯỚC CONTAINER");
            }
            else if (strTypeLanguage == "jp")
            {
                intLanguage = 3;
                dicLanguage.Add("LBLTITLE", "コンテナーのサイズのリスト");
            }
            else
            {
                intLanguage = 2;
                dicLanguage.Add("LBLTITLE", "CONTAINER SIZE LIST");
            }

            var languages = _textResourceRepository.Query(con => (con.LanguageID == intLanguage) &&
                                                          (con.TextKey == "LBLCONTAINERSIZECODE" ||
                                                           con.TextKey == "LBLCONTAINERSIZENAME" ||
                                                           con.TextKey == "LBLDESCRIPTION" ||
                                                           con.TextKey == "LBLSTATUS"
                                                          ));

            languageList = languages.ToList();
            foreach (TextResource_D item in languageList)
            {
                dicLanguage.Add(item.TextKey, item.TextValue);
            }

            var containersizes        = _containerSizeRepository.GetAllQueryable();
            var containersizesOrdered = containersizes.OrderBy("ContainerSizeC descending");
            var containersizeList     = containersizesOrdered.ToList();

            return(ExportExcel.GetContainerSizeList(containersizeList, dicLanguage));
        }