Ejemplo n.º 1
0
        public System.Data.Linq.Table <ThanhPho> LayThanhPho()
        {
            DataSet         ds   = new DataSet();
            QLKHDataContext qlBH = new QLKHDataContext();

            return(qlBH.ThanhPhos);
        }
Ejemplo n.º 2
0
        public bool XoaThanhPho(ref string err, string MaThanhPho)
        {
            QLKHDataContext qlBH = new QLKHDataContext();

            var tpQuery = from tp in qlBH.ThanhPhos
                          where tp.ThanhPho1 == MaThanhPho
                          select tp;

            qlBH.ThanhPhos.DeleteAllOnSubmit(tpQuery);
            qlBH.ThanhPhos.Context.SubmitChanges();
            return(true);
        }
Ejemplo n.º 3
0
        public bool ThemThanhPho(string MaThanhPho, string TenThanhPho, ref string err)
        {
            QLKHDataContext qlKH = new QLKHDataContext();
            ThanhPho        tp   = new ThanhPho();

            tp.ThanhPho1   = MaThanhPho;
            tp.TenThanhPho = TenThanhPho;

            qlKH.ThanhPhos.InsertOnSubmit(tp);
            qlKH.ThanhPhos.Context.SubmitChanges();
            return(true);
        }
Ejemplo n.º 4
0
        public bool CapNhatThanhPho(string MaThanhPho, string TenThanhPho, ref string err)
        {
            QLKHDataContext qlBH = new QLKHDataContext();

            var tpQuery = (from tp in qlBH.ThanhPhos
                           where tp.ThanhPho1 == MaThanhPho
                           select tp).SingleOrDefault();

            if (tpQuery != null)
            {
                tpQuery.TenThanhPho = TenThanhPho;
                qlBH.SubmitChanges();
            }
            return(true);
        }
Ejemplo n.º 5
0
 public BaseServiceResult <IEnumerable <KhachHangInfo> > GetAllKhachHangs()
 {
     try
     {
         List <KhachHangInfo> khachhangList = new List <KhachHangInfo>();
         QLKHDataContext      db            = new QLKHDataContext();
         foreach (var item in db.KhachHangs)
         {
             khachhangList.Add(new KhachHangInfo {
                 Id = item.KhachHangID, Name = item.ConNguoi.HoTen
             });
         }
         return(new BaseServiceResult <IEnumerable <KhachHangInfo> >(ResultStatusCodes.OK, khachhangList));
     }
     catch
     {
         return(BaseServiceResult <IEnumerable <KhachHangInfo> > .InternalErrorResult);
     }
 }