void AddExecute(object param)
        {
            ClientLocation clientLocation;

            if (currentClientDef != null)
            {
                clientLocation = currentClientDef.Clone();
            }
            else
            {
                clientLocation                        = new ClientLocation();
                clientLocation.ExtSys                 = ExtSyss[0].EXT_SYS;
                clientLocation.OverrideKeySource      = OverRideKeySources[0].OVERRIDE_KEY_SOURCE;
                clientLocation.ExtWorkTypeSourceDescr = ExtWorkTypeSources[0].DESCR;
            }
            clientLocation.ExtClientKey = null;// Force them to type in a new  one
            clientLocation.IsAdding     = true;

            this.ClientDefListViewModel.ClientLocations.Add(clientLocation);
            ClientDefListViewModel.CurrentClientLocation = clientLocation;
            //this.ClientDefListViewModel.clientLocations.Add(clientLocation);
            //ClientDefListViewModel.currentClientLocation = clientLocation;

            ClientDefListViewModel.EnablePicker = false;
            CurrentClientDef          = clientLocation;
            CurrentClientDef.Modified = true;
        }
        public override ClientLocation RowConverter(IDataRecord row)
        {
            ClientLocation ec = new ClientLocation();

            rowcount++;
            int lastgood = 0;

            try
            {
                ec.ExtSys = row["ext_sys"].ToString();
                lastgood++;
                ec.ExtClientKey = row["ext_client_key"].ToString();
                lastgood++;
                ec.DefaultInvoiceGrpID = CastDbValue(row, "default_invoice_grp_id");
                lastgood++;
                ec.Description = CastDbValue(row, "descr");
                lastgood++;
                ec.CostCode = CastDbValue(row, "cost_code");
                lastgood++;
                ec.ExtWorkTypeSourceDescr = CastDbValue(row, "ext_work_type_source_descr");
                lastgood++;
                ec.OverrideKeySource = CastDbValue(row, "override_key_source");
                lastgood++;
                ec.DefaultTatThreshold = CastDbValue(row, "default_tat_threshold");
                lastgood++;
                ec.Modified = false;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ec);
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Post([FromBody] ClientLocation client)
        {
            if (ModelState.IsValid)
            {
                var location = new Location
                {
                    Address = client.Address,
                    City    = client.City
                };

                var newClient = new Client {
                    ClientName = client.ClientName
                };
                try
                {
                    var locationAdded = await _repoLoc.Create(location);

                    newClient.LocationId = locationAdded.LocationId;
                    var addedClient = await _repo.Create(newClient);

                    return(Ok(addedClient));
                }
                catch (Exception ex)
                {
                    _logger.LogError($"Exception thrown while getting client: {ex}");
                }
            }
            return(BadRequest($"Error ocurred"));
        }
Ejemplo n.º 4
0
        public ActionResult Create(ClientLocation model)
        {
            SetSessionVariables();

            if (model != null)
            {
                model.CreatedBy            = GetSessionObject().UserID;
                model.CreatedDateTime      = DateTime.Now;
                model.ClientID             = GetSessionObject().ClientID.Value;
                model.ClientLocationStatus = true;
            }

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Common.Instance.ApiClientControllerName);

                //HTTP POST
                var postTask = client.PostAsJsonAsync <ClientLocation>(Common.Instance.ApiClientAddClientLocation, model);
                postTask.Wait();

                var result = postTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    return(RedirectToAction("Index"));
                }
            }

            ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 5
0
 public SpaceDetailsListSearchResponse()
 {
     space    = new ClientWorkSpaceFloorPlan();
     client   = new ClientMaster();
     location = new ClientLocation();
     //facilities = new List<FacilityMaster>();
 }
        //private int lastEntry = 0;
        //static private int debugENTRIES = 0;
        protected override void RowConverter(ClientLocation item, DataRow row)
        {
            rowcount++;
            int lastEntry = 0;

            try
            {
                //if (lastEntry > 2636)
                //    debugENTRIES = 331;//break;
                item.ExtSys = row["ext_sys"].ToString();
                lastEntry++;
                item.ExtClientKey = row["ext_client_key"].ToString();
                lastEntry++;
                item.DefaultInvoiceGrpID = CastDbValueRow(row, "default_invoice_grp_id", true, "decimal");
                lastEntry++;
                item.Description = CastDbValueRow(row, "descr");
                lastEntry++;
                item.CostCode = CastDbValueRow(row, "cost_code");
                lastEntry++;
                item.ExtWorkTypeSourceDescr = CastDbValueRow(row, "ext_work_type_source_descr");
                lastEntry++;
                item.OverrideKeySource = CastDbValueRow(row, "override_key_source");
                lastEntry++;
                item.DefaultTatThreshold = CastDbValueRow(row, "default_tat_threshold", true, "decimal");
                lastEntry++;
                item.Modified = false;
            }
            catch (Exception sysEx)
            {
                throw sysEx;
            }
        }
Ejemplo n.º 7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            ClientSetting setting = new ClientSetting();

            setting.HomeUrl = this.tbHomeUrl.Text;

            ClientLocation location = new ClientLocation();
            double         posX     = 0;

            double.TryParse(this.tbPositionX.Text, out posX);
            location.X = posX;

            double posY = 0;

            double.TryParse(this.tbPositionY.Text, out posY);
            location.Y = posY;

            double width = 0;

            double.TryParse(this.tbWidth.Text, out width);
            location.Width = width;

            double height = 0;

            double.TryParse(this.tbHeight.Text, out height);
            location.Height  = height;
            setting.Location = location;

            if (SettingChanged != null)
            {
                SettingChanged(setting);
            }
            this.Close();
        }
 public WorkSpaceDetailsResponse()
 {
     selectedSpace = new ClientWorkSpaceFloorPlan();
     client        = new ClientMaster();
     location      = new ClientLocation();
     clientFloors  = new List <ClientFloorDetails>();
 }
Ejemplo n.º 9
0
        void LocationManager_LocationsUpdated(object sender, CLLocationsUpdatedEventArgs e)
        {
            var currentLocation = e.Locations[0];

            this.lastLocation = new ClientLocation {
                Latitude = currentLocation.Coordinate.Latitude, Longitude = currentLocation.Coordinate.Longitude, Altitude = currentLocation.Altitude
            };
        }
        public override void Remove(ClientLocation client)
        {
            string sql = String.Format("DELETE FROM {0}.EXT_CLIENT WHERE EXT_SYS = :EXT_SYS and EXT_CLIENT_KEY = :EXT_CLIENT_KEY", SchemaName);
            List <OracleParameter> parameters = new List <OracleParameter>();

            parameters.Add(OracleHelper.CreateParameter(":EXT_SYS", client.ExtSys, OracleType.VarChar, ParameterDirection.Input));
            parameters.Add(OracleHelper.CreateParameter(":EXT_CLIENT_KEY", client.ExtClientKey, OracleType.VarChar, ParameterDirection.Input));
            OracleParameterCollection outParams = OracleHelper.ExecuteNonQuery(base.ConnectionString.Value, sql, parameters.ToArray <OracleParameter>());
        }
        public ClientLocation Post([FromBody] ClientLocation clientLocation)
        {
            db.ClientLocations.Add(clientLocation);
            db.SaveChanges();

            ClientLocation existingClientLocation = db.ClientLocations.Where(temp => temp.ClientLocationID == clientLocation.ClientLocationID).FirstOrDefault();

            return(clientLocation);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 判断一个 ConnectionListItem 是否等价于另一个 ConnectionListItem。
 /// </summary>
 /// <param name="other">要与之比较的 ConnectionListItem。</param>
 /// <returns>一个 <see cref="System.Boolean"/>,指示二者是否等价。</returns>
 public bool Equals(ConnectionListItem other)
 {
     if (other == null)
     {
         return(this == null);
     }
     else
     {
         return(ClientLocation.Equals(other.ClientLocation));
     }
 }
Ejemplo n.º 13
0
        public async Task <IActionResult> GetAsync([FromQuery] ClientLocation clientLocation)
        {
            var service = serviceFunc();

            const double lat = -34.809964, longi = 138.680274;

            var data = await service.GetLocationsAsync(clientLocation.Latitude,
                                                       clientLocation.Longitude, distance : 1);

            return(EitherResponse(data));
        }
Ejemplo n.º 14
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (_telephones != null ? _telephones.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (_comments != null ? _comments.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (ClientLocation != null ? ClientLocation.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Person != null ? Person.GetHashCode() : 0);
         return(hashCode);
     }
 }
        public IActionResult GetByClientLocationID(int ClientLocationID)
        {
            ClientLocation clientLocation = db.ClientLocations.Where(temp => temp.ClientLocationID == ClientLocationID).FirstOrDefault();

            if (clientLocation != null)
            {
                return(Ok(clientLocation));
            }
            else
            {
                return(NoContent());
            }
        }
        private void ClientLocListener(object sender, PropertyChangedEventArgs e)
        {
            ClientLocation c = sender as ClientLocation;

            if (c.Modified)
            {
                EnablePicker = false;
            }
            else
            {
                EnablePicker = true;
            }
        }
Ejemplo n.º 17
0
 public ClientMarker(ClientLocation clientLocation, ClientViewModel client)
 {
     Client      = client;
     Country     = clientLocation.Country;
     CountryName = clientLocation.CountryName;
     Region      = clientLocation.Region;
     City        = clientLocation.City;
     Latitude    = clientLocation.Latitude;
     Longitude   = clientLocation.Longitude;
     ZipCode     = clientLocation.ZipCode;
     Timezone    = clientLocation.Timezone;
     IpAddress   = clientLocation.IpAddress;
 }
 public void SwapClientDefItem(ClientLocation item)
 {
     if (CurrentClientLocation != null)
     {
         RemoveWeakEventListener(CurrentClientLocation, ClientLocListener);
     }
     CurrentClientLocation          = item;
     CurrentClientLocation.Modified = false;
     ClearOutPendingAdds();
     if (CurrentClientLocation != null)
     {
         AddWeakEventListener(CurrentClientLocation, ClientLocListener);
     }
 }
        public int Delete(int ClientLocationID)
        {
            ClientLocation existingClientLocation = db.ClientLocations.Where(temp => temp.ClientLocationID == ClientLocationID).FirstOrDefault();

            if (existingClientLocation != null)
            {
                db.ClientLocations.Remove(existingClientLocation);
                db.SaveChanges();
                return(ClientLocationID);
            }
            else
            {
                return(-1);
            }
        }
        public ClientLocation Put([FromBody] ClientLocation project)
        {
            ClientLocation existingClientLocation = db.ClientLocations.Where(temp => temp.ClientLocationID == project.ClientLocationID).FirstOrDefault();

            if (existingClientLocation != null)
            {
                existingClientLocation.ClientLocationName = project.ClientLocationName;
                db.SaveChanges();
                return(existingClientLocation);
            }
            else
            {
                return(null);
            }
        }
        /// <summary>
        /// COST_CODE  VARCHAR
        /// DEFAULT_INVOICE_GRP_ID  NUMBER
        /// DEFAULT_TAT_THRESHOLD   NUMBER
        /// DESCR                   VARCHAR
        /// EXT_WORK_TYPE_SOURCE_DESCR  VARCHAR
        /// OVERRIDE_KEY_SOURCE  VARCHAR
        /// </summary>
        /// <param name="loc"></param>
        /// <returns></returns>
        public override ClientLocation Update(ClientLocation loc)
        {
            try
            {
                string sql = String.Format("update {0}.EXT_CLIENT set "
                                           + "  DEFAULT_INVOICE_GRP_ID = :id "
                                           + "  ,DEFAULT_TAT_THRESHOLD = :default_tat_threshold "
                                           + "  ,COST_CODE = :cost_code "
                                           + "  ,DESCR = :descr "
                                           + "  ,EXT_WORK_TYPE_SOURCE_DESCR = :ext_work_type_source_descr "
                                           + "  ,OVERRIDE_KEY_SOURCE = :override_key_source "
                                           + " where ext_sys = :ext_sys and ext_client_key = :extclientkey"
                                           , SchemaName);
                List <OracleParameter> parameters = new List <OracleParameter>();
                parameters.Add(OracleHelper.CreateParameter(":id", loc.DefaultInvoiceGrpID, OracleType.Number, ParameterDirection.Input));

                object v;
                if (loc.DefaultTatThreshold == null)
                {
                    v = DBNull.Value;
                }
                else
                {
                    v = loc.DefaultTatThreshold;
                }

                parameters.Add(OracleHelper.CreateParameter(":default_tat_threshold", NullableInput(loc.DefaultTatThreshold), OracleType.Number, ParameterDirection.Input));

                parameters.Add(OracleHelper.CreateParameter(":cost_code", NullableInput(loc.CostCode), OracleType.VarChar, 10, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":descr", NullableInput(loc.Description), OracleType.VarChar, 100, ParameterDirection.Input));

                parameters.Add(OracleHelper.CreateParameter(":ext_work_type_source_descr", NullableInput(loc.ExtWorkTypeSourceDescr), OracleType.VarChar, 100, ParameterDirection.Input));

                parameters.Add(OracleHelper.CreateParameter(":override_key_source", NullableInput(loc.OverrideKeySource), OracleType.VarChar, 30, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":ext_sys", loc.ExtSys, OracleType.VarChar, 20, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":extclientkey", loc.ExtClientKey, OracleType.VarChar, 20, ParameterDirection.Input));
                OracleParameterCollection outParams = OracleHelper.ExecuteNonQuery(base.ConnectionString.Value, sql, parameters.ToArray <OracleParameter>());
                return(loc);
            }
            catch (OracleException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 22
0
 void GongSolutions.Wpf.DragDrop.IDropTarget.Drop(GongSolutions.Wpf.DragDrop.DropInfo dropInfo)
 {
     if (dropInfo.Data is List <ClientLocation> )
     {
         foreach (ClientLocation loc in dropInfo.Data as List <ClientLocation> )
         {
             loc.DefaultInvoiceGrpID = (dropInfo.TargetItem as InvoiceGroup).InvoiceGrpId;
             ExtClientTarget.Update(loc);
         }
     }
     else if (dropInfo.Data is ClientLocation)
     {
         ClientLocation loc = dropInfo.Data as ClientLocation;
         loc.DefaultInvoiceGrpID = (dropInfo.TargetItem as InvoiceGroup).InvoiceGrpId;
         ExtClientTarget.Update(loc);
     }
     DetailVM.SetItemDetails();
 }
Ejemplo n.º 23
0
        private static void onJoinEvent(object sender, PlayerJoinEventArgs e)
        {
            currentMapID = e.mapID;

            ClientLocation c = new ClientLocation();

            c.clientID = Settings.clientID;
            c.location = currentMapID;

            string url = Settings.ROA_MAPPER_API + "client/location";

            var client = new WebClient();

            client.Headers[HttpRequestHeader.ContentType] = "application/json";
            Uri uri          = new Uri(url);
            var servicePoint = ServicePointManager.FindServicePoint(uri);

            servicePoint.Expect100Continue = false;

            client.UploadStringAsync(uri, Newtonsoft.Json.JsonConvert.SerializeObject(c));
        }
Ejemplo n.º 24
0
        private void WorldMap_MouseMove(object sender, MouseEventArgs e)
        {
            var imageControl = (Image) sender;
            var position = e.GetPosition(imageControl);
            var lon = position.X/imageControl.ActualWidth*360 - 180;
            var lat = (position.Y/imageControl.ActualHeight - 1)*-1*180 - 90;

            foreach (var marker in Markers)
            {
                if (marker.Longitude > lon - 1 && marker.Longitude < lon + 1)
                {
                    if (marker.Latitude > lat - 1 && marker.Latitude < lat + 1)
                    {
                        if (marker != _currentMarker)
                        {
                            _currentMarker = marker;
                            _markerToolTip.Placement = PlacementMode.Relative;
                            _markerToolTip.PlacementTarget = imageControl;
                            _markerToolTip.DataContext = marker;
                            _markerToolTip.IsOpen = true;
                        }

                        if (_currentMarker != null)
                        {
                            _markerToolTip.HorizontalOffset = position.X + 5;
                            _markerToolTip.VerticalOffset = position.Y + 5;
                        }
                        //ZoomViewer.Cursor = Cursors.Hand;
                        return;
                    }
                }
            }

            //ZoomViewer.Cursor = Cursors.Arrow;
            _markerToolTip.IsOpen = false;
            _currentMarker = null;
        }
Ejemplo n.º 25
0
        public ActionResult Edit(ClientLocation model)
        {
            SetSessionVariables();

            ClientLocation clientLocation = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Common.Instance.ApiClientControllerName);
                //HTTP GET
                var responseTask = client.PutAsJsonAsync(Common.Instance.ApiClientUpdateClientLocation + model.ClientLocationID, model);
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <ClientLocation>();
                    readTask.Wait();

                    clientLocation = readTask.Result;
                }
            }
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 26
0
        public ActionResult Edit(int ClientLocationID)
        {
            SetSessionVariables();

            ClientLocation clientLocation = null;

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(Common.Instance.ApiClientControllerName);
                //HTTP GET
                var responseTask = client.GetAsync(Common.Instance.ApiClientGetClientLocation + ClientLocationID.ToString());
                responseTask.Wait();

                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsAsync <ClientLocation>();
                    readTask.Wait();

                    clientLocation = readTask.Result;
                }
            }
            return(View(clientLocation));
        }
 public override ClientLocation UnassignLocation(ClientLocation loc)
 {
     try
     {
         string sql = String.Format("update {0}.EXT_CLIENT set "
                                    + "  DEFAULT_INVOICE_GRP_ID = :id "
                                    + " where ext_sys = :ext_sys and ext_client_key = :extclientkey"
                                    , SchemaName);
         List <OracleParameter> parameters = new List <OracleParameter>();
         parameters.Add(OracleHelper.CreateParameter(":id", DBNull.Value, OracleType.Number, ParameterDirection.Input));
         parameters.Add(OracleHelper.CreateParameter(":ext_sys", loc.ExtSys, OracleType.VarChar, 20, ParameterDirection.Input));
         parameters.Add(OracleHelper.CreateParameter(":extclientkey", loc.ExtClientKey, OracleType.VarChar, 20, ParameterDirection.Input));
         OracleParameterCollection outParams = OracleHelper.ExecuteNonQuery(base.ConnectionString.Value, sql, parameters.ToArray <OracleParameter>());
         return(loc);
     }
     catch (OracleException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        protected List <ClientLocation> ConvertToList(IDataReader dr)
        {
            List <ClientLocation> items = new List <ClientLocation>();
            string val;

            while (dr.Read())
            {
                ClientLocation ec = new ClientLocation();
                ec.ExtSys       = dr["ext_sys"].ToString();
                ec.ExtClientKey = dr["ext_client_key"].ToString();
                val             = dr["default_invoice_grp_id"].ToString();
                if (String.IsNullOrEmpty(val))
                {
                    ec.DefaultInvoiceGrpID = null;
                }
                else
                {
                    ec.DefaultInvoiceGrpID = long.Parse(val);
                }
                ec.Description            = dr["descr"].ToString();
                ec.CostCode               = dr["cost_code"].ToString();
                ec.ExtWorkTypeSourceDescr = dr["ext_work_type_source_descr"].ToString();
                ec.OverrideKeySource      = dr["override_key_source"].ToString();
                val = dr["default_tat_threshold"].ToString();
                if (String.IsNullOrEmpty(val))
                {
                    ec.DefaultTatThreshold = 12;
                }
                else
                {
                    ec.DefaultTatThreshold = int.Parse(val);
                }
                items.Add(ec);
            }
            return(items);
        }
        public override bool Add(ClientLocation client)
        {
            string sql = String.Format("INSERT INTO {0}.EXT_CLIENT \r\n"
                                       + "  (EXT_SYS                  ,EXT_CLIENT_KEY                 ,DEFAULT_INVOICE_GRP_ID \r\n"
                                       + "   ,DESCR                   ,COST_CODE                      ,EXT_WORK_TYPE_SOURCE_DESCR  \r\n"
                                       + "   ,OVERRIDE_KEY_SOURCE     ,DEFAULT_TAT_THRESHOLD) \r\n"
                                       + "VALUES \r\n"
                                       + "(  :EXT_SYS                 ,:EXT_CLIENT_KEY                ,:DEFAULT_INVOICE_GRP_ID \r\n"
                                       + "   ,:DESCR                  ,:COST_CODE                     ,:EXT_WORK_TYPE_SOURCE_DESCR \r\n"
                                       + "   ,:OVERRIDE_KEY_SOURCE    ,:DEFAULT_TAT_THRESHOLD)"
                                       , base.SchemaName);

            using (IDbConnection cnn = new OracleConnection(ConnectionString.Value))
                using (IDbCommand cmd = new OracleCommand(sql, (OracleConnection)cnn))
                {
                    cmd.CommandType = CommandType.Text;
                    OracleHelper.AddCommandParameter(cmd, ":EXT_SYS", CheckNull(client.ExtSys), OracleType.Char, 20, ParameterDirection.Input);
                    OracleHelper.AddCommandParameter(cmd, ":EXT_CLIENT_KEY", CheckNull(client.ExtClientKey), OracleType.VarChar, 20, ParameterDirection.Input);
                    OracleHelper.AddCommandParameter(cmd, ":DEFAULT_INVOICE_GRP_ID", CheckNull(client.DefaultInvoiceGrpID), OracleType.Number, ParameterDirection.Input);
                    OracleHelper.AddCommandParameter(cmd, ":DESCR", CheckNull(client.Description), OracleType.VarChar, 100, ParameterDirection.Input);
                    OracleHelper.AddCommandParameter(cmd, ":COST_CODE", CheckNull(client.CostCode), OracleType.VarChar, 10, ParameterDirection.Input);
                    if (String.IsNullOrEmpty(client.ExtWorkTypeSourceDescr))
                    {
                        client.ExtWorkTypeSourceDescr = "<DEFAULT>";
                    }
                    OracleHelper.AddCommandParameter(cmd, ":EXT_WORK_TYPE_SOURCE_DESCR", client.ExtWorkTypeSourceDescr, OracleType.VarChar, 30, ParameterDirection.Input);
                    if (String.IsNullOrEmpty(client.OverrideKeySource))
                    {
                        client.OverrideKeySource = "<DEFAULT>";
                    }
                    OracleHelper.AddCommandParameter(cmd, ":OVERRIDE_KEY_SOURCE", client.OverrideKeySource, OracleType.VarChar, 30, ParameterDirection.Input);
                    OracleHelper.AddCommandParameter(cmd, ":DEFAULT_TAT_THRESHOLD", CheckNull(client.DefaultTatThreshold), OracleType.Number, ParameterDirection.Input);
                    cnn.Open();
                    return(cmd.ExecuteNonQuery() > 0);
                }
        }
Ejemplo n.º 30
0
 protected bool Equals(Client other)
 {
     return(_telephones.SequenceEqual(other._telephones) && _comments.SequenceEqual(other._comments) && ClientLocation.Equals(other.ClientLocation) && Person.Equals(other.Person));
 }