Ejemplo n.º 1
0
 private void btnaddExistClient_Click(object sender, EventArgs e)
 {
     AllClientGridForm form = new AllClientGridForm();
     if (form.ShowDialog() == DialogResult.OK)
     {
         clientAddToJournal = form.clientToAdd;
     }
     form.Hide();
 }
Ejemplo n.º 2
0
 public ClientExt(Client client)
 {
     this.Name = client.Name;
     this.ID = client.ID;
     this.Phone = client.Phone;
     this.SecondName = client.SecondName;
     this.SurName = client.SurName;
     this.listJournal = null;
 }
Ejemplo n.º 3
0
        private void btnAddNewClient_Click(object sender, EventArgs e)
        {
            AddClientForm form = new AddClientForm();
            if (form.ShowDialog() == DialogResult.OK)
            {
                Client clientToAdd = form.clientToAdd;

                DataProvider.DataProvider.AddClient(clientToAdd.Name, clientToAdd.SurName, clientToAdd.SecondName,
                    clientToAdd.Street, clientToAdd.Flat, clientToAdd.City, clientToAdd.Post, clientToAdd.Phone);
                clientAddToJournal = clientToAdd;
                UpdateClientInfo();
            }
        }
Ejemplo n.º 4
0
 private void btnAddClient_Click(object sender, EventArgs e)
 {
     int[] rowsSel=gridViewSearchClient.GetSelectedRows();
     if (rowsSel.Length == 1)
     {
         clientToAdd = (Client)gridViewSearchClient.GetRow(rowsSel[0]);
         this.DialogResult = DialogResult.OK;
     }
     else
     {
         //выберите строку
     }
 }
Ejemplo n.º 5
0
        public EditClientForm(Client changeClient)
        {
            InitializeComponent();
            try
            {
                if (changeClient != null)
                {
                    textEditName.Text = changeClient.Name;
                    textEditSecondName.Text = changeClient.SecondName;
                    textEditSurName.Text = changeClient.SurName;
                    textEditPhone.Text = changeClient.Phone;
                    clientToAdd.ID = changeClient.ID;
                }
            }
            catch(Exception ex )
            {

            }
        }
Ejemplo n.º 6
0
 private Client GetInputClient()
 {
     Client client = new Client();
     client.Name = txtName.Text;
     client.SurName= txtSurname.Text;
     client.SecondName=txtSecondName.Text;
     client.Phone=txtPhone.Text;
     return client;
 }
Ejemplo n.º 7
0
        public static List<Client> GetClients()
        {
            List<Client> clientList = new List<Client>();
            try
            {
                SqlConnection connection = OpenConnection();
                if ((connection == null) || (connection.State == ConnectionState.Closed))
                    return null;

                SqlCommand ngCommand = connection.CreateCommand();
                ngCommand.CommandType = CommandType.StoredProcedure;
                ngCommand.CommandText = GET_CLIENTS_REGISRTY;
                // ngCommand.CommandTimeout = CommandTimeOut > 2 * connection.ConnectionTimeout ? CommandTimeOut : 2 * connection.ConnectionTimeout;

                ngCommand.ExecuteNonQuery();
                SqlDataReader reader = null;
                if (connection != null)
                {

                    reader = ngCommand.ExecuteReader();
                    while (reader.Read())
                    {
                        Client newClient = new Client();

                        newClient.Name = (string)reader["Name"];
                        newClient.SurName = (string)reader["Surname"];
                        newClient.SecondName = (string)reader["SecondName"];
                        newClient.Phone = (string)reader["Phone"];
                        newClient.ID = (int)reader["ID"];
                        clientList.Add(newClient);

                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CloseConnection();
                return null;
            }
            CloseConnection();
            return clientList;
        }