Ejemplo n.º 1
0
        public string ThemKhach(int id, string khachHangCode)
        {
            var message = "";

            try {
                khachHangCode = khachHangCode ?? "";
                khachHangCode = khachHangCode.Trim().ToUpper();
                KhachHang a = Models.KhachHangModel.Instance.GetByCode(khachHangCode);
                if (_db.CTDoanKhaches.Count(x => x.FkKhachHang == a.KhachHangId && x.FkDoan == id) > 0)
                {
                    return("");
                }
                _db.CTDoanKhaches.Add(new CTDoanKhach()
                {
                    CTDoanKhachTenNguoiDi    = a.KhachHangTen,
                    CTDoanKhachSdtNguoiDi    = a.KhachHangSdt,
                    CTDoanKhachDiaChiNguoiDi = a.KhachHangDiaChi,
                    CTDoanKhachCMNDNguoiDi   = a.CMND,
                    FkDoan      = id,
                    FkKhachHang = a.KhachHangId
                });
                _db.SaveChanges();
            }
            catch (Exception e) {
                Console.WriteLine(e);
                message = e.Message;
            }
            return(message);
        }
Ejemplo n.º 2
0
        public string Insert(string name)
        {
            string message = "";

            try {
                var         _name   = name.Trim();
                Dao.QuocGia newItem = new Dao.QuocGia();
                newItem.QuocGiaTen = _name;
                _db.QuocGias.Add(newItem);
                _db.SaveChanges();
            } catch (Exception e) {
                Console.WriteLine(e);
                message = e.Message;
            }
            return(message);
        }
Ejemplo n.º 3
0
        public string Insert(string name, string note)
        {
            string message = "";

            try {
                var _name = name.Trim();
                var _note = note.Trim();
                Dao.LoaiHinhDulich newItem = new Dao.LoaiHinhDulich();
                newItem.LoaiHinhDulichTen  = _name;
                newItem.LoaiHinhDulichNote = _note;
                _db.LoaiHinhDuliches.Add(newItem);
                _db.SaveChanges();
            } catch (Exception e) {
                Console.WriteLine(e);
                message = e.Message;
            }
            return(message);
        }