示例#1
0
 public override void SaveModel()
 {
     if (this.Validation())
     {
         DIC_DTBN      doituongbenhnhan = (DIC_DTBN)this.GetModel();
         SqlResultType flag;
         if (this.actions == Common.Common.Class.Actions.AddNew)
         {
             flag = new PatientObjectProvider().Insert(doituongbenhnhan);
         }
         else
         {
             flag = new PatientObjectProvider().Update(doituongbenhnhan);
         }
         SaveCompleteEventArgs args = new SaveCompleteEventArgs();
         args.Result  = flag == SqlResultType.OK;
         args.Model   = doituongbenhnhan;
         args.Message = "Không lưu được thông tin đối tượng bệnh nhân";
         this.SaveCompleteSuccess(doituongbenhnhan, args);
     }
     else
     {
         XtraMessageBox.Show("Thông tin chưa hợp lệ kiểm tra lại thông tin.");
     }
 }
示例#2
0
        public override object GetModel()
        {
            DIC_DTBN doituongbenhnhan = new DIC_DTBN();

            doituongbenhnhan.IDDTBN            = Convert.ToByte(txtID.EditValue);
            doituongbenhnhan.TenDTBN           = txtName.Text;
            doituongbenhnhan.MoTa              = txtDescription.Text;
            doituongbenhnhan.HinhThucThanhToan = (byte)cmbFormPayment.SelectedIndex;
            doituongbenhnhan.Status            = ckbStatus.Checked ? 1 : 0;
            return(doituongbenhnhan);
        }
示例#3
0
        private void BindingModel()
        {
            this.dxErrorProviderModel.ClearErrors();
            this.isUpdated = false;
            this.isEdited  = false;
            DIC_DTBN doituongbenhnhan = (DIC_DTBN)this.Model;

            txtID.Text                   = doituongbenhnhan.IDDTBN.ToString();
            txtName.Text                 = doituongbenhnhan.TenDTBN;
            txtDescription.Text          = doituongbenhnhan.MoTa;
            cmbFormPayment.SelectedIndex = doituongbenhnhan.HinhThucThanhToan;
            ckbStatus.Checked            = doituongbenhnhan.Status == 1;
            txtID.ReadOnly               = true;
            this.isUpdated               = true;
        }
示例#4
0
 public SqlResultType Delete(DIC_DTBN doituongbenhnhan)
 {
     try
     {
         this.sqlHelper.CommandType = CommandType.StoredProcedure;
         object result = this.sqlHelper.ExecuteScalar("DeleteDoiTuongBenhNhan", new string[] { "@IDDTBN" }, new object[] { doituongbenhnhan.IDDTBN });
         int    kq     = Convert.ToInt32(result);
         return(this.GetResult(kq));
     }
     catch (Exception e)
     {
         log.Error("Delete DOI TUONG BENH NHAN", e);
         return(SqlResultType.Exception);
     }
 }
示例#5
0
 public SqlResultType Update(DIC_DTBN doituongbenhnhan)
 {
     try
     {
         this.sqlHelper.CommandType = CommandType.StoredProcedure;
         object result = this.sqlHelper.ExecuteScalar("UpdateDoiTuongBenhNhan",
                                                      new string[] { "@IDDTBN", "@TenDTBN", "@MoTa", "@Status", "@HinhThucThanhToan" },
                                                      new object[] { doituongbenhnhan.IDDTBN, doituongbenhnhan.TenDTBN, doituongbenhnhan.MoTa, doituongbenhnhan.Status, doituongbenhnhan.HinhThucThanhToan });
         int kq = Convert.ToInt32(result);
         return(this.GetResult(kq));
     }
     catch (Exception e)
     {
         log.Error("Update DOI TUONG BENH NHAN", e);
         return(SqlResultType.Exception);
     }
 }
示例#6
0
 public override bool DeleteModel()
 {
     if (this.Model != null)
     {
         if (XtraMessageBox.Show("Bạn có muốn xóa bản ghi này không?", "Xóa bản ghi", MessageBoxButtons.OKCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.OK)
         {
             DIC_DTBN      doituongbenhnhan = (DIC_DTBN)this.Model;
             SqlResultType resultType       = new PatientObjectProvider().Delete(doituongbenhnhan);
             if (resultType == SqlResultType.OK)
             {
                 this.ClearModel();
                 this.DisabledLayout(true);
             }
             return(resultType == SqlResultType.OK);
         }
     }
     return(false);
 }
示例#7
0
 protected List <DIC_DTBN> DataReaderToList(SqlDataReader dataReader)
 {
     try
     {
         List <DIC_DTBN> dsdoituongbenhnhan = new List <DIC_DTBN>();
         while (dataReader.Read())
         {
             DIC_DTBN doituongbenhnhan = new DIC_DTBN();
             doituongbenhnhan.IDDTBN            = Convert.ToByte(dataReader["IDDTBN"].ToString());
             doituongbenhnhan.TenDTBN           = dataReader["TenDTBN"].ToString();
             doituongbenhnhan.MoTa              = dataReader["MoTa"].ToString();
             doituongbenhnhan.HinhThucThanhToan = Convert.ToByte(dataReader["HinhThucThanhToan"].ToString());
             doituongbenhnhan.Status            = DataConverter.StringToInt(dataReader["Status"].ToString());
             dsdoituongbenhnhan.Add(doituongbenhnhan);
         }
         dataReader.Close();
         return(dsdoituongbenhnhan);
     }
     catch (Exception e)
     {
         log.Error("Generate DOI TUONG BENH NHAN", e);
         return(null);
     }
 }