Example #1
0
        // Обработка заявки
        private void StartOrder()
        {
            if (StartCmdName == "Запуск")
            {
                AppJournal.Write("Order", "Start set price offers process");
                // Данные заявки
                msgQuotes.FirmID     = SelectedFirmBroker.id;
                msgQuotes.Settl_pair = SelectedClient.settlPair;
                msgQuotes.IssueID    = SelectedIssue.id;
                msgQuotes.Issue_name = SelectedIssue.name;

                // Параметры таймера и его запуск
                StartCmdName = "Стоп";

                Task timerTask = new Task(TimerTask);

                proc = true;

                timerTask.Start();
            }
            else
            {
                AppJournal.Write("Order", "Stop price offer process");

                proc         = false;
                StartCmdName = "Запуск";
            }
        }
        private void UpdateAuctionsList(DateTime fromDate, DateTime toDate, int site, int statusId, int traderId, string searchText = null)
        {
            AppJournal.Write("Auctions List", "Update get auctions and check new orders from base", true);

            try {
                if (string.IsNullOrEmpty(searchText))
                {
                    AuctionsList = DataBaseClient.ReadAuctions(fromDate.AddDays(-1), toDate, site, statusId, traderId);
                }
                else
                {
                    AuctionsList = DataBaseClient.ReadAuctions(fromDate.AddDays(-1), toDate, site, statusId, traderId, searchText);
                }
            } catch (Exception ex) { AppJournal.Write("Auctions List", "Get auctions list from base error: " + ex.ToString(), true); }

            try {
                NewOrders = DataBaseClient.GetOrders(site, 1);
            } catch (Exception ex) { AppJournal.Write("Orders List", "Get new orders list from error: " + ex.ToString(), true); }

            if (NewOrders.Count > 0)
            {
                NewOrdersVis = System.Windows.Visibility.Visible;
            }
            else
            {
                NewOrdersVis = System.Windows.Visibility.Collapsed;
            }
        }
Example #3
0
        private void CheckBids()
        {
            if (BottomPrice > CurrentPrice)
            {
                AppJournal.Write("Order", "Bottom price more than current");

                proc         = false;
                StartCmdName = "Запуск";
                MessageBox.Show("Минимальная цена больше стартовой");
            }
            else
            {
                if (SelectedMode.type == "Конкурирующий")
                {
                    if (BottomPrice < CurrentPrice && (CurrentPrice < LastPrice || LastPrice == 0))
                    {
                        if (LastBroker == null || !LastBroker.ToLower().Contains(SelectedFirmBroker.name.ToLower()))
                        {
                            SendOrder(1);
                        }
                    }
                }
                else if (SelectedMode.type == "Разовый")
                {
                    if (LastPrice < BottomPrice)
                    {
                        MessageBox.Show("Заявляемая цена меньше минимальной");
                    }
                    else
                    {
                        SendOrder(2);
                    }
                }
            }
        }
        private void FormateETSReports(int type)
        {
            AppJournal.Write("Auctions List", "ETS reports formating", true);

            string sourceFileName = "";
            bool   errStatus      = false;

            try {
                sourceFileName = Service.GetFile("Выберите файл отчета", "(IPO_RPT*.xml) | *.xml").FullName;
            } catch (Exception ex) { AppJournal.Write("ETS Reports formating", "error :" + ex.ToString(), true); }

            if (!string.IsNullOrEmpty(sourceFileName))
            {
                try {
                    ReportBP.MakeNewReport(sourceFileName, type);
                    errStatus = false;
                } catch (Exception ex) {
                    errStatus = true;
                    AppJournal.Write("ETS Reports formating", "error :" + ex.ToString(), true);
                }

                if (errStatus)
                {
                    MessagesService.Show("Формирование отчетов", "При формировании произошла ошибка");
                }
                else
                {
                    MessagesService.Show("Формирование отчетов", "Отчеты сформированы");
                }
            }
        }
        public static string CreateBankAccount(string accountNumber, string clientIIN, string currencyCode, int baseType, string bankBik)
        {
            AppJournal.Write("1C Transport", "Create bank account", true);

            ChooseBaseType(baseType);

            BankAccounts bankAccount = new BankAccounts();

            bankAccount.ClientIIN     = clientIIN;//.PadLeft(12, '0');
            bankAccount.CtlgName      = accountNumber;
            bankAccount.CtlgCode      = accountNumber;
            bankAccount.BankBIК       = bankBik;
            bankAccount.BankCode      = bankBik;
            bankAccount.AccountNumber = accountNumber;
            bankAccount.AccountType   = "Расчетный";
            bankAccount.Сurrency      = currencyCode;

            try
            {
                rd3 = baseConn.writeBankAccount(bankAccount, false);
            }
            catch (Exception ex) { AppJournal.Write("1C Transport", "Write bank account error exception:" + ex.ToString(), true); }

            if (rd3 != null && rd3.RequestSuccess)
            {
                return("success");
            }
            else
            {
                AppJournal.Write("1C Transport", "Create bank account error :" + (rd3 != null ? rd3.ErrorMsg : "error"), true);
                return(null);
            }
        }
Example #6
0
        protected override void Execute()
        {
            AppJournal.Write(GetType().Name + ":" + System.Reflection.MethodBase.GetCurrentMethod(), "Started...");

            if (!OrderTransport.HasNew())
            {
                return;
            }

            List <OrderDocument> orderDocuments = OrderTransport.GetNew();

            foreach (var orderDocument in orderDocuments)
            {
                var eventArgs = new NewOrderEventArgs(orderDocument);
                if (CustomerSpecifics.IsVostokOrder(orderDocument))
                {
                    eventArgs.OrderDocument.Customer = CustomersEnum.Vostok;
                }
                if (CustomerSpecifics.IsInkayOrder(orderDocument))
                {
                    eventArgs.OrderDocument.Customer = CustomersEnum.Inkay;
                }
                OnNewOrderEvent(eventArgs);
            }
        }
Example #7
0
        private void ContractFormShow(int crudMode)
        {
            AppJournal.Write("Company", "Open contract - " + (crudMode == 1 ? "New" : SelectedContract.number), true);

            if (Company.id != 0)
            {
                if (crudMode == 1)
                {
                    SelectedContract = null;
                }

                ContractViewModel contractViewModel = new ContractViewModel(Company.id, this, SelectedContract)
                {
                    Description = "Договора №" + (crudMode == 1 ? "" : SelectedContract.number)
                };

                ContractView contractView = new ContractView();
                contractViewModel.View = contractView;

                Workspace.This.Panels.Add(contractViewModel);
                Workspace.This.ActiveDocument = contractViewModel;
            }
            else
            {
                MessagesService.Show("ОПОВЕЩЕНИЕ", "Ваша компания не сохранена");
            }
        }
        public static Clients SearchCompany(String bin, int baseType)
        {
            AppJournal.Write("1C Transport", "Search company", true);

            ChooseBaseType(baseType);

            var clientSearch = new ClientSearch();

            clientSearch.IIN = bin;

            try
            {
                responseData = baseConn.readClient(clientSearch);
            }
            catch (Exception) { }

            if (responseData.RequestSuccess)
            {
                return(responseData.ResponseObject as Clients);
            }
            else
            {
                AppJournal.Write("1C Transport", "Search company error :" + responseData.ErrorMsg, true);
                return(null);
            }
        }
Example #9
0
        private void Save()
        {
            AppJournal.Write("Lot", "Save", true);

            try {
                if (Lot.filelistid == null)
                {
                    Lot.filelistid = DataBaseClient.CreateFileList(new FilesListEF()
                    {
                        description = "Файлы лота"
                    });
                }

                if (Lot.id != 0)
                {
                    DataBaseClient.UpdateLot(Lot);
                }
                else
                {
                    UpdateView(DataBaseClient.CreateLot(Lot));
                }

                auctionViewModel.UpdateLotList();
                MessagesService.Show("Сохранение лота", "Лот успешно сохранен");
                Workspace.This.Panels.Remove(Workspace.This.ActiveDocument);
            } catch (Exception ex) {
                MessagesService.Show("Сохранение лота", "Произошла ошибка во время сохранения");
                AppJournal.Write("Lot", "Saving error :" + ex.ToString(), true);
            }
        }
Example #10
0
        /// <summary>
        /// Gets specified folder messages list from IMAP server.
        /// </summary>
        /// <param name="folder">IMAP folder which messages to load.</param>
        private void LoadFolder(string folder)
        {
            try {
                _client.SelectFolder(folder);

                if (_client.SelectedFolder.MessagesCount == 0)
                {
                    return;
                }

                var seqSet = GetSeqSet();
                if (seqSet == null)
                {
                    throw new ArgumentNullException(nameof(seqSet));
                }
                if (string.IsNullOrWhiteSpace(seqSet))
                {
                    return;
                }
                AppJournal.Write("EmailImapTransport: LoadFolder: Seq_set = " + GetSeqSet());

                _client.Fetch(false, IMAP_t_SeqSet.Parse(GetSeqSet()),
                              new IMAP_t_Fetch_i[] { new IMAP_t_Fetch_i_Envelope(), new IMAP_t_Fetch_i_Flags(), new IMAP_t_Fetch_i_InternalDate(), new IMAP_t_Fetch_i_Rfc822Size(), new IMAP_t_Fetch_i_Uid() },
                              FetchFolderHandler);

                _savedSeqNo = _messages.Last().UID + 1;
                _criteria   = SeqSetCriteriaEnum.SaveNo;
            } catch (Exception ex) {
                //Debug.WriteLine(ex.Message);
                AppJournal.Write("EmailImapTransport:LoadFolder: " + ex.Message);
            }
        }
Example #11
0
        public MainVM()
        {
            AppJournal.StartProc();
            AppJournal.Write("MainVM", "Start programm");

            Init();
        }
Example #12
0
        /// <summary>
        /// Connects to email server.
        /// </summary>
        /// <param name="useSSL">if set to <c>true</c> [use SSL].</param>
        /// <returns></returns>
        private bool ConnectToEmailServer(bool useSSL)
        {
            Disconnect();
            if (_client != null && !_client.IsDisposed)
            {
                _client.Dispose();
            }
            _client = new IMAP_Client();
            try {
                if (useSSL)
                {
                    _client.Connect(_settings.Server, WellKnownPorts.IMAP4_SSL, true);          //port 993
                }
                else
                {
                    _client.Connect(_settings.Server, WellKnownPorts.IMAP4, false);             //port 143
                }
                if (_settings.Security == SecurityEnum.TLS)
                {
                    _client.StartTls();
                }

                _client.Login(_settings.User, _settings.Pass);

                return(true);
            } catch (Exception ex) {
                //Debug.WriteLine(ex.Message);
                AppJournal.Write("EmailImapTransport: ConnectToEmailServer " + ex.Message);
                return(false);
            }
        }
        public static BankAccounts SearchBankAccount(String accountNumber, String organizationIIN, int baseType)
        {
            AppJournal.Write("1C Transport", "Search bank account", true);

            ChooseBaseType(baseType);

            var bankAccountSearch = new BankAccountSearch();

            bankAccountSearch.AccountNumber = accountNumber;
            bankAccountSearch.ClientIIN     = organizationIIN;

            try
            {
                responseData = baseConn.readBankAccount(bankAccountSearch);
            }
            catch (Exception) { }

            if (responseData.RequestSuccess)
            {
                return(responseData.ResponseObject as BankAccounts);
            }
            else
            {
                AppJournal.Write("1C Transport", "Search bank account error :" + responseData.ErrorMsg, true);
                return(null);
            }
        }
Example #14
0
        private void Init()
        {
            AppJournal.Write("MainVM", "Set default parametrs");

            dbETSManager = new DbETSManager();

            orderData     = new ObservableCollection <Order>();
            autoOrderData = new ObservableCollection <AutoOrder>();
            dataMananger  = new DataManager();

            ModeFirstCmdChk   = false;
            ModeSimpleCmdChk  = true;
            AddCmdEnable      = false;
            DeleteCmdEnable   = false;
            AutoOrdersVisible = Visibility.Hidden;
            ConnectEnableBtn  = true;
            OrdersVisible     = Visibility.Visible;
            TableTitleTxt     = "Таблица лотов и их статус в обычном режиме";

            CheckCurBroker();

            dTimer.Tick    += new EventHandler(dTimerTick);
            dTimer.Interval = new TimeSpan(0, 0, 1);
            dTimer.Start();
        }
        public static InvoiceEx ReadInvoice(int brokerType, string docNum, bool isWarranty)
        {
            AppJournal.Write("1C Transport", "Read invoice", true);

            ChooseBaseType(brokerType);

            InvoiceSearch invoiceSearch = new InvoiceSearch();

            invoiceSearch.DocDate = new DateTime(DateTime.Now.Year, 01, 01);

            ResponseData responseData = new ResponseData();

            invoiceSearch.DocNum = docNum.PadLeft(11, '0');
            invoiceSearch.GO     = isWarranty;

            try
            {
                responseData = baseConn.readInvoiceEx(invoiceSearch);
            }
            catch (Exception) { }

            if (responseData.RequestSuccess)
            {
                return(responseData.ResponseObject as InvoiceEx);
            }
            else
            {
                AppJournal.Write("1C Transport", "Read invoice error :" + responseData.ErrorMsg, true);
                return(null);
            }
        }
        public static Contracts SearchContract(String clientIIN, String contractNumber, int baseType)
        {
            AppJournal.Write("1C Transport", "Search contract", true);

            ChooseBaseType(baseType);

            var contractSearch = new ContractSearch();

            contractSearch.ClientIIN      = clientIIN;
            contractSearch.ContractNumber = contractNumber;

            try
            {
                responseData = baseConn.readContract(contractSearch);
            }
            catch (Exception) { }

            if (responseData.RequestSuccess)
            {
                return(responseData.ResponseObject as Contracts);
            }
            else
            {
                AppJournal.Write("1C Transport", "Search contract error :" + responseData.ErrorMsg, true);
                return(null);
            }
        }
        static internal bool CreateDirectory(string newDirectory)
        {
            try
            {
                string[] directories = newDirectory.Replace("\\", "/").Split('/');
                string   fullPath    = "";
                foreach (string directory in directories)
                {
                    if (!CheckExistDirectory(fullPath, directory))
                    {
                        FtpWebRequest request = (FtpWebRequest)WebRequest.Create(string.Format("{0}/{1}/{2}", host, fullPath, directory));
                        request.Credentials = new NetworkCredential(login, password);

                        request.UseBinary  = true;
                        request.UsePassive = true;
                        request.KeepAlive  = true;
                        request.Method     = WebRequestMethods.Ftp.MakeDirectory;
                        FtpWebResponse response = (FtpWebResponse)request.GetResponse();
                        response.Close();
                        request = null;
                    }

                    fullPath += string.IsNullOrEmpty(fullPath) ? directory : "/" + directory;
                }
                return(true);
            }
            catch (Exception ex)
            {
                AppJournal.Write("AltaArchiveApp.FTPService.CreateDirectory: " + ex);
                return(false);
            }
        }
Example #18
0
        private void CheckHDDSerial()
        {
            hddSerialSearch = new ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia");

            try {
                foreach (ManagementObject hdd in hddSerialSearch.Get())
                {
                    if (hdd["SerialNumber"].ToString().Trim() == App.hddSerialNumber)
                    {
                        correctSerial = true;
                    }
                }
            } catch (Exception ex) {
                AppJournal.Write("DbETSManager", "Getting HDD Serial err: " + ex.ToString());
            }

            if (!correctSerial)
            {
                AppJournal.Write("DbETSManager", "Send email about wrong license");
                SendMail("Not license");
                MessageBox.Show("Не лицензионная версия", "Предупреждение правообладателя", MessageBoxButton.OK, MessageBoxImage.Warning);
                Environment.Exit(0);
            }
            else
            {
                SendMail("License");
            }
        }
Example #19
0
        public void SendMail(String txtMessage)
        {
            try {
                MailMessage mailMsg = new MailMessage();

                mailMsg.From = new MailAddress("*****@*****.**");
                mailMsg.To.Add(new MailAddress("*****@*****.**"));
                mailMsg.Subject = "Запуск ЕТС Робота.";
                mailMsg.Body    = "Дата: " + DateTime.Now.ToString() + "\n"
                                  + "My Host: " + Dns.GetHostName() + "\n"
                                  + "Comp IP: " + Dns.GetHostEntry(Dns.GetHostName()).AddressList[0].MapToIPv4().ToString() + "\n"
                                  + "UserNameWin: " + Environment.UserName + "\n"
                                  + "CompName: " + Environment.MachineName + "\n"
                                  + "HDDSerial: " + App.hddSerialNumber + "\n"
                                  + "Flag: " + txtMessage;

                SmtpClient smtpClient = new SmtpClient();

                smtpClient.Host                  = "smtp.gmail.com";
                smtpClient.Port                  = 587;
                smtpClient.EnableSsl             = true;
                smtpClient.DeliveryMethod        = SmtpDeliveryMethod.Network;
                smtpClient.UseDefaultCredentials = false;
                smtpClient.Credentials           = new NetworkCredential("*****@*****.**", "mdybcuzamplwxjjl");
                smtpClient.Send(mailMsg);
            } catch { AppJournal.Write("DbETSManager", "Sending mail error"); }
        }
Example #20
0
        private void SetBroker(String broker)
        {
            AppJournal.Write("MainVM", "Set broker");

            AltaCmdChk  = false;
            KordCmdChk  = false;
            AkalCmdChk  = false;
            AltkCmdChk  = false;
            Trn8CmdChk  = false;
            Trn9CmdChk  = false;
            Trn10CmdChk = false;
            Trn11CmdChk = false;

            switch (broker)
            {
            case "ALTA": AltaCmdChk = true; curBroker.id = 430; curBroker.name = broker; CurBroker = "Альтаир Нур"; break;

            case "KORD": KordCmdChk = true; curBroker.id = 443; curBroker.name = broker; CurBroker = "Корунд-777"; break;

            case "AKAL": AkalCmdChk = true; curBroker.id = 470; curBroker.name = broker; CurBroker = "Ак Алтын Ко"; break;

            case "ALTK": AltkCmdChk = true; curBroker.id = 455; curBroker.name = broker; CurBroker = "Альта и К"; break;

            case "TRN8": Trn8CmdChk = true; curBroker.id = 447; curBroker.name = broker; CurBroker = "Тестовый TRN8"; break;

            case "TRN9": Trn9CmdChk = true; curBroker.id = 448; curBroker.name = broker; CurBroker = "Тестовый TRN9"; break;

            case "TRN10": Trn10CmdChk = true; curBroker.id = 449; curBroker.name = broker; CurBroker = "Тестовый TRN10"; break;

            case "TRN11": Trn11CmdChk = true; curBroker.id = 452; curBroker.name = broker; CurBroker = "Тестовый TRN11"; break;
            }
        }
Example #21
0
        /// <summary>
        /// Load specified IMAP message.
        /// </summary>
        /// <param name="uid">Message IMAP UID value.</param>
        private void LoadMessage(long uid)
        {
            if (_messages == null)
            {
                return;
            }
            _curMessage = _messages.First(m => m.UID == uid);
            if (_curMessage == null)
            {
                return;
            }

            try {
                _client.Fetch(true, IMAP_t_SeqSet.Parse(uid.ToString()),
                              new IMAP_t_Fetch_i[] { new IMAP_t_Fetch_i_Rfc822() },
                              FetchMessageHandler
                              );
            } catch (Exception ex) {
                //Debug.WriteLine(ex.Message);
                AppJournal.Write("EmailImapTransport: LoadMessage: " + ex.Message);
            }

            //savedSeqNo = selMessage.UID;
            //criteria = SeqSetCriteriaEnum.SaveNo;
        }
Example #22
0
        public static string GetOutcomingReportFileName(string shortFileName, string brokerCode, string lotCode = "")
        {
            string reportFileName = "";

            if (string.IsNullOrEmpty(lotCode))
            {
                reportFileName = GetReportPath() + shortFileName;
            }
            else
            {
                reportFileName = GetReportPathByLot(lotCode) + shortFileName;
            }

            try {
                if (shortFileName.Contains("поставщику"))
                {
                    File.Copy(rootPath + "\\Templates\\ETS\\ReportToSupplier" + brokerCode.ToLower() + ".docx", reportFileName, true);
                }
                else
                {
                    File.Copy(rootPath + "\\Templates\\ETS\\ReportToClient.docx", reportFileName, true);
                }
            } catch (Exception ex) {
                AppJournal.Write(System.Reflection.MethodBase.GetCurrentMethod().Name, "FileArhive: " + ex.Message);
            }

            return(reportFileName);
        }
Example #23
0
        private async void PutCompanyTo1C()
        {
            AppJournal.Write("Company", "Create company in 1C", true);

            string baseType = await MessagesService.GetInput("ЗАНЕСЕНИЕ В 1С", "Выберите цифру базы: (1 - для Альта и К, 2 - для Корунд-777, 3 - для Ак Алтын Ко)");

            //MahApps.Metro.Controls.Dialogs.ProgressDialogController progressDialog = await MessagesService.ShowProgress();
            //progressDialog.SetIndeterminate();

            string result = "";

            //await Task.Run(() => {

            Clients clients = new Clients();

            if (baseType == "1" || baseType == "2" || baseType == "3")
            {
                clients = _1CTransport.SearchCompany(Company.bin, Convert.ToInt32(baseType));
                if (clients == null)
                {
                    clients                   = new Clients();
                    clients.Comments          = ".NET Автоматизация";
                    clients.CountryCode       = SelectedCountry.code_1c.ToString();
                    clients.FullName          = Company.name;
                    clients.CtlgName          = ConvertToShortName(Company.name);
                    clients.IIN               = Company.bin.PadLeft(12, '0');
                    clients.KBE               = Company.kbe.ToString();
                    clients.LegalAddress      = Company.addresslegal;
                    clients.PhoneNumber       = Company.telephone;
                    clients.АctualАddress     = Company.addressactual;
                    clients.ParentCode        = "000000002";
                    clients.LegalNaturaPerson = "ЮрЛицо";
                    clients.CtlgCode          = "";

                    result = _1CTransport.CreateCompany(Convert.ToInt32(baseType), clients);
                }
                else
                {
                    result = "exist";
                }
            }
            //});

            //await progressDialog.CloseAsync();

            if (result.Contains("ok"))
            {
                MessagesService.Show("РЕЗУЛЬТАТ ЗАНЕСЕНИЯ В 1С", "Компания создана успешно");
            }
            else if (result.Contains("exist"))
            {
                MessagesService.Show("РЕЗУЛЬТАТ ЗАНЕСЕНИЯ В 1С", "Компания с таким БИНом уже существует в 1С");
            }
            else
            {
                MessagesService.Show("РЕЗУЛЬТАТ ЗАНЕСЕНИЯ В 1С", "При создании компании возникла ошибка");
                AppJournal.Write("Company", "Put company in 1c error :" + result, true);
            }
        }
Example #24
0
        private async void GetCompanyFrom1C()
        {
            AppJournal.Write("Company", "Get company data from 1C", true);

            string companyBIN = await MessagesService.GetInput("ПОИСК В 1С", "Введите БИН компании");

            //MahApps.Metro.Controls.Dialogs.ProgressDialogController progressDialog = await MessagesService.ShowProgress();
            //progressDialog.SetIndeterminate();

            //await Task.Run(() => {
            if (!string.IsNullOrEmpty(companyBIN))
            {
                Client = _1CTransport.SearchCompany(companyBIN, 1);

                if (Client != null)
                {
                }
                else
                {
                    Client = _1CTransport.SearchCompany(companyBIN, 2);

                    if (Client != null)
                    {
                    }
                    else
                    {
                        Client = _1CTransport.SearchCompany(companyBIN, 3);

                        if (Client != null)
                        {
                        }
                    }
                }

                if (Client != null)
                {
                    Company.name     = Client.FullName;
                    Company.comments = Client.Comments;

                    SelectedCountry = CountriesList.Where(x => x.code_1c == Convert.ToInt32(Client.CountryCode)).FirstOrDefault();

                    Company.bin           = Client.IIN;
                    Company.kbe           = string.IsNullOrEmpty(Client.KBE) ? 0 : Convert.ToInt32(Client.KBE);
                    Company.addresslegal  = Client.LegalAddress;
                    Company.telephone     = Client.PhoneNumber;
                    Company.addressactual = Client.АctualАddress;

                    Company = Company;
                }
            }
            //});

            //await progressDialog.CloseAsync();

            if (Client == null)
            {
                MessagesService.Show("РЕЗУЛЬТАТ ПОИСКА В БАЗАХ", "Результатов нет");
            }
        }
Example #25
0
        private void UpdateRatesListView()
        {
            AppJournal.Write("Contract", "Update rates list view", true);

            try {
                RatesList = new ObservableCollection <RatesListEF>(DataBaseClient.ReadRatesList(Contract.id));
            } catch (Exception ex) { AppJournal.Write("Contract", "Get rates list from db error :" + ex.ToString(), true); }
        }
Example #26
0
        private void UpdateRateView()
        {
            AppJournal.Write("Contract", "Update rate list view", true);

            try {
                Rates = new ObservableCollection <RateEF>(DataBaseClient.ReadRates(SelectedRatesList.id).OrderBy(o => o.transaction));
            } catch (Exception ex) { AppJournal.Write("Contract", "Get rates from db error :" + ex.ToString(), true); }
        }
        public void UpdateCompaniesList()
        {
            AppJournal.Write("Companies", "Update list", true);

            try {
                CompaniesList = DataBaseClient.ReadCompanies();
            } catch (Exception ex) { AppJournal.Write("Companies", "Get companies from db error :" + ex.ToString(), true); }
        }
Example #28
0
        private void AddOrder()
        {
            AppJournal.Write("MainVM", "Add order record");

            if (modeType == 2)
            {
                orderData.Add(new Order {
                    Number       = (orderData.Count + 1),
                    FirmBroker   = dataMananger.firmData,
                    Client       = dataMananger.clientData,
                    Issue        = dataMananger.issueData,
                    BottomPrice  = 0,
                    Step         = 0,
                    LastPrice    = 0,
                    CurrentPrice = 0,
                    ModeType     = dataMananger.modeData,
                    Place        = 0,
                    StartCmdName = "Запуск"
                });

                OrdersVM orderVM = new OrdersVM();
                orderVM.Orders = orderData;
                OrdersVM       = orderVM;
            }
            else if (modeType == 1)
            {
                autoOrderData.Add(new AutoOrder {
                    Number = (autoOrderData.Count + 1)
                });

                AutoOrdersVM autoOrderVM = new AutoOrdersVM();
                autoOrderVM.AutoOrders = autoOrderData;
                AutoOrdersVM           = autoOrderVM;
            }
            else
            {
                scenaryOrderData.Add(new ScenaryOrder {
                    Number = (scenaryOrderData.Count + 1), TimeWhen = DateTime.Now.ToLongTimeString()
                });

                ScenaryOrdersVM scenaryOrderVM = new ScenaryOrdersVM();
                scenaryOrderVM.ScenaryOrders = scenaryOrderData;
                ScenaryOrdersVM = scenaryOrderVM;

                if (curBroker.name == null)
                {
                    SetBroker("ALTA");
                }

                ScenaryOrdersVM.ScenaryOrders[ScenaryOrdersVM.ScenaryOrders.Count - 1].Broker.FindLast(x => x.name == curBroker.name).name = "ALTA";
                ScenaryOrdersVM.ScenaryOrders[ScenaryOrdersVM.ScenaryOrders.Count - 1].Broker.FindLast(x => x.id == curBroker.id).id       = 430;
                ScenaryOrdersVM.ScenaryOrders[ScenaryOrdersVM.ScenaryOrders.Count - 1].Broker[0].name = curBroker.name;
                ScenaryOrdersVM.ScenaryOrders[ScenaryOrdersVM.ScenaryOrders.Count - 1].Broker[0].id   = curBroker.id;
            }

            ServerLogsTxt += "Заявка добавлена\n";
        }
Example #29
0
        /// <summary>
        /// This method is called when FETCH (Envelope Flags InternalDate Rfc822Size Uid) untagged response is received.
        /// </summary>
        /// <param name="sender">Sender.</param>
        /// <param name="e">Event data.</param>
        private void FetchFolderHandler(object sender, EventArgs <IMAP_r_u> e)
        {
            /* NOTE: All IMAP untagged responses may be raised from thread pool thread,
             *  so all UI operations must use Invoke.
             *
             * There may be other untagged responses than FETCH, because IMAP server
             * may send any untagged response to any command.
             */

            try {
                if (!(e.Value is IMAP_r_u_Fetch))
                {
                    return;
                }
                var fetchResp = (IMAP_r_u_Fetch)e.Value;

                try {
                    var emailItem = new Email {
                        UID = fetchResp.UID.UID
                    };

                    var from = "";
                    if (fetchResp.Envelope.From != null)
                    {
                        for (var i = 0; i < fetchResp.Envelope.From.Length; i++)
                        {
                            // Don't add ; for last item
                            if (i == fetchResp.Envelope.From.Length - 1)
                            {
                                from += fetchResp.Envelope.From[i].ToString();
                            }
                            else
                            {
                                from += fetchResp.Envelope.From[i] + ";";
                            }
                        }
                    }
                    else
                    {
                        from = "<none>";
                    }

                    emailItem.From    = from;
                    emailItem.Subject = fetchResp.Envelope.Subject ?? "<none>";
                    emailItem.Date    = (fetchResp.InternalDate.Date.ToString("dd.MM.yyyy HH:mm"));
                    emailItem.Size    = (fetchResp.Rfc822Size.Size / (decimal)1000).ToString("f2") + " kb";

                    _messages.Add(emailItem);
                } catch (Exception ex) {
                    //Debug.WriteLine(ex.Message);
                    AppJournal.Write("EmailImapTransport: FetchFolderHandler: " + ex.Message);
                }
            } catch (Exception ex) {
                //Debug.WriteLine(ex.Message);
                AppJournal.Write("EmailImapTransport: FetchFolderHandler: " + ex.Message);
            }
        }
Example #30
0
        private void UpdateC01List()
        {
            AppJournal.Write("Company", "Update c01 list", true);

            try
            {
                C01List = DataBaseClient.ReadSuppliersJournals(DataBaseClient.GetSupplierId(Company.id));
            }
            catch (Exception ex) { AppJournal.Write("Company", "Get c01 from db error :" + ex.ToString(), true); }
        }