Пример #1
0
        /// <summary>
        /// Инициализируем главную форму
        /// </summary>
        /// <param name="args">аргументы прилдожения</param>
        public MainForm(string[] args = null)
        {
            InitializeComponent();
            form = this;
            OptionsForm optionsForm = new OptionsForm();
            cbBrowsers.SelectedIndex = cbBrowsers.FindString("FireFox");
            tcMain.Selected += new System.Windows.Forms.TabControlEventHandler(this.tc_TabSelect_Log);
            cbUrlsCheckPageOnErrors.CheckedChanged += new System.EventHandler(this.cbCheckUrl1_VisibleChild);
            cmbboxConnType.TextChanged += new System.EventHandler(this.cmbboxConnType_TextChanged);
            cmbboxConnType.TextChanged += new System.EventHandler(this.cmbboxConnType_TextChanged1);
            Shared.browserName = MainForm.form.cbBrowsers.SelectedItem.ToString();
            cmbboxConnType.SelectedIndex = 0;
            dataGVResult.Visible = false;
            tbLog.Visible = true;
            //перемещаем последний лог в архив
            if (File.Exists(Shared.StartupPath + "log.html"))
            {
                File.AppendAllText(Shared.StartupPath + "ArchiveLog.html", File.ReadAllText(Shared.StartupPath + "log.html"));
                File.Delete(Shared.StartupPath + "log.html");
            }

            //начинаем работу
            //Log.Gap();
            Log.PlainTextToHTMLLog("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">");
            Log.PlainTextToHTMLLog("<div style=\"margin: 50px 0px 0px 50px;\"></div>");
            Log.PlainTextToHTMLLog("<head><style>.plus, .minus { display: inline-block; padding-left: 20px;}.plus { background: url(plus.gif) no-repeat 5px 5px;} .minus { background: url(minus.gif) no-repeat 5px 5px; }</style><script>function collapse(id, link){var block = document.getElementById(id); if (block.style.display == \"none\"){block.style.display = \"block\";link.className = \"minus\";	}else{block.style.display = \"none\";link.className = \"plus\";}return false;}function collapseSpan(id, link){var block = document.getElementById(id);if (block.style.display == \"none\"){block.style.display = \"block\";}else{block.style.display =\"none\";}return false;}</script></head>");
            Log.MesNormal("============ новая сессия " + DateTime.Now + " ============", false);
            Log.Gap();

            XmlDocument reader = new XmlDocument();
            reader.Load("options.xml");

            if (File.Exists("options.xml") == false)
                File.Create("options.xml");

            MainForm.form.tbCheckUrlsUrlToCheck.Text = reader.GetValue("/Options/CheckUrls_options/url");
            MainForm.form.tbCheckUrlsLogin.Text = reader.GetValue("/Options/CheckUrls_options/login");
            MainForm.form.tbCheckUrlsPass.Text = reader.GetValue("/Options/CheckUrls_options/password");
        }
Пример #2
0
 public DbUpdateConfig(XmlDocument xmlConfig)
 {
     ProviderType = xmlConfig.GetValue(ToolConfigNames.Provider);
       ConnectionString = xmlConfig.GetValue(ToolConfigNames.ConnectionString);
       Driver = ToolHelper.CreateDriver(ProviderType, ConnectionString);
       ModelUpdateOptions = ReflectionHelper.ParseEnum<DbUpgradeOptions>(xmlConfig.GetValue(ToolConfigNames.ModelUpdateOptions));
       DbOptions = ReflectionHelper.ParseEnum<DbOptions>(xmlConfig.GetValue(ToolConfigNames.DbOptions));
       AssemblyPath = xmlConfig.GetValue(ToolConfigNames.AssemblyPath);
       AppClassName = xmlConfig.GetValue(ToolConfigNames.AppClassName);
       OutputPath = xmlConfig.GetValue(ToolConfigNames.OutputPath);
 }
Пример #3
0
        public DbFirstConfig(XmlDocument xmlConfig)
        {
            ProviderType = xmlConfig.GetValue(ToolConfigNames.Provider);
              ConnectionString = xmlConfig.GetValue(ToolConfigNames.ConnectionString);
              Driver = ToolHelper.CreateDriver(ProviderType, ConnectionString);
              Options = ReflectionHelper.ParseEnum<DbFirstOptions>(xmlConfig.GetValue(ToolConfigNames.Options));
              Schemas = xmlConfig.GetValueList(ToolConfigNames.Schemas);
              OutputPath = xmlConfig.GetValue(ToolConfigNames.OutputPath);
              Namespace = xmlConfig.GetValue(ToolConfigNames.Namespace);
              AppClassName = xmlConfig.GetValue(ToolConfigNames.AppClassName);

              var autoValueSpec = xmlConfig.GetValue(ToolConfigNames.AutoValues);
              AutoValues = ParseAutoValuesSpec(autoValueSpec);
              var dataTypesSpec = xmlConfig.GetValue(ToolConfigNames.ForceDataTypes);
              ForceDataTypes = ParseDataTypesSpec(dataTypesSpec);
              IgnoreTables = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
              var ignoreList = xmlConfig.GetValue(ToolConfigNames.IgnoreTables);
              if(!string.IsNullOrWhiteSpace(ignoreList))
            IgnoreTables.UnionWith(ignoreList.Split(new [] {',', ';'}, StringSplitOptions.RemoveEmptyEntries));
        }
Пример #4
0
        /// <summary>
        /// Returns list of all transactions in OFX document
        /// </summary>
        /// <param name="doc">OFX document</param>
        /// <returns>List of transactions found in OFX document</returns>
        private void ImportTransations(OFXDocument ofxDocument, XmlDocument doc)
        {
            var xpath = GetXPath(ofxDocument.AccType, OFXSection.TRANSACTIONS);

             ofxDocument.StatementStart = doc.GetValue(xpath + "/DTSTART").ToDate();
             ofxDocument.StatementEnd = doc.GetValue(xpath + "/DTEND").ToDate();

             var transactionNodes = doc.SelectNodes(xpath + "/STMTTRN");

             ofxDocument.Transactions = new List<Transaction>();

             foreach (XmlNode node in transactionNodes)
            ofxDocument.Transactions.Add(new Transaction(node, ofxDocument.Currency));
        }
Пример #5
0
        /// <summary>
        /// Метод читает все опции из options.xml и записывает их в форму OptionsForm
        /// </summary>
        public static void OptionsRead()
        {
            XmlDocument reader = new XmlDocument();
            reader.Load("options.xml");

            if (File.Exists("options.xml") == false)
                File.Create("options.xml");

            #region Пути к установкам
            //пути к установкам BB
            foreach (XmlElement el in reader.DocumentElement.SelectNodes("/Options/PathToFolderWhereToInstall/edition[@title='BB']"))
            {
                OptionsForm.form.tbPathBB_mysql.Text = el.SelectSingleNode("mysql") != null ? el.SelectSingleNode("mysql").InnerText : "";
            }

            #endregion

            #region Урлы установок
            //BB
            foreach (XmlElement el in reader.DocumentElement.SelectNodes("/Options/URLS/edition[@title='BB']"))
            {
                OptionsForm.form.tbURL_BB_mysql.Text = el.SelectSingleNode("mysql") != null ? el.SelectSingleNode("mysql").InnerText : "";
            }

            #endregion

            //строки подключения к базам
            OptionsForm.form.tbConString_mysql.Text = reader.GetValue("/Options/ConnectionString/mysql");
            OptionsForm.form.tbConString_mysql_port.Text = reader.GetValue("/Options/ConnectionString/mysql_port");

            //путь к firefox.exe и профилю
            OptionsForm.form.tbPathToFfExe.Text = reader.GetValue("/Options/firefox_options/pathToFirefoxExe");
            OptionsForm.form.tbPathToFfProfile.Text = reader.GetValue("/Options/firefox_options/pathToFirefoxProfile");

            #region пользователи
            foreach (XmlElement el in reader.DocumentElement.SelectNodes("/Options/users/user[@profile='Admin']"))
            {
                OptionsForm.form.tb_usr_Admin_Name.Text = el.SelectSingleNode("Name").InnerText != "" ? el.SelectSingleNode("Name").InnerText : "";
                OptionsForm.form.tb_usr_Admin_LastName.Text = el.SelectSingleNode("LastName").InnerText != "" ? el.SelectSingleNode("LastName").InnerText : "";
                OptionsForm.form.tb_usr_Admin_Email.Text = el.SelectSingleNode("Email").InnerText != "" ? el.SelectSingleNode("Email").InnerText : "";
                OptionsForm.form.tb_usr_Admin_Login.Text = el.SelectSingleNode("Login").InnerText != "" ? el.SelectSingleNode("Login").InnerText : "admin";
                OptionsForm.form.tb_usr_Admin_Password.Text = el.SelectSingleNode("Password").InnerText != "" ? el.SelectSingleNode("Password").InnerText : "111111";
                OptionsForm.form.tb_usr_Admin_Ava.Text = el.SelectSingleNode("Avatar").InnerText != "" ? el.SelectSingleNode("Avatar").InnerText : "";
            }
            foreach (XmlElement el in reader.DocumentElement.SelectNodes("/Options/users/user[@profile='Intra1']"))
            {
                OptionsForm.form.tb_usr_Intra1_Name.Text = el.SelectSingleNode("Name").InnerText != "" ? el.SelectSingleNode("Name").InnerText : "Семен";
                OptionsForm.form.tb_usr_Intra1_LastName.Text = el.SelectSingleNode("LastName").InnerText != "" ? el.SelectSingleNode("LastName").InnerText : "Синичкин";
                OptionsForm.form.tb_usr_Intra1_Email.Text = el.SelectSingleNode("Email").InnerText != "" ? el.SelectSingleNode("Email").InnerText : "";
                OptionsForm.form.tb_usr_Intra1_Login.Text = el.SelectSingleNode("Login").InnerText != "" ? el.SelectSingleNode("Login").InnerText : "s***n";
                OptionsForm.form.tb_usr_Intra1_Password.Text = el.SelectSingleNode("Password").InnerText != "" ? el.SelectSingleNode("Password").InnerText : "111111";
                OptionsForm.form.tb_usr_Intra1_Ava.Text = el.SelectSingleNode("Avatar").InnerText != "" ? el.SelectSingleNode("Avatar").InnerText : "avatar_semen.jpg";
            }
            foreach (XmlElement el in reader.DocumentElement.SelectNodes("/Options/users/user[@profile='Intra2']"))
            {
                OptionsForm.form.tb_usr_Intra2_Name.Text = el.SelectSingleNode("Name").InnerText != "" ? el.SelectSingleNode("Name").InnerText : "Иван";
                OptionsForm.form.tb_usr_Intra2_LastName.Text = el.SelectSingleNode("LastName").InnerText != "" ? el.SelectSingleNode("LastName").InnerText : "Иванов";
                OptionsForm.form.tb_usr_Intra2_Email.Text = el.SelectSingleNode("Email").InnerText != "" ? el.SelectSingleNode("Email").InnerText : "";
                OptionsForm.form.tb_usr_Intra2_Login.Text = el.SelectSingleNode("Login").InnerText != "" ? el.SelectSingleNode("Login").InnerText : "ivan";
                OptionsForm.form.tb_usr_Intra2_Password.Text = el.SelectSingleNode("Password").InnerText != "" ? el.SelectSingleNode("Password").InnerText : "111111";
                OptionsForm.form.tb_usr_Intra2_Ava.Text = el.SelectSingleNode("Avatar").InnerText != "" ? el.SelectSingleNode("Avatar").InnerText : "avatar_ivan.jpg";
            }
            #endregion

            //последний проверенный урл
            MainForm.form.tbCheckUrlsUrlToCheck.Text = reader.GetValue("/Options/CheckUrls_options/url");
            MainForm.form.tbCheckUrlsLogin.Text = reader.GetValue("/Options/CheckUrls_options/login");
            MainForm.form.tbCheckUrlsPass.Text = reader.GetValue("/Options/CheckUrls_options/password");
        }
Пример #6
0
        public static TrackingInfo TrackPackage(string trackingnumber)
        {
            TrackingInfo info = new TrackingInfo();

            string request =
                "<?xml version=\"1.0\" ?>"
                + "<AccessRequest xml:lang='en-US'>"
                    + "<AccessLicenseNumber>????????</AccessLicenseNumber>"
                    + "<UserId>?????????</UserId>"
                    + "<Password>????????</Password>"
                + "</AccessRequest>"
                + "<?xml version=\"1.0\" ?>"
                + "<TrackRequest>"
                    + "<Request>"
                        + "<TransactionReference>"
                            + "<CustomerContext>guidlikesubstance</CustomerContext>"
                        + "</TransactionReference>"
                        + "<RequestAction>Track</RequestAction>"
                    + "</Request>"
                    + "<TrackingNumber>" + trackingnumber + "</TrackingNumber>"
                + "</TrackRequest>";

            //string url = "https://wwwcie.ups.com/ups.app/xml/Track"; // test
            string url = "https://onlinetools.ups.com/ups.app/xml/Track"; // production

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);

            byte[] requestBytes = System.Text.Encoding.ASCII.GetBytes(request);

            req.Method = "POST";
            req.ContentType = "text/xml;charset=utf-8";
            req.ContentLength = requestBytes.Length;

            Stream requestStream = req.GetRequestStream();
            requestStream.Write(requestBytes, 0, requestBytes.Length);
            requestStream.Close();

            HttpWebResponse res = (HttpWebResponse)req.GetResponse();

            XmlDocument doc = new XmlDocument();

            doc.Load(res.GetResponseStream());

            string response = doc.GetValue("/TrackResponse/Response/ResponseStatusCode");

            info.url = "http://wwwapps.ups.com/WebTracking/processInputRequest?TypeOfInquiryNumber=T&loc=en_US&InquiryNumber=" + trackingnumber;
            info.trackingNumber = trackingnumber;

            if (response == "0")
            {

                info.success = false;
                info.errorCode = doc.GetValue("/TrackResponse/Response/Error/ErrorCode");
                info.errorDescription = doc.GetValue("/TrackResponse/Response/Error/ErrorDescription");

            }
            else
            {

                info.success = true;
                info.statusCode = doc.GetValue("/TrackResponse/Shipment/Package/Activity/Status/StatusCode/Code");
                info.status = doc.GetValue("/TrackResponse/Shipment/Package/Activity/Status/StatusType/Description");
                info.service = doc.GetValue("/TrackResponse/Shipment/Service/Description");

                string pickupDate = doc.GetValue("/TrackResponse/Shipment/PickupDate");

                if (!String.IsNullOrEmpty(pickupDate))
                    info.pickedUp = DateTime.TryParse(pickupDate.Substring(4, 2) + "/" + pickupDate.Substring(6, 2) + "/" + pickupDate.Substring(0, 4), out info.pickedupdate);

                info.delivered = (info.status == "DELIVERED");

                if (info.delivered)
                {

                    string deliverDate = doc.GetValue("/TrackResponse/Shipment/Package/Activity/Date");
                    deliverDate = deliverDate.Substring(4, 2) + "/" + deliverDate.Substring(6, 2) + "/" + deliverDate.Substring(0, 4);

                    string deliverTime = doc.GetValue("/TrackResponse/Shipment/Package/Activity/Time");
                    deliverTime = deliverTime.Substring(0, 2) + ":" + deliverTime.Substring(2, 2);

                    DateTime.TryParse(deliverDate + " " + deliverTime, out info.deliveryDate);

                }

                info.shipFromAddress = doc.GetValue("/TrackResponse/Shipment/Shipper/Address/AddressLine1");
                info.shipFromCity = doc.GetValue("/TrackResponse/Shipment/Shipper/Address/StateProvinceCode");
                info.shipFromState = doc.GetValue("/TrackResponse/Shipment/Shipper/Address/StateProvinceCode");
                info.shipFromZip = doc.GetValue("/TrackResponse/Shipment/Shipper/Address/PostalCode");
                info.shipFromCountry = doc.GetValue("/TrackResponse/Shipment/Shipper/Address/CountryCode");

                info.shipToCity = doc.GetValue("/TrackResponse/Shipment/ShipTo/Address/City");
                info.shipToState = doc.GetValue("/TrackResponse/Shipment/ShipTo/Address/StateProvinceCode");
                info.shipToZip = doc.GetValue("/TrackResponse/Shipment/ShipTo/Address/PostalCode");
                info.shipToCountry = doc.GetValue("/TrackResponse/Shipment/ShipTo/Address/CountryCode");

            }

            return info;
        }