private bool AddOrEditEntityObject(bool add = false)
        {
            if (add)
            {
                model = new DeliveryNote(session);
                model.DeliveryNoteID = 0;
            }
            else if (!add && model == null)
            {
                model = GetDeliveryNoteProvider().GetDeliveryNoteModel();
            }

            model.DeliveryNoteDate    = DateEditDeliveryNoteDate.Date;
            model.DeliveryNoteNumber  = txtDeliveryNoteNumber.Text;
            model.RecivedMaterialDate = DateEditDeliveryNoteDate.Date;

            int supplierID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupSupplier));

            if (model.SupplierID != null)
            {
                model.SupplierID = clientRepo.GetClientByID(supplierID, model.SupplierID.Session);
            }
            else
            {
                model.SupplierID = clientRepo.GetClientByID(supplierID);
            }

            int locationID = CommonMethods.ParseInt(GetGridLookupValue(GridLookupLocation));

            if (model.LocationID != null)
            {
                model.LocationID = locationRepo.GetLocationByID(locationID, model.LocationID.Session);
            }
            else
            {
                model.LocationID = locationRepo.GetLocationByID(locationID);
            }

            model.Notes = MemoNotes.Text;

            /*if (!String.IsNullOrEmpty(model.Picture))
             * {
             *  //UploadProfile.ProfileImage.Src = model.Picture.Replace(AppDomain.CurrentDomain.BaseDirectory, "\\");
             * }*/

            if (GetDeliveryNoteProvider().GetDeliveryNoteStatus() == Enums.DeliveryNoteStatus.Error && !String.IsNullOrEmpty(processError))
            {
                model.ProcessError = processError;
            }

            model.DeliveryNoteStatusID = deliveryNoteRepo.GetDeliveryNoteStatusByCode(GetDeliveryNoteProvider().GetDeliveryNoteStatus(), model.Session);

            deliveryNoteID = deliveryNoteRepo.SaveDeliveryNote(model, PrincipalHelper.GetUserID());

            return(true);
        }