Example #1
0
        public string DBConnection()
        {
            DatabaseConnectionClass databaseConnectionClass = new DatabaseConnectionClass();
            string Con                = databaseConnectionClass.var1;
            string User               = databaseConnectionClass.var2;
            string Pass               = databaseConnectionClass.var3;
            string Connectionstring   = System.IO.File.ReadAllText(Con);
            string ConnectionUserName = System.IO.File.ReadAllText(User);
            string ConnectionPasswrod = System.IO.File.ReadAllText(Pass);

            string Con1  = Connectionstring.TrimEnd();
            string User1 = EncryptionAndDecryption.Decrypt(ConnectionUserName);
            string Pass1 = EncryptionAndDecryption.Decrypt(ConnectionPasswrod);

            con  = "Data Source=" + Con1.ToString() + ";Initial Catalog=DB_CORE;Network Library=DBMSSOCN;User ID=" + User1.ToString() + "; Password="******"";
            con2 = "Data Source=" + Con1.ToString() + ";Initial Catalog=DB_CENTRAL;Network Library=DBMSSOCN;User ID=" + User1.ToString() + "; Password="******"";
            con3 = "Data Source=" + Con1.ToString() + ";Initial Catalog=DB_INVENTORY;Network Library=DBMSSOCN;User ID=" + User1.ToString() + "; Password="******"";

            return(con);
        }
Example #2
0
        private static void Get11010102MinMaxDefValue(ref int AIntMinValue, ref int AIntMaxValue, ref int AIntDefValue)
        {
            string LStrVerificationCode104 = string.Empty;
            string LStrParameterValueDB    = string.Empty;

            DataRow[] LDataRow11010101 = GDataTable11001.Select("C003 = 11010101");
            LStrVerificationCode104 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);

            LStrParameterValueDB = LDataRow11010101[0]["C006"].ToString();
            LStrParameterValueDB = EncryptionAndDecryption.EncryptDecryptString(LStrParameterValueDB, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
            LStrParameterValueDB = LStrParameterValueDB.Substring(8);
            if (LStrParameterValueDB == "0")
            {
                AIntMinValue = 0; AIntMaxValue = 32; AIntDefValue = 6;
            }
            else
            {
                AIntMinValue = 6; AIntMaxValue = 32; AIntDefValue = 6;
            }
        }
Example #3
0
        /// <summary>
        /// 得到技能组信息
        /// </summary>
        /// <param name="AListSkillInfo"></param>
        /// <param name="AStrRent"></param>
        public static void GetSkillInfo(DataBaseConfig ADataBaseConfig, ref List <ObjectInfo> AListSkillInfo, string AStrRent)
        {
            AListSkillInfo.Clear();

            DataTable LDataTableReturn = new DataTable();
            string    LStrDynamicSQL   = string.Empty;
            string    LStrRentToken    = string.Empty;
            string    LStrSingleObject = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperationReturn = new DatabaseOperation01Return();
                DataOperations01          LDataOperations          = new DataOperations01();

                LStrDynamicSQL = string.Format("SELECT * FROM T_11_009_{0} WHERE C000 = 2 AND C004 = 1 ORDER BY C002"
                                               , AStrRent);
                LDatabaseOperationReturn = LDataOperations.SelectDataByDynamicSQL(ADataBaseConfig.IntDatabaseType, ADataBaseConfig.StrDatabaseProfile, LStrDynamicSQL);
                if (!LDatabaseOperationReturn.BoolReturn)
                {
                    LDataTableReturn = null;
                }
                else
                {
                    LDataTableReturn = LDatabaseOperationReturn.DataSetReturn.Tables[0];
                    foreach (DataRow LDataRowSingleRow in LDataTableReturn.Rows)
                    {
                        ObjectInfo skillInfoTemp = new ObjectInfo();
                        skillInfoTemp.ObjID   = LongParse(LDataRowSingleRow["C001"].ToString(), 0);
                        skillInfoTemp.ObjName = EncryptionAndDecryption.EncryptDecryptString(LDataRowSingleRow["C008"].ToString(), IStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                        skillInfoTemp.ObjType = 6;
                        AListSkillInfo.Add(skillInfoTemp);
                    }
                }
            }
            catch (Exception ex)
            {
                LDataTableReturn = null;
                FileLog.WriteInfo("GetSkillInfo()", ex.Message);
            }
        }
Example #4
0
        /// <summary>
        /// 得到所有的租户
        /// </summary>
        public static void ObtainRentList(DataBaseConfig ADataBaseConfig, ref List <string> AListStrRentExistObjects)
        {
            DataTable LDataTableReturn = new DataTable();
            string    LStrDynamicSQL   = string.Empty;
            string    LStrRentToken    = string.Empty;
            string    LStrSingleObject = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperationReturn = new DatabaseOperation01Return();
                DataOperations01          LDataOperations          = new DataOperations01();

                LStrDynamicSQL           = "SELECT * FROM T_00_121 ORDER BY C001 ASC";
                LDatabaseOperationReturn = LDataOperations.SelectDataByDynamicSQL(ADataBaseConfig.IntDatabaseType, ADataBaseConfig.StrDatabaseProfile, LStrDynamicSQL);
                if (!LDatabaseOperationReturn.BoolReturn)
                {
                    LDataTableReturn = null;
                }
                else
                {
                    LDataTableReturn = LDatabaseOperationReturn.DataSetReturn.Tables[0];
                    foreach (DataRow LDataRowSingleRent in LDataTableReturn.Rows)
                    {
                        LStrRentToken = EncryptionAndDecryption.EncryptDecryptString(LDataRowSingleRent["C021"].ToString(), IStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                        while (!Regex.IsMatch(LStrRentToken, @"^\d{5}$"))
                        {
                            LStrRentToken = EncryptionAndDecryption.EncryptDecryptString(LDataRowSingleRent["C021"].ToString(), IStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                        }
                        LDataRowSingleRent["C021"] = LStrRentToken;
                        LStrRentToken = LDataRowSingleRent["C021"].ToString();
                        AListStrRentExistObjects.Add(LStrRentToken);
                    }
                }
            }
            catch (Exception ex)
            {
                LDataTableReturn = null;
                FileLog.WriteInfo("ObtainRentList()", ex.Message);
            }
        }
Example #5
0
        /// <summary>
        /// 得到所有座席信息
        /// </summary>
        /// <param name="AListAgentInfo"></param>
        /// <param name="AStrRent"></param>
        public static void GetAllAgentInfo(DataBaseConfig ADataBaseConfig, ref List <ObjectInfo> AListAgentInfo, GlobalSetting AGolbalSetting)
        {
            AListAgentInfo.Clear();
            DataTable LDataTableReturn = new DataTable();
            string    LStrDynamicSQL   = string.Empty;
            string    LStrRentToken    = string.Empty;
            string    LStrSingleObject = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperationReturn = new DatabaseOperation01Return();
                DataOperations01          LDataOperations          = new DataOperations01();

                LStrDynamicSQL = string.Format("SELECT * FROM T_11_101_{0} WHERE C001 >= 1030000000000000000 AND C001 < 1040000000000000000 AND C002=1  AND C012='1' "
                                               , AGolbalSetting.StrRent);
                LDatabaseOperationReturn = LDataOperations.SelectDataByDynamicSQL(ADataBaseConfig.IntDatabaseType, ADataBaseConfig.StrDatabaseProfile, LStrDynamicSQL);
                if (!LDatabaseOperationReturn.BoolReturn)
                {
                    LDataTableReturn = null;
                }
                else
                {
                    LDataTableReturn = LDatabaseOperationReturn.DataSetReturn.Tables[0];
                    foreach (DataRow LDataRowSingleRow in LDataTableReturn.Rows)
                    {
                        ObjectInfo agentInfoTemp = new ObjectInfo();
                        agentInfoTemp.ObjID       = LongParse(LDataRowSingleRow["C001"].ToString(), 0);
                        agentInfoTemp.BeyondOrgID = LongParse(LDataRowSingleRow["C011"].ToString(), 0);
                        agentInfoTemp.ObjName     = EncryptionAndDecryption.EncryptDecryptString(LDataRowSingleRow["C017"].ToString(), IStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                        agentInfoTemp.ObjType     = 1;
                        AListAgentInfo.Add(agentInfoTemp);
                    }
                }
            }
            catch (Exception ex)
            {
                LDataTableReturn = null;
                FileLog.WriteInfo("GetAllAgentInfo()", ex.Message);
            }
        }
        public void ShowMyControlOrg()
        {
            string LStrMyOrg               = string.Empty;
            string LStrOrgID               = string.Empty;
            string LStrOrgName             = string.Empty;
            string LStrOrgParent           = string.Empty;
            string LStrVerificationCode104 = string.Empty;
            string LStrImagesPath          = string.Empty;

            try
            {
                IListrTVItemAllOrg.Clear();
                TreeViewMyCtrlOrg.Items.Clear();
                LStrImagesPath          = System.IO.Path.Combine(App.GClassSessionInfo.LocalMachineInfo.StrCommonApplicationData, @"UMP.Client\Themes", App.GClassSessionInfo.ThemeInfo.Name, @"Images\S1103");
                LStrVerificationCode104 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);
                DataRow[] LDataRowMyInfo = App.IDataTable11005.Select("C001 = " + App.GClassSessionInfo.UserInfo.UserID.ToString());
                LStrMyOrg = LDataRowMyInfo[0]["C006"].ToString();
                LStrOrgID = LStrMyOrg;
                DataRow[] LDataRowOrg = App.IDataTable11006.Select("C001 = " + LStrOrgID);
                LStrOrgName   = LDataRowOrg[0]["C002"].ToString();
                LStrOrgName   = EncryptionAndDecryption.EncryptDecryptString(LStrOrgName, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                LStrOrgParent = LDataRowOrg[0]["C004"].ToString();
                TreeViewItem LTreeViewItemRoot = new TreeViewItem();
                LTreeViewItemRoot.Header      = LStrOrgName;
                LTreeViewItemRoot.DataContext = LStrOrgID;
                if (LStrOrgParent != "0")
                {
                    TreeViewItemProps.SetItemImageName(LTreeViewItemRoot, LStrImagesPath + @"\S1103004.ico");
                }
                else
                {
                    TreeViewItemProps.SetItemImageName(LTreeViewItemRoot, LStrImagesPath + @"\S1103000.ico");
                }
                TreeViewMyCtrlOrg.Items.Add(LTreeViewItemRoot);
                ShowMyControlOrg(LTreeViewItemRoot, LStrOrgID);
                LTreeViewItemRoot.IsExpanded = true;
                IListrTVItemAllOrg.Add(LTreeViewItemRoot);
            }
            catch { }
        }
Example #7
0
        private void RefreshType212ViewData(OperationEventArgs AEventArgs)
        {
            string LStrDataContext = string.Empty;

            string LStrServerData001 = string.Empty;
            string LStrServerData011 = string.Empty;
            string LStrServerData012 = string.Empty;
            string LStrServerData013 = string.Empty;
            string LStrServerData014 = string.Empty;
            string LStrServerData015 = string.Empty;
            string LStrServerData016 = string.Empty;
            string LStrServerData017 = string.Empty;
            string LStrServerData018 = string.Empty;

            foreach (TreeViewItem LTreeViewItemSingleResurce in TreeViewResourceList.Items)
            {
                if (LTreeViewItemSingleResurce.DataContext.ToString() != "212")
                {
                    continue;
                }
                foreach (TreeViewItem LTreeViewItemSingleDecServer in LTreeViewItemSingleResurce.Items)
                {
                    LStrDataContext = LTreeViewItemSingleDecServer.DataContext.ToString();
                    if (LStrDataContext != AEventArgs.ObjectSource0.ToString())
                    {
                        continue;
                    }

                    DataRow[] LDataRowDecServer = App.IListDataSetReturn[1].Tables[0].Select("C001 = " + LStrDataContext);

                    LStrServerData017 = LDataRowDecServer[0]["C017"].ToString();
                    LStrServerData017 = EncryptionAndDecryption.EncryptDecryptString(LStrServerData017, IStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);

                    LTreeViewItemSingleDecServer.Header = LStrServerData017;
                    break;
                }
                break;
            }
        }
Example #8
0
        public void ShowParameterEditStyle(DataRow ADataRowParamInfo)
        {
            string LStr11001003            = string.Empty; //参数编码
            string LStrVerificationCode104 = string.Empty;
            string LStrParameterValueDB    = string.Empty;

            try
            {
                IDataRowCurrent = ADataRowParamInfo;
                if (IPageParent != null)
                {
                    IPageParent.IOperationEvent += IPageParent_IOperationEvent;
                }
                LStr11001003              = ADataRowParamInfo["C003"].ToString();
                LStrVerificationCode104   = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);
                RadioButtonValueX.Content = App.GetDisplayCharater("Page00000A", "Act" + LStr11001003 + "VX");
                RadioButtonValue1.Content = App.GetDisplayCharater("Page00000A", "Act" + LStr11001003 + "V1");
                LStrParameterValueDB      = ADataRowParamInfo["C006"].ToString();
                LStrParameterValueDB      = EncryptionAndDecryption.EncryptDecryptString(LStrParameterValueDB, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                LStrParameterValueDB      = LStrParameterValueDB.Substring(8);
                if (LStrParameterValueDB != "1")
                {
                    RadioButtonValueX.IsChecked = true;
                    foreach (ComboBoxItem LComboBoxItemSingle in ComboBoxFirstDay.Items)
                    {
                        if (LComboBoxItemSingle.DataContext.ToString() == LStrParameterValueDB)
                        {
                            LComboBoxItemSingle.IsSelected = true; break;
                        }
                    }
                }
                else
                {
                    RadioButtonValue1.IsChecked = true;
                }
                IPageParent.IChangeLanguageEvent += IPageParent_IChangeLanguageEvent;
            }
            catch { }
        }
Example #9
0
        public void ShowParameterEditStyle(DataRow ADataRowParamInfo)
        {
            string LStr11001003            = string.Empty; //参数编码
            string LStrVerificationCode104 = string.Empty;
            string LStrParameterValueDB    = string.Empty;

            try
            {
                IDataRowCurrent = ADataRowParamInfo;
                if (IPageParent != null)
                {
                    IPageParent.IOperationEvent += IPageParent_IOperationEvent;
                }
                CheckBoxExtension.IsChecked = false; CheckBoxAgentID.IsChecked = false;
                LStr11001003              = ADataRowParamInfo["C003"].ToString();
                LStrVerificationCode104   = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);
                CheckBoxExtension.Content = App.GetDisplayCharater("Page00000A", "Act" + LStr11001003 + "VE");
                CheckBoxAgentID.Content   = App.GetDisplayCharater("Page00000A", "Act" + LStr11001003 + "VA");
                LStrParameterValueDB      = ADataRowParamInfo["C006"].ToString();
                LStrParameterValueDB      = EncryptionAndDecryption.EncryptDecryptString(LStrParameterValueDB, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                LStrParameterValueDB      = LStrParameterValueDB.Substring(8);
                string[] LStrGroupType = LStrParameterValueDB.Split(IPageParent.IStrSpliterChar.ToCharArray());
                foreach (string LStrType in LStrGroupType)
                {
                    if (LStrType == "E")
                    {
                        CheckBoxExtension.IsChecked = true; continue;
                    }
                    if (LStrType == "A")
                    {
                        CheckBoxAgentID.IsChecked = true; continue;
                    }
                }

                IPageParent.IChangeLanguageEvent += IPageParent_IChangeLanguageEvent;
            }
            catch { }
        }
        public void ShowOrgTypeInformation()
        {
            string LStrVerificationCode104 = string.Empty;
            string LStrParameterValueDB    = string.Empty;
            string LStrOrgTypeID           = string.Empty;

            try
            {
                LStrVerificationCode104 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);
                ImageOrgStatus.Style    = (Style)App.Current.Resources["ImageOrgStatus" + IDataRow11009["C004"].ToString() + "Style"];
                LStrOrgTypeID           = IDataRow11009["C001"].ToString();
                if (LStrOrgTypeID == "905" + App.GClassSessionInfo.RentInfo.Token + "00000000000")
                {
                    StrOrgTypeName = App.GetDisplayCharater("S1100018");
                }
                else
                {
                    LStrParameterValueDB = IDataRow11009["C006"].ToString();
                    StrOrgTypeName       = EncryptionAndDecryption.EncryptDecryptString(LStrParameterValueDB, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                }
            }
            catch { }
        }
Example #11
0
        // GET: AdmUser/Create
        public ActionResult Create()
        {
            AdmUser admUser = new AdmUser()
            {
                UserName      = "******",
                UserAccounts  = "123456",
                Password      = "******",
                Guid          = Guid.NewGuid().ToString().ToUpper(),
                DepId         = 2,
                RoleId        = 1,
                LastLoginTime = DateTime.Now,
                Sex           = 1,
                NumOfLogins   = 1
            };

            admUser.CreateTime = DateTime.Now;
            admUser.Password   = EncryptionAndDecryption.Encode(admUser.Password);
            // _DccyDbContext.AdmUser.Add(admUser);
            DBHandler.Db.AdmUser.Add(admUser);
            int m = DBHandler.DbSavaChange();

            return(View());
        }
Example #12
0
        public void ShowParameterEditStyle(DataRow ADataRowParamInfo)
        {
            string LStr11001003            = string.Empty; //参数编码
            string LStrVerificationCode104 = string.Empty;
            string LStrParameterValueDB    = string.Empty;

            try
            {
                if (IPageParent != null)
                {
                    IPageParent.IOperationEvent += IPageParent_IOperationEvent;
                }
                LStr11001003            = ADataRowParamInfo["C003"].ToString();
                LStrVerificationCode104 = S1106App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);

                LStrParameterValueDB              = ADataRowParamInfo["C006"].ToString();
                LStrParameterValueDB              = EncryptionAndDecryption.EncryptDecryptString(LStrParameterValueDB, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                LStrParameterValueDB              = LStrParameterValueDB.Substring(8);
                TextBoxValueInput.Text            = LStrParameterValueDB;
                IPageParent.IChangeLanguageEvent += IPageParent_IChangeLanguageEvent;
            }
            catch { }
        }
Example #13
0
        public static string DecryptString(string strSource)
        {
            string strReturn = string.Empty;
            string strTemp;

            do
            {
                if (strSource.Length > 512)
                {
                    strTemp   = strSource.Substring(0, 512);
                    strSource = strSource.Substring(512, strSource.Length - 512);
                }
                else
                {
                    strTemp   = strSource;
                    strSource = string.Empty;
                }
                strReturn += EncryptionAndDecryption.EncryptDecryptString(strTemp,
                                                                          CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104),
                                                                          EncryptionAndDecryption.UMPKeyAndIVType.M104);
            } while (strSource.Length > 0);
            return(strReturn);
        }
Example #14
0
        public ActionResult LoginDatabase(AllModels model)
        {
            string AdminUser = Server.MapPath("~/DatabaseConnection/AdminUser.txt");
            string AdminPass = Server.MapPath("~/DatabaseConnection/AdminPassword.txt");

            string AdminUserName = System.IO.File.ReadAllText(AdminUser);
            string AdminPassword = System.IO.File.ReadAllText(AdminPass);

            string User2 = EncryptionAndDecryption.Decrypt(AdminUserName);
            string Pass2 = EncryptionAndDecryption.Decrypt(AdminPassword);

            if (model.Maintenance.AdminUser != User2.ToString().TrimEnd() || model.Maintenance.AdminPassword != Pass2.ToString().TrimEnd())
            {
                ViewBag.HeaderError  = string.Format("Unable  to connect to server.");
                ViewBag.MessageError = string.Format("Check your Admin Username or Admin Password.");
                return(View());
            }
            else
            {
                Session["AdminUser"] = User2;
                return(RedirectToAction("UpdateData", "Login"));
            }
        }
Example #15
0
        public static string EncryptString001(string strSource)
        {
            string strReturn = string.Empty;
            string strTemp;

            do
            {
                if (strSource.Length > 128)
                {
                    strTemp   = strSource.Substring(0, 128);
                    strSource = strSource.Substring(128, strSource.Length - 128);
                }
                else
                {
                    strTemp   = strSource;
                    strSource = string.Empty;
                }
                strReturn += EncryptionAndDecryption.EncryptDecryptString(strTemp,
                                                                          CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M001),
                                                                          EncryptionAndDecryption.UMPKeyAndIVType.M001);
            } while (strSource.Length > 0);
            return(strReturn);
        }
        private void ShowSkillGroupTreeView()
        {
            string LStrSkillID             = string.Empty;
            string LStrSkillCode           = string.Empty;
            string LStrSkillName           = string.Empty;
            string LStrVerificationCode104 = string.Empty;
            string LStrImagesPath          = string.Empty;

            LStrVerificationCode104 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);
            LStrImagesPath          = System.IO.Path.Combine(App.GClassSessionInfo.LocalMachineInfo.StrCommonApplicationData, @"UMP.Client\Themes", App.GClassSessionInfo.ThemeInfo.Name, @"Images\S1100\S1100005.png");
            GridObjectSelect.Children.Clear();
            UCTreeViewYoung LUCTreeViewYoung = new UCTreeViewYoung();

            GridObjectSelect.Children.Add(LUCTreeViewYoung);
            foreach (DataRow LDataRowSingleSkillGroup in App.IDataTable11009.Rows)
            {
                LStrSkillID   = LDataRowSingleSkillGroup["C001"].ToString();
                LStrSkillCode = LDataRowSingleSkillGroup["C006"].ToString();
                LStrSkillName = LDataRowSingleSkillGroup["C008"].ToString();
                LStrSkillCode = EncryptionAndDecryption.EncryptDecryptString(LStrSkillCode, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                TreeViewItem LTreeViewItemSkillGroup = LUCTreeViewYoung.AddTreeViewItem(null, false, LStrImagesPath, LStrSkillCode + " (" + LStrSkillName + ")", LStrSkillID);
            }
        }
Example #17
0
        private void ShowSingleSkillGroupInformation()
        {
            string LStrVerificationCode104 = string.Empty;
            string LStrParameterValueDB    = string.Empty;

            try
            {
                TextBoxSkillCode.IsReadOnly           = true;
                TextBoxSkillName.IsReadOnly           = true;
                CheckBoxIsEnabled.IsEnabled           = false;
                TextBoxSingleTypeDescriber.IsReadOnly = true;

                LStrVerificationCode104 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);

                StrEditApply                = App.GetDisplayCharater("UCOrganizationMaintenance", "ButtonEdit");
                ButtonEditApply.Style       = (Style)App.Current.Resources["ButtonEditStyle"];
                ButtonCancelEdit.Visibility = System.Windows.Visibility.Collapsed;
                IStrCurrentMethod           = "V";

                CheckBoxIsEnabled.IsChecked     = false;
                TextBoxSingleTypeDescriber.Text = string.Empty;

                LStrParameterValueDB  = IDataRowCurrentFocused["C006"].ToString();
                TextBoxSkillCode.Text = EncryptionAndDecryption.EncryptDecryptString(LStrParameterValueDB, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                LStrParameterValueDB  = IDataRowCurrentFocused["C008"].ToString();

                TextBoxSkillName.Text = LStrParameterValueDB;// EncryptionAndDecryption.EncryptDecryptString(LStrParameterValueDB, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                if (IDataRowCurrentFocused["C004"].ToString() == "1")
                {
                    CheckBoxIsEnabled.IsChecked = true;
                }

                LStrParameterValueDB            = IDataRowCurrentFocused["C009"].ToString();
                TextBoxSingleTypeDescriber.Text = LStrParameterValueDB;
            }
            catch { }
        }
Example #18
0
        /// <summary>
        /// 得到该租户的月和周的设定
        /// 12010101每周开始于默认值为0,表示从周日晚上24点开始
        /// 0为周日,1星期一,6为星期六
        /// 12010102每月开始于默认值为1
        /// 1为自然月,2为2号,最大28为28号
        /// 12010401 为分机和座席 E为分机 A为座席 E char(27)A为座席+分机 R为真实分机
        /// </summary>
        public static void GetGlobalSetting(DataBaseConfig ADataBaseConfig, ref string AStrParamValue, string AStrRent, string AStrParamNumber)
        {
            AStrParamValue = string.Empty;
            DataTable LDataTableReturn = new DataTable();
            string    LStrDynamicSQL   = string.Empty;
            string    LStrRentToken    = string.Empty;
            string    LStrSingleObject = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperationReturn = new DatabaseOperation01Return();
                DataOperations01          LDataOperations          = new DataOperations01();

                LStrDynamicSQL = string.Format("SELECT * FROM T_11_001_{0} WHERE C003={1}"
                                               , AStrRent
                                               , AStrParamNumber);
                LDatabaseOperationReturn = LDataOperations.SelectDataByDynamicSQL(ADataBaseConfig.IntDatabaseType, ADataBaseConfig.StrDatabaseProfile, LStrDynamicSQL);
                if (!LDatabaseOperationReturn.BoolReturn)
                {
                    LDataTableReturn = null;
                }
                else
                {
                    LDataTableReturn = LDatabaseOperationReturn.DataSetReturn.Tables[0];
                    foreach (DataRow LDataRowSingleRow in LDataTableReturn.Rows)
                    {
                        AStrParamValue = EncryptionAndDecryption.EncryptDecryptString(LDataRowSingleRow["C006"].ToString(), IStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102).Trim(' ').Substring(AStrParamNumber.Length);
                    }
                }
            }
            catch (Exception ex)
            {
                LDataTableReturn = null;
                FileLog.WriteInfo("GetGlobalSetting()", ex.Message);
            }
        }
Example #19
0
        public string CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType aKeyIvid)
        {
            string lStrReturn;
            Random lRandom = new Random();

            try
            {
                lStrReturn = DateTime.Now.ToString("yyyyMMddHHmmss");
                var lIntRand = lRandom.Next(0, 14);
                var lStrTemp = lIntRand.ToString("00");
                lStrReturn = lStrReturn.Insert(lIntRand, "VCT");
                lIntRand   = lRandom.Next(0, 17);
                lStrTemp  += lIntRand.ToString("00");
                lStrReturn = lStrReturn.Insert(lIntRand, "UMP");
                lIntRand   = lRandom.Next(0, 20);
                lStrTemp  += lIntRand.ToString("00");
                lStrReturn = lStrReturn.Insert(lIntRand, ((int)aKeyIvid).ToString("000"));

                lStrReturn = EncryptionAndDecryption.EncryptStringY(lStrTemp + lStrReturn);
            }
            catch { lStrReturn = string.Empty; }

            return(lStrReturn);
        }
Example #20
0
        /// <summary>
        /// 根据租户信息,更改表中的初始化数据
        /// </summary>
        /// <param name="AListStringArgs">
        /// 0-数据库类型
        /// 1-数据库服务器
        /// 2-端口
        /// 3-登录名
        /// 4-登录密码
        /// 5-数据库名或服务名
        /// 6-0租户名称
        /// 7-1租户Token
        /// 8-2超级系统管理员密码
        /// 9-3系统默认界面显示语言
        /// </param>
        /// <returns></returns>
        private OperationDataArgs OperationA15(List <string> AListStringArgs)
        {
            OperationDataArgs LOperationReturn        = new OperationDataArgs();
            List <string>     LListStrDatabaseProfile = new List <string>();
            List <string>     LListStrRentDataSetted  = new List <string>();

            string LStrXmlFileName         = string.Empty;
            string LStrVerificationCode001 = string.Empty;
            string LStrVerificationCode104 = string.Empty;
            string LStrUserID19            = string.Empty;
            string LStrXmlSAPassword       = string.Empty;
            string LStrA01 = string.Empty;

            try
            {
                for (int LIntLoopTemp = 0; LIntLoopTemp <= 5; LIntLoopTemp++)
                {
                    LListStrDatabaseProfile.Add(AListStringArgs[LIntLoopTemp]);
                }
                for (int LIntLoopTemp = 6; LIntLoopTemp <= 9; LIntLoopTemp++)
                {
                    LListStrRentDataSetted.Add(AListStringArgs[LIntLoopTemp]);
                }

                if (LListStrDatabaseProfile[0] == "2")
                {
                    LOperationReturn = DatabaseType2Operation.InitTableByRentInfo(LListStrDatabaseProfile, LListStrRentDataSetted);
                }
                if (LListStrDatabaseProfile[0] == "3")
                {
                    LOperationReturn = DatabaseType3Operation.InitTableByRentInfo(LListStrDatabaseProfile, LListStrRentDataSetted);
                }

                #region 修改XML文件的administrator的密码
                LStrVerificationCode001 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M001);
                LStrVerificationCode104 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);
                LStrUserID19            = "102" + AListStringArgs[7] + "00000000001";
                LStrXmlSAPassword       = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[8], LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                LStrXmlSAPassword       = EncryptionAndDecryption.EncryptStringSHA512(LStrUserID19 + LStrXmlSAPassword, LStrVerificationCode001, EncryptionAndDecryption.UMPKeyAndIVType.M001);
                LStrXmlFileName         = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                LStrXmlFileName         = Path.Combine(LStrXmlFileName, @"UMP.Server\Args02.UMP.xml");
                XmlDocument LXmlDocArgs02 = new XmlDocument();
                LXmlDocArgs02.Load(LStrXmlFileName);
                XmlNodeList LXmlNodeListSAUsers = LXmlDocArgs02.SelectSingleNode("Parameters02").SelectSingleNode("SAUsers").ChildNodes;
                foreach (XmlNode LXmlNodeSingleUser in LXmlNodeListSAUsers)
                {
                    LStrA01 = LXmlNodeSingleUser.Attributes["A01"].Value;
                    if (LStrA01 != LStrUserID19)
                    {
                        continue;
                    }
                    LXmlNodeSingleUser.Attributes["A03"].Value = LStrXmlSAPassword;
                    break;
                }
                LXmlDocArgs02.Save(LStrXmlFileName);
                #endregion
            }
            catch (Exception ex)
            {
                LOperationReturn.BoolReturn   = false;
                LOperationReturn.StringReturn = "OperationA15()\n" + ex.ToString();
            }

            return(LOperationReturn);
        }
        public ActionResult Login(string acountName, string password, string code)
        {
            AdmUser admUser = null;

            #region 用户名验证
            if (acountName != null && acountName.Length > 0 && acountName != "")
            {
                var user = DBHandler.Db.AdmUser.First(u => u.UserAccounts == acountName || u.Email == acountName || u.Tel == acountName);
                if (user != null && user.Id > 0)
                {
                    admUser = user;
                }
                else
                {
                    ViewBag.LoginMsg = "请输入合法的登录帐号或帐号不存在!!!";
                    return(View("Index"));
                }
            }
            else
            {
                ViewBag.LoginMsg = "请输入合法的登录帐号!!!";
                return(View("Index"));
            }
            #endregion
            #region 密码验证
            if (password != null && password.Length > 0 && password != "")
            {
                var userPwdEncode = EncryptionAndDecryption.Encode(password);
                if (admUser.Password.Equals(userPwdEncode))
                {
                }
                else
                {
                    ViewBag.LoginMsg = "密码错误!!!";
                    return(View("Index"));
                }
            }
            else
            {
                ViewBag.LoginMsg = "请输入合法的登录密码!!!";
                return(View("Index"));
            }
            #endregion
            #region 验证码
            if (code != null && code.Length > 0 && code != "")
            {
                if (code.Equals(TempData["SecurityCode"]))
                {
                    HttpContext.Session.SetString("AdmUserSession", JsonConvert.SerializeObject(admUser));
                    return(RedirectToAction("Index", "Home", admUser));
                }
                else
                {
                    ViewBag.LoginMsg = "验证码输入错误!!!";
                    return(View("Index"));
                }
            }
            else
            {
                ViewBag.LoginMsg = "请输入合法的验证码!!!";
                return(View("Index"));
            }
            #endregion
        }
Example #22
0
        private void ShowOrgAgent(TreeViewItem ATreeViewItem, string AStrParentOrgID)
        {
            string LStrVerificationCode104 = string.Empty;
            string LStrOrgID      = string.Empty;
            string LStrOrgName    = string.Empty;
            string LStrOrgParent  = string.Empty;
            string LStrImagesPath = string.Empty;

            string LStrAgentStatus = string.Empty;
            string LStrAgentID     = string.Empty;
            string LStrAgentCode   = string.Empty;
            string LStrAgentName   = string.Empty;

            try
            {
                LStrImagesPath          = System.IO.Path.Combine(App.GClassSessionInfo.LocalMachineInfo.StrCommonApplicationData, @"UMP.Client\Themes", App.GClassSessionInfo.ThemeInfo.Name, @"Images\S1103");
                LStrVerificationCode104 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);

                DataRow[] LDataRowOrg = App.IDataTable11006.Select("C004 = " + AStrParentOrgID);
                foreach (DataRow LDataRowSingleOrg in LDataRowOrg)
                {
                    LStrOrgID = LDataRowSingleOrg["C001"].ToString();
                    if (App.IDataTable11201UO.Select("C004 = " + LStrOrgID).Length <= 0)
                    {
                        continue;
                    }
                    LStrOrgName = LDataRowSingleOrg["C002"].ToString();
                    LStrOrgName = EncryptionAndDecryption.EncryptDecryptString(LStrOrgName, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    TreeViewItem LTreeViewItemSubOrg = new TreeViewItem();
                    LTreeViewItemSubOrg.Header      = LStrOrgName;
                    LTreeViewItemSubOrg.DataContext = LStrOrgID;
                    TreeViewItemProps.SetItemImageName(LTreeViewItemSubOrg, LStrImagesPath + @"\S1103004.ico");
                    ATreeViewItem.Items.Add(LTreeViewItemSubOrg);
                    IListTVIOrg.Add(LTreeViewItemSubOrg);
                    ShowOrgAgent(LTreeViewItemSubOrg, LStrOrgID);
                    LTreeViewItemSubOrg.IsExpanded = true;
                }
                DataRow[] LDataRowAgent = App.IDataTable11101.Select("C011 = '" + AStrParentOrgID + "' AND C002 = 1", "C017 ASC");
                foreach (DataRow LDataRowSingleAgent in LDataRowAgent)
                {
                    LStrAgentID   = LDataRowSingleAgent["C001"].ToString();
                    LStrAgentCode = LDataRowSingleAgent["C017"].ToString();
                    //LStrAgentCode = EncryptionAndDecryption.EncryptDecryptString(LStrAgentCode, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    if (App.IDataTable11201UA.Select("C003 = " + App.GClassSessionInfo.UserInfo.UserID.ToString() + " AND C004 = " + LStrAgentID).Length <= 0)
                    {
                        continue;
                    }
                    LStrAgentName   = LDataRowSingleAgent["C018"].ToString();
                    LStrAgentName   = EncryptionAndDecryption.EncryptDecryptString(LStrAgentName, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    LStrAgentStatus = LDataRowSingleAgent["C012"].ToString();
                    TreeViewItem LTreeViewItemSubAgent = new TreeViewItem();
                    LTreeViewItemSubAgent.Header      = "(" + LStrAgentCode + ") " + LStrAgentName;
                    LTreeViewItemSubAgent.DataContext = LStrAgentID;
                    if (LStrAgentStatus == "1")
                    {
                        TreeViewItemProps.SetItemImageName(LTreeViewItemSubAgent, LStrImagesPath + @"\S1103001.ico");
                    }
                    else
                    {
                        TreeViewItemProps.SetItemImageName(LTreeViewItemSubAgent, LStrImagesPath + @"\S1103002.ico");
                    }
                    ATreeViewItem.Items.Add(LTreeViewItemSubAgent);

                    IListTVIAgent.Add(LTreeViewItemSubAgent);
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.ToString()); }
        }
Example #23
0
        public void ShowControlOrgAgent()
        {
            string LStrMyOrg               = string.Empty;
            string LStrOrgID               = string.Empty;
            string LStrOrgName             = string.Empty;
            string LStrOrgParent           = string.Empty;
            string LStrVerificationCode104 = string.Empty;
            string LStrImagesPath          = string.Empty;

            try
            {
                TreeViewOrgAgent.Items.Clear();
                IListTVIOrg.Clear();
                IListTVIAgent.Clear();


                LStrImagesPath          = System.IO.Path.Combine(App.GClassSessionInfo.LocalMachineInfo.StrCommonApplicationData, @"UMP.Client\Themes", App.GClassSessionInfo.ThemeInfo.Name, @"Images\S1103");
                LStrVerificationCode104 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);
                DataRow[] LDataRowMyInfo = App.IDataTable11005.Select("C001 = " + App.GClassSessionInfo.UserInfo.UserID.ToString());
                LStrMyOrg = LDataRowMyInfo[0]["C006"].ToString();
                LStrOrgID = LStrMyOrg;
                DataRow[] LDataRowOrg = App.IDataTable11006.Select("C001 = " + LStrOrgID);
                LStrOrgName   = LDataRowOrg[0]["C002"].ToString();
                LStrOrgName   = EncryptionAndDecryption.EncryptDecryptString(LStrOrgName, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                LStrOrgParent = LDataRowOrg[0]["C004"].ToString();
                TreeViewItem LTreeViewItemRoot = new TreeViewItem();
                LTreeViewItemRoot.Header      = LStrOrgName;
                LTreeViewItemRoot.DataContext = LStrOrgID;
                if (LStrOrgParent != "0")
                {
                    TreeViewItemProps.SetItemImageName(LTreeViewItemRoot, LStrImagesPath + @"\S1103004.ico");
                }
                else
                {
                    TreeViewItemProps.SetItemImageName(LTreeViewItemRoot, LStrImagesPath + @"\S1103000.ico");
                }
                TreeViewOrgAgent.Items.Add(LTreeViewItemRoot);
                IListTVIOrg.Add(LTreeViewItemRoot);
                ShowOrgAgent(LTreeViewItemRoot, LStrOrgID);

                LTreeViewItemRoot.IsExpanded = true;
                LTreeViewItemRoot.Focus();
                LTreeViewItemRoot.BringIntoView();

                IUCBasicInfo.IPageParent = this;
                IUCSkillInfo.IPageParent = this;
                IUCManger.IPageParent    = this;

                //StackPanelAgentProperties.Children.Clear();

                //IUCBasicInfo.BorderThickness = new Thickness(1, 1, 1, 1);
                //IUCBasicInfo.BorderBrush = Brushes.LightGray;
                //StackPanelAgentProperties.Children.Add(IUCBasicInfo);

                //IUCSkillInfo.Margin = new Thickness(0, 5, 0, 0);
                //IUCSkillInfo.BorderThickness = new Thickness(1, 1, 1, 1);
                //IUCSkillInfo.BorderBrush = Brushes.LightGray;
                //StackPanelAgentProperties.Children.Add(IUCSkillInfo);

                //IUCManger.Margin = new Thickness(0, 5, 0, 0);
                //IUCManger.BorderThickness = new Thickness(1, 1, 1, 1);
                //IUCManger.BorderBrush = Brushes.LightGray;
                //StackPanelAgentProperties.Children.Add(IUCManger);

                ShowElementContent();
                IUCBasicInfo.ShowElementContent();
                IUCBasicInfo.ShowMyControlOrg();
                IUCSkillInfo.ShowElementContent();
                IUCManger.ShowElementContent();
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString(),"3");
            }
        }
Example #24
0
        /// <summary>
        /// 用M004加密
        /// </summary>
        /// <param name="strSource"></param>
        /// <returns></returns>
        public static string EncryptWithM004(string strSource)
        {
            string LStrVerificationCode004 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M004);

            return(EncryptionAndDecryption.EncryptDecryptString(strSource, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004));
        }
Example #25
0
        /// <summary>
        /// 用M104解密
        /// </summary>
        /// <param name="strSource"></param>
        /// <returns></returns>
        public static string DecryptWithM025(string strSource)
        {
            string LStrVerificationCode125 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M125);

            return(EncryptionAndDecryption.EncryptDecryptString(strSource, LStrVerificationCode125, EncryptionAndDecryption.UMPKeyAndIVType.M125));
        }
Example #26
0
        public void GetDatabaseConnectionProfile()
        {
            string LStrXmlFileName      = string.Empty;
            string LStrVerificationCode = string.Empty;

            string LStrAttributesData = string.Empty;
            //0:数据库服务器;1:端口;2:数据库名或服务名;3:登录用户;4:登录密码;5:其他参数
            List <string> LListStrDBProfile = new List <string>();

            try
            {
                IIntDatabaseType    = 0;
                IStrDatabaseProfile = string.Empty;

                LStrVerificationCode = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);

                LStrXmlFileName =
                    Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                // System.AppDomain.CurrentDomain.BaseDirectory;//测试用


                LStrXmlFileName = System.IO.Path.Combine(LStrXmlFileName, @"UMP.Server\Args01.UMP.xml");

                XmlDocument LXmlDocArgs01 = new XmlDocument();
                LXmlDocArgs01.Load(LStrXmlFileName);
                XmlNodeList LXmlNodeListDatabase = LXmlDocArgs01.SelectSingleNode("DatabaseParameters").ChildNodes;

                #region 读取数据库连接参数
                foreach (XmlNode LXmlNodeSingleDatabase in LXmlNodeListDatabase)
                {
                    LStrAttributesData = LXmlNodeSingleDatabase.Attributes["P03"].Value;
                    LStrAttributesData = EncryptionAndDecryption.EncryptDecryptString(LStrAttributesData, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    if (LStrAttributesData != "1")
                    {
                        continue;
                    }

                    //数据库类型
                    LStrAttributesData = LXmlNodeSingleDatabase.Attributes["P02"].Value;
                    LStrAttributesData = EncryptionAndDecryption.EncryptDecryptString(LStrAttributesData, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    IIntDatabaseType   = int.Parse(LStrAttributesData);

                    //数据库服务器名或IP地址
                    LStrAttributesData = LXmlNodeSingleDatabase.Attributes["P04"].Value;
                    LStrAttributesData = EncryptionAndDecryption.EncryptDecryptString(LStrAttributesData, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    LListStrDBProfile.Add(LStrAttributesData);

                    //数据库服务端口
                    LStrAttributesData = LXmlNodeSingleDatabase.Attributes["P05"].Value;
                    LStrAttributesData = EncryptionAndDecryption.EncryptDecryptString(LStrAttributesData, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    LListStrDBProfile.Add(LStrAttributesData);

                    //数据库名或Service Name
                    LStrAttributesData = LXmlNodeSingleDatabase.Attributes["P06"].Value;
                    LStrAttributesData = EncryptionAndDecryption.EncryptDecryptString(LStrAttributesData, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    LListStrDBProfile.Add(LStrAttributesData);

                    //登录用户
                    LStrAttributesData = LXmlNodeSingleDatabase.Attributes["P07"].Value;
                    LStrAttributesData = EncryptionAndDecryption.EncryptDecryptString(LStrAttributesData, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    LListStrDBProfile.Add(LStrAttributesData);

                    //登录密码
                    LStrAttributesData = LXmlNodeSingleDatabase.Attributes["P08"].Value;
                    LStrAttributesData = EncryptionAndDecryption.EncryptDecryptString(LStrAttributesData, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    LListStrDBProfile.Add(LStrAttributesData);

                    //其他参数
                    LStrAttributesData = LXmlNodeSingleDatabase.Attributes["P09"].Value;
                    LStrAttributesData = EncryptionAndDecryption.EncryptDecryptString(LStrAttributesData, LStrVerificationCode, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    LListStrDBProfile.Add(LStrAttributesData);

                    break;
                }
                #endregion

                #region 创建数据库连接字符串
                string LStrDBConnectProfile = string.Empty;

                if (IIntDatabaseType == 2)
                {
                    IStrDatabaseProfile  = string.Format("Data Source={0},{1};Initial Catalog={2};User Id={3};Password={4}", LListStrDBProfile[0], LListStrDBProfile[1], LListStrDBProfile[2], LListStrDBProfile[3], LListStrDBProfile[4]);
                    LStrDBConnectProfile = string.Format("Data Source={0},{1};Initial Catalog={2};User Id={3};Password={4}", LListStrDBProfile[0], LListStrDBProfile[1], LListStrDBProfile[2], LListStrDBProfile[3], "******");
                    LStrDBConnectProfile = "DataBase Type : MS SQL Server\n" + LStrDBConnectProfile;
                }
                if (IIntDatabaseType == 3)
                {
                    IStrDatabaseProfile  = string.Format("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0}) (PORT={1})))(CONNECT_DATA=(SERVICE_NAME= {2})));User Id={3}; Password={4}", LListStrDBProfile[0], LListStrDBProfile[1], LListStrDBProfile[2], LListStrDBProfile[3], LListStrDBProfile[4]);
                    LStrDBConnectProfile = string.Format("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0}) (PORT={1})))(CONNECT_DATA=(SERVICE_NAME= {2})));User Id={3}; Password={4}", LListStrDBProfile[0], LListStrDBProfile[1], LListStrDBProfile[2], LListStrDBProfile[3], "******");
                    LStrDBConnectProfile = "DataBase Type : Oracle\n" + LStrDBConnectProfile;
                }
                FileLog.WriteInfo("GetDatabaseConnectionProfile()", LStrDBConnectProfile);

                #endregion
            }
            catch (Exception)
            {
                Thread.Sleep(1000 * 10);
                IIntDatabaseType    = 0;
                IStrDatabaseProfile = string.Empty;
            }
        }
Example #27
0
        /// <summary>
        /// 写入操作日志
        /// </summary>
        /// <param name="AListStrOperationInfo">
        /// 0:客户端SessionID
        /// 1:模块ID                      2:功能操作编号                3:租户Token(5位)          4:操作用户ID
        /// 5:当前操作角色                6:机器名                      7:机器IP                    8:操作时间 UTC
        /// 9:操作结果                    10:操作内容对应的语言包ID     11:替换参数                 12:异常错误
        /// </param>
        /// <param name="AStrReturnCode"></param>
        /// <param name="AStrReturnMessage"></param>
        /// <returns></returns>
        public bool S01BOperation01(List <string> AListStrOperationInfo, ref string AStrReturnCode, ref string AStrReturnMessage)
        {
            bool             LBoolReturn             = true;
            string           LStrVerificationCode004 = string.Empty;
            string           LStrVerificationCode104 = string.Empty;
            SqlConnection    LSqlConnection          = null;
            OracleConnection LOracleConnection       = null;
            string           LStrSelectSQL           = string.Empty;
            List <string>    LListStrReplaceArgs     = new List <string>();
            List <string>    LListStrException       = new List <string>();

            try
            {
                #region 局部变量初始化、定义
                LStrVerificationCode004 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M004);
                LStrVerificationCode104 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);

                DataOperations01          LDataOperation     = new DataOperations01();
                DatabaseOperation01Return LDBOperationReturn = new DatabaseOperation01Return();
                #endregion

                #region 获取操作日志流水号
                string LStrOperationSerialID = string.Empty;
                if (AListStrOperationInfo[1] == "11000")
                {
                    LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(IIntDBType, IStrDBConnectProfile, 11, 901, AListStrOperationInfo[3], DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
                }
                else
                {
                    LDBOperationReturn = LDataOperation.GetSerialNumberByProcedure(IIntDBType, IStrDBConnectProfile, 11, 902, AListStrOperationInfo[3], DateTime.UtcNow.ToString("yyyyMMddHHmmss"));
                }
                if (!LDBOperationReturn.BoolReturn)
                {
                    //系统分配操作日志流水号失败
                    AStrReturnCode    = EncryptionAndDecryption.EncryptDecryptString("E01B01", LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    AStrReturnMessage = LDBOperationReturn.StrReturn;
                    return(false);
                }
                else
                {
                    LStrOperationSerialID = LDBOperationReturn.StrReturn;
                }
                #endregion

                #region 拆分替换参数和异常出错
                string LStrReplaceArgs = string.Empty;
                string LStrException   = string.Empty;
                LStrReplaceArgs = AListStrOperationInfo[11];
                LStrException   = AListStrOperationInfo[12];
                while (LStrReplaceArgs.Length > 1024)
                {
                    LListStrReplaceArgs.Add(LStrReplaceArgs.Substring(0, 1024));
                    LStrReplaceArgs = LStrReplaceArgs.Substring(1024);
                }
                if (!string.IsNullOrEmpty(LStrReplaceArgs))
                {
                    LListStrReplaceArgs.Add(LStrReplaceArgs);
                }
                while (LListStrReplaceArgs.Count < 5)
                {
                    LListStrReplaceArgs.Add("");
                }

                while (LStrException.Length > 1024)
                {
                    LListStrException.Add(LStrException.Substring(0, 1024));
                    LStrException = LStrException.Substring(1024);
                }
                if (!string.IsNullOrEmpty(LStrException))
                {
                    LListStrException.Add(LStrException);
                }
                while (LListStrException.Count < 5)
                {
                    LListStrException.Add("");
                }
                #endregion

                #region 将日志写入DataSet中
                //LStrSelectSQL = "SELECT * FROM T_11_901_" + AListStrOperationInfo[3] + " WHERE 1 = 2";
                LStrSelectSQL      = "SELECT * FROM T_11_901 WHERE 1 = 2";
                LDBOperationReturn = LDataOperation.SelectDataByDynamicSQL(IIntDBType, IStrDBConnectProfile, LStrSelectSQL);
                DataSet LDataSetSave2DB = LDBOperationReturn.DataSetReturn;
                LDataSetSave2DB.Tables[0].TableName = "T_11_901";
                DataRow LDataRowNewLog = LDataSetSave2DB.Tables[0].NewRow();
                LDataRowNewLog.BeginEdit();
                LDataRowNewLog["C001"] = long.Parse(LStrOperationSerialID);
                LDataRowNewLog["C002"] = long.Parse(AListStrOperationInfo[0]);
                LDataRowNewLog["C003"] = Int16.Parse(AListStrOperationInfo[1]);
                LDataRowNewLog["C004"] = long.Parse(AListStrOperationInfo[2]);
                LDataRowNewLog["C005"] = long.Parse(AListStrOperationInfo[4]);
                LDataRowNewLog["C006"] = AListStrOperationInfo[6];
                LDataRowNewLog["C007"] = AListStrOperationInfo[7];
                LDataRowNewLog["C008"] = long.Parse((DateTime.Parse(AListStrOperationInfo[8])).ToString("yyyyMMddHHmmss"));
                LDataRowNewLog["C009"] = AListStrOperationInfo[9];
                LDataRowNewLog["C010"] = AListStrOperationInfo[10];
                LDataRowNewLog["C011"] = LListStrReplaceArgs[0];
                LDataRowNewLog["C012"] = LListStrReplaceArgs[1];
                LDataRowNewLog["C013"] = LListStrReplaceArgs[2];
                LDataRowNewLog["C014"] = LListStrReplaceArgs[3];
                LDataRowNewLog["C015"] = LListStrReplaceArgs[4];
                LDataRowNewLog["C016"] = LListStrException[0];
                LDataRowNewLog["C017"] = LListStrException[1];
                LDataRowNewLog["C018"] = LListStrException[2];
                LDataRowNewLog["C019"] = LListStrException[3];
                LDataRowNewLog["C020"] = LListStrException[4];
                LDataRowNewLog["C021"] = long.Parse(AListStrOperationInfo[5]);
                LDataRowNewLog["C022"] = AListStrOperationInfo[3];
                LDataRowNewLog.EndEdit();
                LDataSetSave2DB.Tables[0].Rows.Add(LDataRowNewLog);
                #endregion

                #region 将操作日志写入MSSQL数据库
                if (IIntDBType == 2)
                {
                    LSqlConnection = new SqlConnection(IStrDBConnectProfile);
                    SqlDataAdapter    LSqlDataAdapter    = new SqlDataAdapter(LStrSelectSQL, LSqlConnection);
                    SqlCommandBuilder LSqlCommandBuilder = new SqlCommandBuilder();

                    LSqlCommandBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                    LSqlCommandBuilder.SetAllValues   = false;
                    LSqlCommandBuilder.DataAdapter    = LSqlDataAdapter;
                    LSqlDataAdapter.Update(LDataSetSave2DB, "T_11_901");
                    LDataSetSave2DB.AcceptChanges();
                    LSqlCommandBuilder.Dispose();
                    LSqlDataAdapter.Dispose();
                }
                #endregion

                #region 将操作日志写入Oracle数据库
                if (IIntDBType == 3)
                {
                    LOracleConnection = new OracleConnection(IStrDBConnectProfile);
                    OracleDataAdapter    LOracleDataAdapter    = new OracleDataAdapter(LStrSelectSQL, LOracleConnection);
                    OracleCommandBuilder LOracleCommandBuilder = new OracleCommandBuilder();

                    LOracleCommandBuilder.ConflictOption = ConflictOption.OverwriteChanges;
                    LOracleCommandBuilder.SetAllValues   = false;
                    LOracleCommandBuilder.DataAdapter    = LOracleDataAdapter;
                    LOracleDataAdapter.Update(LDataSetSave2DB, "T_11_901");
                    LDataSetSave2DB.AcceptChanges();
                    LOracleCommandBuilder.Dispose();
                    LOracleDataAdapter.Dispose();
                }
                #endregion
            }
            catch (Exception ex)
            {
                LBoolReturn       = false;
                AStrReturnCode    = EncryptionAndDecryption.EncryptDecryptString("E01B99", LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                AStrReturnMessage = "S01BOperations.S01BOperation01()\n" + ex.Message;
            }
            finally
            {
                if (LSqlConnection != null)
                {
                    if (LSqlConnection.State == System.Data.ConnectionState.Open)
                    {
                        LSqlConnection.Close();
                    }
                    LSqlConnection.Dispose();
                }
                if (LOracleConnection != null)
                {
                    if (LOracleConnection.State == ConnectionState.Open)
                    {
                        LOracleConnection.Close();
                    }
                    LOracleConnection.Dispose(); LOracleConnection = null;
                }
            }

            return(LBoolReturn);
        }
Example #28
0
        public List <string> GetSettedData(ref string AStrCallReturn)
        {
            List <string> LListStrReturn          = new List <string>();
            string        LStrVerificationCode004 = string.Empty;
            string        LStrRentName            = string.Empty;
            string        LStrRentToken           = string.Empty;
            string        LStrAdminPassword       = string.Empty;
            string        LStrConfirmPwd          = string.Empty;
            string        LStrDefaultLanguage     = string.Empty;
            int           LIntRentToken           = 0;

            try
            {
                LStrVerificationCode004 = App.CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M004);

                LStrRentName = TextBoxRentOrgName.Text.Trim();
                if (string.IsNullOrEmpty(LStrRentName))
                {
                    AStrCallReturn = "ER0026"; return(LListStrReturn);
                }
                LStrRentToken = TextBoxRentOrgToken.Text.Trim();
                if (string.IsNullOrEmpty(LStrRentToken))
                {
                    AStrCallReturn = "ER0027"; return(LListStrReturn);
                }
                if (!int.TryParse(LStrRentToken, out LIntRentToken))
                {
                    AStrCallReturn = "ER0027"; return(LListStrReturn);
                }
                if (LIntRentToken < 0 || LIntRentToken > 99999)
                {
                    AStrCallReturn = "ER0027"; return(LListStrReturn);
                }
                LStrRentToken = LIntRentToken.ToString("00000");

                LStrAdminPassword = PasswordBoxAdminPassword.Password;
                if (string.IsNullOrEmpty(LStrAdminPassword))
                {
                    AStrCallReturn = "ER0028"; return(LListStrReturn);
                }
                LStrConfirmPwd = PasswordBoxAdminConfirmPwd.Password;

                if (LStrAdminPassword != LStrConfirmPwd)
                {
                    AStrCallReturn = "ER0025"; return(LListStrReturn);
                }

                LStrAdminPassword = EncryptionAndDecryption.EncryptDecryptString(LStrAdminPassword, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);

                ComboBoxItem LComboBoxItemLanguage = ComboBoxDefaultLanguage.SelectedItem as ComboBoxItem;
                if (LComboBoxItemLanguage == null)
                {
                    AStrCallReturn = "ER0029"; return(LListStrReturn);
                }
                LStrDefaultLanguage = LComboBoxItemLanguage.DataContext.ToString();

                //0-租户名称
                LListStrReturn.Add(LStrRentName);
                //1-租户Token
                LListStrReturn.Add(LStrRentToken);
                //2-超级系统管理员密码
                LListStrReturn.Add(LStrAdminPassword);
                //3-系统默认界面显示语言
                LListStrReturn.Add(LStrDefaultLanguage);
            }
            catch { LListStrReturn.Clear(); }

            return(LListStrReturn);
        }
Example #29
0
        private void ActionSynchronousExtensionData()
        {
            string LStrDynamicSQL = string.Empty;
            string LStrTemp = string.Empty;
            string LStrUserDefaultPwd = string.Empty;
            string LStrVerificationCode002 = string.Empty;
            string LStrVerificationCode102 = string.Empty;
            string LStrDataTimeNow = string.Empty;
            string LStrDataID = string.Empty;
            SqlConnection LSqlConnection = null;
            OracleConnection LOracleConnection = null;

            string LStr11101001 = string.Empty;
            string LStr11101002 = string.Empty;
            string LStr11101012 = string.Empty;
            string LStr11101013 = string.Empty;
            string LStr11101014 = string.Empty;
            string LStr11101015 = string.Empty;
            string LStr11101017 = string.Empty;

            string LStrStep = string.Empty;

            try
            {
                DatabaseOperation01Return LDatabaseOperation01Return = new DatabaseOperation01Return();
                DataOperations01 LDataOperations01 = new DataOperations01();

                LStrVerificationCode002 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M002);
                LStrVerificationCode102 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M102);

                #region 获取租户列表
                LStrDynamicSQL = "SELECT * FROM T_00_121 ORDER BY C001";
                LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);

                //租户列表
                DataSet LDataSet00121 = LDatabaseOperation01Return.DataSetReturn;
                #endregion

                #region 获取所有录音服务器和录音、录屏通道
                List<string> LListStrServerRentInfo = new List<string>();

                LStrDynamicSQL = "SELECT * FROM T_11_101_00000 WHERE (C001 > 2210000000000000000 AND C001 < 2220000000000000000 AND C002 = 1) OR (C001 > 2310000000000000000 AND C001 < 2320000000000000000 AND C002 = 1)";
                LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                //所有录音录屏服务器
                DataSet LDataSet11101AllLGServer = LDatabaseOperation01Return.DataSetReturn;
                foreach (DataRow LDataRowSingleServer in LDataSet11101AllLGServer.Tables[0].Rows)
                {
                    LStr11101001 = LDataRowSingleServer["C001"].ToString();
                    LStr11101017 = LDataRowSingleServer["C017"].ToString();
                    LStr11101017 = LStr11101017.Substring(9);
                    LStr11101017 = EncryptionAndDecryption.EncryptDecryptString(LStr11101017, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                    LDataRowSingleServer["C017"] = LStr11101017;
                    //服务器19位编码 + char(27) + 服务器IP + char(27) + "未被分配"
                    LListStrServerRentInfo.Add(LStr11101001 + IStrSpliterChar + LStr11101017 + IStrSpliterChar + "0");
                }

                LStrDynamicSQL = "SELECT * FROM T_11_101_00000 WHERE (C001 > 2250000000000000000 AND C001 < 2260000000000000000 AND (C002 = 1 OR C002 = 2)) OR (C001 > 2320000000000000000 AND C001 < 2330000000000000000 AND (C002 = 1 OR C002 = 2)) ORDER BY C001, C002";
                LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                //所有录音录屏通道
                DataSet LDataSet11101AllLGChannel = LDatabaseOperation01Return.DataSetReturn;
                for (int LIntLoopChannel = 0; LIntLoopChannel < LDataSet11101AllLGChannel.Tables[0].Rows.Count; LIntLoopChannel++)
                {
                    //C001:通道编码 19 位
                    //C012:通道ID 0~2000
                    //C013:录音服务器IP
                    //C014:分机号
                    //C015:通道名
                    LStr11101002 = LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C002"].ToString();
                    if (LStr11101002 == "1")
                    {
                        LStr11101013 = LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C013"].ToString();
                        DataRow[] LDataRowArray = LDataSet11101AllLGServer.Tables[0].Select("C001 = " + LStr11101013);
                        LStr11101017 = LDataRowArray[0]["C017"].ToString();
                        LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C017"] = LStr11101017;
                    }
                    if (LStr11101002 == "2")
                    {
                        LStr11101001 = LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C001"].ToString();
                        LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel - 1]["C014"] = LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C012"].ToString();
                        if (LStr11101001.Substring(0, 3) == "225")
                        {
                            LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel - 1]["C015"] = LDataSet11101AllLGChannel.Tables[0].Rows[LIntLoopChannel]["C011"].ToString();
                        }
                    }
                }

                #endregion

                #region 获取租户租用的服务器
                string LStrRentBegin = string.Empty, LStrRentEnd = string.Empty;
                string LStr11201004 = string.Empty;

                List<string> LListStrRentToken = new List<string>();
                List<List<string>> LListListRentServer = new List<List<string>>();

                foreach (DataRow LDataRowSingleRent in LDataSet00121.Tables[0].Rows)
                {
                    LStrRentBegin = LDataRowSingleRent["C011"].ToString();
                    LStrRentEnd = LDataRowSingleRent["C012"].ToString();
                    LStrRentBegin = EncryptionAndDecryption.EncryptDecryptString(LStrRentBegin, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                    LStrRentEnd = EncryptionAndDecryption.EncryptDecryptString(LStrRentEnd, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);

                    LStrTemp = LDataRowSingleRent["C021"].ToString();
                    LStrTemp = EncryptionAndDecryption.EncryptDecryptString(LStrTemp, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                    LStrDataID = LDataRowSingleRent["C001"].ToString();

                    //租户Token + char(27) + 租户19位编码
                    LListStrRentToken.Add(LStrTemp + IStrSpliterChar + LStrDataID);

                    List<string> LListStrRentServerInfo = new List<string>();

                    if (DateTime.Parse(LStrRentBegin) <= DateTime.UtcNow && DateTime.Parse(LStrRentEnd) >= DateTime.UtcNow)
                    {
                        LStrDynamicSQL = "SELECT * FROM T_11_201_" + LStrTemp + " WHERE C003 = " + LStrDataID + " AND ((C004 > 2210000000000000000 AND C004 < 2220000000000000000) OR (C004 > 2310000000000000000 AND C004 < 2320000000000000000))";
                        LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);

                        foreach (DataRow LDataRowRentSingleServer in LDatabaseOperation01Return.DataSetReturn.Tables[0].Rows)
                        {
                            LStr11201004 = LDataRowRentSingleServer["C004"].ToString();
                            DataRow[] LDataRowArray = LDataSet11101AllLGServer.Tables[0].Select("C001 = " + LStr11201004);
                            if (LDataRowArray.Length > 0)
                            {
                                LStr11101017 = LDataRowArray[0]["C017"].ToString();
                                //服务器19位编码 + char(27) + 服务器IP
                                LListStrRentServerInfo.Add(LStr11201004 + IStrSpliterChar + LStr11101017);
                            }
                        }
                    }
                    LListListRentServer.Add(LListStrRentServerInfo);
                }
                #endregion

                #region 将未分配给租户的服务器全部分配给顶级租户

                for (int LIntLoopServer = 0; LIntLoopServer < LListStrServerRentInfo.Count; LIntLoopServer++)
                {
                    foreach (List<string> LListStrRentServerInfo in LListListRentServer)
                    {
                        foreach (string LStrsingleServer in LListStrRentServerInfo)
                        {
                            if ((LStrsingleServer + IStrSpliterChar + "0") == LListStrServerRentInfo[LIntLoopServer])
                            {
                                string[] LStrArrayTemp = LStrsingleServer.Split(IStrSpliterChar.ToCharArray());
                                LListStrServerRentInfo[LIntLoopServer] = LStrArrayTemp[0] + IStrSpliterChar + LStrArrayTemp[1] + IStrSpliterChar + "1";
                            }
                        }
                    }
                }

                foreach (string LStrUnRentServer in LListStrServerRentInfo)
                {
                    string[] LStrArrayTemp = LStrUnRentServer.Split(IStrSpliterChar.ToCharArray());
                    if (LStrArrayTemp[2] == "0")
                    {
                        //List<string> LListTemp = new List<string>();
                        //LListTemp.Add(LStrArrayTemp[0] + IStrSpliterChar + LStrArrayTemp[1]);
                        LListListRentServer[0].Add(LStrArrayTemp[0] + IStrSpliterChar + LStrArrayTemp[1]);
                    }
                }
                #endregion

                #region 检查租户分机资源是否在原始配置资源中,如果不在,则从表中删除
                bool LBoolRented = false;
                List<string> LListStrRentServers = new List<string>();
                for (int LIntLoopRent = 0; LIntLoopRent < LListStrRentToken.Count; LIntLoopRent++)
                {
                    LListStrRentServers.Clear();
                    string[] LStrRentBasicArray = LListStrRentToken[LIntLoopRent].Split(IStrSpliterChar.ToCharArray());
                    foreach (string LStrRentServices in LListListRentServer[LIntLoopRent])
                    {
                        string[] LStrServerArray = LStrRentServices.Split(IStrSpliterChar.ToCharArray());
                        LListStrRentServers.Add(LStrServerArray[1]);
                    }
                    LStrDynamicSQL = "SELECT * FROM T_11_101_" + LStrRentBasicArray[0] + " WHERE C001 > 1040000000000000000 AND C001 < 1050000000000000000 AND C002 = 1";
                    LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                    if (!LDatabaseOperation01Return.BoolReturn) { continue; }
                    foreach (DataRow LDataRowSingleChannel in LDatabaseOperation01Return.DataSetReturn.Tables[0].Rows)
                    {
                        LStr11101001 = LDataRowSingleChannel["C001"].ToString();
                        LStr11101017 = LDataRowSingleChannel["C017"].ToString();
                        LStrStep = LStr11101017;
                        LStr11101017 = EncryptionAndDecryption.EncryptDecryptString(LStr11101017, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                        string[] LStrExtensionServerIP = LStr11101017.Split(IStrSpliterChar.ToCharArray());
                        if (LStrExtensionServerIP.Length < 2)
                        {
                            //WriteEntryLog("ActionSynchronousExtensionData()\nError Extension\n{" + LStrStep + "}", EventLogEntryType.Warning);
                            continue;
                        }
                        
                        LBoolRented = false;
                        foreach (string LStrSingleServer in LListStrRentServers)
                        {
                            if (LStrSingleServer == LStrExtensionServerIP[1]) { LBoolRented = true; break; }
                        }
                        if (!LBoolRented)
                        {
                            LStrDynamicSQL = "UPDATE T_11_101_" + LStrRentBasicArray[0] + " SET C012 = '0' WHERE C001 = " + LStr11101001;
                            LDataOperations01.ExecuteDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                        }
                        else
                        {
                            DataRow[] LDataRowFindChannel = LDataSet11101AllLGChannel.Tables[0].Select("C002 = 1 AND C013 = '" + LStrExtensionServerIP[1] + "' AND C014 = '" + LStrExtensionServerIP[0] + "'");
                            if (LDataRowFindChannel == null || LDataRowFindChannel.Length <= 0)
                            {
                                LStrDynamicSQL = "UPDATE T_11_101_" + LStrRentBasicArray[0] + " SET C012 = '0' WHERE C001 = " + LStr11101001;
                                LDataOperations01.ExecuteDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                            }
                        }
                    }
                }
                #endregion

                #region 遍历所有Channel,添加到对应的租户中
                //C001:通道编码 19 位
                //C012:通道ID 0~2000
                //C017:录音服务器IP
                //C014:分机号
                //C015:通道名
                for (int LIntLoopRent = 0; LIntLoopRent < LListStrRentToken.Count; LIntLoopRent++)
                {
                    string[] LStrRentBasicArray = LListStrRentToken[LIntLoopRent].Split(IStrSpliterChar.ToCharArray());

                    #region 获取新用户默认密码
                    LStrDynamicSQL = "SELECT C006 FROM T_11_001_" + LStrRentBasicArray[0] + " WHERE C003 = 11010501";
                    LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                    DataSet LDataSet11010501 = LDatabaseOperation01Return.DataSetReturn;
                    LStrUserDefaultPwd = LDataSet11010501.Tables[0].Rows[0][0].ToString();
                    LStrUserDefaultPwd = EncryptionAndDecryption.EncryptDecryptString(LStrUserDefaultPwd, LStrVerificationCode102, EncryptionAndDecryption.UMPKeyAndIVType.M102);
                    LStrUserDefaultPwd = LStrUserDefaultPwd.Substring(8);
                    #endregion

                    foreach (string LStrRentServices in LListListRentServer[LIntLoopRent])
                    {
                        string[] LStrServerArray = LStrRentServices.Split(IStrSpliterChar.ToCharArray());

                        DataRow[] LDataRowChannelBasic = LDataSet11101AllLGChannel.Tables[0].Select("C002 = 1 AND C017 = '" + LStrServerArray[1] + "'");
                        foreach (DataRow LDataRowSingleChannel in LDataRowChannelBasic)
                        {
                            LStr11101014 = LDataRowSingleChannel["C014"].ToString();
                            LStr11101013 = LStrServerArray[1];
                            LStr11101001 = LDataRowSingleChannel["C001"].ToString();
                            LStr11101012 = LDataRowSingleChannel["C012"].ToString();
                            LStr11101015 = LDataRowSingleChannel["C015"].ToString();
                            LStr11101017 = LDataRowSingleChannel["C017"].ToString();

                            LStrTemp = EncryptionAndDecryption.EncryptDecryptString(LStr11101014 + IStrSpliterChar + LStr11101013, LStrVerificationCode002, EncryptionAndDecryption.UMPKeyAndIVType.M002);
                            LStrDynamicSQL = "SELECT * FROM T_11_101_" + LStrRentBasicArray[0] + " WHERE C001 IN (SELECT C001 FROM T_11_101_" + LStrRentBasicArray[0] + " WHERE C001 > 1040000000000000000 AND C001 < 1050000000000000000 AND C017 = '" + LStrTemp + "') ORDER BY C002";

                            LDatabaseOperation01Return = LDataOperations01.SelectDataByDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                            DataSet LDataSetSave2DBBI = LDatabaseOperation01Return.DataSetReturn;
                            LDataSetSave2DBBI.Tables[0].TableName = "T_11_101_" + LStrRentBasicArray[0];
                            if (LDataSetSave2DBBI.Tables[0].Rows.Count <= 0)
                            {
                                LStrDataID = GetSerialIDByType(IIntDatabaseType, IStrDatabaseProfile, LStrRentBasicArray[0], 11, 104).ToString();
                                //LStrUserDefaultPwd = EncryptionAndDecryption.EncryptDecryptString(LStrDataID + LStrUserDefaultPwd, LStrVerificationCode002, EncryptionAndDecryption.UMPKeyAndIVType.M002);
                                #region 如果是新增分机,初始化2行数据
                                for (int LIntAddRow = 1; LIntAddRow <= 2; LIntAddRow++)
                                {
                                    DataRow LDataRowNewData = LDataSetSave2DBBI.Tables[0].NewRow();
                                    LDataRowNewData.BeginEdit();
                                    LDataRowNewData["C001"] = long.Parse(LStrDataID);
                                    LDataRowNewData["C002"] = LIntAddRow;
                                    if (LIntAddRow == 1)
                                    {
                                        LDataRowNewData["C011"] = "101" + LStrRentBasicArray[0] + "00000000001";
                                        LDataRowNewData["C012"] = "1";
                                        LDataRowNewData["C013"] = "1";
                                        LDataRowNewData["C014"] = "0";
                                        LDataRowNewData["C015"] = "N";
                                        LDataRowNewData["C016"] = "09";
                                        LDataRowNewData["C017"] = LStrTemp;
                                        LDataRowNewData["C020"] = EncryptionAndDecryption.EncryptStringSHA512(LStrDataID + LStrUserDefaultPwd, LStrVerificationCode002, EncryptionAndDecryption.UMPKeyAndIVType.M002); ;
                                    }
                                    if (LIntAddRow == 2)
                                    {
                                        LDataRowNewData["C011"] = "2014/01/01 00:00:00";
                                        LDataRowNewData["C012"] = "0";
                                        LDataRowNewData["C013"] = "0";
                                    }
                                    LDataRowNewData.EndEdit();
                                    LDataSetSave2DBBI.Tables[0].Rows.Add(LDataRowNewData);

                                    if (IIntDatabaseType == 2)
                                    {
                                        LStrDynamicSQL = "INSERT INTO T_11_201_" + LStrRentBasicArray[0] + " VALUES(0, 0, 102" + LStrRentBasicArray[0] + "00000000001, " + LStrDataID + ", '2014-01-01 00:00:00', '2199-12-31 23:59:59')";
                                    }
                                    else
                                    {
                                        LStrDynamicSQL = "INSERT INTO T_11_201_" + LStrRentBasicArray[0] + " VALUES(0, 0, 102" + LStrRentBasicArray[0] + "00000000001, " + LStrDataID + ", TO_DATE('2014-01-01 00:00:00','yyyy-MM-dd HH24:mi:ss'), TO_DATE('2199-12-31 23:59:59','yyyy-MM-dd HH24:mi:ss'))";
                                    }
                                    LDataOperations01.ExecuteDynamicSQL(IIntDatabaseType, IStrDatabaseProfile, LStrDynamicSQL);
                                }
                                #endregion

                            }
                            LStrDataID = LDataSetSave2DBBI.Tables[0].Rows[0]["C001"].ToString();

                            #region 更新分机信息
                            LDataSetSave2DBBI.Tables[0].Rows[0]["C012"] = "1";
                            LDataSetSave2DBBI.Tables[0].Rows[0]["C018"] = LStr11101015;
                            LStr11101013 = LDataRowSingleChannel["C013"].ToString();
                            //WriteEntryLog("LStr11101013 = " + LStr11101013, EventLogEntryType.Warning);
                            if (LStr11101013.Substring(0, 3) == "221")
                            {
                                //LDataSetSave2DBBI.Tables[0].Rows[1]["C015"] = LStr11101017;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C015"] = LStr11101013;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C016"] = LStr11101012;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C017"] = LStr11101001;
                            }
                            else
                            {
                                //LDataSetSave2DBBI.Tables[0].Rows[1]["C018"] = LStr11101017;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C018"] = LStr11101013;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C019"] = LStr11101012;
                                LDataSetSave2DBBI.Tables[0].Rows[1]["C020"] = LStr11101001;
                            }
                            #endregion

                            #region 将数据保存到MSSQL数据库
                            if (IIntDatabaseType == 2)
                            {
                                LSqlConnection = new SqlConnection(IStrDatabaseProfile);

                                LStrDynamicSQL = "SELECT * FROM T_11_101_" + LStrRentBasicArray[0] + " WHERE C001 = " + LStrDataID + " ORDER BY C002 ASC";
                                SqlDataAdapter LSqlDataAdapter1 = new SqlDataAdapter(LStrDynamicSQL, LSqlConnection);
                                SqlCommandBuilder LSqlCommandBuilder1 = new SqlCommandBuilder();

                                LSqlCommandBuilder1.ConflictOption = ConflictOption.OverwriteChanges;
                                LSqlCommandBuilder1.SetAllValues = false;
                                LSqlCommandBuilder1.DataAdapter = LSqlDataAdapter1;
                                LSqlDataAdapter1.Update(LDataSetSave2DBBI, "T_11_101_" + LStrRentBasicArray[0]);
                                LDataSetSave2DBBI.AcceptChanges();
                                LSqlCommandBuilder1.Dispose();
                                LSqlDataAdapter1.Dispose();
                            }
                            #endregion

                            #region 将数据保存到Oracle数据库
                            if (IIntDatabaseType == 3)
                            {
                                LOracleConnection = new OracleConnection(IStrDatabaseProfile);

                                LStrDynamicSQL = "SELECT * FROM T_11_101_" + LStrRentBasicArray[0] + " WHERE C001 = " + LStrDataID + " ORDER BY C002 ASC";
                                OracleDataAdapter LOracleDataAdapter1 = new OracleDataAdapter(LStrDynamicSQL, LOracleConnection);
                                OracleCommandBuilder LOracleCommandBuilder1 = new OracleCommandBuilder();

                                LOracleCommandBuilder1.ConflictOption = ConflictOption.OverwriteChanges;
                                LOracleCommandBuilder1.SetAllValues = false;
                                LOracleCommandBuilder1.DataAdapter = LOracleDataAdapter1;
                                LOracleDataAdapter1.Update(LDataSetSave2DBBI, "T_11_101_" + LStrRentBasicArray[0]);
                                LDataSetSave2DBBI.AcceptChanges();
                                LOracleCommandBuilder1.Dispose();
                                LOracleDataAdapter1.Dispose();
                            }
                            #endregion
                        }
                    }
                }
                #endregion

            }
            catch (Exception ex)
            {
                IBooInSynchronous = false;
                IBoolCanAbortSynchronous = true;
                WriteEntryLog("ActionSynchronousExtensionData()\n" + LStrStep + "\n" + ex.ToString(), EventLogEntryType.Error);
            }
            finally
            {
                if (LSqlConnection != null)
                {
                    if (LSqlConnection.State == System.Data.ConnectionState.Open) { LSqlConnection.Close(); }
                    LSqlConnection.Dispose();
                }
                if (LOracleConnection != null)
                {
                    if (LOracleConnection.State == ConnectionState.Open) { LOracleConnection.Close(); }
                    LOracleConnection.Dispose(); LOracleConnection = null;
                }
            }
        }
Example #30
0
        /// <summary>
        /// 向XML文件中写入数据库连接参数信息,通知 Service 00 重新获得数据库连接参数
        /// </summary>
        /// <param name="AListStringArgs">
        /// 0-数据库类型
        /// 1-数据库服务器
        /// 2-端口
        /// 3-登录名
        /// 4-登录密码
        /// 5-数据库名或服务名
        /// 6-当前版本
        /// </param>
        /// <returns></returns>
        private OperationDataArgs OperationA90(List <string> AListStringArgs)
        {
            OperationDataArgs LOperationReturn        = new OperationDataArgs();
            string            LStrXmlFileName         = string.Empty;
            string            LStrVerificationCode004 = string.Empty;
            string            LStrVerificationCode104 = string.Empty;
            string            LStrP02 = string.Empty;
            string            LStrP04 = string.Empty, LStrP05 = string.Empty, LStrP06 = string.Empty, LStrP07 = string.Empty, LStrP08 = string.Empty;
            string            LStrP09           = string.Empty;
            string            LStrLoginPassword = string.Empty;

            string LStrDBConnectProfile = string.Empty;
            string LStrDynamicSQL       = string.Empty;

            int       LIntHttpBindingPort = 0;
            int       LIntService01Port   = 0;
            string    LStrCallReturn      = string.Empty;
            string    LStrSendMessage     = string.Empty;
            TcpClient LTcpClient          = null;
            SslStream LSslStream          = null;

            try
            {
                LStrVerificationCode004 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M004);
                LStrVerificationCode104 = CreateVerificationCode(EncryptionAndDecryption.UMPKeyAndIVType.M104);

                LStrLoginPassword = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[4], LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);

                #region 保存数据库连接信息至 UMP.Server\Args01.UMP.xml
                LStrXmlFileName = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                LStrXmlFileName = Path.Combine(LStrXmlFileName, @"UMP.Server\Args01.UMP.xml");

                XmlDocument LXmlDocArgs01 = new XmlDocument();
                LXmlDocArgs01.Load(LStrXmlFileName);
                XmlNodeList LXmlNodeListDatabaseParameters = LXmlDocArgs01.SelectSingleNode("DatabaseParameters").ChildNodes;
                foreach (XmlNode LXmlNodeSingleDatabaseParameter in LXmlNodeListDatabaseParameters)
                {
                    LXmlNodeSingleDatabaseParameter.Attributes["P03"].Value = EncryptionAndDecryption.EncryptDecryptString("0", LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP02 = LXmlNodeSingleDatabaseParameter.Attributes["P02"].Value;
                    LStrP02 = EncryptionAndDecryption.EncryptDecryptString(LStrP02, LStrVerificationCode104, EncryptionAndDecryption.UMPKeyAndIVType.M104);
                    if (LStrP02 != AListStringArgs[0])
                    {
                        continue;
                    }
                    LXmlNodeSingleDatabaseParameter.Attributes["P03"].Value = EncryptionAndDecryption.EncryptDecryptString("1", LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP04 = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[1], LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP05 = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[2], LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP06 = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[5], LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP07 = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[3], LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP08 = EncryptionAndDecryption.EncryptDecryptString(LStrLoginPassword, LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                    LStrP09 = EncryptionAndDecryption.EncryptDecryptString(AListStringArgs[6], LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);

                    LXmlNodeSingleDatabaseParameter.Attributes["P04"].Value = LStrP04;
                    LXmlNodeSingleDatabaseParameter.Attributes["P05"].Value = LStrP05;
                    LXmlNodeSingleDatabaseParameter.Attributes["P06"].Value = LStrP06;
                    LXmlNodeSingleDatabaseParameter.Attributes["P07"].Value = LStrP07;
                    LXmlNodeSingleDatabaseParameter.Attributes["P08"].Value = LStrP08;
                    LXmlNodeSingleDatabaseParameter.Attributes["P09"].Value = LStrP09;
                }
                LXmlDocArgs01.Save(LStrXmlFileName);
                #endregion

                #region 将创建的版本信息写入到 T_00_000
                string LStrSelectC000 = AscCodeToChr(27) + AscCodeToChr(27) + AscCodeToChr(27) + AscCodeToChr(27) + "1";
                if (AListStringArgs[0] == "2")
                {
                    LStrDBConnectProfile = string.Format("Data Source={0},{1};Initial Catalog={2};User Id={3};Password={4}", AListStringArgs[1], AListStringArgs[2], AListStringArgs[5], AListStringArgs[3], LStrLoginPassword);
                    LStrDynamicSQL       = "INSERT INTO T_00_000(C000, C001, C002, C003, C004, C005) VALUES('" + LStrSelectC000 + "', 'CreateDB', '" + AListStringArgs[6] + "', 'CREATEDB', '1', GETUTCDATE())";
                }
                if (AListStringArgs[0] == "3")
                {
                    LStrDBConnectProfile = string.Format("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0}) (PORT={1})))(CONNECT_DATA=(SERVICE_NAME= {2})));User Id={3}; Password={4}", AListStringArgs[1], AListStringArgs[2], AListStringArgs[5], AListStringArgs[3], LStrLoginPassword);
                    LStrDynamicSQL       = "INSERT INTO T_00_000(C000, C001, C002, C003, C004, C005) VALUES('" + LStrSelectC000 + "', 'CreateDB', '" + AListStringArgs[6] + "', 'CREATEDB', '1', F_00_004())";
                }
                DataOperations01          LDataOperations            = new DataOperations01();
                DatabaseOperation01Return LDatabaseOperation01Return = LDataOperations.SelectDataByDynamicSQL(int.Parse(AListStringArgs[0]), LStrDBConnectProfile, LStrDynamicSQL);
                if (!LDatabaseOperation01Return.BoolReturn)
                {
                    LOperationReturn.BoolReturn   = false;
                    LOperationReturn.StringReturn = LDatabaseOperation01Return.StrReturn;
                    return(LOperationReturn);
                }
                #endregion

                #region 通知 Service 00 重新获得数据库连接参数
                LStrSendMessage = EncryptionAndDecryption.EncryptDecryptString("M01C01", LStrVerificationCode004, EncryptionAndDecryption.UMPKeyAndIVType.M004);
                foreach (string LStrSingleArgs in AListStringArgs)
                {
                    LStrSendMessage += AscCodeToChr(27) + LStrSingleArgs;
                }
                LIntHttpBindingPort = GetIISHttpBindingPort(ref LStrCallReturn);
                if (LIntHttpBindingPort <= 0)
                {
                    LOperationReturn.BoolReturn   = false;
                    LOperationReturn.StringReturn = "GetIISHttpBindingPort()\n" + LStrCallReturn;
                    return(LOperationReturn);
                }
                LIntService01Port = LIntHttpBindingPort - 1;
                if (LIntService01Port == 8009)
                {
                    LIntService01Port = 8008;
                }
                try
                {
                    LTcpClient = new TcpClient("127.0.0.1", LIntService01Port);
                    LSslStream = new SslStream(LTcpClient.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null);
                    LSslStream.AuthenticateAsClient("VoiceCyber.PF", null, SslProtocols.Default, false);
                    byte[] LByteMesssage = Encoding.UTF8.GetBytes(LStrSendMessage + "\r\n");
                    LSslStream.Write(LByteMesssage); LSslStream.Flush();
                }
                catch { }
                #endregion
            }
            catch (Exception ex)
            {
                LOperationReturn.BoolReturn   = false;
                LOperationReturn.StringReturn = "OperationA90()\n" + ex.ToString();
            }
            finally
            {
                if (LSslStream != null)
                {
                    LSslStream.Close();
                }
                if (LTcpClient != null)
                {
                    LTcpClient.Close();
                }
            }

            return(LOperationReturn);
        }