protected void btnSaveService_Click(object sender, EventArgs e) { AboutDirector director = new AboutDirector(); director.DirectorName = txtDirector.Text; director.DirectorDesignation = txtDirectorDesignation.Text; director.DirectorEmail = txtDirectorEmail.Text; var basePath = Server.MapPath("~/Images"); var rowCount = sManager.GetDirectorCountTotal(); var fileName = string.Format("{0:00000000}_{1}", rowCount, directorPhoto.FileName); var filePath = System.IO.Path.Combine(basePath, fileName); director.DirectorPhoto = Path.Combine("/Images", fileName); int countRows = sManager.SaveDirector(director); if (countRows > 0) { successPanel1.Visible = true; successPanel.Visible = false; alertText1.InnerHtml = "Saved Successfully"; } var selectedPhoto = directorPhoto; selectedPhoto.SaveAs(filePath); }
internal int InsertDirector(AboutDirector director) { try { connection.Open(); command = new SqlCommand("wsp_aboutDirector", connection); command.Parameters.Add("@DirectorName", SqlDbType.NVarChar).Value = director.DirectorName; command.Parameters.Add("@DirectorDesignation", SqlDbType.NVarChar).Value = director.DirectorDesignation; command.Parameters.Add("@DirectorEmail", SqlDbType.NVarChar).Value = director.DirectorEmail; command.Parameters.Add("@DirectorPhoto", SqlDbType.NVarChar).Value = director.DirectorPhoto; command.CommandType = CommandType.StoredProcedure; rows = command.ExecuteNonQuery(); } finally { connection.Close(); } return(rows); }
internal int SaveDirector(AboutDirector director) { return(sGateway.InsertDirector(director)); }