Example #1
0
        public System.Data.Linq.Table <ThanhPho> LayThanhPho()
        {
            //DataSet ds = new DataSet();
            QLBHDataContext qlBH = new QLBHDataContext();

            return(qlBH.ThanhPhos);
        }
Example #2
0
        public bool RemoveCity(string cityID, ref string err)
        {
            QLBHDataContext qLBH = new QLBHDataContext();
            var             TP   = from tp in qLBH.ThanhPhos
                                   where tp.ThanhPho1 == cityID
                                   select tp;

            qLBH.ThanhPhos.DeleteAllOnSubmit(TP);
            qLBH.SubmitChanges();
            return(true);
        }
Example #3
0
        public bool AddCity(string cityID, string cityName, ref string err)
        {
            QLBHDataContext qLBH = new QLBHDataContext();
            ThanhPho        city = new ThanhPho();

            city.ThanhPho1   = cityID.Trim();
            city.TenThanhPho = cityName.Trim();
            qLBH.ThanhPhos.InsertOnSubmit(city);
            qLBH.ThanhPhos.Context.SubmitChanges();
            return(true);
        }
Example #4
0
        public bool UpdateCity(string cityID, string cityName, ref string err)
        {
            QLBHDataContext qLBH = new QLBHDataContext();
            var             TP   = (from tp in qLBH.ThanhPhos
                                    where tp.ThanhPho1 == cityID
                                    select tp).SingleOrDefault();

            if (TP != null)
            {
                TP.TenThanhPho = cityID;
                qLBH.SubmitChanges();
            }
            return(true);
        }