protected void CallbackPanel_Callback(object sender, DevExpress.Web.CallbackEventArgsBase e)
 {
     if (e.Parameter == "RefreshGrid")
     {
         ASPxGridViewDeliveryNoteItem.DataBind();
     }
     else
     {
         object user      = ASPxGridViewDeliveryNoteItem.GetRowValues(ASPxGridViewDeliveryNoteItem.FocusedRowIndex, "DeliveryNoteItemID");
         bool   openPopup = SetSessionsAndOpenPopUp(e.Parameter, Enums.EmployeeSession.UserID, user);
         AddValueToSession(Enums.EmployeeSession.EmployeeID, deliveryNoteID);
         if (openPopup)
         {
             PopupControlUsers.ShowOnPageLoad = true;
         }
     }
 }
        private void ParseXML(string xmlPath, int userID)
        {
            try
            {
                XDocument doc        = XDocument.Load(new StreamReader(xmlPath, Encoding.UTF8));
                int       locationID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupLocation));
                int       supplierID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupSupplier));
                var       rootName   = doc.Root.Name;
                List <SummaryItemModel> topLevelList = new List <SummaryItemModel>();
                List <Item>             atomes       = new List <Item>();
                bool isRepacking = false;

                if (rootName == Enums.XMLTagName.Posiljka.ToString())
                {
                    var products = doc.Root.Element(Enums.XMLTagName.Vsebina.ToString()).Descendants(Enums.XMLTagName.Ident.ToString()).ToList();
                    topLevelList = FindTopLevelSummaryItems(products);
                    atomes       = SetHierarchyOfAtomes(products, topLevelList);
                }
                else
                {
                    var obj = doc.Root.Element(Enums.XMLTagName.SummaryItems.ToString());
                    List <SummaryItemModel> list = GetSummaryItems(obj);
                    var repacking = list.Where(si => si.ProducerProductName == "Repacking").FirstOrDefault();
                    isRepacking = repacking == null ? false : true;

                    topLevelList = FindTopLevelSummaryItems(list, doc.Root.Element(Enums.XMLTagName.Units.ToString()), isRepacking);
                    atomes       = SetHierarchyOfAtomes(doc.Root.Element(Enums.XMLTagName.Units.ToString()), list);
                }

                deliveryNoteRepo.SaveSummaryToDeliveryNoteItem(topLevelList, deliveryNoteID, locationID, supplierID, atomes, userID);

                deliveryNoteRepo.SaveInventoryDeliveries(atomes, deliveryNoteID, locationID, userID, isRepacking);
                //GetDeliveryNoteProvider().SetDeliveryNoteStatus(Enums.DeliveryNoteStatus.Completed);
                ASPxGridViewDeliveryNoteItem.DataBind();
            }
            catch (Exception ex)
            {
                processError = ex.Message;
                GetDeliveryNoteProvider().SetDeliveryNoteStatus(Enums.DeliveryNoteStatus.Error);
                AddOrEditEntityObject((userAction == (int)Enums.UserAction.Add ? true : false));
                throw new Exception(ex.Message, ex);
            }
        }