Ejemplo n.º 1
0
 void mValue_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
 {
     try
     {
         if (mIsSkipChange)
         {
             return;
         }
         if (e.NewValue == null)
         {
             return;
         }                                    //当用户按退格键删除文本框中所有数字,这里的NewValue可能为Null,此时不能强制转为double,所以这里判断一下
         double newValue = (double)e.NewValue;
         if (NumericStandard != null)
         {
             string invalidMsg = "Input Invalid";
             string title      = "UMP ScoreSheet Designer";
             if (Languages != null)
             {
                 ScoreLangauge lang =
                     Languages.FirstOrDefault(
                         l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T108");
                 if (lang != null)
                 {
                     title = lang.Display;
                 }
                 lang =
                     Languages.FirstOrDefault(
                         l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "N101");
                 if (lang != null)
                 {
                     invalidMsg = lang.Display;
                 }
             }
             if (newValue > NumericStandard.MaxValue || newValue < NumericStandard.MinValue)
             {
                 MessageBox.Show(invalidMsg, title, MessageBoxButton.OK, MessageBoxImage.Error);
                 if (mValue != null)
                 {
                     mIsSkipChange = true;
                     mValue.Value  = NumericStandard.Score;
                     mIsSkipChange = false;
                 }
                 return;
             }
             NumericStandard.Score = newValue;
             NumericStandard.Score = newValue;
             PropertyChangedEventArgs args = new PropertyChangedEventArgs();
             args.ScoreObject  = NumericStandard;
             args.PropertyName = "Score";
             NumericStandard.PropertyChanged(NumericStandard, args);
         }
     }
     catch { }
 }
Ejemplo n.º 2
0
        private void ShowLanguage()
        {
            if (Languages == null)
            {
                return;
            }
            ScoreLangauge lang = Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "L_Creator");

            if (lang != null)
            {
                LbCreatorTitleTable.Content = lang.Display;
                LbCreatorTitleTree.Content  = lang.Display;
            }
        }
Ejemplo n.º 3
0
 private void ShowLanguages()
 {
     if (Languages != null)
     {
         ScoreLangauge lang =
             Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "L102");
         if (lang != null)
         {
             LbStatistics = lang.Display;
         }
         else
         {
             LbStatistics = "Statistics";
         }
         lang =
             Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "L103");
         if (lang != null)
         {
             LbScoreItem = lang.Display;
         }
         else
         {
             LbScoreItem = "Score Item";
         }
         lang =
             Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "L104");
         if (lang != null)
         {
             LbTotalScore = lang.Display;
         }
         else
         {
             LbTotalScore = "TotalScore";
         }
         lang =
             Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "L105");
         if (lang != null)
         {
             LbScore = lang.Display;
         }
         else
         {
             LbScore = "Score";
         }
     }
 }
 private void SetRadioContent()
 {
     if (Languages != null)
     {
         ScoreLangauge lang =
             Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "R_Yes");
         if (lang != null)
         {
             RadioYesContent = lang.Display;
         }
         lang =
             Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "R_No");
         if (lang != null)
         {
             RadioNoContent = lang.Display;
         }
     }
 }
Ejemplo n.º 5
0
 void mValue_ValueChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
 {
     if (NumericStandard != null)
     {
         string invalidMsg = "Input Invalid";
         string title      = "UMP ScoreSheet Designer";
         if (Languages != null)
         {
             ScoreLangauge lang =
                 Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "T_AppName");
             if (lang != null)
             {
                 title = lang.Display;
             }
             lang =
                 Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "N_001");
             if (lang != null)
             {
                 invalidMsg = lang.Display;
             }
         }
         if (mValue != null)
         {
             double doubleValue;
             if (!double.TryParse(mValue.Text, out doubleValue))
             {
                 MessageBox.Show(invalidMsg, title, MessageBoxButton.OK, MessageBoxImage.Error);
                 mValue.Value = NumericStandard.Score;
                 return;
             }
             if (doubleValue > NumericStandard.MaxValue || doubleValue < NumericStandard.MinValue)
             {
                 MessageBox.Show(invalidMsg, title, MessageBoxButton.OK, MessageBoxImage.Error);
                 mValue.Value = NumericStandard.Score;
                 return;
             }
             NumericStandard.Score = doubleValue;
             PropertyChangedEventArgs args = new PropertyChangedEventArgs();
             args.ScoreObject  = NumericStandard;
             args.PropertyName = "Score";
             NumericStandard.PropertyChanged(NumericStandard, args);
         }
     }
 }
Ejemplo n.º 6
0
 private void SetRadioContent()
 {
     if (Languages != null)
     {
         if (YesNoStandard != null &&
             YesNoStandard.ReverseDisplay)
         {
             //反转 是 否 显示
             ScoreLangauge lang =
                 Languages.FirstOrDefault(
                     l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "R102");
             if (lang != null)
             {
                 RadioYesContent = lang.Display;
             }
             lang =
                 Languages.FirstOrDefault(
                     l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "R101");
             if (lang != null)
             {
                 RadioNoContent = lang.Display;
             }
         }
         else
         {
             ScoreLangauge lang =
                 Languages.FirstOrDefault(
                     l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "R101");
             if (lang != null)
             {
                 RadioYesContent = lang.Display;
             }
             lang =
                 Languages.FirstOrDefault(
                     l => l.LangID == LangID && l.Category == "ScoreViewer" && l.Code == "R102");
             if (lang != null)
             {
                 RadioNoContent = lang.Display;
             }
         }
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Init
        /// </summary>
        public void Init()
        {
            if (ControlItem == null)
            {
                return;
            }
            if (Languages == null)
            {
                return;
            }
            ScoreLangauge lang = Languages.FirstOrDefault(l => l.LangID == LangID && l.Category == "PropertyViewer" && l.Code == string.Format("P_Enum_JugeType_{0}", ControlItem.JugeType));

            if (lang == null)
            {
                LbContent.Content = ControlItem.JugeType;
            }
            else
            {
                LbContent.Content = lang.Display;
            }
        }
Ejemplo n.º 8
0
        private void LoadLanguageInfos()
        {
            try
            {
                if (CurrentApp.Session == null || CurrentApp.Session.LangTypeInfo == null)
                {
                    return;
                }
                mListLanguageInfos.Clear();
                WebRequest webRequest = new WebRequest();
                webRequest.Code    = (int)RequestCode.WSGetLangList;
                webRequest.Session = CurrentApp.Session;
                webRequest.ListData.Add(string.Empty);
                webRequest.ListData.Add(string.Empty);
                webRequest.ListData.Add(string.Format("31{0}0", ConstValue.SPLITER_CHAR));
                webRequest.ListData.Add(string.Format("3101{0}0", ConstValue.SPLITER_CHAR));
                webRequest.ListData.Add(string.Empty);
                webRequest.ListData.Add(string.Empty);
                Service11012Client client = new Service11012Client(
                    WebHelper.CreateBasicHttpBinding(CurrentApp.Session)
                    , WebHelper.CreateEndpointAddress(CurrentApp.Session.AppServerInfo, "Service11012"));
                WebReturn webReturn = client.DoOperation(webRequest);
                client.Close();
                if (!webReturn.Result)
                {
                    ShowException(string.Format("{0}\t{1}", webReturn.Code, webReturn.Message));
                }
                for (int i = 0; i < webReturn.ListData.Count; i++)
                {
                    OperationReturn optReturn = XMLHelper.DeserializeObject <LanguageInfo>(webReturn.ListData[i]);
                    if (!optReturn.Result)
                    {
                        ShowException(string.Format("{0}\t{1}", optReturn.Code, optReturn.Message));
                        return;
                    }
                    LanguageInfo langInfo = optReturn.Data as LanguageInfo;
                    if (langInfo == null)
                    {
                        ShowException(string.Format("LanguageInfo is null"));
                        return;
                    }
                    ScoreLangauge scoreLanguage = new ScoreLangauge();
                    scoreLanguage.LangID  = langInfo.LangID;
                    scoreLanguage.Display = langInfo.Display;

                    string name = langInfo.Name;
                    if (name.StartsWith("OBJ301"))
                    {
                        scoreLanguage.Code     = name;
                        scoreLanguage.Category = langInfo.Page;
                        mListLanguageInfos.Add(scoreLanguage);
                    }
                    if (name.StartsWith("PRO301"))
                    {
                        scoreLanguage.Code     = name;
                        scoreLanguage.Category = langInfo.Page;
                        mListLanguageInfos.Add(scoreLanguage);
                    }
                    if (name.StartsWith("PROD301"))
                    {
                        scoreLanguage.Code     = name;
                        scoreLanguage.Category = langInfo.Page;
                        mListLanguageInfos.Add(scoreLanguage);
                    }
                    if (name.StartsWith("3101GRP301"))
                    {
                        scoreLanguage.Code     = name;
                        scoreLanguage.Category = langInfo.Page;
                        mListLanguageInfos.Add(scoreLanguage);
                    }
                    if (name.StartsWith("3101Designer"))
                    {
                        scoreLanguage.Category = langInfo.Page;
                        scoreLanguage.Code     = name.Substring(12);
                        mListLanguageInfos.Add(scoreLanguage);
                    }
                    if (name.StartsWith("3101ToolBar"))
                    {
                        scoreLanguage.Category = langInfo.Page;
                        scoreLanguage.Code     = name.Substring(11);
                        mListLanguageInfos.Add(scoreLanguage);
                    }
                    if (name.StartsWith("3101ScoreViewer"))
                    {
                        scoreLanguage.Category = langInfo.Page;
                        scoreLanguage.Code     = name.Substring(15);
                        mListLanguageInfos.Add(scoreLanguage);
                    }
                    if (name.StartsWith("3101PropertyViewer"))
                    {
                        scoreLanguage.Category = langInfo.Page;
                        scoreLanguage.Code     = name.Substring(18);
                        mListLanguageInfos.Add(scoreLanguage);
                    }
                    if (name.StartsWith("3101ObjectViewer"))
                    {
                        scoreLanguage.Category = langInfo.Page;
                        scoreLanguage.Code     = name.Substring(16);
                        mListLanguageInfos.Add(scoreLanguage);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowException(ex.Message);
            }
        }
Ejemplo n.º 9
0
        private void SynchLanguages()
        {
            string path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Languages.xml");

            if (!File.Exists(path))
            {
                ShowErrorMessage(string.Format("{0}\t{1}", "Not Exist Path", path));
                return;
            }
            try
            {
                ScoreLanguageManager manager;
                OperationReturn      optReturn = XMLHelper.DeserializeFile <ScoreLanguageManager>(path);
                if (!optReturn.Result)
                {
                    ShowErrorMessage(string.Format("{0}\t{1}\t{2}", "Load fail", optReturn.Code,
                                                   optReturn.Message));
                    return;
                }
                manager = optReturn.Data as ScoreLanguageManager;
                if (manager == null)
                {
                    ShowErrorMessage(string.Format("{0}\tScoreLanguageManager is null", "Null"));
                    return;
                }
                mListLanguageInfos.Clear();
                for (int i = 0; i < manager.Languages.Count; i++)
                {
                    mListLanguageInfos.Add(manager.Languages[i]);
                }

                List <ScoreLangauge> listLangs = mListLanguageInfos.Where(l => l.Code.StartsWith("PROD301") && l.LangID == 2052).ToList();
                int count = 0;

                string strConn =
                    string.Format(
                        "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={1})))(CONNECT_DATA=(SERVICE_NAME={2})));User Id={3}; Password={4}",
                        "192.168.4.182",
                        1521,
                        "PFOrcl",
                        "PFDEV",
                        "PF,123");
                string               strSql        = string.Format("select * from t_00_005 where c009 = 0 and c010 = 0");
                OracleConnection     objConn       = new OracleConnection(strConn);
                OracleDataAdapter    objAdapter    = new OracleDataAdapter(strSql, objConn);
                OracleCommandBuilder objCmdBuilder = new OracleCommandBuilder(objAdapter);
                objCmdBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                objCmdBuilder.SetAllValues   = false;
                try
                {
                    DataSet objDataSet = new DataSet();
                    objAdapter.Fill(objDataSet);
                    for (int i = 0; i < listLangs.Count; i++)
                    {
                        ScoreLangauge lang = listLangs[i];
                        DataRow       dr   =
                            objDataSet.Tables[0].Select(string.Format("C002 = '{0}' and c001 = 2052", string.Format("{0}", lang.Code))).FirstOrDefault();
                        if (dr == null)
                        {
                            dr         = objDataSet.Tables[0].NewRow();
                            dr["C001"] = 2052;
                            dr["C002"] = string.Format("{0}", lang.Code);
                            dr["C003"] = 0;
                            dr["C004"] = 0;
                            dr["C005"] = lang.Display;
                            dr["C009"] = 0;
                            dr["C010"] = 0;
                            dr["C011"] = lang.Category;
                            objDataSet.Tables[0].Rows.Add(dr);
                            count++;
                        }
                    }

                    objAdapter.Update(objDataSet);
                    objDataSet.AcceptChanges();
                }
                catch (Exception ex)
                {
                    ShowErrorMessage(ex.Message);
                }
                finally
                {
                    objAdapter.Dispose();
                    objConn.Close();
                }
                ShowErrorMessage(string.Format("End\t{0}", count));
            }
            catch (Exception ex)
            {
                ShowErrorMessage(ex.Message);
            }
        }