Beispiel #1
0
        public static bool Delete(KhachHang data)
        {
            try
            {
                if (data != null)
                {
                    data.DeleteFlag = true;
                    dbContext.SubmitChanges();
                    return true;
                }
            }
            catch
            {

            }

            NewConnection();
            return false;
        }
Beispiel #2
0
 private static bool Insert(KhachHang data)
 {
     try
     {
         dbContext.KhachHangs.InsertOnSubmit(data);
         dbContext.SubmitChanges();
         return true;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #3
0
        /// <summary>
        /// Insert new data
        /// </summary>
        /// <returns>Return id of the new data if success</returns>
        public static int? Insert(byte idGroup, string ten, string KhachHangName, string gioiTinh = "Nam", string ma = "",
            DateTime? ngayHetHan = null, string soXe = "", double dien = 0, double nuoc = 0,
            DateTime? DOB = null, string CMND = "", DateTime? ngayCap = null, string noiCap = "",
            string diaChi = "", string dtdd = "", string email = "", string ghiChu = "")
        {
            int? res = null;

            try
            {
                if (GetByMa(ma) == null)
                {
                    KhachHang data = new KhachHang();
                    data.Ma = ma;
                    data.IdGroup = idGroup;
                    data.Ten = ten;
                    data.GioiTinh = gioiTinh;
                    data.NgayHetHan = ngayHetHan;
                    data.SoXe = soXe;
                    data.Dien = dien;
                    data.Nuoc = nuoc;
                    data.DOB = DOB;
                    data.CMND = CMND;
                    data.NgayCap = ngayCap;
                    data.NoiCap = noiCap;
                    data.DiaChi = diaChi;
                    data.DTDD = dtdd;
                    data.Email = email;
                    data.GhiChu = ghiChu;
                    data.UpdateDate = DateTime.Now;
                    data.UpdateBy = UserImp.currentUser.Id;

                    if (Insert(data))
                    {
                        res = data.Id;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return res;
        }
Beispiel #4
0
        public static bool Update(KhachHang data)
        {
            try
            {
                if (data != null)
                {
                    dbContext.SubmitChanges();
                    return true;
                }

                return false;
            }
            catch
            {
                return false;
            }
        }
 partial void DeleteKhachHang(KhachHang instance);
 partial void UpdateKhachHang(KhachHang instance);
 partial void InsertKhachHang(KhachHang instance);
		private void detach_KhachHangs(KhachHang entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
		private void attach_KhachHangs(KhachHang entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}