protected void frmRoomAmenity_ItemCommand(object sender, FormViewCommandEventArgs e) { Accomodation_ID = Guid.Parse(Request.QueryString["Hotel_Id"]); Accommodation_RoomInfo_Id = new Guid(((TextBox)(this.Parent.FindControl("txtRoomInfo_Id"))).Text); TextBox txtRoomInfo_Id = (TextBox)frmRoomAmenity.FindControl("txtRoomInfo_Id"); TextBox txtAmenityName = (TextBox)frmRoomAmenity.FindControl("txtAmenityName"); DropDownList ddlFacilityCategory = (DropDownList)frmRoomAmenity.FindControl("ddlFacilityCategory"); if (e.CommandName.ToString() == "AddAmenity") { TLGX_Consumer.MDMSVC.DC_Accomodation_RoomFacilities newObj = new MDMSVC.DC_Accomodation_RoomFacilities { Accommodation_RoomFacility_Id = Guid.NewGuid(), Accommodation_Id = Accomodation_ID, Accommodation_RoomInfo_Id = Accommodation_RoomInfo_Id, AmenityName = txtAmenityName.Text.Trim(), AmenityType = ddlFacilityCategory.SelectedItem.Text.Trim(), Create_Date = DateTime.Now, Create_User = System.Web.HttpContext.Current.User.Identity.Name, IsActive = true }; if (AccSvc.AddRoomFacilities(newObj)) { frmRoomAmenity.DataBind(); GetRoomAmenityDetails(); BootstrapAlert.BootstrapAlertMessage(dvMsg, "Room Amenity has been added successfully", BootstrapAlertType.Success); } else { BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning); } } else if (e.CommandName.ToString() == "UpdateAmenity") { Guid myRow_Id = Guid.Parse(grdRoomAmenities.SelectedDataKey.Value.ToString()); var result = AccSvc.GetRoomFacilitiesDetails(Accomodation_ID, Accommodation_RoomInfo_Id, myRow_Id); // AccSvc.GetRoomDetails(Accomodation_ID, myRow_Id); if (result.Count > 0) { TLGX_Consumer.MDMSVC.DC_Accomodation_RoomFacilities newObj = new MDMSVC.DC_Accomodation_RoomFacilities { Accommodation_RoomFacility_Id = myRow_Id, Accommodation_Id = Accomodation_ID, Accommodation_RoomInfo_Id = Accommodation_RoomInfo_Id, AmenityName = txtAmenityName.Text.Trim(), AmenityType = ddlFacilityCategory.SelectedItem.Text.Trim(), Edit_Date = DateTime.Now, Edit_user = System.Web.HttpContext.Current.User.Identity.Name, IsActive = true }; if (AccSvc.UpdateRoomFacilities(newObj)) { Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]); frmRoomAmenity.ChangeMode(FormViewMode.Insert); frmRoomAmenity.DataBind(); GetRoomAmenityDetails(); BootstrapAlert.BootstrapAlertMessage(dvMsg, "Room Amenity has been updated successfully", BootstrapAlertType.Success); } else { BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning); } } } }