protected void frmHotelUpdate_ItemCommand(object sender, FormViewCommandEventArgs e) { DropDownList ddlHotelUpdateSource = (DropDownList)frmHotelUpdate.FindControl("ddlHotelUpdateSource"); TextBox txtDescription = (TextBox)frmHotelUpdate.FindControl("txtDescription"); TextBox txtFrom = (TextBox)frmHotelUpdate.FindControl("txtFrom"); TextBox txtTo = (TextBox)frmHotelUpdate.FindControl("txtTo"); CheckBox chkIsInternal = (CheckBox)frmHotelUpdate.FindControl("chkIsInternal"); if (e.CommandName.ToString() == "Add") { TLGX_Consumer.MDMSVC.DC_Accommodation_HotelUpdates newObj = new MDMSVC.DC_Accommodation_HotelUpdates { Accommodation_HotelUpdates_Id = Guid.NewGuid(), Accommodation_Id = Guid.Parse(Request.QueryString["Hotel_Id"]), Description = txtDescription.Text.Trim(), Source = ddlHotelUpdateSource.SelectedItem.Text.Trim(), Create_Date = DateTime.Now, Create_User = System.Web.HttpContext.Current.User.Identity.Name, FromDate = DateTime.ParseExact(txtFrom.Text.Trim(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture), ToDate = DateTime.ParseExact(txtTo.Text.Trim(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture), IsActive = true }; if (chkIsInternal.Checked) { newObj.IsInternal = true; } else { newObj.IsInternal = false; } if (AccSvc.AddHotelUpdate(newObj)) { frmHotelUpdate.ChangeMode(FormViewMode.Insert); frmHotelUpdate.DataBind(); GetHotelUpdateDetails(); GetLookUpData(); BootstrapAlert.BootstrapAlertMessage(dvMsg, "Updates has been added successfully", BootstrapAlertType.Success); } else { BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning); } } if (e.CommandName.ToString() == "Modify") { Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]); Guid myRow_Id = Guid.Parse(grdHotelupdates.SelectedDataKey.Value.ToString()); var result = AccSvc.GetHotelUpdateDetails(Accomodation_ID, myRow_Id); if (result.Count > 0) { TLGX_Consumer.MDMSVC.DC_Accommodation_HotelUpdates newObj = new MDMSVC.DC_Accommodation_HotelUpdates { Accommodation_HotelUpdates_Id = myRow_Id, Accommodation_Id = Guid.Parse(Request.QueryString["Hotel_Id"]), Description = txtDescription.Text.Trim(), Source = ddlHotelUpdateSource.SelectedItem.Text.Trim(), Edit_Date = DateTime.Now, Edit_User = System.Web.HttpContext.Current.User.Identity.Name, FromDate = DateTime.ParseExact(txtFrom.Text.Trim(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture), ToDate = DateTime.ParseExact(txtTo.Text.Trim(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture), IsActive = true }; if (chkIsInternal.Checked) { newObj.IsInternal = true; } else { newObj.IsInternal = false; } if (AccSvc.UpdateHotelUpdate(newObj)) { Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]); frmHotelUpdate.ChangeMode(FormViewMode.Insert); frmHotelUpdate.DataBind(); GetHotelUpdateDetails(); GetLookUpData(); BootstrapAlert.BootstrapAlertMessage(dvMsg, "Updates has been updated successfully", BootstrapAlertType.Success); } else { BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning); } } } ; }