Пример #1
0
        /// <summary>
        /// 选择数据库事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void dbItem_Selected(TreeViewItem selectedItem)
        {
            try
            {
                UC_DBOperation uc_db = new UC_DBOperation(this);
                spOperator.Children.Clear();
                spOperator.Children.Add(uc_db);
                UC_DBOpeartionDefault uc_DBOpeartionDefault = new UC_DBOpeartionDefault(this);
                spOperator.Children.Add(uc_DBOpeartionDefault);
                App.GCurrentDBServer = selectedItem.Tag as DBInfo;

                ////没有打开过 才加载语言种类
                //if (selectedItem.Items.Count <= 0)
                //{
                selectedItem.Items.Clear();
                InitTreeLanguageItem(selectedItem);
                //}
                TreeViewItemProps.SetItemImageName(selectedItem, System.IO.Path.Combine(App.GStrApplicationDirectory, @"Images\00000015.ico"));

                DataTable       dt         = GetAllLanguages(selectedItem);
                UC_LanguageData uc_LanData = new UC_LanguageData(dt, this);
                dpData.Children.Clear();
                dpData.Children.Add(uc_LanData);
                //lstAllLans = uc_LanData.lstViewrSource;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message,
                                this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Пример #2
0
        /// <summary>
        /// 取消导出文件事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void dpCancel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            LanManagerWindow.dpDetail.Children.Clear();
            LanManagerWindow.spOperator.Children.RemoveAt(1);
            UC_DBOpeartionDefault defaultWin2 = new UC_DBOpeartionDefault(LanManagerWindow);

            LanManagerWindow.spOperator.Children.Add(defaultWin2);
        }
Пример #3
0
        /// <summary>
        /// 取消编辑语言
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void dpCancel_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            LanManagerWindow.dpDetail.Children.Clear();
            LanManagerWindow.spOperator.Children.RemoveAt(1);
            UC_DBOpeartionDefault defaultWin2 = new UC_DBOpeartionDefault(LanManagerWindow);

            LanManagerWindow.spOperator.Children.Add(defaultWin2);
            UC_LanguageInfo lanInfo = new UC_LanguageInfo(App.GLstLanguageItemInEdit, LanManagerWindow);

            LanManagerWindow.dpDetail.Children.Add(lanInfo);
        }
Пример #4
0
        /// <summary>
        /// 确认导出文件事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void dpSave_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            LanManagerWindow.IsEnabled = false;
            IListStrExportOptions.Clear();
            IListStrExportOptions.Add("");
            IListStrExportOptions.Add("");
            IListStrExportOptions.Add("");

            if (string.IsNullOrEmpty(uc_Export.txtLanFile.Text))
            {
                MessageBox.Show(this.TryFindResource("Error002").ToString(),
                                this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
                LanManagerWindow.IsEnabled = true;
                return;
            }

            IListStrExportOptions[0] = uc_Export.txtLanFile.Text;
            string strLanCode = (uc_Export.cmbLanID.SelectedItem as ComboBoxItem).DataContext.ToString();

            IListStrExportOptions[1] = strLanCode;
            string strPwd = string.Empty;

            if (uc_Export.chkIsEncryption.IsChecked == true)
            {
                if (string.IsNullOrEmpty(uc_Export.txtPwd.Password))
                {
                    MessageBox.Show(this.TryFindResource("Error003").ToString(),
                                    this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
                    LanManagerWindow.IsEnabled = true;
                    return;
                }
                if (uc_Export.txtPwd.Password != uc_Export.txtConfirmPwd.Password)
                {
                    MessageBox.Show(this.TryFindResource("Error004").ToString(),
                                    this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
                    LanManagerWindow.IsEnabled = true;
                    return;
                }
                strPwd = uc_Export.txtPwd.Password;
            }
            else
            {
                strPwd = "vctyoung";
            }
            IListStrExportOptions[2] = strPwd;
            StartExport();

            LanManagerWindow.spOperator.Children.RemoveAt(1);
            UC_DBOpeartionDefault defaultWin = new UC_DBOpeartionDefault(LanManagerWindow);

            LanManagerWindow.spOperator.Children.Add(defaultWin);
            LanManagerWindow.dpDetail.Children.Clear();
        }
Пример #5
0
        void lvLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            #region 准备数据
            LanguageInfo row = lvLanguage.SelectedItem as LanguageInfo;
            if (row == null)
            {
                return;
            }
            string strMessageId = row.MessageID;

            List <LanguageInfo> lstLans = lstViewrSource.Where(p => p.MessageID == strMessageId).ToList();
            App.GLstLanguageItemInEdit.Clear();
            App.GLstLanguageItemInEdit = lstLans;

            #endregion
            #region 加载控件
            UC_LanguageInfo uc_Lan;
            if (LanManagerWindow.dpDetail.Children.Count > 0)
            {
                try
                {
                    //如果dpDetail中加载的是UC_LanguageInfo控件 则直接填充控件 而不New一个新的UC_LanguageInfo
                    uc_Lan = LanManagerWindow.dpDetail.Children[0] as UC_LanguageInfo;
                    uc_Lan.lstLanguageInfos = lstLans;
                    uc_Lan.InitControl();
                }
                catch
                {
                    //反之 则new一个新的 加载到dpDetail
                    uc_Lan = new UC_LanguageInfo(lstLans, LanManagerWindow);
                    LanManagerWindow.dpDetail.Children.Clear();
                    LanManagerWindow.dpDetail.Children.Add(uc_Lan);
                }
                LanManagerWindow.spOperator.Children.RemoveAt(1);
                UC_DBOpeartionDefault edit = new UC_DBOpeartionDefault(LanManagerWindow);
                LanManagerWindow.spOperator.Children.Add(edit);
            }
            else
            {
                uc_Lan = new UC_LanguageInfo(lstLans, LanManagerWindow);
                LanManagerWindow.dpDetail.Children.Clear();
                LanManagerWindow.dpDetail.Children.Add(uc_Lan);
            }
            #endregion
        }
Пример #6
0
        void InstanceBackgroundWorkerImportAppenUpdate_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (bIsImportSuccess)
            {
                List <string> lstParams = new List <string>();
                lstParams.Add(App.GCurrentDBServer.DbType.ToString());
                lstParams.Add(App.GCurrentDBServer.Host);
                lstParams.Add(App.GCurrentDBServer.Port);
                lstParams.Add(App.GCurrentDBServer.ServiceName);
                lstParams.Add(App.GCurrentDBServer.LoginName);
                lstParams.Add(App.GCurrentDBServer.Password);
                lstParams.Add(strImportLanguageType);

                ReturnResult result = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, 7, lstParams);
                MessageBox.Show(this.TryFindResource("Message002").ToString(),
                                this.TryFindResource("Message003").ToString(), MessageBoxButton.OK, MessageBoxImage.Information);
                if (LanManagerWindow.dpData.Children.Count > 0)
                {
                    UC_LanguageData uc_data = LanManagerWindow.dpData.Children[0] as UC_LanguageData;
                    Common.RefershData(uc_data.lvLanguage);
                    uc_data.lstViewrSource = uc_data.lvLanguage.ItemsSource as List <LanguageInfo>;
                }

                LanManagerWindow.InitControl();
            }
            else
            {
                MessageBox.Show(this.TryFindResource("Error005").ToString() + App.GStrLoginUserApplicationDataPath + "\\UMP.PF.MAMT\\Log" + DateTime.Now.Year + DateTime.Now.Month + DateTime.Now.Day + ".log",
                                this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
            }
            LanManagerWindow.spOperator.Children.RemoveAt(1);
            UC_DBOpeartionDefault defaultWin = new UC_DBOpeartionDefault(LanManagerWindow);

            LanManagerWindow.spOperator.Children.Add(defaultWin);
            LanManagerWindow.dpDetail.Children.Clear();
        }
Пример #7
0
        /// <summary>
        /// 保存编辑语言
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void dpSave_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            List <string>       lstParams;
            List <LanguageInfo> lstLans = GetLanguagesEdited();
            ReturnResult        result  = null;

            for (int i = 0; i < lstLans.Count; i++)
            {
                lstParams = new List <string>();
                lstParams.Add(App.GCurrentDBServer.DbType.ToString());
                lstParams.Add(App.GCurrentDBServer.Host);
                lstParams.Add(App.GCurrentDBServer.Port);
                lstParams.Add(App.GCurrentDBServer.ServiceName);
                lstParams.Add(App.GCurrentDBServer.LoginName);
                lstParams.Add(App.GCurrentDBServer.Password);
                lstParams.Add(lstLans[i].LanguageCode);
                lstParams.Add(lstLans[i].MessageID);
                if (lstLans[i].DisplayMessage.Length > 1024)
                {
                    lstParams.Add(lstLans[i].DisplayMessage.Substring(0, 1024));
                    lstParams.Add(lstLans[i].DisplayMessage.Substring(1024));
                }
                else
                {
                    lstParams.Add(lstLans[i].DisplayMessage);
                    lstParams.Add(string.Empty);
                }
                if (lstLans[i].TipMessage.Length > 1024)
                {
                    lstParams.Add(lstLans[i].TipMessage.Substring(0, 1024));
                    lstParams.Add(lstLans[i].TipMessage.Substring(1024));
                }
                else
                {
                    lstParams.Add(lstLans[i].TipMessage);
                    lstParams.Add(string.Empty);
                }

                result = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port
                                                                   , 3, lstParams);
                if (!result.BoolReturn)
                {
                    MessageBox.Show(lstLans[i].LanguageCode + this.TryFindResource("SaveLanguageItemError").ToString(),
                                    this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    UC_LanguageInfo uc_Info = new UC_LanguageInfo(lstLans, LanManagerWindow);
                    LanManagerWindow.dpDetail.Children.Clear();
                    LanManagerWindow.dpDetail.Children.Add(uc_Info);

                    LanManagerWindow.spOperator.Children.RemoveAt(1);
                    UC_DBOpeartionDefault uc_Default = new UC_DBOpeartionDefault(LanManagerWindow);
                    LanManagerWindow.spOperator.Children.Add(uc_Default);
                }
            }

            TreeView     tree               = LanManagerWindow.spContent.Children[2] as TreeView;
            TreeViewItem item               = tree.SelectedItem as TreeViewItem;
            string       strContextValue    = item.DataContext.ToString();
            string       strSelectedLanCode = string.Empty;

            if (strContextValue.StartsWith("Lan-"))
            {
                DataRow row = item.Tag as DataRow;
                strSelectedLanCode = row["C002"].ToString();
            }
            UC_LanguageData data = LanManagerWindow.dpData.Children[0] as UC_LanguageData;

            Common.RefershData(data.lvLanguage, strSelectedLanCode);
            data.lstViewrSource = data.lvLanguage.ItemsSource as List <LanguageInfo>;
            List <LanguageInfo> lstSingleLans = null;

            if (!string.IsNullOrEmpty(strSelectedLanCode))
            {
                lstSingleLans = data.lstViewrSource.Where(p => p.LanguageCode == strSelectedLanCode).ToList();
                data.lvLanguage.ItemsSource = null;
                data.lvLanguage.ItemsSource = lstSingleLans;
            }
        }