Beispiel #1
0
 private TxtParamClass RowConvertToModel(DataGridViewRow row, TxtParamClass model)
 {
     model.Name = row.Cells["ColName"].Value == null ? string.Empty : row.Cells["ColName"].Value.ToString();
     model.Login = row.Cells["LoginId"].Value == null ? 0 : Convert.ToInt32(row.Cells["LoginId"].Value);
     model.StartTime = row.Cells["StartDateTime"].Value == null ? DateTime.Now : Convert.ToDateTime(row.Cells["StartDateTime"].Value);
     model.EndTime = row.Cells["EndDateTime"].Value == null ? DateTime.Now : Convert.ToDateTime(row.Cells["EndDateTime"].Value);
     model.Amount = row.Cells["StartAmount"].Value == null ? 0 : Convert.ToDouble(row.Cells["StartAmount"].Value);
     model.Ratio = row.Cells["Ratio"].Value == null ? 1 : Convert.ToDouble(row.Cells["Ratio"].Value);
     model.Groups = row.Cells["Group"].Value == null ? new List<string>() : row.Cells["Group"].Value.ToString().Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
     return model;
 }
Beispiel #2
0
        private void BindData4File(string fileName)
        {
            loading.ShowLoading();
            ThreadPool.QueueUserWorkItem((obj) =>
            {
                try
                {
                    string[] array = File.ReadAllLines(fileName);
                    if (list == null)
                    {
                        list = new List<TxtParamClass>();
                    }

                    foreach (string str in array)
                    {
                        UserRecordSE user = CustomService.Service.GetUserRecordsByLogin(int.Parse(str));
                        int count = 0;
                        while (string.IsNullOrEmpty(user.Name))
                        {
                            count++;
                            if (count > 5)
                            {
                                break;
                            }
                            user = CustomService.Service.GetUserRecordsByLogin(int.Parse(str));
                        }
                        if (user.Group == "oceanforex")
                        {
                            var model = new TxtParamClass()
                            {
                                Login = user.Login,
                                Name = user.Name,
                                MemberId = user.Login,
                                Amount = user.Balance,
                                Ratio = 1,
                                StartTime = user.Regdate,
                                Groups = new List<string>() { user.Group }
                            };
                            list.Add(model);
                        }
                    }

                    this.BeginInvoke((MethodInvoker)(() =>
                    {
                        Display(list);
                        loading.HideLoading();
                    }));
                }
                catch (Exception ee)
                {
                    _log.Error(ee);
                }
            });
        }