Ejemplo n.º 1
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (Them)
            {//Thêm
                LoaiTaiSan temp = new LoaiTaiSan();
                temp.MaLoaiTaiSan = txtMa.Text;
                temp.TenLoaiTaiSan = txtTen.Text;

                if (!CheckLoi(temp)) return;

                int kq = LoaiTaiSanBiz.AddLoaiTaiSan(temp);
                if (kq > 0) MSG.ThemThanhCong();
                else MSG.ThemThatBai();
            }
            else
            {//Sửa
                LoaiTaiSan temp = new LoaiTaiSan();
                temp.MaLoaiTaiSan = txtMa.Text;
                temp.TenLoaiTaiSan = txtTen.Text;
                int kq = LoaiTaiSanBiz.EditLoaiTaiSan(temp);
                if (kq > 0) MSG.SuaThanhCong();
                else MSG.SuaThatBai();
            }
            this.Close();
        }
Ejemplo n.º 2
0
 public LoaiTaiSan Copy()
 {
     LoaiTaiSan kq = new LoaiTaiSan();
     kq.MaLoaiTaiSan = maLoaiTaiSan;
     kq.TenLoaiTaiSan = tenLoaiTaiSan;
     return kq;
 }
Ejemplo n.º 3
0
        public LoaiTaiSan Copy()
        {
            LoaiTaiSan kq = new LoaiTaiSan();

            kq.MaLoaiTaiSan  = maLoaiTaiSan;
            kq.TenLoaiTaiSan = tenLoaiTaiSan;
            return(kq);
        }
Ejemplo n.º 4
0
 public static List<LoaiTaiSan> getListLoaiTaiSan()
 {
     List<LoaiTaiSan> kq = new List<LoaiTaiSan>();
     string sql = "SELECT [MaLoaiTaiSan],[TenLoaiTaiSan] FROM  [VNAAccounting].[dbo].[LoaiTaiSan]";
     System.Data.DataTable dt = DAL.CSDL.hienthi(sql);
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         LoaiTaiSan temp = new LoaiTaiSan();
         temp.MaLoaiTaiSan = dt.Rows[i]["MaLoaiTaiSan"].ToString();
         temp.TenLoaiTaiSan = dt.Rows[i]["TenLoaiTaiSan"].ToString();
         kq.Add(temp);
     }
     return kq;
 }
Ejemplo n.º 5
0
 bool CheckLoi(LoaiTaiSan data)
 {
     bool kq = true;
     //mã loại tài sản rỗng
     if (string.IsNullOrEmpty(data.MaLoaiTaiSan))
     {
         MSG.ErrorStand("Bạn chưa nhập mã loại tài sản!");
         txtMa.Focus();
         return false;
     }
     //mã loại tài sản đã có trong cơ sở dữ liệu
     foreach (LoaiTaiSan item in frmDMLoaiTaiSan.Ldata)
     {
         if (item.MaLoaiTaiSan.ToUpper().Equals(txtMa.Text.ToUpper()))
         {
             MSG.ErrorStand("Mã loại tài sản đã có trong cơ sở dữ liệu!");
             txtMa.Focus();
             return false;
         }
     }
     return kq;
 }
Ejemplo n.º 6
0
 public static int EditLoaiTaiSan(LoaiTaiSan input)
 {
     string sql = "UPDATE [VNAAccounting].[dbo].[LoaiTaiSan] SET TenLoaiTaiSan = N'" + input.TenLoaiTaiSan + "' WHERE MaLoaiTaiSan = N'" + input.MaLoaiTaiSan.ToUpper() + "'";
     return DAL.CSDL.ThemSuaXoa(sql);
 }
Ejemplo n.º 7
0
 public static int DeleteLoaiTaiSan(LoaiTaiSan input)
 {
     string sql = "DELETE FROM [VNAAccounting].[dbo].[LoaiTaiSan] WHERE MaLoaiTaiSan = N'" + input.MaLoaiTaiSan.ToUpper() + "'";
     return DAL.CSDL.ThemSuaXoa(sql);
 }
Ejemplo n.º 8
0
 public static int AddLoaiTaiSan(LoaiTaiSan input)
 {
     string sql = "INSERT INTO [VNAAccounting].[dbo].[LoaiTaiSan]([MaLoaiTaiSan],[TenLoaiTaiSan]) VALUES(N'" + input.MaLoaiTaiSan.ToUpper() + "',N'" + input.TenLoaiTaiSan + "')";
     return DAL.CSDL.ThemSuaXoa(sql);
 }
Ejemplo n.º 9
0
 //------------------------------------------>
 private void DongY()
 {
     if (vtIndex == -1) return;
     switch (chose)
     {
         case CONFIG.ConstFrm.frmDMLoaiTaiSan:
             {
                 loaitaisan = Utils.DataGridViewRow_to_LoaiTaiSan(DataGridView.Rows[vtIndex]);
                 break;
             }
         case CONFIG.ConstFrm.frmDMTaiSan:
             {
                 taisan = Utils.DataGridViewRow_to_TaiSan(DataGridView.Rows[vtIndex]);
                 break;
             }
         case CONFIG.ConstFrm.frmDMPhanNhomTaiSan:
             {
                 phannhomtaisan = Utils.DataGridViewRow_to_PhanNhomTaiSan(DataGridView.Rows[vtIndex]);
                 break;
             }
         case CONFIG.ConstFrm.frmDMLyDoTangGiamTaiSan:
             {
                 lydotanggiamtaisan = Utils.DataGridViewRow_to_LyDoTangGiamTaiSan(DataGridView.Rows[vtIndex]);
                 break;
             }
         case CONFIG.ConstFrm.frmDMBoPhanHachToan:
             {
                 bophanhachtoan = Utils.DataGridViewRow_to_BoPhanHachToan(DataGridView.Rows[vtIndex]);
                 break;
             }
         case CONFIG.ConstFrm.frmDMPhanXuong:
             {
                 phanxuong = Utils.DataGridViewRow_to_PhanXuong(DataGridView.Rows[vtIndex]);
                 break;
             }
         case CONFIG.ConstFrm.frmDMPhi:
             {
                 phi = Utils.DataGridViewRow_to_Phi(DataGridView.Rows[vtIndex]);
                 break;
             }
         case CONFIG.ConstFrm.frmDMBoPhanSuDung:
             {
                 bophansusung = Utils.DataGridViewRow_to_BoPhanSuDung(DataGridView.Rows[vtIndex]);
                 break;
             }
         case CONFIG.ConstFrm.frmDMNguonVon:
             {
                 nguonvon = Utils.DataGridViewRow_to_NguonVon(DataGridView.Rows[vtIndex]);
                 break;
             }
         default:
             break;
     }
 }
Ejemplo n.º 10
0
 public static LoaiTaiSan DataGridViewRow_to_LoaiTaiSan(System.Windows.Forms.DataGridViewRow Input)
 {
     LoaiTaiSan kq = new LoaiTaiSan();
     kq.MaLoaiTaiSan = Input.Cells["MaLoaiTaiSan"].Value.ToString();
     kq.TenLoaiTaiSan = Input.Cells["TenLoaiTaiSan"].Value.ToString();
     return kq;
 }