Exemplo n.º 1
0
        /// <summary>
        /// 新增帐套,包括帐套项
        /// </summary>
        /// <param name="accountSet"></param>
        /// <returns></returns>
        public int InsertWholeAccountSet(AccountSet accountSet)
        {
            InitializeTranscation();
            int accountSetId;

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Parameters.Add(_ParmAccountSetName, SqlDbType.NVarChar, 255).Value = accountSet.AccountSetName;
                cmd.Parameters.Add(_ParmDescription, SqlDbType.Text).Value             = accountSet.Description;

                cmd.Parameters.Add(_ParmPKID, SqlDbType.Int).Direction = ParameterDirection.Output;
                SqlHelper.TransExecuteNonQueryReturnPKID("InsertAccountSet", cmd, _Conn, _Trans, out accountSetId);
                //循环新增每一个项
                for (int i = 0; i < accountSet.Items.Count; i++)
                {
                    InsertAccountSetItem(accountSetId, accountSet.Items[i], _Conn, _Trans);
                }
                _Trans.Commit();
            }
            catch
            {
                _Trans.Rollback();
                throw;
            }
            finally
            {
                _Conn.Close();
            }
            return(accountSetId);
        }
Exemplo n.º 2
0
 public void SetMessage(AccountSet sender, MessageSet message)
 {
     NickName.Text    = sender.Login;
     Message.ReadOnly = true;
     Message.Text     = message.MessageText;
     Date.Text        = message.Date.ToString();
 }
Exemplo n.º 3
0
 /// <summary>
 /// 更新帐套,包括帐套项
 /// </summary>
 /// <param name="accountSet"></param>
 /// <returns></returns>
 public int UpdateWholeAccountSet(AccountSet accountSet)
 {
     InitializeTranscation();
     try
     {
         SqlCommand cmd = new SqlCommand();
         cmd.Parameters.Add(_ParmPKID, SqlDbType.Int).Value = accountSet.AccountSetID;
         cmd.Parameters.Add(_ParmAccountSetName, SqlDbType.NVarChar, 255).Value = accountSet.AccountSetName;
         cmd.Parameters.Add(_ParmDescription, SqlDbType.Text).Value             = accountSet.Description;
         SqlHelper.TransExecuteNonQuery("UpdateAccountSet", cmd, _Conn, _Trans);
         //删除原有的每一个项
         DeleteAccountSetItemByAccountSetID(accountSet.AccountSetID, _Conn, _Trans);
         //循环新增每一个项
         for (int i = 0; i < accountSet.Items.Count; i++)
         {
             InsertAccountSetItem(accountSet.AccountSetID, accountSet.Items[i], _Conn, _Trans);
         }
         _Trans.Commit();
     }
     catch
     {
         _Trans.Rollback();
         throw;
     }
     finally
     {
         _Conn.Close();
     }
     return(accountSet.AccountSetID);
 }
        public void LoadMessages(AccountSet Client)
        {
            this.Client = Client;
            ForumContainer container = new ForumContainer();

            // Где мы получатели
            foreach (var converstation in container.ConversationSet.Where(x => x.RecipientId == Client.AccountId).ToList())
            {
                void handlerClickerChat(object sender, EventArgs args)
                {
                    MessageSendForm messageForm = new MessageSendForm(Client, converstation.AccountSet_Sender);

                    messageForm.Show();
                };
                Chat.Chat newChat = new Chat.Chat(converstation.AccountSet_Sender.Login, handlerClickerChat);
                pmFlowLoyoutPanel.Controls.Add(newChat);
            }

            // Где мы отправители
            foreach (var converstation in container.ConversationSet.Where(x => x.SenderId == Client.AccountId).ToList())
            {
                void handlerClickerChat(object sender, EventArgs args)
                {
                    MessageSendForm messageForm = new MessageSendForm(Client, converstation.AccountSet_Recipient);

                    messageForm.Show();
                };


                Chat.Chat newChat = new Chat.Chat(converstation.AccountSet_Recipient.Login, handlerClickerChat);
                pmFlowLoyoutPanel.Controls.Add(newChat);
            }
        }
        public void UpdateEmployeeAccountSetFacade(int employeeID, AccountSet accountSet,
                                                   string backAccountsName, DateTime changeDate, string description)
        {
            UpdateEmployeeAccountSet updateEmployeeAccountSet =
                new UpdateEmployeeAccountSet(employeeID, accountSet, backAccountsName, changeDate, description);

            updateEmployeeAccountSet.Excute();
        }
Exemplo n.º 6
0
        public TithelyClient(TithelyOptions options)
        {
            System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12 | System.Net.SecurityProtocolType.Tls11;

            _organizationSet = new OrganizationSet(options);
            _accountSet      = new AccountSet(options);
            _chargeSet       = new ChargeSet(options);
        }
        /// <summary>
        /// 暂存
        /// </summary>
        /// <param name="salaryId">薪资id</param>
        /// <param name="employeeID">员工id</param>
        /// <param name="dt">发薪时间</param>
        /// <param name="accountSet">员工帐套</param>
        /// <param name="backAcountsName">操作人</param>
        /// <param name="description">描述</param>
        /// <param name="versionNumber">版本号</param>
        public void TemporarySaveEmployeeAccountSetFacadeFacade(int salaryId, int employeeID, DateTime dt,
                                                                AccountSet accountSet, string backAcountsName,
                                                                string description, int versionNumber)
        {
            TemporarySaveEmployeeAccountSet tempSave =
                new TemporarySaveEmployeeAccountSet(salaryId, employeeID, dt, accountSet, backAcountsName, description,
                                                    versionNumber);

            tempSave.Excute();
        }
Exemplo n.º 8
0
        public static AccountSet CreateAccount(double usd, double eur, double pln, double czk)
        {
            var account = new AccountSet();

            account[Currencies.USD] = usd;
            account[Currencies.EUR] = eur;
            account[Currencies.PLN] = pln;
            account[Currencies.CZK] = czk;
            return(account);
        }
Exemplo n.º 9
0
        public int UpdateEmployeeAccountSet(int employeeID, AccountSet accountSet)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(_ParmEmployeeID, SqlDbType.Int).Value                = employeeID;
            cmd.Parameters.Add(_ParmAccountSetID, SqlDbType.Int).Value              = accountSet.AccountSetID;
            cmd.Parameters.Add(_ParmAccountSetName, SqlDbType.NVarChar, 255).Value  = accountSet.AccountSetName;
            cmd.Parameters.Add(_ParmEmployeeAccountSetItems, SqlDbType.Image).Value = SerializeAccountSetItemList(accountSet.Items);
            cmd.Parameters.Add(_ParmDescription, SqlDbType.NVarChar, 255).Value     = accountSet.Description;
            return(SqlHelper.ExecuteNonQuery("UpdateEmployeeAccountSet", cmd));
        }
Exemplo n.º 10
0
        ///<summary>
        ///</summary>
        ///<param name="employeeID"></param>
        ///<param name="accountSet"></param>
        ///<returns></returns>
        public int InsertEmployeeAccountSet(int employeeID, AccountSet accountSet)
        {
            int        pkid;
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(_ParmEmployeeID, SqlDbType.Int).Value                = employeeID;
            cmd.Parameters.Add(_ParmAccountSetID, SqlDbType.Int).Value              = accountSet.AccountSetID;
            cmd.Parameters.Add(_ParmAccountSetName, SqlDbType.NVarChar, 255).Value  = accountSet.AccountSetName;
            cmd.Parameters.Add(_ParmEmployeeAccountSetItems, SqlDbType.Image).Value = SerializeAccountSetItemList(accountSet.Items);
            cmd.Parameters.Add(_ParmDescription, SqlDbType.NVarChar, 255).Value     = accountSet.Description;
            cmd.Parameters.Add(_ParmPKID, SqlDbType.Int).Direction = ParameterDirection.Output;
            SqlHelper.ExecuteNonQueryReturnPKID("InsertEmployeeAccountSet", cmd, out pkid);
            return(pkid);
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            var account = new AccountSet();

            account[Currencies.USD] = 100;
            var server = new BorexServer();

            server.Convert(account, Currencies.USD, Currencies.EUR, 50);
            foreach (Currencies e in Enum.GetValues(typeof(Currencies)))
            {
                Console.WriteLine("{0,-7}{1:0.00}", e, account[e]);
            }
            Console.ReadKey();
        }
Exemplo n.º 12
0
        static void Main(string[] args)
        {
            var account = new AccountSet();

            account[Currencies.USD]     = account[Currencies.EUR] =
                account[Currencies.PLN] = account[Currencies.CZK] = 100;
            var server = new BorexServer();

            var currencies = server
                             .Rates
                             .OrderBy(z => z.RelativeGrowth)
                             .Select(z => z.Currency)
                             .ToArray();

            server.Convert(account, currencies.First(), currencies.Last(), 100);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 通过姓名精确查询
        /// </summary>
        ///  <param name="accountSetName"></param>
        /// <returns></returns>
        public AccountSet GetAccountSetByName(string accountSetName)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(_ParmAccountSetName, SqlDbType.NVarChar, 255).Value = accountSetName;
            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAccountSetByName", cmd))
            {
                while (sdr.Read())
                {
                    int        accountSetPkid = Convert.ToInt32(sdr[_DBPKID]);
                    string     name           = sdr[_DBAccountSetName].ToString();
                    AccountSet accountSet     = new AccountSet(accountSetPkid, name);
                    accountSet.Description = sdr[_DBDescription].ToString();
                    return(accountSet);
                }
            }
            return(null);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 通过ID查找帐套,包括帐套项
        /// </summary>
        /// <param name="accountSetID"></param>
        /// <returns></returns>
        public AccountSet GetWholeAccountSetByPKID(int accountSetID)
        {
            SqlCommand cmd = new SqlCommand();

            cmd.Parameters.Add(_ParmPKID, SqlDbType.Int).Value = accountSetID;
            using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAccountSetByPKID", cmd))
            {
                while (sdr.Read())
                {
                    int        accountSetPkid = Convert.ToInt32(sdr[_DBPKID]);
                    string     name           = sdr[_DBAccountSetName].ToString();
                    AccountSet accountSet     = new AccountSet(accountSetPkid, name);
                    accountSet.Description = sdr[_DBDescription].ToString();
                    accountSet.Items       = GetAccountSetItemByAccountSetID(accountSetID);
                    return(accountSet);
                }
            }
            return(null);
        }
Exemplo n.º 15
0
        /// <summary>
        /// init = Получатель, send = Отправитель
        /// </summary>
        /// <param name="init">Получатель</param>
        /// <param name="send">Отправитель</param>
        private void GetMessages(AccountSet init, AccountSet send)
        {
            using (ForumContainer container = new ForumContainer())
            {
                ConversationSet conversation = container.ConversationSet.SingleOrDefault(x =>
                                                                                         (x.AccountSet_Recipient.AccountId == init.AccountId && x.AccountSet_Sender.AccountId == send.AccountId) ||
                                                                                         (x.AccountSet_Recipient.AccountId == send.AccountId && x.AccountSet_Sender.AccountId == init.AccountId)
                                                                                         );


                if (conversation == null)
                {
                    ConversationSet newConversation = new ConversationSet()
                    {
                        RecipientId = init.AccountId,
                        SenderId    = send.AccountId
                    };

                    FormConversation = newConversation;

                    container.ConversationSet.Add(newConversation);
                    container.SaveChanges();

                    return;
                }
                else
                {
                    FormConversation = conversation;

                    var MessageList = container.MessageSet.Where(x => x.ConversationSet.ConversationId == FormConversation.ConversationId).ToList();
                    if (MessageList.Count > 0)
                    {
                        foreach (MessageSet message in MessageList)
                        {
                            AddNewMessageContainer(message);
                        }
                    }

                    return;
                }
            }
        }
Exemplo n.º 16
0
        public async Task <IActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                AccountSet user = new AccountSet {
                    Email = model.Email, Name = model.Email
                };
                // добавляем пользователя
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    // генерация токена для пользователя
                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    var callbackUrl = Url.Action(
                        "ConfirmEmail",
                        "Account",
                        new { userId = user.Id, code = code },
                        protocol: HttpContext.Request.Scheme);
                    EmailService emailService = new EmailService();
                    await emailService.SendEmailAsync(model.Email, "Confirm your account",
                                                      $"Подтвердите регистрацию, перейдя по ссылке: <a href='{callbackUrl}'>link</a>");

                    return(Content("Для завершения регистрации проверьте электронную почту и перейдите по ссылке, указанной в письме"));
                }
                else
                {
                    foreach (var error in result.Errors)
                    {
                        ModelState.AddModelError(string.Empty, error.Description);
                    }
                }
            }
            return(View(model));
        }
Exemplo n.º 17
0
 /// <summary>
 /// initial = Получатель, sender = Отправитель
 /// </summary>
 /// <param name="initial">Получатель</param>
 /// <param name="sender">Отправитель</param>
 public MessageSendForm(AccountSet initial, AccountSet sender)
 {
     InitializeComponent();
     Recipient = initial;
     Sender    = sender;
 }
Exemplo n.º 18
0
        private static StObject TransactionFormatted(StObject source, TransactionType transactionType)
        {
            StObject constructed = null;

            if (transactionType == Enums.TransactionType.Invalid)
            {
            }
            else if (transactionType == Enums.TransactionType.Payment)
            {
                constructed = new Payment();
            }
            else if (transactionType == Enums.TransactionType.Claim)
            {
            }
            else if (transactionType == Enums.TransactionType.WalletAdd)
            {
            }
            else if (transactionType == Enums.TransactionType.AccountSet)
            {
                constructed = new AccountSet();
            }
            else if (transactionType == Enums.TransactionType.PasswordFund)
            {
            }
            else if (transactionType == Enums.TransactionType.SetRegularKey)
            {
            }
            else if (transactionType == Enums.TransactionType.NickNameSet)
            {
            }
            else if (transactionType == Enums.TransactionType.OfferCreate)
            {
                constructed = new OfferCreate();
            }
            else if (transactionType == Enums.TransactionType.OfferCancel)
            {
                constructed = new OfferCancel();
            }
            else if (transactionType == Enums.TransactionType.Contract)
            {
            }
            else if (transactionType == Enums.TransactionType.RemoveContract)
            {
            }
            else if (transactionType == Enums.TransactionType.TrustSet)
            {
                constructed = new TrustSet();
            }
            else if (transactionType == Enums.TransactionType.EnableFeature)
            {
            }
            else if (transactionType == Enums.TransactionType.SetFee)
            {
            }

            if (constructed == null)
            {
                constructed = new Transaction(transactionType);
            }

            constructed.fields = source.fields;

            return(constructed);
        }
Exemplo n.º 19
0
 public void Show(AccountSet accountSet)
 {
     _accountSet = accountSet ?? throw new ArgumentNullException(nameof(accountSet));
 }
Exemplo n.º 20
0
        private void RegistrationButton_Click(object sender, EventArgs e)
        {
            if (Login.Text == string.Empty)
            {
                MessageBox.Show("Вы оставили поле Логин пустым");
                return;
            }

            if (EmailTextBox.Text == string.Empty)
            {
                MessageBox.Show("Вы оставили поле Почта пустым");
                return;
            }

            if (TelephoneNumber.Text == string.Empty)
            {
                MessageBox.Show("Вы оставили поле Телефон пустым");
                return;
            }

            if (Password.Text == string.Empty)
            {
                MessageBox.Show("Вы оставили поле Пароль пустым");
                return;
            }

            if (UserName.Text == string.Empty)
            {
                MessageBox.Show("Вы оставили поле Имя пустым");
                return;
            }

            using (ForumContainer container = new ForumContainer())
            {
                if (container.AccountSet.SingleOrDefault(x => x.Login == Login.Text) != null)
                {
                    MessageBox.Show("Данный логин уже занят. Выберите другой логин для входа на форум.");
                    return;
                }

                if (container.AccountSet.SingleOrDefault(x => x.Email == EmailTextBox.Text) != null)
                {
                    MessageBox.Show("Данный емайл уже занят. Выберите другой емайл.");
                    return;
                }

                if (container.AccountSet.SingleOrDefault(x => x.PhoneNumber == TelephoneNumber.Text) != null)
                {
                    MessageBox.Show("Данный телефонный номер уже занят. Выберите другой телефонный номер.");
                    return;
                }

                if (Password.Text.Equals(RePassword.Text))
                {
                    AccountSet newAccount = new AccountSet()
                    {
                        Login       = Login.Text,
                        PhoneNumber = TelephoneNumber.Text,
                        Email       = EmailTextBox.Text,
                        Password    = HashPassword(Password.Text),
                        Name        = UserName.Text,
                        UserName    = UserName.Text,
                        AccountType = 0,
                        CreateDate  = DateTime.Now,
                        Points      = 0,
                        Reputation  = 0
                    };

                    container.AccountSet.Add(newAccount);
                    container.SaveChanges();
                    MessageBox.Show("Аккаунт был успешно создан!");
                }
                else
                {
                    MessageBox.Show("Повторите попытку. Вы ввели не одинаковый пароль.");
                    return;
                }
            }
        }
Exemplo n.º 21
0
 public AccountSet ForAccounts(int[] accountids)
 {
     AccountSet = new AccountSet(accountids);
     return(AccountSet);
 }
Exemplo n.º 22
0
 public AddNewTheme(AccountSet Client, EventHandler eventHandler)
 {
     Author       = Client;
     ReturnToMain = eventHandler;
     InitializeComponent();
 }
Exemplo n.º 23
0
 public MyAccount(AccountSet client)
 {
     Account = client;
     InitializeComponent();
 }
Exemplo n.º 24
0
 public NewPrivateMessage(AccountSet Client, Control fromControl)
 {
     this.Client       = Client;
     pmFlowLoyoutPanel = fromControl.Controls.OfType <FlowLayoutPanel>().First();
     InitializeComponent();
 }
Exemplo n.º 25
0
        public override void Dispose()
        {
            base.Dispose();

            AccountSet.Dispose();
        }