Esempio n. 1
0
        /// <summary>
        /// 通过wcf获得所有的语言信息
        /// </summary>
        /// <param name="dbItem"></param>
        /// <returns></returns>
        private DataTable GetAllLanguages(TreeViewItem dbItem)
        {
            DataTable dt = new DataTable();

            try
            {
                TreeViewItem     parentItem = dbItem.Parent as TreeViewItem;
                ServerInfomation serverInfo = parentItem.Tag as ServerInfomation;
                DBInfo           dbInfo     = dbItem.Tag as DBInfo;
                ReturnResult     result     = AboutLanguagesInServer.WCFOperationMthodA("HTTP", serverInfo.Host, serverInfo.Port, 2, dbInfo);
                if (result.BoolReturn)
                {
                    if (result.DataSetReturn.Tables.Count > 0)
                    {
                        dt = result.DataSetReturn.Tables[0];
                    }
                }
                else
                {
                    MessageBox.Show(result.StringReturn,
                                    this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message,
                                this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
            }
            return(dt);
        }
Esempio n. 2
0
        /// <summary>
        /// 获得需要创建的数据库对象列表
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void bgwInitDataWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            List <string> lstArgs = new List <string>();

            lstArgs.Add(App.GCreatingDBInfo.DbType.ToString());
            RRAllObjectsResult = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, 9, lstArgs);
        }
Esempio n. 3
0
        /// <summary>
        /// 下一步  检测是否能连上数据库服务器 如果能连上 则进入下一步 不能则报错
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void ButtonNextStep_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txtServerHost.Text) || string.IsNullOrEmpty(txtServerPort.Text) ||
                string.IsNullOrEmpty(txtLoginName.Text) || string.IsNullOrEmpty(txtLoginPassword.Password))
            {
                MessageBox.Show(TryFindResource("Error014").ToString(), TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            App.GCreatingDBInfo.Host        = txtServerHost.Text;
            App.GCreatingDBInfo.Port        = txtServerPort.Text;
            App.GCreatingDBInfo.ServiceName = txtServicName.Text;
            App.GCreatingDBInfo.LoginName   = txtLoginName.Text;
            App.GCreatingDBInfo.Password    = txtLoginPassword.Password;
            ReturnResult result = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, 8, App.GCreatingDBInfo);

            if (result.BoolReturn)
            {
                CreateDBStup32 stup32 = new CreateDBStup32();
                stup32.Show();
                this.Close();
            }
            else
            {
                string strMsg = string.Format(TryFindResource("Error015").ToString(), result.StringReturn);
                MessageBox.Show(strMsg, TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 解密密码的失去焦点事件  在失去焦点时 判断密码是否正确
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void txtLanPwd_LostFocus(object sender, RoutedEventArgs e)
        {
            string LStrLanguagePackageFile = string.Empty;
            string LStrDecryptionPassword  = string.Empty;
            bool   LBoolCallReturn         = true;
            string LStrCallReturn          = string.Empty;

            try
            {
                // btn.IsEnabled = true;
                LStrLanguagePackageFile = txtLanFile.Text;
                LStrDecryptionPassword  = txtLanPwd.Password.Trim();
                if (string.IsNullOrEmpty(LStrDecryptionPassword))
                {
                    System.Windows.MessageBox.Show(this.TryFindResource("LanFilePwdNotNull").ToString(),
                                                   this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }
                LBoolCallReturn = TryDecryptionLanguagePackage(LStrLanguagePackageFile, LStrDecryptionPassword, ref LStrCallReturn);
                if (!LBoolCallReturn)
                {
                    System.Windows.MessageBox.Show(this.TryFindResource("LanFileDecryptFailed").ToString(),
                                                   this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
                    return;
                }

                ReturnResult result = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, 1, App.GCurrentDBServer);
                if (result.BoolReturn)
                {
                    if (result.DataSetReturn.Tables.Count > 0)
                    {
                        for (int i = 0; i < result.DataSetReturn.Tables[0].Rows.Count; i++)
                        {
                            if (result.DataSetReturn.Tables[0].Rows[i]["C002"].ToString() == LStrCallReturn)
                            {
                                txtLanID.Text = LStrCallReturn + " (" + result.DataSetReturn.Tables[0].Rows[i]["C005"] + ")";
                            }
                        }
                        if (string.IsNullOrEmpty(txtLanID.Text))
                        {
                            string strError = string.Format(TryFindResource("Error001").ToString(), LStrCallReturn);
                            System.Windows.MessageBox.Show(strError,
                                                           this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show(this.TryFindResource("FilePathNotNull").ToString(),
                                               this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 浏览按钮事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnBrowse_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title            = "选择文件";
            openFileDialog.Filter           = "YLP文件|*.YLP|所有文件|*.*";
            openFileDialog.FileName         = string.Empty;
            openFileDialog.FilterIndex      = 1;
            openFileDialog.RestoreDirectory = true;
            openFileDialog.DefaultExt       = "zip";
            DialogResult result = openFileDialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            string fileName = openFileDialog.FileName;

            txtLanFile.Text = fileName;

            string LStrCallReturn  = string.Empty;
            bool   LBoolCallReturn = TryDecryptionLanguagePackage(txtLanFile.Text, "vctyoung", ref LStrCallReturn);

            if (!LBoolCallReturn)
            {
                txtLanPwd.IsEnabled = true;
                //ButtonIDecryptionFile.IsEnabled = true;
                txtLanPwd.Focus();
            }
            else
            {
                txtLanPwd.Password  = string.Empty;
                txtLanPwd.IsEnabled = false;
                //ButtonIDecryptionFile.IsEnabled = false;
                ReturnResult wcfresult = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, 1, App.GCurrentDBServer);
                if (wcfresult.BoolReturn)
                {
                    if (wcfresult.DataSetReturn.Tables.Count > 0)
                    {
                        for (int i = 0; i < wcfresult.DataSetReturn.Tables[0].Rows.Count; i++)
                        {
                            if (wcfresult.DataSetReturn.Tables[0].Rows[i]["C002"].ToString() == LStrCallReturn)
                            {
                                txtLanID.Text = LStrCallReturn + " (" + wcfresult.DataSetReturn.Tables[0].Rows[i]["C005"] + ")";
                            }
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        void InitControlContent()
        {
            RRLanguangeTypesResult = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, 1, App.GCurrentDBServer);
            UC_LanguageData uc_LanData = LanManagerWindow.dpData.Children[0] as UC_LanguageData;

            lstAllLanguages = uc_LanData.lvLanguage.ItemsSource as List <LanguageInfo>;

            IListStrAllowSurportLanguageCode = new List <string>();
            if (RRLanguangeTypesResult.BoolReturn)
            {
                if (RRLanguangeTypesResult.DataSetReturn.Tables.Count > 0)
                {
                    for (int i = 0; i < RRLanguangeTypesResult.DataSetReturn.Tables[0].Rows.Count; i++)
                    {
                        IListStrAllowSurportLanguageCode.Add(RRLanguangeTypesResult.DataSetReturn.Tables[0].Rows[i]["C002"].ToString());
                    }
                }
            }
        }
Esempio n. 7
0
        ReturnResult UpdateLanguage(XmlNode lanNode)
        {
            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);
            string strNodeName = string.Empty;

            for (int i = 1; i < lanNode.ChildNodes.Count; i++)
            {
                strNodeName = lanNode.ChildNodes[i].Name.ToUpper();
                if (strNodeName == "DISPLAYMESSAGE" || strNodeName == "TIPMESSAGE")
                {
                    if (lanNode.ChildNodes[i].InnerText.Length > 2048)
                    {
                        continue;
                    }
                    if (lanNode.ChildNodes[i].InnerText.Length > 1024)
                    {
                        lstParams.Add(lanNode.ChildNodes[i].InnerText.Substring(0, 1024));
                        lstParams.Add(lanNode.ChildNodes[i].InnerText.Substring(1025));
                    }
                    else
                    {
                        lstParams.Add(lanNode.ChildNodes[i].InnerText);
                        lstParams.Add("");
                    }
                }
                else if (strNodeName == "C001" || strNodeName == "C002")
                {
                    lstParams.Add(lanNode.ChildNodes[i].InnerText);
                }
            }
            ReturnResult result = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port
                                                                            , 3, lstParams);

            return(result);
        }
Esempio n. 8
0
        ReturnResult InsertLanguage(XmlNode lanNode)
        {
            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);
            //从i=1开始 因为第一个childnode值是rownum 不需要导入数据库
            for (int i = 1; i < lanNode.ChildNodes.Count; i++)
            {
                if (lanNode.ChildNodes[i].Name.ToUpper() == "DISPLAYMESSAGE" || lanNode.ChildNodes[i].Name.ToUpper() == "TIPMESSAGE")
                {
                    if (lanNode.ChildNodes[i].InnerText.Length > 2048)
                    {
                        continue;
                    }
                    if (lanNode.ChildNodes[i].InnerText.Length > 1024)
                    {
                        lstParams.Add(lanNode.ChildNodes[i].InnerText.Substring(0, 1024));
                        lstParams.Add(lanNode.ChildNodes[i].InnerText.Substring(1025));
                    }
                    else
                    {
                        lstParams.Add(lanNode.ChildNodes[i].InnerText);
                        lstParams.Add("");
                    }
                }
                else
                {
                    lstParams.Add(lanNode.ChildNodes[i].InnerText);
                }
            }
            lstParams.Add("");  //InObject字段值 目前为空
            ReturnResult Result = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, 5, lstParams);

            return(Result);
        }
Esempio n. 9
0
        void InstanceBackgroundWorkerImportOnlyRefresh_DoWork(object sender, DoWorkEventArgs e)
        {
            //删除一种类型的语言
            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);
            RRemoveLanResult = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, 4, lstParams);
            if (RRemoveLanResult.BoolReturn)
            {
                //开始写入数据库
                ReturnResult InsertResult = null;
                foreach (XmlNode node in IXMLNodeTableDataRowsList.ChildNodes)
                {
                    if (node.ChildNodes.Count > 0)
                    {
                        InsertResult = InsertLanguage(node);
                        if (!InsertResult.BoolReturn)
                        {
                            bIsImportSuccess = false;
                            string        strError  = DateTime.Now + " | " + string.Format(this.TryFindResource("Error006").ToString(), node["C002"]);
                            List <string> lstErrors = new List <string>();
                            lstErrors.Add(strError);
                            strError = DateTime.Now + " | " + string.Format(this.TryFindResource("Error006").ToString(), InsertResult.StringReturn);
                            Logger.WriteLog(lstErrors);
                        }
                    }
                }
            }
            else
            {
                InstanceBackgroundWorkerImportOnlyRefresh.Dispose(); InstanceBackgroundWorkerImportOnlyRefresh = null;
                MessageBox.Show(RRemoveLanResult.StringReturn,
                                this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 10
0
        void InstanceBackgroundWorkerExportLanguagePackage_DoWork(object sender, DoWorkEventArgs e)
        {
            DBInfo       dbInfo = App.GCurrentDBServer;
            ReturnResult result = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, 2, dbInfo);

            if (result.BoolReturn)
            {
                if (result.DataSetReturn.Tables.Count > 0)
                {
                    DataTable      dtAllLan     = result.DataSetReturn.Tables[0];
                    List <DataRow> lstSingleLan = dtAllLan.Select("C001=" + IListStrExportOptions[1]).ToList();
                    dt_SingleLanguageType = new DataTable();
                    dt_SingleLanguageType = dtAllLan.Clone();
                    for (int i = 0; i < lstSingleLan.Count; i++)
                    {
                        dt_SingleLanguageType.Rows.Add(lstSingleLan[i].ItemArray);
                    }
                    string LStrCallReturn = string.Empty;
                    bIsWriteSuccess = WriteDataToXMLFile(dt_SingleLanguageType, ref LStrCallReturn);
                }
            }
        }
Esempio n. 11
0
 /// <summary>
 /// 在选择中数据库时 加载语言类型列表
 /// </summary>
 /// <param name="dbItem"></param>
 private void InitTreeLanguageItem(TreeViewItem dbItem)
 {
     try
     {
         TreeViewItem     parentItem = dbItem.Parent as TreeViewItem;
         ServerInfomation serverInfo = parentItem.Tag as ServerInfomation;
         App.GCurrentUmpServer = serverInfo;
         DBInfo       dbInfo = dbItem.Tag as DBInfo;
         ReturnResult result = AboutLanguagesInServer.WCFOperationMthodA("Http", serverInfo.Host, serverInfo.Port
                                                                         , 1, dbInfo);
         if (result.BoolReturn)
         {
             if (result.DataSetReturn.Tables.Count > 0)
             {
                 DataTable    dt = result.DataSetReturn.Tables[0];
                 TreeViewItem item;
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     item             = new TreeViewItem();
                     item.Header      = dt.Rows[i]["C005"].ToString();
                     item.Tag         = dt.Rows[i];
                     item.DataContext = "Lan-" + dt.Rows[i]["C005"].ToString();
                     TreeViewItemProps.SetItemImageName(item, System.IO.Path.Combine(App.GStrApplicationDirectory, @"Images\00000027.ico"));
                     item.SetResourceReference(TreeViewItem.StyleProperty, "TreeViewItemWithImg");
                     dbItem.Items.Add(item);
                 }
             }
             dbItem.IsExpanded = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message,
                         this.TryFindResource("ErrorMsgTitle").ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Esempio n. 12
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();
        }
Esempio n. 13
0
 void worker_DoWork(object sender, DoWorkEventArgs e)
 {
     //获得所有支持的语言类型
     RAllLanguagesResult = AboutLanguagesInServer.WCFOperationMthodA("HTTP", App.GCurrentUmpServer.Host, App.GCurrentUmpServer.Port, 1, App.GCurrentDBServer);
 }
Esempio n. 14
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;
            }
        }