示例#1
0
文件: Congnhan.cs 项目: leson96/Demo
 public List <HeSoLuong> ViewHeSoLuong(string sql)
 {
     try
     {
         List <HeSoLuong> list = new List <HeSoLuong>();
         SqlDataReader    dr   = p.View(sql);
         if (dr != null)
         {
             string MaHSL, TenHeSoLuong, HeSL;
             while (dr.Read())
             {
                 MaHSL        = dr.GetString(0);
                 TenHeSoLuong = dr.GetString(1);
                 HeSL         = dr.GetString(2);
                 HeSoLuong hsl = new HeSoLuong(MaHSL, TenHeSoLuong, HeSL);
                 list.Add(hsl);
             }
         }
         return(list);
     }
     catch (SqlException p)
     {
         throw p;
     }
 }
示例#2
0
        public static int DeleteProfile(HeSoLuong qh)
        {
            SqlParameter[] para = new SqlParameter[]
            {
                new SqlParameter("@bac", qh.BacLuong)
            };

            return(ConectToSQL_Datvd.Execute_NonQuery("XoaLuong", para));
        }
示例#3
0
        public static int UpdateProfile(HeSoLuong qh)
        {
            SqlParameter[] para = new SqlParameter[]
            { new SqlParameter("@bac", qh.BacLuong),
              new SqlParameter("@luongcb", qh.LuongCB),
              new SqlParameter("@luongtangca", qh.LuongTangCa) };

            return(ConectToSQL_Datvd.Execute_NonQuery("SuaLuong", para));
        }
示例#4
0
        private void navBarItem10_LinkClicked(object sender, DevExpress.XtraNavBar.NavBarLinkEventArgs e)
        {
            panelControl1.Controls.Clear();
            HeSoLuong hsl = new HeSoLuong();

            hsl.Dock = DockStyle.Fill;
            panelControl1.Controls.Add(hsl);
            btnSearch.Visibility = DevExpress.XtraBars.BarItemVisibility.Never;
        }
 public int UpdateHeSoLuong(HeSoLuong hsl)
 {
     try
     {
         return(new Congnhan().UpdateHeSoLuong(hsl));
     }
     catch (Exception p)
     {
         throw p;
     }
 }
示例#6
0
文件: Congnhan.cs 项目: leson96/Demo
        public int UpdateHeSoLuong(HeSoLuong hsl)
        {
            List <SqlParameter> paras = new List <SqlParameter>();

            paras.Add(new SqlParameter("@mahsl", hsl.MaHSL));
            paras.Add(new SqlParameter("@tenhesoluong", hsl.TenHeSoLuong));
            paras.Add(new SqlParameter("@hesoluong", hsl.HeSL));
            try
            {
                return(p.ExecNonQuery("updatehesoluong", CommandType.StoredProcedure, paras));
            }
            catch (SqlException p)
            {
                throw p;
            }
        }
        private void btnLuu_Click(object sender, EventArgs e)
        {
            if (txtBacLuong.Text == "" || txtLuongCB.Text == "" || txtLuongtangca.Text == "")
            {
                MessageBox.Show("Bạn Cần Điền Đầy Đủ Thông Tin Trước Khi Lưu", "Thông Báo");
            }
            else
            if (check == 1)
            {
                HeSoLuong qh = new HeSoLuong();
                qh.BacLuong    = txtBacLuong.Text;
                qh.LuongCB     = float.Parse(txtLuongCB.Text);
                qh.LuongTangCa = float.Parse(txtLuongtangca.Text);



                if (HeSoLuongCtrl.InsertProfile(qh) > 0)
                {
                    MessageBox.Show("Thêm mới thành công");
                    UCHeSoLuong_Load(sender, e);
                    dgvHeSoLuong.Enabled = true;
                }
                else
                {
                    MessageBox.Show("Không thể thêm mới");
                }
            }

            else
            {
                HeSoLuong qh = new HeSoLuong();
                qh.BacLuong    = txtBacLuong.Text;
                qh.LuongCB     = float.Parse(txtLuongCB.Text);
                qh.LuongTangCa = float.Parse(txtLuongtangca.Text);

                if (HeSoLuongCtrl.UpdateProfile(qh) > 0)
                {
                    MessageBox.Show("Sửa thành công");
                    UCHeSoLuong_Load(sender, e);
                    dgvHeSoLuong.Enabled = true;
                }
                else
                {
                    MessageBox.Show("Không thể Sửa");
                }
            }
        }
示例#8
0
文件: Form1.cs 项目: leson96/Demo
        private void btSuaHSL_Click(object sender, EventArgs e)
        {
            if (MaHSL.Text == "" || txtTenHSL.Text == "" || txtHSL.Text == "")
            {
                MessageBox.Show("Khong co du lieu");
                return;
            }
            HeSoLuong hsl = new HeSoLuong(MaHSL.Text, txtTenHSL.Text, txtHSL.Text);

            try
            {
                cnb.UpdateHeSoLuong(hsl);
            }
            catch (Exception p)
            {
                MessageBox.Show(p.ToString());
            }
        }
        private void btSuaHSL_Click(object sender, EventArgs e)
        {
            if (MaHSL.Text == "" || txtTenHSL.Text == "" || txtHSL.Text == "")
            {
                MessageBox.Show("Không có dữ liệu để sửa", "Thông báo");
                return;
            }
            HeSoLuong hsl = new HeSoLuong(MaHSL.Text, txtTenHSL.Text, int.Parse(txtHSL.Text));

            try
            {
                cnb.UpdateHeSoLuong(hsl);
                LoadHSL_();
            }
            catch (Exception p)
            {
                MessageBox.Show(p.ToString());
            }
        }
示例#10
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     if (txtBacLuong.Text == "")
     {
         MessageBox.Show("Bạn cần chọn Bậc Lương để xóa !", "Thông Báo");
     }
     else
     if (MessageBox.Show("Bạn có chắc chắn muốn xóa Lương " + txtBacLuong.Text + "?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         HeSoLuong qh = new HeSoLuong();
         qh.BacLuong = txtBacLuong.Text;
         if (HeSoLuongCtrl.DeleteProfile(qh) > 0)
         {
             MessageBox.Show("Xóa thành công");
             UCHeSoLuong_Load(sender, e);
         }
         else
         {
             MessageBox.Show("Không thể Xóa");
         }
     }
 }
 public static int DeleteProfile(HeSoLuong qh)
 {
     return(HeSoLuongMod.DeleteProfile(qh));
 }
 public static int UpdateProfile(HeSoLuong qh)
 {
     return(HeSoLuongMod.UpdateProfile(qh));
 }
 public static int InsertProfile(HeSoLuong qh)
 {
     return(HeSoLuongMod.InsertProfile(qh));
 }