Esempio n. 1
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            HotelManager hm    = new HotelManager();
            Hotel        hotel = new Hotel();
            ICityManager cm    = (ICityManager)BusinessObjectManager.GetCityManager();

            hotel.HotelId     = Convert.ToInt64(txtHotelId.Text);
            hotel.HotelName   = txtHotelName.Text;
            hotel.Address     = txtAddress.Text;
            hotel.City        = cm.GetCityById(Convert.ToInt64(dpCity.SelectedValue));
            hotel.CityID      = Convert.ToInt32(dpCity.SelectedValue);
            hotel.BriefNote   = txtBrief.Text;
            hotel.Email       = txtEMail.Text;
            hotel.ContactNo   = txtContact.Text;
            hotel.Pincode     = txtPincode.Text;
            hotel.StarRanking = Convert.ToInt32(dpStarRanking.SelectedValue);
            hotel.PhotoUrl    = txtPhoto.Text;
            hotel.WebsiteURL  = txtWebsite.Text;

            hm.UpdateHotel(hotel);

            ResetHotelDataSet();

            Response.Redirect("~/Admin/ViewHotel.aspx");
        }
Esempio n. 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                try
                {
                    ICityManager cityManager = BusinessObjectManager.GetCityManager();
                    List <City>  cities      = cityManager.GetCities();

                    dpFromCity.Items.Add("None");
                    foreach (City c in cities)
                    {
                        ListItem item = new ListItem(c.Name, c.CityId.ToString());
                        dpFromCity.Items.Add(item);
                    }
                    dpFromCity.DataBind();

                    dpToCity.Items.Add("None");
                    foreach (City c in cities)
                    {
                        ListItem item = new ListItem(c.Name, c.CityId.ToString());
                        dpToCity.Items.Add(item);
                    }
                    dpToCity.DataBind();
                }
                catch (CityManagerException ex)
                {
                    throw ex;
                }
            }
        }
Esempio n. 3
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                HotelManager hm    = new HotelManager();
                Hotel        hotel = new Hotel();
                ICityManager cm    = (ICityManager)BusinessObjectManager.GetCityManager();

                hotel.HotelName   = txtHotelName.Text;
                hotel.Address     = txtAddress.Text;
                hotel.City        = cm.GetCityById(Convert.ToInt64(dpCity.SelectedValue));
                hotel.CityID      = Convert.ToInt32(dpCity.SelectedValue);
                hotel.BriefNote   = txtBrief.Text;
                hotel.Email       = txtEMail.Text;
                hotel.ContactNo   = txtContact.Text;
                hotel.Pincode     = txtPincode.Text;
                hotel.StarRanking = Convert.ToInt32(dpStarRanking.SelectedValue);
                hotel.PhotoUrl    = txtPhoto.Text;
                hotel.WebsiteURL  = txtWebsite.Text;

                hm.SaveHotel(hotel);

                //Resetting the session to invalidate the hotels
                Session["HOTELDS"] = null;

                Response.Redirect("~/Admin/ViewHotel.aspx");
            }
            catch (Exception ex)
            {
                lblError.Text = ex.Message;
            }
        }
Esempio n. 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ctlAdminMaster.ErrorMessage = "";
            if (!IsPostBack)
            {
                try
                {
                    ICityManager cityManager = (ICityManager)BusinessObjectManager.GetCityManager();
                    List <City>  cities      = cityManager.GetCities();

                    dpFromCity.Items.Add("None");
                    foreach (City c in cities)
                    {
                        ListItem item = new ListItem(c.Name + " (" + c.StateInfo.Name + ")", c.CityId.ToString());
                        dpFromCity.Items.Add(item);
                    }
                    dpFromCity.DataBind();

                    dpToCity.Items.Add("None");
                    foreach (City c in cities)
                    {
                        ListItem item = new ListItem(c.Name + " (" + c.StateInfo.Name + ")", c.CityId.ToString());
                        dpToCity.Items.Add(item);
                    }
                    dpToCity.DataBind();
                }
                catch (CityManagerException ex)
                {
                    ctlAdminMaster.ErrorMessage = ex.Message;
                }
            }
        }
        protected void grdCity_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            if (IsValid)
            {
                GridViewRow row = grdCity.Rows[e.RowIndex];

                HiddenField hdnStateId  = (HiddenField)row.FindControl("hdnStateId");
                TextBox     txtState    = (TextBox)row.FindControl("txtState");
                TextBox     txtCityName = (TextBox)row.FindControl("txtCityName");

                if (string.IsNullOrWhiteSpace(txtCityName.Text))
                {
                    ctlAdminMaster.ErrorMessage = "City Name Can't be Empty";
                    txtCityName.Focus();
                }
                else
                {
                    int cityId = Int32.Parse(grdCity.DataKeys[e.RowIndex].Value.ToString());

                    string CityName  = txtCityName.Text;
                    string StateName = txtState.Text;

                    City _city = new City()
                    {
                        CityId    = cityId,
                        Name      = CityName,
                        StateInfo = new State()
                        {
                            StateId = long.Parse(hdnStateId.Value),
                            Name    = StateName
                        }
                    };

                    try
                    {
                        ICityManager cityManger = (ICityManager)BusinessObjectManager.GetCityManager();

                        if (cityManger.UpdateCity(_city))
                        {
                            ctlAdminMaster.ErrorMessage = "City Updated Successfully";
                        }
                        else
                        {
                            ctlAdminMaster.ErrorMessage = "City already exists";
                        }
                        grdCity.EditIndex = -1;
                        BindData();
                    }
                    catch (CityManagerException ex)
                    {
                        ctlAdminMaster.ErrorMessage = ex.Message;
                    }
                }
            }
        }
Esempio n. 6
0
        protected void grdCity_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = grdCity.Rows[e.RowIndex];

            TextBox txtState    = (TextBox)row.FindControl("txtState");
            TextBox txtCityName = (TextBox)row.FindControl("txtCityName");

            if (txtCityName.Text.Length == 0)
            {
                lblError.Text = "City Name Can't be Empty";
                txtCityName.Focus();
            }
            else
            {
                int cityId = Int32.Parse(grdCity.DataKeys[e.RowIndex].Value.ToString());

                string CityName  = txtCityName.Text;
                string StateName = txtState.Text;

                City _city = new City()
                {
                    CityId    = cityId,
                    Name      = CityName,
                    StateInfo = new State()
                    {
                        Name = StateName
                    }
                };

                try
                {
                    ICityManager cityManger = (ICityManager)BusinessObjectManager.GetCityManager();

                    if (cityManger.UpdateCity(_city))
                    {
                        lblError.Text = "City Updated Successfully";
                    }
                    else
                    {
                        lblError.Text = "City already exists";
                    }
                    grdCity.EditIndex = -1;
                    BindData();
                }
                catch (CityManagerException ex)
                {
                    throw ex;
                }
            }
        }
Esempio n. 7
0
 public void BindData()
 {
     try
     {
         ICityManager cityManger = (ICityManager)BusinessObjectManager.GetCityManager();
         List <City>  cities     = cityManger.GetCities();
         grdCity.DataSource = cities;
         grdCity.DataBind();
     }
     catch (CityManagerException ex)
     {
         throw ex;
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            hotelManager = new HotelManager();
            cityManager  = (ICityManager)BusinessObjectManager.GetCityManager();

            if (!Page.IsPostBack)
            {
                dpCity.DataSource     = cityManager.GetCities();
                dpCity.DataTextField  = "Name";
                dpCity.DataValueField = "CityId";
                dpCity.DataBind();
                dpCity.Items.Insert(0, "--- Select City ---");
            }
        }
Esempio n. 9
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ctlAdminMaster.ErrorMessage = "";
            if (cityNameValidator.IsValid)
            {
                if (txtCrCity.Text.Trim().Length == 0)
                {
                    ctlAdminMaster.ErrorMessage = "City Name Can't be Empty";
                    txtCrCity.Focus();
                }
                else if (dpStateCity.Text.Equals("None") == true)
                {
                    ctlAdminMaster.ErrorMessage = "Select the State";
                    dpStateCity.Focus();
                }
                else
                {
                    string CityName = txtCrCity.Text;

                    State _state = new State();
                    _state.StateId = long.Parse(dpStateCity.SelectedItem.Value);

                    City _city = new City();
                    _city.Name      = CityName;
                    _city.StateInfo = _state;

                    ICityManager cityManger = (ICityManager)BusinessObjectManager.GetCityManager();

                    try
                    {
                        if (cityManger.AddCity(_city))
                        {
                            ctlAdminMaster.ErrorMessage = "City Added Successfully";
                        }
                        else
                        {
                            ctlAdminMaster.ErrorMessage = "City already exists";
                        }
                    }

                    catch (CityManagerException ex)
                    {
                        ctlAdminMaster.ErrorMessage = ex.Message;
                    }
                }
            }
        }
Esempio n. 10
0
        public void clear()
        {
            txtCrCity.Text = "";
            ctlAdminMaster.ErrorMessage = "";
            dpStateCity.Items.Clear();

            ICityManager cityManager = (ICityManager)BusinessObjectManager.GetCityManager();
            List <State> stateList   = cityManager.GetStates();

            dpStateCity.Items.Add("None");
            foreach (State s in stateList)
            {
                ListItem item = new ListItem(s.Name, s.StateId.ToString());
                dpStateCity.Items.Add(item);
            }
            dpStateCity.DataBind();
        }
Esempio n. 11
0
 public void BindData()
 {
     try
     {
         ICityManager cityManger = (ICityManager)BusinessObjectManager.GetCityManager();
         List <City>  cities     = cityManger.GetCities();
         if (cities.Count > 0)
         {
             grdCity.DataSource = cities;
             ctlAdminMaster.BuildPager(grdCity);
         }
         else
         {
             grdCity.Visible = false;
         }
     }
     catch (CityManagerException ex)
     {
         ctlAdminMaster.ErrorMessage = ex.Message;
     }
 }
        private void clear()
        {
            dpFromCity.Items.Clear();
            dpToCity.Items.Clear();
            dpAirlineName.Items.Clear();
            dpFlightName.Items.Clear();
            DropDownList1.Items.Clear();
            DropDownList2.Items.Clear();
            DropDownList4.Items.Clear();
            DropDownList5.Items.Clear();

            for (int i = 1; i <= 24; i++)
            {
                DropDownList1.Items.Add(i.ToString());
                DropDownList4.Items.Add(i.ToString());
            }
            DropDownList1.DataBind();
            DropDownList4.DataBind();

            for (int i = 0; i <= 59; i++)
            {
                DropDownList2.Items.Add(i.ToString());
                DropDownList5.Items.Add(i.ToString());
            }
            DropDownList2.DataBind();
            DropDownList5.DataBind();

            txtDuration.Enabled = false;

            txtDuration.Text  = "";
            chkStatus.Checked = false;

            try
            {
                ICityManager cityManager = (ICityManager)BusinessObjectManager.GetCityManager();
                List <City>  cities      = cityManager.GetCities();

                foreach (City c in cities)
                {
                    ListItem item = new ListItem(c.Name.Trim(), c.CityId.ToString());
                    dpFromCity.Items.Add(item);
                }
                dpFromCity.DataBind();


                foreach (City c in cities)
                {
                    ListItem item = new ListItem(c.Name, c.CityId.ToString());
                    dpToCity.Items.Add(item);
                }
                dpToCity.DataBind();

                AirLineManager objairline = new AirLineManager();
                List <Airline> airlines   = objairline.GetAirLines();

                foreach (Airline c in airlines)
                {
                    ListItem item = new ListItem(c.Name, c.Id.ToString());
                    dpAirlineName.Items.Add(item);
                }
                dpAirlineName.DataBind();
            }
            catch (CityManagerException ex)
            {
                throw ex;
            }
            catch (AirlineManagerException exc)
            {
                throw exc;
            }
        }
        private void clear()
        {
            dpFromCity.Items.Clear();
            dpToCity.Items.Clear();
            dpAirlineName.Items.Clear();
            dpFlightName.Items.Clear();
            DropDownList1.Items.Clear();
            DropDownList2.Items.Clear();
            DropDownList4.Items.Clear();
            DropDownList5.Items.Clear();

            DropDownList1.Items.Add("None");
            DropDownList4.Items.Add("None");
            for (int i = 1; i <= 24; i++)
            {
                DropDownList1.Items.Add(i.ToString());
                DropDownList4.Items.Add(i.ToString());
            }
            DropDownList1.DataBind();
            DropDownList4.DataBind();

            DropDownList2.Items.Add("None");
            DropDownList5.Items.Add("None");
            for (int i = 0; i <= 59; i++)
            {
                DropDownList2.Items.Add(i.ToString());
                DropDownList5.Items.Add(i.ToString());
            }
            DropDownList2.DataBind();
            DropDownList5.DataBind();

            txtDuration.Enabled = false;

            txtDuration.Text  = "";
            chkStatus.Checked = false;
            ICityManager cityManager = (ICityManager)BusinessObjectManager.GetCityManager();

            try
            {
                List <City> cities = cityManager.GetCities();

                dpFromCity.Items.Add("None");
                foreach (City c in cities)
                {
                    ListItem item = new ListItem(c.Name, c.CityId.ToString());
                    dpFromCity.Items.Add(item);
                }
                dpFromCity.DataBind();

                dpToCity.Items.Add("None");
                foreach (City c in cities)
                {
                    ListItem item = new ListItem(c.Name, c.CityId.ToString());
                    dpToCity.Items.Add(item);
                }
                dpToCity.DataBind();
            }
            catch (CityManagerException e)
            {
                lblError.Text = e.Message;
            }


            IAirLineManager airlineManager = (IAirLineManager)AirTravelManagerFactory.Create("AirlineManager");

            try
            {
                List <Airline> airlines = airlineManager.GetAirLines();

                dpAirlineName.Items.Add("None");
                foreach (Airline c in airlines)
                {
                    ListItem item = new ListItem(c.Name, c.Id.ToString());
                    dpAirlineName.Items.Add(item);
                }
                dpAirlineName.DataBind();
            }
            catch (AirlineManagerException e)
            {
                lblError.Text = e.Message;
            }

            var travelClassvalues = Enum.GetValues(typeof(TravelClass)).Cast <TravelClass>();

            Repeater1.DataSource = travelClassvalues;
            Repeater1.DataBind();
        }