protected void loadUsers() { ClsITBA ba = new ClsITBA(); List <clsCollectionSpecialist> qShipMeth = SrvCollectionSpecialist.GetCollectionSpecialistView(); rgITBA.DataSource = qShipMeth; }
protected void rgITBA_UpdateCommand(object source, GridCommandEventArgs e) { try { UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); Label errorMsg = (Label)userControl.FindControl("lblErrorMessage"); clsCollectionSpecialist oRow = populateObj(userControl); oRow.idCollectionSpecialist = Convert.ToInt16((userControl.FindControl("hdnITBAID") as HiddenField).Value); string updateMsg = ""; if (IsValid) { if (oRow != null) { updateMsg = SrvCollectionSpecialist.UpdateCollectionSpecialist(oRow); if (updateMsg == "") { lblSuccess.Text = "Successfully updated information for " + "'" + oRow.Name + "'"; } else { errorMsg.Visible = true; errorMsg.Text = updateMsg; e.Canceled = true; } } } else { errorMsg.Visible = true; errorMsg.Text = "Please enter Required fields"; e.Canceled = true; } } catch (Exception ex) { pnlDanger.Visible = true; lblDanger.Text = ex.Message.ToString(); e.Canceled = true; } }
protected void rgITBA_InsertCommand(object sender, GridCommandEventArgs e) { try { UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID); Label errorMsg = (Label)userControl.FindControl("lblErrorMessage"); clsCollectionSpecialist oRow = populateObj(userControl); string insertMsg = ""; if (IsValid) { if (oRow != null) { insertMsg = SrvCollectionSpecialist.InsertCollectionSpecialist(oRow); if (insertMsg == "") { lblSuccess.Text = "Successfully Added New Record " + oRow.Name; } else { errorMsg.Visible = true; errorMsg.Text = insertMsg; e.Canceled = true; } } } else { errorMsg.Visible = true; errorMsg.Text = "Please enter Required fields"; e.Canceled = true; } } catch (Exception ex) { pnlDanger.Visible = true; lblDanger.Text = ex.Message.ToString(); e.Canceled = true; } }