示例#1
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            aboutChairman chairmen = new aboutChairman();

            chairmen.ChairmanName        = txtChairmanName.Text;
            chairmen.ChairmanDesignation = txtChairmandesignation.Text;
            chairmen.ChairmanEmail       = txtEmail.Text;

            var basePath = Server.MapPath("~/Images");
            var rowCount = sManager.GetCountTotal();
            var fileName = string.Format("{0:00000000}_{1}", rowCount, chairmanPhoto.FileName);
            var filePath = System.IO.Path.Combine(basePath, fileName);

            chairmen.ChairmanPhoto = Path.Combine("/Images", fileName);

            int countRows = sManager.SaveChairman(chairmen);

            if (countRows > 0)
            {
                successPanel.Visible  = true;
                successPanel1.Visible = false;
                alertText.InnerHtml   = "Saved Sucessfully.";
            }

            var selectedPhoto = chairmanPhoto;

            selectedPhoto.SaveAs(filePath);
        }
示例#2
0
 internal int InsertChairman(aboutChairman chairmen)
 {
     try
     {
         connection.Open();
         command = new SqlCommand("wsp_aboutChairman", connection);
         command.Parameters.Add("@ChairmanName", SqlDbType.NVarChar).Value        = chairmen.ChairmanName;
         command.Parameters.Add("@ChairmanDesignation", SqlDbType.NVarChar).Value = chairmen.ChairmanDesignation;
         command.Parameters.Add("@ChairmanEmail", SqlDbType.NVarChar).Value       = chairmen.ChairmanEmail;
         command.Parameters.Add("@ChairmanPhoto", SqlDbType.NVarChar).Value       = chairmen.ChairmanPhoto;
         command.CommandType = CommandType.StoredProcedure;
         rows = command.ExecuteNonQuery();
     }
     finally
     {
         connection.Close();
     }
     return(rows);
 }
 internal int SaveChairman(aboutChairman chairmen)
 {
     return(sGateway.InsertChairman(chairmen));
 }