private void AddLocation(string postCode, ref int?locId, ref string postCodeValue)
        {
            LocationBO loc = new LocationBO();

            try
            {
                loc.New();
                loc.Current.LocationName = postCode;
                loc.Current.PostCode     = postCode;
                //    loc.Current.LocationName = "";
                loc.Current.LocationTypeId = Enums.LOCATION_TYPES.POSTCODE;
                loc.Save();



                locId         = loc.Current.Id.ToIntorNull();
                postCodeValue = loc.Current.PostCode;
            }
            catch (Exception ex)
            {
                if (loc.Errors.Count > 0)
                {
                    ENUtils.ShowMessage(loc.ShowErrors());
                }
                else
                {
                    ENUtils.ShowMessage(ex.Message);
                }
            }
        }
Exemplo n.º 2
0
    protected void extddlLocation_extendDropDown_SelectedIndexChanged(object sender, EventArgs e)
    {
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
        try
        {
            _Location = new LocationBO();

            DataSet dsLocation = _Location.Location(extddlLocation.Text, ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID);
            txtOfficeCity.Text     = dsLocation.Tables[0].Rows[0]["SZ_CITY"].ToString();
            txtOfficeZip.Text      = dsLocation.Tables[0].Rows[0]["SZ_ZIP"].ToString();
            txtOfficeAdd.Text      = dsLocation.Tables[0].Rows[0]["SZ_ADDRESS"].ToString();
            extddlOfficeState.Text = dsLocation.Tables[0].Rows[0]["SZ_STATE_ID"].ToString();
            SetReadOnly();
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End
        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
Exemplo n.º 3
0
        void Grid_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (e.Action == Telerik.WinControls.Data.NotifyCollectionChangedAction.Remove)
            {
                objMaster = new LocationBO();

                try
                {
                    objMaster.GetByPrimaryKey(grdLister.CurrentRow.Cells["Id"].Value.ToInt());
                    if (objMaster.Current != null)
                    {
                        objMaster.Delete(objMaster.Current);
                    }
                }
                catch (Exception ex)
                {
                    if (objMaster.Errors.Count > 0)
                    {
                        ENUtils.ShowMessage(objMaster.ShowErrors());
                    }
                    else
                    {
                        ENUtils.ShowMessage(ex.Message);
                    }
                    e.Cancel = true;
                }
            }
        }
Exemplo n.º 4
0
        public override void Save()
        {
            try
            {
                foreach (var item in grdLister.Rows)
                {
                    if (item.Cells[COLS.BackgroundColorValue].Value.ToInt() != item.Cells[COLS.BackgroundColorOldValue].Value.ToInt() ||
                        item.Cells[COLS.TextColorValue].Value.ToInt() != item.Cells[COLS.TextColorOldValue].Value.ToInt())
                    {
                        objMaster = new LocationBO();
                        objMaster.GetByPrimaryKey(item.Cells[COLS.Id].Value.ToInt());

                        if (objMaster.Current != null)
                        {
                            objMaster.Current.BackgroundColor = item.Cells[COLS.BackgroundColorValue].Value.ToIntorNull();

                            objMaster.Current.TextColor   = item.Cells[COLS.TextColorValue].Value.ToIntorNull();
                            objMaster.CheckDataValidation = false;
                            objMaster.Save();
                        }
                    }
                }

                ((frmBookingDashBoard)System.Windows.Forms.Application.OpenForms.OfType <Form>().FirstOrDefault(c => c.Name == "frmBookingDashBoard")).FillAirportsList();

                new BroadcasterData().BroadCastToAll(RefreshTypes.REFRESH_DASHBOARD);
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
Exemplo n.º 5
0
        public LocationBO Update(LocationBO location)
        {
            Location updateLocation = converter.Convert(location);

            _context.Entry <Location>(updateLocation).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
            _context.SaveChanges();
            return(converter.Convert(updateLocation));
        }
Exemplo n.º 6
0
        private void CompareLocation_Click(object sender, EventArgs e)
        {
            LocationBO location7 = PermitBLL.GetLocation(6);
            LocationBO location8 = PermitBLL.GetLocation(8);

            List <KeyValuePair <string, string> > changes = CompareObjects.FindDifferences(location7, location8, "Permit 7", "Permit 8");

            DisplayDifferences(changes, "Compare two location business objects");
        }
Exemplo n.º 7
0
        public frmAirportColorCodings()
        {
            InitializeComponent();

            objMaster = new LocationBO();
            this.SetProperties((INavigation)objMaster);

            FormatGrid();
            this.Load       += new EventHandler(frmBookingTypes_Load);
            this.FormClosed += new FormClosedEventHandler(frmBookingTypes_FormClosed);
        }
Exemplo n.º 8
0
        public LocationBO Create(LocationBO location)
        {
            Location loc = converter.Convert(location);

            if (loc == null)
            {
                return(null);
            }
            _context.Locations.Add(loc);
            _context.SaveChanges();
            return(converter.Convert(loc));
        }
        private void InitializeConstructor()
        {
            objMaster = new LocationBO();
            this.SetProperties((INavigation)objMaster);
            FillCombos();

            this.Shown            += new EventHandler(frmLocations_Shown);
            this.FormClosed       += new FormClosedEventHandler(frmLocations_FormClosed);
            txtShortCutKey.Enabled = false;
            txtShortCutKey.Text    = "";
            this.KeyDown          += new KeyEventHandler(frmLocations_KeyDown);
            this.ddlLocationType.SelectedIndexChanged += new Telerik.WinControls.UI.Data.PositionChangedEventHandler(ddlLocationType_SelectedIndexChanged);
        }
Exemplo n.º 10
0
        public frmLocationList()
        {
            InitializeComponent();
            this.Load += new EventHandler(frmLocationList_Load);
            grdLister.CellDoubleClick += new GridViewCellEventHandler(grdLister_CellDoubleClick);
            grdLister.RowsChanging    += new Telerik.WinControls.UI.GridViewCollectionChangingEventHandler(Grid_RowsChanging);
            objMaster = new LocationBO();

            this.SetProperties((INavigation)objMaster);
            //   grdLister.CellFormatting+=new CellFormattingEventHandler(grdLister_CellFormatting);

            grdLister.ShowRowHeaderColumn = false;
            this.Shown += new EventHandler(frmLocationList_Shown);

            grdLister.CommandCellClick += new CommandCellClickEventHandler(grid_CommandCellClick);
            //    grdLister.EnableFastScrolling = true;
        }
Exemplo n.º 11
0
        public Location Convert(LocationBO l)
        {
            if (l == null)
            {
                return(null);
            }
            Location location = new Location
            {
                CoordinationX = l.CoordinationX,
                CoordinationY = l.CoordinationY,
                Description   = l.Description,
                Id            = l.Id,
                Name          = l.Name,
                ParentId      = l.ParentId,
                Store         = sc.Convert(l.Store),
                StoreId       = l.StoreId
            };

            return(location);
        }
        public override void Save()
        {
            FareBO objFareMaster = null;

            try
            {
                int vehicleId = 0;


                string  oldFrom = string.Empty;
                string  vehicle = string.Empty;
                string  from    = string.Empty;
                string  to      = string.Empty;
                decimal fares   = 0.00m;

                int?fromLocId     = null;
                int?toLocId       = null;
                int?fromLocTypeId = null;
                int?toLocTypeId   = null;

                List <Fleet_VehicleType> listOfVehicle   = AppVars.BLData.GetQueryable <Fleet_VehicleType>(null).ToList();
                List <Gen_Location>      listOfLocations = General.GetQueryable <Gen_Location>(null).ToList();


                LocationBO objLocationMaster = null;

                int recordNo = 0;
                foreach (var row in grdFixFares.Rows)
                {
                    if (!string.IsNullOrEmpty(row.Cells[COLS.VehicleName].Value.ToStr()))
                    {
                        vehicle = row.Cells[COLS.VehicleName].Value.ToStr();
                    }

                    from    = row.Cells[COLS.From].Value.ToStr().ToUpper();
                    oldFrom = from;

                    if (!string.IsNullOrEmpty(row.Cells[COLS.To].Value.ToStr().ToUpper()))
                    {
                        to = row.Cells[COLS.To].Value.ToStr().ToUpper();
                    }

                    if (row.Cells[COLS.Fare].Value.ToStr().StartsWith("£"))
                    {
                        fares = row.Cells[COLS.Fare].Value.ToStr().Substring(1).ToDecimal();
                    }
                    else
                    {
                        fares = row.Cells[COLS.Fare].Value.ToDecimal();
                    }



                    if (string.IsNullOrEmpty(from))
                    {
                        continue;
                    }

                    if (string.IsNullOrEmpty(to))
                    {
                    }

                    vehicleId = listOfVehicle.FirstOrDefault(c => c.VehicleType.ToLower().Trim() == vehicle).DefaultIfEmpty().Id;

                    if (vehicleId == 0)
                    {
                        // row.Cells[COLS.Status].Value = "Required : Vehicle";
                        continue;
                    }



                    Gen_Location objLoc = listOfLocations.FirstOrDefault(c =>
                                                                         ((c.LocationName.ToUpper().Trim() + " " + c.PostCode.ToUpper()) == from) ||
                                                                         (c.PostCode == from));


                    if (objLoc == null)
                    {
                        objLocationMaster = new LocationBO();

                        try
                        {
                            objLocationMaster.New();

                            from = General.GetPostCodeMatch(from);



                            if (string.IsNullOrEmpty(from))
                            {
                            }

                            objLocationMaster.Current.LocationName   = from;
                            objLocationMaster.Current.PostCode       = from;
                            objLocationMaster.Current.LocationTypeId = Enums.LOCATION_TYPES.POSTCODE;

                            objLocationMaster.Save();
                        }
                        catch (Exception ex)
                        {
                            if (objLocationMaster.Errors.Count > 0)
                            {
                                ENUtils.ShowMessage(objLocationMaster.ShowErrors());
                            }
                            else
                            {
                                ENUtils.ShowMessage(ex.Message);
                            }
                            break;
                        }

                        objLoc = objLocationMaster.Current;

                        listOfLocations.Add(objLoc);
                    }

                    fromLocId     = objLoc.Id;
                    fromLocTypeId = objLoc.LocationTypeId;



                    objLoc = listOfLocations.FirstOrDefault(c =>
                                                            ((c.LocationName.ToUpper().Trim() + " " + c.PostCode.ToUpper()) == to) ||
                                                            (c.PostCode == to));

                    if (objLoc == null)
                    {
                        objLocationMaster = new LocationBO();

                        try
                        {
                            objLocationMaster.New();


                            to = General.GetPostCodeMatch(to);

                            // to = General.GetPostCodeMatch(to);


                            if (to.Contains(' ') == false)
                            {
                            }

                            objLocationMaster.Current.LocationName   = to;
                            objLocationMaster.Current.PostCode       = to;
                            objLocationMaster.Current.LocationTypeId = Enums.LOCATION_TYPES.POSTCODE;

                            objLocationMaster.Save();
                        }
                        catch (Exception ex)
                        {
                            if (objLocationMaster.Errors.Count > 0)
                            {
                                ENUtils.ShowMessage(objLocationMaster.ShowErrors());
                            }
                            else
                            {
                                ENUtils.ShowMessage(ex.Message);
                            }
                            break;
                        }
                        objLoc = objLocationMaster.Current;
                        listOfLocations.Add(objLoc);
                    }

                    toLocId     = objLoc.Id;
                    toLocTypeId = objLoc.LocationTypeId;


                    if (recordNo == 0)
                    {
                        objFareMaster = new FareBO();


                        int fareId = General.GetObject <Fare>(c => c.VehicleTypeId == vehicleId).DefaultIfEmpty().Id;

                        if (fareId > 0)
                        {
                            objFareMaster.GetByPrimaryKey(fareId);
                        }
                        else
                        {
                            objFareMaster.New();
                        }


                        objFareMaster.Current.VehicleTypeId = vehicleId;
                        objFareMaster.Current.IsCompanyWise = false;
                    }

                    objFareMaster.Current.Fare_ChargesDetails.Add(new Fare_ChargesDetail
                    {
                        OriginId                  = fromLocId,
                        DestinationId             = toLocId,
                        OriginLocationTypeId      = fromLocTypeId,
                        DestinationLocationTypeId = toLocTypeId,
                        Rate = fares
                    });

                    recordNo++;
                }

                objFareMaster.Save();
            }
            catch (Exception ex)
            {
                if (objFareMaster.Errors.Count > 0)
                {
                    ENUtils.ShowMessage(objFareMaster.ShowErrors());
                }
                else
                {
                    ENUtils.ShowMessage(ex.Message);
                }
            }
        }
Exemplo n.º 13
0
 public LocationBO Post([FromBody] LocationBO location)
 {
     return(_location.Create(location));
 }
Exemplo n.º 14
0
 public LocationBO Put(long id, [FromBody] LocationBO updatedLocation)
 {
     return(_location.Update(updatedLocation));
 }
Exemplo n.º 15
0
 // POST api/values
 public int Post([FromBody] LocationBO value)
 {
     return(_iLocationsBL.AddLocations(value));
 }
Exemplo n.º 16
0
 public int Put([FromBody] LocationBO value)
 {
     return(_iLocationsBL.UpdateLocations(value));
 }
Exemplo n.º 17
0
 public LocationVM(LocationBO data)
 {
     this.PermitKey = data.PermitKey;
     this.Latitude = data.Latitude;
     this.Longitude = data.Longitude;
     this.LegalDescriptionOfAccess= data.LegalDescriptionOfAccess;
     this.NearestTown = data.NearestTown;
     this.Quadrangles = data.Quadrangles;
     this.Counties = data.Counties;
 }