예제 #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            PhieuKhamObj pkObj = new PhieuKhamObj();

            addData(pkObj);
            if (flagLuu == 0)
            {
                if (PKCtr.AddData(pkObj))
                {
                    MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Thêm không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                if (PKCtr.UpdData(pkObj))
                {
                    MessageBox.Show("Sửa thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("Sửa không thành công!", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            phieukham_Load(sender, e);
        }
예제 #2
0
 private void addData(PhieuKhamObj pkObj)
 {
     pkObj.MaPK       = txtmapk.Text.Trim();
     pkObj.TrieuChung = txttrieuchung.Text.Trim();
     pkObj.ChuanDoan  = txtchuandoan.Text.Trim();
     pkObj.MaBN       = cmbMaBN.SelectedValue.ToString();
     pkObj.NgayKham   = dtngaykham.Text;
     pkObj.STT        = int.Parse(txtstt.Text.Trim());
 }
예제 #3
0
 public bool UpdData(PhieuKhamObj pkObj)
 {
     cmd.CommandText = "Update PhieuKham set NgayKham = CONVERT(DATE,'" + pkObj.NgayKham + "',103), STT = " + pkObj.STT + ", TrieuChung = N'" + pkObj.TrieuChung + "',ChuanDoan = N'" + pkObj.ChuanDoan + "' Where MaPK = '" + pkObj.MaPK + "'";
     cmd.CommandType = CommandType.Text;
     cmd.Connection  = con.Connection;
     try
     {
         con.OpenConn();
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch (Exception ex)
     {
         string mex = ex.Message;
         cmd.Dispose();
         con.CloseConn();
     }
     return(false);
 }
예제 #4
0
 public bool AddData(PhieuKhamObj pkObj)
 {
     cmd.CommandText = "Insert into PhieuKham values ('" + pkObj.MaPK + "','" + pkObj.MaBN + "',CONVERT(DATE,'" + pkObj.NgayKham + "',103),'" + pkObj.STT + "',N'" + pkObj.TrieuChung + "',N'" + pkObj.ChuanDoan + "')";
     cmd.CommandType = CommandType.Text;
     cmd.Connection  = con.Connection;
     try
     {
         con.OpenConn();
         cmd.ExecuteNonQuery();
         return(true);
     }
     catch (Exception ex)
     {
         string mex = ex.Message;
         cmd.Dispose();
         con.CloseConn();
     }
     return(false);
 }
예제 #5
0
 public bool UpdData(PhieuKhamObj pkObj)
 {
     return(pkMod.UpdData(pkObj));
 }
예제 #6
0
 public bool AddData(PhieuKhamObj pkObj)
 {
     return(pkMod.AddData(pkObj));
 }