Beispiel #1
0
        //internal bool RenameClient(int currentClientId, string editClientName)
        //{
        //    var updateClient = SqlQueryBuilder.UpdateClient(currentClientId, editClientName, DBConnection);
        //    return CommitDML(updateClient);
        //}

        internal ClientInfo GetClientInfo(int clientId)
        {
            var        getIdentType = SqlQueryBuilder.SelectClientRow(clientId, DBConnection);
            ClientInfo clientInfo   = new ClientInfo();

            try
            {
                SqlDataReader reader = getIdentType.ExecuteReader();
                while (reader.Read())
                {
                    clientInfo = new ClientInfo
                    {
                        Id             = clientId,
                        ClientName     = reader[0].ToString(),
                        Org_Id         = (int)reader[1],
                        FidDocType     = reader[2] == null ? IdentityDocType.NULL : (IdentityDocType)reader[2],
                        Requisites     = reader[3] == null ? null : reader[3].ToString(),
                        ServerScanLink = reader[4] == null ? null : reader[4].ToString(),
                    };
                }
                reader.Close();
                return(clientInfo);
            }
            catch (Exception ex)
            {
                throw new Exception("Не удалось прочитать информацию о клиенте из базы данных." + ex.Message);
            }
        }