private void SaveAirports() { DataTable dt = new DataTable(); dt.Columns.Add("airportID", typeof(int)); DataRow rowAirport; HiddenField uoHiddenFieldAirport; DataTable dtBrand = null; dtBrand = new DataTable(); DataColumn colBrandID = new DataColumn("colBrandID", typeof(Int32)); dtBrand.Columns.Add(colBrandID); DataRow rowBrand; int portAgent = GlobalCode.Field2Int(Request.QueryString["pid"]); try { foreach (ListViewItem item in uoListViewAirportSaved.Items) { uoHiddenFieldAirport = (HiddenField)item.FindControl("uoHiddenFieldAirportSaved"); //uoCheckBoxListBrand = (CheckBoxList)item.FindControl("uoCheckBoxListBrand"); UserAirportList AirportItem = new UserAirportList(); int airport = GlobalCode.Field2Int(uoHiddenFieldAirport.Value); //get brand and user id of user string stringger = Request.RawUrl.ToString(); rowAirport = dt.NewRow(); rowAirport["airportID"] = airport; dt.Rows.Add(rowAirport); } for (int i = 0; i < uoCheckBoxListBrand.Items.Count; i++) { if (uoCheckBoxListBrand.Items[i].Selected) { rowBrand = dtBrand.NewRow(); rowBrand["colBrandID"] = GlobalCode.Field2Int(uoCheckBoxListBrand.Items[i].Value); dtBrand.Rows.Add(rowBrand); } } MaintenanceViewBLL.BrandAirportVehicleSave(portAgent, dt, dtBrand, uoHiddenFieldUser.Value); } catch (Exception ex) { throw ex; } finally{ } }
/// <summary> /// Date Created: 25/09/2011 /// Created By: Josephine Gad /// Description: Save User Airport /// </summary> private void SaveUserAirport() { DataTable dt = null; HiddenField uoHiddenFieldAirport; List <UserAirportList> list = new List <UserAirportList>(); try { foreach (ListViewItem item in uoListViewAirportSaved.Items) { uoHiddenFieldAirport = (HiddenField)item.FindControl("uoHiddenFieldAirport"); UserAirportList AirportItem = new UserAirportList(); AirportItem.AirportID = GlobalCode.Field2Int(uoHiddenFieldAirport.Value); AirportItem.UserName = uoHiddenFieldUser.Value; list.Add(AirportItem); } string strLogDescription = "Airport of User added"; string strFunction = "SaveUserAirport"; dt = getDataTable(list); UserAccountBLL.SaveUserAirport(dt, uoHiddenFieldUserName.Value, strLogDescription, strFunction, Path.GetFileName(Request.Path)); AlertMessage("User Airport successfully saved."); } catch (Exception ex) { AlertMessage(ex.Message); } finally { if (dt != null) { dt.Dispose(); } } }