void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e) { if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove) { objMaster = new ComplaintBO(); try { objMaster.GetByPrimaryKey(grdLister.CurrentRow.Cells["Id"].Value.ToInt()); if (objMaster.Current != null) { objMaster.Delete(objMaster.Current); } } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } e.Cancel = true; } } }
//Save public override void Save() { try { if (objMaster.PrimaryKeyValue == null) { objMaster.New(); } else { objMaster.Edit(); } objMaster.Current.ComplainDateTime = txtComplainDate.Value.ToDate(); objMaster.Current.IncidentDateTime = txtincidentDate.Value.ToDate(); objMaster.Current.CustomerName = txtCustomerName.Text.Trim(); objMaster.Current.CustomerAddress = txtAddressDetail.Text.Trim(); objMaster.Current.CustomerPhoneNo = txtPhoneNo.Text.Trim(); objMaster.Current.JobDetail = txtJobDetail.Text.Trim(); objMaster.Current.ControllerName = txtControlerName.Text.Trim(); objMaster.Current.CustomerPhoneNo = txtPhoneNo.Text.Trim(); objMaster.Current.ComplainDescription = txtComplain.Text.Trim(); objMaster.Current.DealtWith = txtDealt.Text.Trim(); objMaster.Current.ResultDescription = txtResult.Text.Trim(); int?driverId = null; int?companyId = null; if (rdoDriver.IsChecked == true) { driverId = ddlDriver.SelectedValue.ToIntorNull(); } else if (rdoAccount.IsChecked == true) { companyId = ddlAccount.SelectedValue.ToIntorNull(); } objMaster.Current.CompanyId = companyId; objMaster.Current.DriverId = driverId; long BookingId = txtJobRef.Tag.ToLong(); if (BookingId > 0 && txtJobRef.Text.Trim() != string.Empty) { objMaster.Current.BookingId = BookingId; } else { objMaster.Current.BookingId = null; } if (txtControlerName.Visible == true) { objMaster.Current.ControllerName = txtControlerName.Text.Trim(); } else { objMaster.Current.ControllerName = ""; } if (rdoDriver.IsChecked == true) { objMaster.Current.ComplaintBy = 1; } else { objMaster.Current.ComplaintBy = 0; } //New Code 15 Aprail if (rdoAccount.IsChecked == true) { objMaster.Current.ComplaintBy = 2; } // objMaster.Save(); savedId = objMaster.Current.Id; txtRefno.Text = objMaster.Current.RefNo.ToStr(); if (IsHidePopulateDate == false) { PopulateData(); } } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }