Exemplo n.º 1
0
 void InspectorDataEditor_Ok(object sender, EventArgs e)
 {
     try
     {
         if (((PhysicalCountInspectorInfo)InspectorDataEditor.DataSource).UserId == Guid.Empty)
         {
             errorDisplayer.ShowErrorMessage("Inspector is required");
         }
         else if (InspectorDataEditor.IsNew)
         {
             inventoryService.AddInspector(physicalCountInformation, (PhysicalCountInspectorInfo)InspectorDataEditor.DataSource);
             InspectorGridViewer.DataBind();
             InspectorDataEditor.IsNew = false;
         }
         else
         {
             var editedInspector = from inspector in PhysicalCountInformation.Inspectors
                                   where inspector.Id == ((PhysicalCountInspectorInfo)InspectorDataEditor.DataSource).Id
                                   select inspector;
             if (editedInspector.Count() > 0)
             {
                 editedInspector.ElementAt(0).Copy((PhysicalCountInspectorInfo)InspectorDataEditor.DataSource);
                 InspectorGridViewer.DataBind();
             }
         }
         btnCancel.Text = "  Cancel  ";
         mpeInspectorDataEditorExtender.Hide();
     }
     catch (Exception ex)
     {
         errorDisplayer.ShowErrorMessage(ex.Message);
     }
 }