Beispiel #1
0
        private void cbReport_SelectedIndexChanged(object sender, EventArgs e)
        {
            var reportId = TypeParser.GetInt32Value(cbReport.SelectedValue);

            switch (reportId)
            {
            case (int)ReportType.ProjectOverview:
            {
                var rpt = new RptProjects();
                rpt.ShowDialog();
            }
            break;

            case (int)ReportType.NextPayment:
            {
                var rpt = new RptNextPayment();
                rpt.ShowDialog();
            }
            break;

            case (int)ReportType.None:
                return;
            }

            cbReport.SelectedValue = (int)ReportType.None;
        }
Beispiel #2
0
        private void gridTransferPool_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            var grid = sender as DataGridView;

            if (grid != null)
            {
                var projectId = TypeParser.GetInt32Value(grid.Rows[e.RowIndex].Cells[Namespace.GridColProjectId].Value);
                System.Diagnostics.Process.Start(ProxySearch.GetPathTranserDetail(projectId));
            }
        }
Beispiel #3
0
        private void txtPageTo_TextChanged(object sender, EventArgs e)
        {
            var from = Math.Max(1, TypeParser.GetInt32Value(txtPageFrom.Text));
            var to   = Math.Max(1, TypeParser.GetInt32Value(txtPageTo.Text));

            txtPageTo.Text = $"{to}";
            if (from > to)
            {
                txtPageFrom.Text = $"{to}";
            }
        }
Beispiel #4
0
 public bool Save()
 {
     BusinessCache.Settings.SearchingKeywordsString = txtSearchingKeyword.Text;
     BusinessCache.Settings.MatchingKeywordsString  = FormatMatchingKeywords(txtMatchKeyword.Text);
     BusinessCache.Settings.Yijia         = TypeParser.GetDouble(txtYijia.Text);
     BusinessCache.Settings.Rate          = TypeParser.GetDouble(txtRate.Text);
     BusinessCache.Settings.NextPayment   = TypeParser.GetInt(txtNextPayment.Text);
     BusinessCache.Settings.FreqTransfer  = TypeParser.GetInt32Value(txtFreqTranser.Text, 60);
     BusinessCache.Settings.DelayTransfer = TypeParser.GetInt32Value(txtDelayTransfer.Text);
     BusinessCache.Settings.PageFrom      = TypeParser.GetInt32Value(txtPageFrom.Text);
     BusinessCache.Settings.PageTo        = TypeParser.GetInt32Value(txtPageTo.Text);
     BusinessCache.Settings.AutoAcquire   = chkAutoAcquire.Checked;
     BusinessCache.Settings.TrySaveToConfig();
     return(true);
 }
        public static string HexDecrypt(this string value)
        {
            if (string.IsNullOrEmpty(value))
            {
                return(string.Empty);
            }
            var strval = string.Empty;

            for (var y = 1; y <= value.Length; y += 2)
            {
                string strtmp = Strings.Mid(value, y, 2);
                strval = strval + Strings.Chr(TypeParser.GetInt32Value(Conversion.Val("&h" + strtmp)));
            }

            return(strval);
        }
Beispiel #6
0
 public static void TryRetriveFromConfig(this UserSettings setting)
 {
     if (setting == null)
     {
         setting = new UserSettings();
     }
     setting.SearchingKeywordsString = TypeParser.GetStringValue(ConfigurationManager.AppSettings[UserSettings.Namespance.SearchingKeyword]);
     setting.MatchingKeywordsString  = TypeParser.GetStringValue(ConfigurationManager.AppSettings[UserSettings.Namespance.MatchingKeyword]);
     setting.Yijia         = TypeParser.GetDouble(ConfigurationManager.AppSettings[UserSettings.Namespance.Yijia]);
     setting.Rate          = TypeParser.GetDouble(ConfigurationManager.AppSettings[UserSettings.Namespance.Rate]);
     setting.NextPayment   = TypeParser.GetInt(ConfigurationManager.AppSettings[UserSettings.Namespance.NextPayment]);
     setting.FreqTransfer  = TypeParser.GetInt32Value(ConfigurationManager.AppSettings[UserSettings.Namespance.FreqTransfer], 60);
     setting.DelayTransfer = TypeParser.GetInt32Value(ConfigurationManager.AppSettings[UserSettings.Namespance.DelayTransfer]);
     setting.PageFrom      = TypeParser.GetInt32Value(ConfigurationManager.AppSettings[UserSettings.Namespance.PageFrom]);
     setting.PageTo        = TypeParser.GetInt32Value(ConfigurationManager.AppSettings[UserSettings.Namespance.PageTo]);
     setting.AutoAcquire   = TypeParser.GetBoolValue(ConfigurationManager.AppSettings[UserSettings.Namespance.AutoAcquire]);
 }
Beispiel #7
0
        private void gridNextPayment_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            var grid = sender as DataGridView;

            if (grid != null)
            {
                var colName = grid.Columns[e.ColumnIndex].Name;
                if (colName == Namespace.GridColProjectType)
                {
                    var typeId = TypeParser.GetInt32Value(grid.Rows[e.RowIndex].Cells[Namespace.GridColProjectTypeId].Value);
                    if (typeId == (int)Business.Model.ProjectType.Binggou)
                    {
                        e.Value = Properties.Resources.ico_bing;
                    }
                    else
                    {
                        e.Value = Properties.Resources.ico_guan;
                    }
                }
            }
        }
Beispiel #8
0
        private ServerSettings CheckVersion(ServerSettings serverSettings, ClientSettings clientSettings)
        {
            if (clientSettings == null || serverSettings == null)
            {
                return(serverSettings);
            }

            var ret = new ServerSettings();

            ret.TargetServer = ServerSettings.TargetServer;

            var versionLocal = TypeParser.GetStringValue(clientSettings.LocalVersion).Split('.');

            foreach (var serverSettingItem in serverSettings.Items)
            {
                var versionServer = TypeParser.GetStringValue(serverSettingItem.ReleaseVersion).Split('.');

                if (versionLocal.Length != versionServer.Length)
                {
                    ret.Items.Add(serverSettingItem);
                    continue;
                }

                for (var i = 0; i < versionLocal.Length; i++)
                {
                    var valLocal  = TypeParser.GetInt32Value(versionLocal[i]);
                    var valServer = TypeParser.GetInt32Value(versionServer[i]);
                    if (valLocal < valServer)
                    {
                        ret.Items.Add(serverSettingItem);
                        break;
                    }
                }
            }
            return(ret);
        }
Beispiel #9
0
        private async Task <SxhResult> SubmitAsync()
        {
            if (Project != null && Account != null)
            {
                var para = new VmAcquire()
                {
                    AcquisitionPrice    = TypeParser.GetDoubleValue(Project.minTransferingPrice, 0),
                    Copies              = TypeParser.GetInt32Value(txtCopy.Text),
                    ProjectId           = Project.projectId,
                    ProjectName         = Project.projectTitle,
                    ShowPrice           = TypeParser.GetDoubleValue(Project.advicePrice),
                    TockenKey           = txtToken.Text,
                    TokenAcquire        = txtTokenAcquire.Text,
                    TransactionPassword = Account.PasswordTran,
                    VerificationCode    = txtVerifyCode.Text,
                    TokenOffical        = Account.TokenOffical,
                };

                var proxy = new ProxyAcquisition();
                return(await proxy.SubmitAsync(para));
            }

            return(new SxhResult(false, $"invalid project or account"));
        }
Beispiel #10
0
        private void gridTransferPool_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            var grid = sender as DataGridView;

            if (grid != null)
            {
                var isTargeted = false;
                var settings   = BusinessCache.Settings;
                var colName    = grid.Columns[e.ColumnIndex].Name;

                switch (colName)
                {
                case Namespace.GridColProjectType:
                    //cell formatting
                    var eumnType = (ProjectType)TypeParser.GetInt32Value(grid.Rows[e.RowIndex].Cells[Namespace.GridColProjectTypeId].Value);
                    switch (eumnType)
                    {
                    case Business.Model.ProjectType.Ziguan:
                        e.Value = Properties.Resources.ico_guan;
                        break;

                    case Business.Model.ProjectType.Binggou:
                        e.Value = Properties.Resources.ico_bing;
                        break;

                    default:
                        break;
                    }
                    break;

                case Namespace.GridColRateDisplay:
                    //rate
                    isTargeted = IsMatchRate(grid, e.RowIndex, settings);
                    isTargeted = IsMatchNextPaymentRemain(grid, e.RowIndex, settings, isTargeted);
                    isTargeted = IsMatchName(grid, e.RowIndex, settings, isTargeted);
                    break;

                case Namespace.GridColYijiaDisplay:
                    //yijia
                    isTargeted = IsMatchYijia(grid, e.RowIndex, settings);
                    isTargeted = IsMatchNextPaymentRemain(grid, e.RowIndex, settings, isTargeted);
                    isTargeted = IsMatchName(grid, e.RowIndex, settings, isTargeted);
                    break;

                default:
                    break;
                }

                //e.CellStyle.ForeColor = COLOR_NORMAL;

                if (isTargeted)
                {
                    e.CellStyle.ForeColor = COLOR_HIGHLIGHT;

                    if (!BusinessCache.PoolTranser.IsLocked)
                    {
                        var projectId = TypeParser.GetInt32Value(grid.Rows[e.RowIndex].Cells[Namespace.GridColProjectId].Value);
                        Targets.Add(projectId);
                    }
                }
            }
        }
Beispiel #11
0
        private async Task <int> UpdateProductPayment(IEnumerable <int> projectIds)
        {
            if (projectIds == null)
            {
                projectIds = (from project in _context.Project
                              where project.StatusId == (int)StatusProject.Active
                              select project.Id).ToList();
            }

            var tmpItems = from product in _context.Product
                           join project in _context.Project on product.ProjectId equals project.Id
                           where projectIds.Contains(product.ProjectId) && project.StatusId == (int)StatusProject.Active
                           select new
            {
                product.Id,
                product.ValueDate,
                project.PayTypeId,
                project.Deadline
            };

            var paymentList = new List <ProductPayment>();

            foreach (var item in tmpItems.ToList())
            {
                var payment = new ProductPayment();
                payment.ProductId   = item.Id;
                payment.NextPayment = item.ValueDate;
                payment.LastUpdate  = DateTime.Now;

                var dateDue = item.ValueDate.AddMonths(TypeParser.GetInt32Value(item.Deadline * 12));
                switch ((PaymentType)item.PayTypeId)
                {
                case PaymentType.Annual:
                    payment.FreqTotal = TypeParser.GetInt32Value(item.Deadline);
                    while (payment.NextPayment < DateTime.Now)
                    {
                        payment.NextPayment = payment.NextPayment.AddMonths(12);
                        payment.FreqCurrent++;
                    }
                    break;

                case PaymentType.AnnualHalf:
                    payment.FreqTotal = TypeParser.GetInt32Value(item.Deadline * 2);
                    while (payment.NextPayment < DateTime.Now)
                    {
                        payment.NextPayment = payment.NextPayment.AddMonths(6);
                        payment.FreqCurrent++;
                    }
                    break;

                case PaymentType.Quater:
                    payment.FreqTotal = TypeParser.GetInt32Value(item.Deadline * 4);
                    while (payment.NextPayment < DateTime.Now)
                    {
                        payment.NextPayment = payment.NextPayment.AddMonths(3);
                        payment.FreqCurrent++;
                    }
                    break;

                case PaymentType.Month:
                    payment.FreqTotal = TypeParser.GetInt32Value(item.Deadline * 12);
                    while (payment.NextPayment < DateTime.Now)
                    {
                        payment.NextPayment = payment.NextPayment.AddMonths(1);
                        payment.FreqCurrent++;
                    }
                    break;

                case PaymentType.Day:
                    payment.FreqTotal = TypeParser.GetInt32Value(item.Deadline * 365);
                    while (payment.NextPayment < DateTime.Now)
                    {
                        payment.NextPayment = payment.NextPayment.AddDays(1);
                        payment.FreqCurrent++;
                    }
                    break;

                default:
                    break;
                }

                if (payment.NextPayment <= dateDue)
                {
                    paymentList.Add(payment);
                }
            }

            _context.ProductPayment.RemoveRange(from p in _context.ProductPayment select p);
            await _context.SaveChangesAsync();

            await _context.ProductPayment.AddRangeAsync(paymentList);

            return(await _context.SaveChangesAsync());
        }