Пример #1
0
 void StackCountDataEditor_Ok(object sender, EventArgs e)
 {
     try
     {
         if (((StackPhysicalCountInfo)StackCountDataEditor.DataSource).StackId == Guid.Empty)
         {
             errorDisplayer.ShowErrorMessage("Stack is required");
         }
         else if (StackCountDataEditor.IsNew)
         {
             inventoryService.AddStackPhysicalCount(PhysicalCountInformation, ((StackPhysicalCountInfo)StackCountDataEditor.DataSource));
             StackGrid.DataBind();
             StackCountDataEditor.IsNew = false;
         }
         else
         {
             var editedStackCount = from stackCount in PhysicalCountInformation.Stacks
                                    where stackCount.Id == ((StackPhysicalCountInfo)StackCountDataEditor.DataSource).Id
                                    select stackCount;
             if (editedStackCount.Count() > 0)
             {
                 editedStackCount.ElementAt(0).Copy((StackPhysicalCountInfo)StackCountDataEditor.DataSource);
                 StackGrid.DataBind();
             }
         }
         mpeStackCountDataEditorExtender.Hide();
         btnCancel.Text = "  Cancel  ";
     }
     catch (Exception ex)
     {
         errorDisplayer.ShowErrorMessage(ex.Message);
     }
 }