public void BindValues() { try { Facility objFaciliy = FacilityController.GetFacilitiesById(FacilityId); txtDescp.Text = objFaciliy.description; txtName.Text = objFaciliy.facilityName; serImg.ImageUrl = objFaciliy.image; } catch (Exception ex) { throw ex; } }
public void UpdateFacility() { try { try { Facility objFaciliy = FacilityController.GetFacilitiesById(FacilityId); objFaciliy.facilityName = txtName.Text; objFaciliy.description = txtDescp.Text; if (fileUpldImg.HasFile) { string fileName = "", path = "", ext = ""; ext = Path.GetExtension(fileUpldImg.PostedFile.FileName); if (ext.Equals(".jpg") || ext.Equals(".png") || ext.Equals(".gif") || ext.Equals(".jpeg")) { fileName = Path.GetFileName(fileUpldImg.PostedFile.FileName); path = "ServiceImages/" + fileName; ResizeImage(fileUpldImg.PostedFile.InputStream, Server.MapPath(path)); //fileUpldImg.SaveAs(Server.MapPath(path)); objFaciliy.image = path; } else { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "err_msg", "MessageBox('Error','Please select Image file Only');", true); } } objFaciliy = new FacilityController().UpdateFacility(objFaciliy); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "suc_msg", "MessageBox('Success','Service Updated Successfully');", true); ClearValues(); BindGrid(); PanelVisibility(true, false); } catch (Exception ex) { throw ex; } } catch (Exception ex) { throw ex; } }