private void updateCustom_Click(object sender, EventArgs e)
        {
            AuthorUpdateSdi authorUpdateSdi = new AuthorUpdateSdi();

            authorUpdateSdi.AuthorId = authorIdTextBox.Text;
            authorUpdateSdi.Fname    = fnameTextBox.Text;
            authorUpdateSdi.Mname    = mnameTextBox.Text;
            authorUpdateSdi.Lname    = lnameTextBox.Text;
            authorUpdateSdi.DOB1     = dobTextBox.Value.ToString();
            Author author = authorService.updateAuthor(authorUpdateSdi);

            if (author != null)
            {
                this.Close();
                authorForm.updateDataToTable(author);
            }
        }
示例#2
0
        public Author updateAuthor(AuthorUpdateSdi sdi)
        {
            con = SqlServerConnection.getConnnection();
            con.Open();
            StringBuilder sql = new StringBuilder();

            sql.Append(" update Author  set " +
                       "fName = @fname," +
                       "lName = @lname," +
                       "mName = @mname," +
                       "DOB = @dob ");
            sql.Append(" where AuthorId = @authorid");
            SqlCommand command = new SqlCommand(sql.ToString(), con);

            command.Parameters.AddWithValue("fname", sdi.Fname);
            command.Parameters.AddWithValue("mname", sdi.Mname);
            command.Parameters.AddWithValue("lname", sdi.Lname);
            command.Parameters.AddWithValue("dob", DateTime.Parse(sdi.DOB1));
            command.Parameters.AddWithValue("authorid", sdi.AuthorId);
            command.ExecuteNonQuery();
            con.Close();
            return(this.getAuthorById(sdi.AuthorId));
        }
示例#3
0
 public Author updateAuthor(AuthorUpdateSdi authorUpdateSdi)
 {
     return(authorRepoService.updateAuthor(authorUpdateSdi));
 }