Exemplo n.º 1
0
        protected void ctlLocationLookup_OnObjectLookUpReturn(object sender, ObjectLookUpReturnArgs e)
        {
            IList <DbLocation>            locationList            = (IList <DbLocation>)e.ObjectReturn;
            IList <DbServiceTeamLocation> serviceTeamLocationList = new List <DbServiceTeamLocation>();

            foreach (DbLocation location in locationList)
            {
                Location locate = new Location();
                locate.LocationID = location.LocationID;
                DbServiceTeam         serviceTeam         = ScgDbQueryProvider.DbServiceTeamQuery.FindByIdentity(Convert.ToInt64(ctlServiceTeamIDHidden.Value));
                DbServiceTeamLocation serviceTeamLocation = GetServiceTeamLocation(serviceTeam, locate);
                serviceTeamLocationList.Add(serviceTeamLocation);
            }

            if (serviceTeamLocationList.Count > 0)
            {
                try
                {
                    DbServiceTeamLocationService.AddServiceTeamLocationList(serviceTeamLocationList);
                    ctlLocationGrid.DataCountAndBind();
                }
                catch (ServiceValidationException ex)
                {
                    ValidationErrors.MergeErrors(ex.ValidationErrors);
                }
            }
            ctlUpdatePanelLocationGrid.Update();
        }