Пример #1
0
 //Add CTPDX
 public bool addCTPDX(string masp, string soluong, PHIEUDEXUAT pdx)
 {
     db = new CMART8Entities();
     try
     {
         try
         {
             CTPHIEUDEXUAT ctdx = db.CTPHIEUDEXUATs.Single(st => st.SOPHIEU.Equals(pdx.SOPHIEUDX) && st.MASP.Equals(masp));
             int           dem  = int.Parse(ctdx.SOLUONG.ToString()) + int.Parse(soluong);
             ctdx.SOLUONG = dem;
             db.SaveChanges();
             return(true);
         }
         catch
         {
             CTPHIEUDEXUAT ctdx = new CTPHIEUDEXUAT();
             ctdx.SOPHIEU = pdx.SOPHIEUDX;
             ctdx.MASP    = masp;
             ctdx.SOLUONG = int.Parse(soluong);
             db.CTPHIEUDEXUATs.Add(ctdx);
             db.SaveChanges();
             return(true);
         }
     }
     catch {
         return(false);
     }
 }
Пример #2
0
        public bool addTTKM(string masp, float giakm, DateTime tgbd, DateTime tgkt, string noidung, string hinhanh)
        {
            db = new CMART8Entities();
            KHUYENMAI TTKM = new KHUYENMAI();

            try
            {
                TTKM.MAKM    = DateTime.Now.ToString();
                TTKM.MASP    = masp;
                TTKM.GIAKM   = giakm;
                TTKM.HINHANH = hinhanh;
                //TTKM.THOIGIANBD = DateTime.Parse(tgbd);
                //TTKM.THOIGIANKT = DateTime.Parse(tgkt);
                TTKM.THOIGIANBD = tgbd;
                TTKM.THOIGIANKT = tgkt;
                TTKM.NOIDUNG    = noidung;
                db.KHUYENMAIs.AddObject(TTKM);
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #3
0
        public bool deleteSP(String id)
        {
            db = new CMART8Entities();
            SANPHAM SP = db.SANPHAMs.Single(st => st.MASP.Contains(id));

            db.SANPHAMs.DeleteObject(SP);
            db.SaveChanges();
            return(true);
        }
Пример #4
0
      public bool deleteNCC(String id)
      {
          db = new CMART8Entities();
          NHACUNGCAP ncc = db.NHACUNGCAPs.Single(st => st.MANCC.Contains(id));

          db.NHACUNGCAPs.DeleteObject(ncc);
          db.SaveChanges();
          return(true);
      }
Пример #5
0
        public bool deleteLSP(String id)
        {
            db = new CMART8Entities();
            LOAISANPHAM LSP = db.LOAISANPHAMs.Single(st => st.MALOAI.Contains(id));

            db.LOAISANPHAMs.DeleteObject(LSP);
            db.SaveChanges();
            return(true);
        }
Пример #6
0
        public bool deleteTTKM(String id)
        {
            db = new CMART8Entities();
            KHUYENMAI TTKM = db.KHUYENMAIs.Single(st => st.MAKM.Contains(id));

            db.KHUYENMAIs.DeleteObject(TTKM);
            db.SaveChanges();
            return(true);
        }
Пример #7
0
        //tao mới phiếu đề xuất
        public PHIEUDEXUAT createPDX(string maTK)
        {
            db = new CMART8Entities();
            PHIEUDEXUAT pdx = new PHIEUDEXUAT();

            pdx.SOPHIEUDX  = autoID();
            pdx.NGAYDEXUAT = DateTime.Now;
            pdx.MATK       = maTK;
            db.PHIEUDEXUATs.Add(pdx);
            db.SaveChanges();
            return(pdx);
        }
Пример #8
0
 //Delete CTPDX
 public bool deleteCTPDX(string masp, PHIEUDEXUAT pdx)
 {
     db = new CMART8Entities();
     try
     {
         CTPHIEUDEXUAT ctdx = db.CTPHIEUDEXUATs.Single(st => st.SOPHIEU.Equals(pdx.SOPHIEUDX) && st.MASP.Equals(masp));
         db.CTPHIEUDEXUATs.Remove(ctdx);
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #9
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (lblMKM.Visible == false && lblXNMK.Visible == false && lbTDN.Visible == false && lbMKHT.Visible == false && flag == true)
     {
         TAIKHOAN tk = db.TAIKHOANs.Single(st => st.MATK == TK.MATK);
         tk.MATKHAU = txtPass.Text;
         TK         = tk;
         db.SaveChanges();
         MessageBox.Show("Cập nhật mật khẩu mới thành công!");
         btnCancel_Click(null, null);
     }
     else
     {
         MessageBox.Show("Cập nhật mật khẩu mới không thành công!");
     }
 }
Пример #10
0
 //Update PDX
 public bool updatePDX(PHIEUDEXUAT pdx, string mancc)
 {
     try
     {
         db = new CMART8Entities();
         PHIEUDEXUAT dx = db.PHIEUDEXUATs.Find(pdx.SOPHIEUDX);
         dx.MANCC           = mancc;
         db.Entry(dx).State = System.Data.EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #11
0
        public bool editLSP(string id, string ten)
        {
            db = new CMART8Entities();
            LOAISANPHAM LSP = db.LOAISANPHAMs.Single(st => st.MALOAI.Equals(id));

            try
            {
                LSP.TENLOAI = ten;
                db.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #12
0
 public bool updatePNHCN(PHIEUNHAPHANGCHINHANH PN, string sophieuTS, string chinhanh, DateTime ngay)
 {
     try
     {
         db = new CMART8Entities();
         PHIEUNHAPHANGCHINHANH pn = db.PHIEUNHAPHANGCHINHANHs.Find(PN.SOPHIEU);
         pn.SOPHIEUNHTS     = sophieuTS;
         pn.CHINHANH        = chinhanh;
         pn.NGAYNHAP        = ngay;
         db.Entry(pn).State = System.Data.EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #13
0
        public bool addLSP(string ten)
        {
            db = new CMART8Entities();
            LOAISANPHAM LSP = new LOAISANPHAM();

            try
            {
                LSP.MALOAI    = DateTime.Now.ToString();
                LSP.TENLOAI   = ten;
                LSP.SOLUONGSP = 0;
                db.LOAISANPHAMs.AddObject(LSP);
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #14
0
      public bool editNCC(string id, string ten, string diachi, string sdt)
      {
          db = new CMART8Entities();
          NHACUNGCAP ncc = db.NHACUNGCAPs.Single(st => st.MANCC.Equals(id));

          try
          {
              ncc.TENNCC = ten;
              ncc.DIACHI = diachi;
              ncc.SDT    = sdt;
              db.SaveChanges();

              return(true);
          }
          catch (Exception)
          {
              return(false);
          }
      }
Пример #15
0
      public bool addNCC(string ten, string diachi, string sdt)
      {
          db = new CMART8Entities();
          NHACUNGCAP ncc = new NHACUNGCAP();

          try {
              ncc.MANCC  = DateTime.Now.ToString();
              ncc.TENNCC = ten;
              ncc.DIACHI = diachi;
              ncc.SDT    = sdt;
              db.NHACUNGCAPs.AddObject(ncc);
              db.SaveChanges();
              return(true);
          }
          catch (Exception)
          {
              return(false);
          }
      }
Пример #16
0
 public bool updatePNHTS(PHIEUNHAPHANGTRUSO PN, string sophieudx, string tongtien, string maTK, DateTime ngay)
 {
     try
     {
         db = new CMART8Entities();
         PHIEUNHAPHANGTRUSO pn = db.PHIEUNHAPHANGTRUSOes.Find(PN.SOPHIEU);
         pn.SOPHIEUDX       = sophieudx;
         pn.TONGTIEN        = ulong.Parse(tongtien);
         pn.MATK            = maTK;
         pn.NGAYNHAP        = ngay;
         db.Entry(pn).State = System.Data.EntityState.Modified;
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #17
0
        public bool addSP(string ten, string hinhanh, string maloai, string mancc)
        {
            db = new CMART8Entities();
            SANPHAM SP = new SANPHAM();

            try {
                SP.MASP    = DateTime.Now.ToString();
                SP.TENSP   = ten;
                SP.HINHANH = hinhanh;
                SP.MALOAI  = maloai;
                SP.MANCC   = mancc;
                db.SANPHAMs.AddObject(SP);
                db.SaveChanges();
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #18
0
        public bool editSP(string id, string ten, string hinhanh, string maloai, string mancc)
        {
            db = new CMART8Entities();
            SANPHAM SP = db.SANPHAMs.Single(st => st.MASP.Equals(id));

            try
            {
                SP.TENSP   = ten;
                SP.HINHANH = hinhanh;
                SP.MALOAI  = maloai;
                SP.MANCC   = mancc;
                db.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Пример #19
0
 //Hủy phiếu đề xuất
 public bool deletePDX(PHIEUDEXUAT pdx)
 {
     try
     {
         db = new CMART8Entities();
         List <CTPHIEUDEXUAT> lst = db.CTPHIEUDEXUATs.Where(x => x.SOPHIEU.Equals(pdx.SOPHIEUDX)).ToList();
         foreach (CTPHIEUDEXUAT item in lst)
         {
             db.CTPHIEUDEXUATs.Remove(item);
         }
         db.SaveChanges();
         db = new CMART8Entities();
         PHIEUDEXUAT PDX = db.PHIEUDEXUATs.Find(pdx.SOPHIEUDX);
         db.PHIEUDEXUATs.Remove(PDX);
         db.SaveChanges();
         return(true);
     }
     catch {
         return(false);
     }
 }
Пример #20
0
 //Cập nhật chi tiết nhập hàng trụ sở
 public bool updateListCTTS(List <CTPHIEUNHAPHANGTRUSO> list, PHIEUNHAPHANGTRUSO PN)
 {
     db = new CMART8Entities();
     try
     {
         List <CTPHIEUNHAPHANGTRUSO> tmp = db.CTPHIEUNHAPHANGTRUSOes.Where(st => st.SOPHIEUNHTS.Equals(PN.SOPHIEU)).ToList();
         foreach (CTPHIEUNHAPHANGTRUSO it in tmp)
         {
             db.CTPHIEUNHAPHANGTRUSOes.Remove(it);
             db.SaveChanges();
         }
         db = new CMART8Entities();
         foreach (CTPHIEUNHAPHANGTRUSO item in list)
         {
             db.CTPHIEUNHAPHANGTRUSOes.Add(item);
         }
         db.SaveChanges();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #21
0
        public bool editTTKM(string makm, string masp, float giakm, DateTime tgbd, DateTime tgkt, string noidung, string hinhanh)
        {
            db = new CMART8Entities();
            KHUYENMAI TTKM = db.KHUYENMAIs.Single(st => st.MAKM.Equals(makm));

            try
            {
                TTKM.MASP    = masp;
                TTKM.GIAKM   = giakm;
                TTKM.HINHANH = hinhanh;
                //TTKM.THOIGIANBD = DateTime.Parse(tgbd);
                //TTKM.THOIGIANKT = DateTime.Parse(tgkt);
                TTKM.THOIGIANBD = tgbd;
                TTKM.THOIGIANKT = tgkt;
                TTKM.NOIDUNG    = noidung;
                db.SaveChanges();

                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
        }