Пример #1
0
 /// <summary>
 /// Lưu KTKL cho nhân viên
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btSave_Click(object sender, EventArgs e)
 {
     if (txtN.Text != "" && txtKLKT.Text != "")
     {
         PeopleDTO pp = new PeopleDTO();
         KTKLDTO   kt = new KTKLDTO();
         kt.ID = Int32.Parse(cbbKTKL.Text);
         pp.ID = Int32.Parse(cbbID.Text.Substring(0, cbbID.Text.Length - 3));
         pp.KH = cbbID.Text.Substring(cbbID.Text.Length - 3);
         int result = ketoan.ThemNVKTKL(kt, pp);
         if (result > 0)
         {
             MessageBox.Show("Thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
             this.Close();
         }
         else
         {
             MessageBox.Show("Không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("Chưa nhập đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
        /// <summary>
        /// Sửa KTKL
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btedit_Click(object sender, EventArgs e)
        {
            KTKLDTO         KT  = new KTKLDTO();
            DataGridViewRow row = dtgKTKL.CurrentRow;

            if (row != null)
            {
                KT.ID    = Int32.Parse(row.Cells["ID KTKL"].Value.ToString());
                KT.Money = Int32.Parse(row.Cells["Số tiền"].Value.ToString());
                KT.Name  = row.Cells["Tên KTKL"].Value.ToString();
                KT.HT    = row.Cells["Hình thức"].Value.ToString();
                rad      = new AddRAD();
                rad.KTKL = KT;
                rad.ShowDialog();
                createtableKTKL();
            }
        }
Пример #3
0
        /// <summary>
        /// Thêm nếu KTKL nếu biến KTKL== null
        /// Edit khi KTKL!=null
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btSave_Click(object sender, EventArgs e)
        {
            if (txtN.Text == "" || cbbHT.Text == "" || txtM.Text == "")
            {
                MessageBox.Show("Chưa nhập đủ thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            KTKLDTO KT = new KTKLDTO();
            int     tam;
            bool    kq = Int32.TryParse(txtM.Text, out tam);

            if (kq == true)
            {
                KT.Money = tam;
                KT.Name  = txtN.Text;
                KT.HT    = cbbHT.Text;
                int result;
                if (ktkl == null)
                {
                    result = ketoan.ThemKTKL(KT);
                }
                else
                {
                    KT.ID  = ktkl.ID;
                    result = ketoan.EditKTKL(KT);
                }
                if (result >= 0)
                {
                    MessageBox.Show("Thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Không thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Số tiền không hợp lệ", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        /// <summary>
        /// Mã KTKL của một nhân viên
        /// </summary>
        /// <param name="Cv"></param>
        /// <param name="Id"></param>
        public void getIDKTKL(out List <KTKLDTO> KTKL, object Id)
        {
            KTKL = new List <KTKLDTO>();
            Providers     provi  = new Providers();
            SqlDataReader reader = provi.getIDKTKL(Id);

            if (reader != null)
            {
                while (reader.Read())
                {
                    KTKLDTO dto = new KTKLDTO();
                    dto.ID = Int32.Parse(reader["Id_KTKL"].ToString());
                    KTKL.Add(dto);
                }
                reader.Close();
            }
            else
            {
                KTKL = null;
            }
        }/// <summary>
        /// <summary>
        /// Thêm KTKL của nhân viên
        /// </summary>
        /// <param name="kt"></param>
        /// <param name="pp"></param>
        /// <returns></returns>
        public int ThemNVKTKL(KTKLDTO kt, PeopleDTO pp)
        {
            Providers provi = new Providers();

            return(provi.ThemNVKTKL(kt.ID, pp.ID, pp.KH));
        }
        /// <summary>
        /// Sửa KTKL
        /// </summary>
        /// <param name="l"></param>
        /// <returns></returns>
        public int EditKTKL(KTKLDTO l)
        {
            Providers provi = new Providers();

            return(provi.EditKTKL(l.Name, l.HT, l.Money, l.ID));
        }
        /// <summary>
        /// Thêm KTKL
        /// </summary>
        /// <param name="pp"></param>
        /// <returns></returns>
        public int ThemKTKL(KTKLDTO pp)
        {
            Providers provi = new Providers();

            return(provi.ThemKTKL(pp.Name, pp.HT, pp.Money));
        }