Example #1
0
        private void btnDongY_Click(object sender, EventArgs e)
        {
            if (Them)
            {//Thêm
                Phi temp = new Phi();
                temp.MaPhi = txtMa.Text;
                temp.TenPhi = txtTen.Text;

                if (!CheckLoi(temp)) return;

                int kq = PhiBiz.AddPhi(temp);
                if (kq > 0) MSG.ThemThanhCong();
                else MSG.ThemThatBai();
            }
            else
            {//Sửa
                Phi temp = new Phi();
                temp.MaPhi = txtMa.Text;
                temp.TenPhi = txtTen.Text;
                int kq = PhiBiz.EditPhi(temp);
                if (kq > 0) MSG.SuaThanhCong();
                else MSG.SuaThatBai();
            }
            this.Close();
        }
Example #2
0
 public Phi Copy()
 {
     Phi kq = new Phi();
     kq.MaPhi = maPhi;
     kq.TenPhi = tenPhi;
     return kq;
 }
Example #3
0
        public Phi Copy()
        {
            Phi kq = new Phi();

            kq.MaPhi  = maPhi;
            kq.TenPhi = tenPhi;
            return(kq);
        }
Example #4
0
 public static List<Phi> getListPhi()
 {
     List<Phi> kq = new List<Phi>();
     string sql = "SELECT [MaPhi],[TenPhi] FROM  [VNAAccounting].[dbo].[Phi]";
     System.Data.DataTable dt = DAL.CSDL.hienthi(sql);
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         Phi temp = new Phi();
         temp.MaPhi = dt.Rows[i]["MaPhi"].ToString();
         temp.TenPhi = dt.Rows[i]["TenPhi"].ToString();
         kq.Add(temp);
     }
     return kq;
 }
Example #5
0
 bool CheckLoi(Phi data)
 {
     bool kq = true;
     //mã phí rỗng
     if (string.IsNullOrEmpty(data.MaPhi))
     {
         MSG.ErrorStand("Bạn chưa nhập mã phí!");
         txtMa.Focus();
         return false;
     }
     //mã phí đã có trong cơ sở dữ liệu
     foreach (Phi item in frmDMPhi.Ldata)
     {
         if (item.MaPhi.ToUpper().Equals(txtMa.Text.ToUpper()))
         {
             MSG.ErrorStand("Mã phí đã có trong cơ sở dữ liệu!");
             txtMa.Focus();
             return false;
         }
     }
     return kq;
 }
Example #6
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;
     }
 }
Example #7
0
 public static int EditPhi(Phi input)
 {
     string sql = "UPDATE [VNAAccounting].[dbo].[Phi] SET TenPhi = N'" + input.TenPhi + "' WHERE MaPhi = N'" + input.MaPhi.ToUpper() + "'";
     return DAL.CSDL.ThemSuaXoa(sql);
 }
Example #8
0
 public static int DeletePhi(Phi input)
 {
     string sql = "DELETE FROM [VNAAccounting].[dbo].[Phi] WHERE MaPhi = N'" + input.MaPhi.ToUpper() + "'";
     return DAL.CSDL.ThemSuaXoa(sql);
 }
Example #9
0
 public static int AddPhi(Phi input)
 {
     string sql = "INSERT INTO [VNAAccounting].[dbo].[Phi]([MaPhi],[TenPhi]) VALUES(N'" + input.MaPhi.ToUpper() + "',N'" + input.TenPhi + "')";
     return DAL.CSDL.ThemSuaXoa(sql);
 }
Example #10
0
 public static Phi DataGridViewRow_to_Phi(System.Windows.Forms.DataGridViewRow Input)
 {
     Phi kq = new Phi();
     kq.MaPhi = Input.Cells["MaPhi"].Value.ToString();
     kq.TenPhi = Input.Cells["TenPhi"].Value.ToString();
     return kq;
 }