示例#1
0
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string cityID = GridView1.DataKeys[e.RowIndex].Value.ToString();

            CityDAO.DeleteCity(cityID);
            ShowDataCity();
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = CityDAO.GetDataCity();
                int       t  = dt.Rows.Count;
                cboFromCity.DataSource     = CityDAO.GetDataCity();
                cboFromCity.DataTextField  = "CityName";
                cboFromCity.DataValueField = "CityID";
                cboToCity.DataSource       = CityDAO.GetDataCity();
                cboToCity.DataTextField    = "CityName";
                cboToCity.DataValueField   = "CityID";
                cboFromCity.DataBind();
                cboToCity.DataBind();
            }

            if (Session["msg"] != null)
            {
                string msg = Session["msg"].ToString();
                lbNeedSearch.Text = msg;
                Session.Remove("msg");
            }
            else
            {
                lbNeedSearch.Text = "";
            }
        }
示例#3
0
 public AddUserViewModel()
 {
     AddUserCommand = new RelayCommand(AddUser);
     ToUsersManagementTabCommand = new RelayCommand(ToUsersManagementTab);
     SelectedDate = new DateTime(1970, 1, 1);
     Cities       = CityDAO.GetCitiesQuery().ToObservableCollection();
 }
示例#4
0
 public UsersManagementViewModel(User selectedUser)
 {
     EditCommand                 = new RelayCommand(Edit);
     ToEditTabCommand            = new RelayCommand(ToEditTab);
     GetListUsersCommand         = new RelayCommand(GetListUsers);
     ToAddTabCommand             = new RelayCommand(ToAddTab);
     RemoveCommand               = new RelayCommand(Remove);
     ToUsersManagementTabCommand = new RelayCommand(ToUsersManagementTab);
     Cities = CityDAO.GetCitiesQuery().ToObservableCollection();
     LoadData(selectedUser);
     SelectedUser = selectedUser;
 }
示例#5
0
 public UsersManagementViewModel()
 {
     EditCommand                 = new RelayCommand(Edit);
     ToEditTabCommand            = new RelayCommand(ToEditTab);
     GetListUsersCommand         = new RelayCommand(GetListUsers);
     ToAddTabCommand             = new RelayCommand(ToAddTab);
     RemoveCommand               = new RelayCommand(Remove);
     ToAddAppointmentTabCommand  = new RelayCommand(ToAddAppointmentTab);
     ToUsersManagementTabCommand = new RelayCommand(ToUsersManagementTab);
     ToAdminPanelCommand         = new RelayCommand(ToAdminPanel);
     Cities = CityDAO.GetCitiesQuery().ToObservableCollection();
 }
 public User(string firstname, string lastname, string cin, DateTime selectedDate, string password, bool superUser,
             string phoneNumber, string role, string city)
 {
     this.Fisrtname   = firstname;
     this.Lastname    = lastname;
     this.CIN         = cin;
     this.DateOfBirth = selectedDate;
     this.Password    = password;
     this.IsSuperUser = superUser;
     this.PhoneNumber = phoneNumber;
     this.Role        = role;
     this.City        = CityDAO.GetCityByName(city);
 }
示例#7
0
        public void Create(string city,string country, string street, int house, int flat, string firstName, string name, string lastName, string telephone)
        {
            adress adress = context.adresses.Create();

            CityDAO cityDAO = new CityDAO();
            adress.idCity = cityDAO.FindCity(city, country);
            adress.street = street;
            adress.house = house;
            adress.flat = flat;

            PersonDAO personDAO = new PersonDAO();
            adress.idPerson = personDAO.FindPerson(firstName,name,lastName,telephone);
            context.adresses.Add(adress);
            context.SaveChanges();
        }
示例#8
0
        protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            string      cityID     = GridView1.DataKeys[e.RowIndex].Value.ToString();
            GridViewRow row        = GridView1.Rows[e.RowIndex];
            TextBox     cityName   = (TextBox)row.Cells[1].Controls[0];
            TextBox     nationalID = (TextBox)row.Cells[2].Controls[0];

            GridView1.EditIndex = -1;
            //update data
            City c = new City();

            c.CityID     = cityID;
            c.CityName   = cityName.Text;
            c.NationalID = nationalID.Text;
            CityDAO.UpdateCity(c);
            ShowDataCity();
        }
示例#9
0
        protected void ShowDataCity()
        {
            DataTable dt = CityDAO.GetDataCity();

            if (dt.Rows.Count > 0)
            {
                GridView1.DataSource = dt;
                GridView1.DataBind();
            }
            else
            {
                dt.Rows.Add(dt.NewRow());
                GridView1.DataSource = dt;
                GridView1.DataBind();
                int columncount = GridView1.Rows[0].Cells.Count;
                GridView1.Rows[0].Cells.Clear();
                GridView1.Rows[0].Cells.Add(new TableCell());
                GridView1.Rows[0].Cells[0].ColumnSpan = columncount;
                GridView1.Rows[0].Cells[0].Text       = "No Records Found";
            }
        }
示例#10
0
        /// <summary>
        /// Search city
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SearchCity(object sender, EventArgs e)
        {
            DataTable searchTBL = CityDAO.GetDataCityByName(txtSearch.Text.Trim());

            if (searchTBL.Rows.Count > 0)
            {
                GridView1.DataSource = searchTBL;
                GridView1.DataBind();
            }
            else
            {
                searchTBL.Rows.Add(searchTBL.NewRow());
                GridView1.DataSource = searchTBL;
                GridView1.DataBind();
                int columncount = GridView1.Rows[0].Cells.Count;
                GridView1.Rows[0].Cells.Clear();
                GridView1.Rows[0].Cells.Add(new TableCell());
                GridView1.Rows[0].Cells[0].ColumnSpan = columncount;
                GridView1.Rows[0].Cells[0].Text       = "No Records Found";
            }
        }
示例#11
0
        /// <summary>
        /// Add new city
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string cityID     = txtID.Text;
            string cityName   = txtName.Text;
            string nationalID = txtNationalID.Text;

            if (CityDAO.DulicateCity(cityID))
            {
                phError.Controls.Add(new LiteralControl("<div class='alert alert-danger'>"));
                Label error = new Label();
                error.Text = "CityID has been dupplicated!";
                phError.Controls.Add(error);
                phError.Controls.Add(new LiteralControl("</div>"));
                return;
            }
            else if (string.IsNullOrEmpty(cityID) || string.IsNullOrEmpty(cityName) ||
                     string.IsNullOrEmpty(nationalID))
            {
                phError.Controls.Add(new LiteralControl("<div class='alert alert-danger'>"));
                Label error = new Label();
                error.Text = "All data must not be empty!";
                phError.Controls.Add(error);
                phError.Controls.Add(new LiteralControl("</div>"));
                return;
            }
            else
            {
                City c = new City();
                c.CityID     = cityID;
                c.CityName   = cityName;
                c.NationalID = nationalID;
                if (CityDAO.AddCity(c))
                {
                    Session["addOK"] = "New CITY has been added!";
                    Response.Redirect("AdminCity.aspx");
                }
            }
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = CityDAO.GetDataCity();

                cbFromCity.DataSource     = dt;
                cbFromCity.DataValueField = "CityID";
                cbFromCity.DataTextField  = "CityName";
                cbFromCity.DataBind();

                cbToCity.DataSource     = dt;
                cbToCity.DataValueField = "CityID";
                cbToCity.DataTextField  = "CityName";
                cbToCity.DataBind();

                txtRoute.Text = cbFromCity.SelectedItem.ToString() + " to " + cbToCity.SelectedItem.ToString();
            }

            btnSave.Click += BtnSave_Click;
            btnBack.Click += BtnBack_Click;
            cbFromCity.SelectedIndexChanged += CbFromCity_SelectedIndexChanged;
            cbToCity.SelectedIndexChanged   += CbToCity_SelectedIndexChanged;
        }
示例#13
0
 public static async Task CreateOneCity(string cityName, string provinceName, string provinceCode, string countryName, string countryCode)
 {
     CityDAO cityDAO = new CityDAO();
     await cityDAO.CreateOneCity(cityName, provinceName, provinceCode, countryName, countryCode);
 }
示例#14
0
 /// <summary>
 /// 构造函数
 /// </summary>
 public CityBLL(LoggingSessionInfo pUserInfo)
 {
     this.CurrentUserInfo = pUserInfo;
     this._currentDAO     = new CityDAO(pUserInfo);
 }
示例#15
0
        public static List <City> GetCityByCityNameAndProvinceAndCountry(string cityName, string province, string country)
        {
            CityDAO cityDAO = new CityDAO();

            return(cityDAO.GetCityByCityNameAndProvinceAndCountry(cityName, province, country));
        }
示例#16
0
        public static List <City> GetCityByKeyword(string keyword)
        {
            CityDAO cityDAO = new CityDAO();

            return(cityDAO.GetCityByKeyword(keyword));
        }
示例#17
0
        public static async Task <List <City> > GetAllCityList()
        {
            CityDAO cityDAO = new CityDAO();

            return(await cityDAO.GetAllCityList());
        }
示例#18
0
        public static async Task <long> DeleteCityById(string id)
        {
            CityDAO cityDAO = new CityDAO();

            return(await cityDAO.DeleteCityById(id));
        }
示例#19
0
        public static async Task <long> UpdateCityById(string id, string cityName, string provinceName, string provinceCode, string countryName, string countryCode)
        {
            CityDAO cityDAO = new CityDAO();

            return(await cityDAO.UpdateCityById(id, cityName, provinceName, provinceCode, countryName, countryCode));
        }
示例#20
0
        public void Create(City city)
        {
            CityDAO cityDAO = new CityDAO();

            cityDAO.Create(TABLE, city.AssembleDictionary());
        }
示例#21
0
        /// <summary> Retrieves Entity rows in a datatable which match the specified filter. It will always create a new connection to the database.</summary>
        /// <param name="selectFilter">A predicate or predicate expression which should be used as filter for the entities to retrieve.</param>
        /// <param name="maxNumberOfItemsToReturn"> The maximum number of items to return with this retrieval query.</param>
        /// <param name="sortClauses">The order by specifications for the sorting of the resultset. When not specified, no sorting is applied.</param>
        /// <param name="relations">The set of relations to walk to construct to total query.</param>
        /// <param name="pageNumber">The page number to retrieve.</param>
        /// <param name="pageSize">The page size of the page to retrieve.</param>
        /// <returns>DataTable with the rows requested.</returns>
        public static DataTable GetMultiAsDataTable(IPredicate selectFilter, long maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relations, int pageNumber, int pageSize)
        {
            CityDAO dao = DAOFactory.CreateCityDAO();

            return(dao.GetMultiAsDataTable(maxNumberOfItemsToReturn, sortClauses, selectFilter, relations, pageNumber, pageSize));
        }