protected void gviewWTE_RowEditing(object sender, GridViewEditEventArgs e) { //show the modal popup //load the formview //get the id int wteID = Convert.ToInt32((gviewWTE.Rows[e.NewEditIndex].FindControl("hdnWTEID") as HiddenField).Value.ToString()); WaterTreatmentEquipment wte = WTEManager.GetByWTEID(wteID); WaterTreatmentEquipmentList wteList = new WaterTreatmentEquipmentList(); wteList.Add(wte); fviewUpdateWTE.DataSource = wteList; fviewUpdateWTE.DataBind(); this.modPopUpShowUpdateWTE.Show(); }
public static WaterTreatmentEquipmentList GetList(int accountID) { WaterTreatmentEquipmentList aList = null; MyDBConnection myConn = new MyDBConnection(); SqlConnection conn = new SqlConnection(); SqlDataReader dr; SqlCommand cmd = null; string sql = "Select * from AquaOne.dbo.WaterTreatmentEquipment where accountID = @accountID"; try { // Open the connection conn = myConn.OpenDB(); cmd = new SqlCommand(sql, conn); cmd.Parameters.Add("@accountID", SqlDbType.Int).Value = accountID; dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); if (dr.HasRows) { aList = new WaterTreatmentEquipmentList(); while (dr.Read()) { aList.Add(FillDataRecord(dr)); } } cmd.Dispose(); dr.Close(); } finally { myConn.CloseDB(conn); } return(aList); }