Esempio n. 1
0
        public static int EditTaiSan(TaiSan input)
        {
            string sql = "UPDATE [VNAAccounting].[dbo].[TaiSan] SET ";
            sql += "TenTaiSan = N'" + input.TenTaiSan + "',MaLoaiTaiSan = N'" + input.MaLoaiTaiSan.ToUpper() + "',MaLyDoTangGiamTaiSan = N'" + input.MaLyDoTangGiamTaiSan.ToUpper() + "',NgayTangTaiSan = '" + input.NgayTangTaiSan.ToString("MM/dd/yyyy") + "',NgayTinhKhauHao = '" + input.NgayTinhKhauHao.ToString("MM/dd/yyyy") + "',";
            sql += "SoKyKhauHao = N'" + input.SoKyKhauHao + "',MaBoPhanHachToan = N'" + input.MaBoPhanHachToan.ToUpper() + "',MaPhanXuong = N'" + input.MaPhanXuong.ToUpper() + "',MaPhi = N'" + input.MaPhi.ToUpper() + "',MaBoPhanSuDung = N'" + input.MaBoPhanSuDung.ToUpper() + "',";
            sql += "TKTaiSan = N'" + input.TKTaiSan.ToUpper() + "',TKKhauHao = N'" + input.TKKhauHao.ToUpper() + "',TKChiPhi = N'" + input.TKChiPhi.ToUpper() + "',PhanNhom1 = N'" + input.PhanNhom1 + "',PhanNhom2 = N'" + input.PhanNhom2 + "',";
            sql += "PhanNhom3 = N'" + input.PhanNhom3 + "',TenKhac = N'" + input.TenKhac + "',SoHieuTaiSan = N'" + input.SoHieuTaiSan.ToUpper() + "',ThongSoKyThuat = N'" + input.ThongSoKyThuat + "',NuocSanXuat = N'" + input.NuocSanXuat + "',";
            sql += "NamSanXuat = N'" + input.NamSanXuat + "',NgayDuaVaoSuDung = '" + input.NgayDuaVaoSuDung.ToString("MM/dd/yyyy") + "',NgayDinhChiSuDung = '" + input.NgayDinhChiSuDung.ToString("MM/dd/yyyy") + "',LyDoDinhChi = N'" + input.LyDoDinhChi + "',GhiChu = N'" + input.GhiChu + "'";
            sql += " WHERE MaTaiSan = N'" + input.MaTaiSan.ToUpper() + "'";
            int kq = DAL.CSDL.ThemSuaXoa(sql);
            if (kq > 0)
            {
                //Delete chi tiết tài sản
                ChiTietTaiSan xoactts = new ChiTietTaiSan(); xoactts.MaTaiSan = input.MaTaiSan;
                ChiTietTaiSanBiz.DeleteChiTietTaiSan(xoactts);
                //Delete phụ tùng kèm theo
                PhuTungKemTheo xoaptkt = new PhuTungKemTheo(); xoaptkt.MaTaiSan = input.MaTaiSan;
                PhuTungKemTheoBiz.DeletePhuTungKemTheo(xoaptkt);

                //Insert chi tiết tài sản
                foreach (ChiTietTaiSan item in input.Lchitiettaisan)
                {
                    ChiTietTaiSanBiz.AddChiTietTaiSan(item);
                }
                //Insert phụ tùng kèm theo
                foreach (PhuTungKemTheo item in input.Lphutungkemtheo)
                {
                    PhuTungKemTheoBiz.AddPhuTungKemTheo(item);
                }
            }
            return kq;
        }
Esempio n. 2
0
 public static int DeleteTaiSan(TaiSan input)
 {
     string sql = "DELETE FROM [VNAAccounting].[dbo].[TaiSan] WHERE MaTaiSan = N'" + input.MaTaiSan.ToUpper() + "'";
     //Delete chi tiết tài sản
     ChiTietTaiSan xoactts = new ChiTietTaiSan(); xoactts.MaTaiSan = input.MaTaiSan;
     ChiTietTaiSanBiz.DeleteChiTietTaiSan(xoactts);
     //Delete phụ tùng kèm theo
     PhuTungKemTheo xoaptkt = new PhuTungKemTheo(); xoaptkt.MaTaiSan = input.MaTaiSan;
     PhuTungKemTheoBiz.DeletePhuTungKemTheo(xoaptkt);
     return DAL.CSDL.ThemSuaXoa(sql);
 }
Esempio n. 3
0
 public PhuTungKemTheo Copy()
 {
     PhuTungKemTheo kq = new PhuTungKemTheo();
     kq.MaTaiSan = maTaiSan;
     kq.MaPhuTungKemTheo = maPhuTungKemTheo;
     kq.TenPhuTungKemTheo = tenPhuTungKemTheo;
     kq.DVT = dVT;
     kq.SoLuong = soLuong;
     kq.GiaTri = giaTri;
     kq.GhiChu = ghiChu;
     return kq;
 }
Esempio n. 4
0
        public PhuTungKemTheo Copy()
        {
            PhuTungKemTheo kq = new PhuTungKemTheo();

            kq.MaTaiSan          = maTaiSan;
            kq.MaPhuTungKemTheo  = maPhuTungKemTheo;
            kq.TenPhuTungKemTheo = tenPhuTungKemTheo;
            kq.DVT     = dVT;
            kq.SoLuong = soLuong;
            kq.GiaTri  = giaTri;
            kq.GhiChu  = ghiChu;
            return(kq);
        }
Esempio n. 5
0
 public static List<PhuTungKemTheo> getListPhuTungKemTheo(string MaTaiSan)
 {
     List<PhuTungKemTheo> kq = new List<PhuTungKemTheo>();
     string sql = "SELECT [MaTaiSan],[MaPhuTungKemTheo],[TenPhuTungKemTheo],[DVT],[SoLuong],[GiaTri],[GhiChu] FROM [VNAAccounting].[dbo].[PhuTungKemTheo] WHERE MaTaiSan=N'" + MaTaiSan.ToUpper() + "'";
     System.Data.DataTable dt = DAL.CSDL.hienthi(sql);
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         PhuTungKemTheo temp = new PhuTungKemTheo();
         temp.MaTaiSan = dt.Rows[i]["MaTaiSan"].ToString();
         temp.MaPhuTungKemTheo = dt.Rows[i]["MaPhuTungKemTheo"].ToString();
         temp.TenPhuTungKemTheo = dt.Rows[i]["TenPhuTungKemTheo"].ToString();
         temp.DVT = dt.Rows[i]["DVT"].ToString();
         temp.SoLuong = double.Parse(dt.Rows[i]["SoLuong"].ToString());
         temp.GiaTri = double.Parse(dt.Rows[i]["GiaTri"].ToString());
         temp.GhiChu = dt.Rows[i]["GhiChu"].ToString();
         kq.Add(temp);
     }
     return kq;
 }
Esempio n. 6
0
 public static int EditPhuTungKemTheo(PhuTungKemTheo input)
 {
     string sql = "UPDATE [VNAAccounting].[dbo].[PhuTungKemTheo] SET TenPhuTungKemTheo = N'" + input.TenPhuTungKemTheo + "',DVT = N'" + input.DVT + "',SoLuong = " + input.SoLuong + ",GiaTri = " + input.GiaTri + ",GhiChu = N'" + input.GhiChu + "' WHERE (MaPhuTungKemTheo = N'" + input.MaPhuTungKemTheo.ToUpper() + "') AND (MaTaiSan = N'" + input.MaTaiSan.ToUpper() + "')";
     return DAL.CSDL.ThemSuaXoa(sql);
 }
Esempio n. 7
0
 public static int DeletePhuTungKemTheo(PhuTungKemTheo input)
 {
     string sql = "DELETE FROM [VNAAccounting].[dbo].[PhuTungKemTheo] WHERE (MaPhuTungKemTheo = N'" + input.MaPhuTungKemTheo.ToUpper() + "') AND (MaTaiSan = N'" + input.MaTaiSan.ToUpper() + "')";
     return DAL.CSDL.ThemSuaXoa(sql);
 }
Esempio n. 8
0
 public static int AddPhuTungKemTheo(PhuTungKemTheo input)
 {
     string sql = "INSERT INTO [VNAAccounting].[dbo].[PhuTungKemTheo]([MaTaiSan],[MaPhuTungKemTheo],[TenPhuTungKemTheo],[DVT],[SoLuong],[GiaTri],[GhiChu]) VALUES(N'" + input.MaTaiSan.ToUpper() + "',N'" + input.MaPhuTungKemTheo.ToUpper() + "',N'" + input.TenPhuTungKemTheo + "',N'" + input.DVT + "'," + input.SoLuong + "," + input.GiaTri + ",N'" + input.GhiChu + "')";
     return DAL.CSDL.ThemSuaXoa(sql);
 }
Esempio n. 9
0
        private void btnPhuTungKemTheoOK_Click(object sender, EventArgs e)
        {
            try
            {
                PhuTungKemTheo temp = new PhuTungKemTheo();
                temp.MaTaiSan = txtMaTaiSan.Text.ToUpper();

                temp.MaPhuTungKemTheo = txtMaPhuTungKemTheo.Text.ToUpper();
                temp.TenPhuTungKemTheo = txtTenPhuTungKemTheo.Text;
                temp.DVT = txtDonViTinh.Text;
                temp.SoLuong = double.Parse(txtSoLuong.Text);
                temp.GiaTri = double.Parse(txtGiaTri.Text);
                temp.GhiChu = txtGhiChuPhuTungKemTheo.Text;

                //Check lỗi phụ tùng kèm theo

                LPhuTungKemTheo.Add(temp);
                DataGridViewCTPhuTungKemTheo.DataSource = LPhuTungKemTheo.ToArray();
                FixDataGirdView(DataGridViewCTPhuTungKemTheo, true);
                ResetPhuTungKemTheo();
                if (isEditChiTietPhuTung) isEditChiTietPhuTung = false;
            }
            catch (Exception ex)
            {
                MSG.Error(ex);
            }
        }