Ejemplo n.º 1
0
 public ActionResult ThemPhieudieutri(NoitruPhieudieutri objTreatment)
 {
     try
     {
         using (var scope = new TransactionScope())
         {
             using (var dbscope = new SharedDbConnectionScope())
             {
                 //if(Convert.ToDateTime(objTreatment.NgayLapPhieu))
                 SqlQuery sqlQuery = new Select().From(NoitruPhieudieutri.Schema)
                                     .Where(NoitruPhieudieutri.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri);
                 if (sqlQuery.GetRecordCount() <= 0)
                 {
                     objTreatment.NgaySua  = null;
                     objTreatment.NguoiSua = string.Empty;
                     objTreatment.IsNew    = true;
                     objTreatment.Save();
                 }
                 else
                 {
                     objTreatment.TenMaysua = globalVariables.gv_strComputerName;
                     objTreatment.IpMaysua  = globalVariables.gv_strIPAddress;
                     objTreatment.NgaySua   = DateTime.Now;
                     objTreatment.NguoiSua  = globalVariables.UserName;
                     objTreatment.MarkOld();
                     objTreatment.IsNew    = false;
                     objTreatment.IsLoaded = true;
                     objTreatment.Save();
                     new Update(KcbChidinhcl.Schema)
                     .Set(KcbChidinhcl.Columns.NgayChidinh).EqualTo(objTreatment.NgayDieutri)
                     .Where(KcbChidinhcl.Columns.IdDieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute();
                     new Update(KcbDonthuoc.Schema)
                     .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objTreatment.NgayDieutri)
                     .Where(KcbDonthuoc.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute();
                 }
                 new Update(KcbLuotkham.Schema)
                 .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(2)
                 .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objTreatment.IdBenhnhan)
                 .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objTreatment.MaLuotkham).Execute();
             }
             scope.Complete();
             return(ActionResult.Success);
         }
     }
     catch (Exception exception)
     {
         log.Error("loi trong qua trinh tao phieu dieu tri: {0}", exception.ToString());
         return(ActionResult.Error);
     }
 }
Ejemplo n.º 2
0
 public ActionResult ThemPhieudieutri(NoitruPhieudieutri objTreatment)
 {
     try
     {
         using (var scope = new TransactionScope())
         {
             using (var dbscope = new SharedDbConnectionScope())
             {
                 if (objTreatment.IdPhieudieutri <= 0)
                 {
                     objTreatment.NgaySua  = null;
                     objTreatment.NguoiSua = string.Empty;
                     objTreatment.IsNew    = true;
                     objTreatment.Save();
                 }
                 else
                 {
                     objTreatment.MarkOld();
                     objTreatment.IsNew    = false;
                     objTreatment.IsLoaded = true;
                     objTreatment.Save();
                     new Update(KcbChidinhcl.Schema)
                     .Set(KcbChidinhcl.Columns.NgayChidinh).EqualTo(objTreatment.NgayDieutri)
                     .Where(KcbChidinhcl.Columns.IdDieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute();
                     new Update(KcbDonthuoc.Schema)
                     .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objTreatment.NgayDieutri)
                     .Where(KcbDonthuoc.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute();
                 }
                 new Update(KcbLuotkham.Schema)
                 .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(2)
                 .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objTreatment.IdBenhnhan)
                 .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objTreatment.MaLuotkham).Execute();
             }
             scope.Complete();
             return(ActionResult.Success);
         }
     }
     catch (Exception exception)
     {
         log.Error("loi trong qua trinh tao phieu dieu tri: {0}", exception.ToString());
         return(ActionResult.Error);
     }
 }
        public void Update(int IdPhieudieutri,string MaLuotkham,int? IdBenhnhan,short? IdBacsi,int? IdBuongGiuong,long? IdBuong,long? IdGiuong,short? IdKhoanoitru,string Thu,string ThongtinTheodoi,string ThongtinDieutri,DateTime? NgayDieutri,string GioDieutri,byte? TthaiBosung,byte? TthaiIn,byte? TrangThai,int? IdGoi,byte? TrongGoi,DateTime? NgayTao,string NguoiTao,DateTime? NgaySua,string NguoiSua,string IpMaytao,string IpMaysua,string TenMaytao,string TenMaysua)
        {
            NoitruPhieudieutri item = new NoitruPhieudieutri();
            item.MarkOld();
            item.IsLoaded = true;

            item.IdPhieudieutri = IdPhieudieutri;

            item.MaLuotkham = MaLuotkham;

            item.IdBenhnhan = IdBenhnhan;

            item.IdBacsi = IdBacsi;

            item.IdBuongGiuong = IdBuongGiuong;

            item.IdBuong = IdBuong;

            item.IdGiuong = IdGiuong;

            item.IdKhoanoitru = IdKhoanoitru;

            item.Thu = Thu;

            item.ThongtinTheodoi = ThongtinTheodoi;

            item.ThongtinDieutri = ThongtinDieutri;

            item.NgayDieutri = NgayDieutri;

            item.GioDieutri = GioDieutri;

            item.TthaiBosung = TthaiBosung;

            item.TthaiIn = TthaiIn;

            item.TrangThai = TrangThai;

            item.IdGoi = IdGoi;

            item.TrongGoi = TrongGoi;

            item.NgayTao = NgayTao;

            item.NguoiTao = NguoiTao;

            item.NgaySua = NgaySua;

            item.NguoiSua = NguoiSua;

            item.IpMaytao = IpMaytao;

            item.IpMaysua = IpMaysua;

            item.TenMaytao = TenMaytao;

            item.TenMaysua = TenMaysua;

            item.Save(UserName);
        }
Ejemplo n.º 4
0
        private void ThemPhieuDieuTri()
        {
            if (objPhieudieutri == null)
            {
                objPhieudieutri = new NoitruPhieudieutri();
            }
            if (em_Action == action.Update)
            {
                objPhieudieutri.MarkOld();
                objPhieudieutri.IsLoaded       = true;
                objPhieudieutri.IsNew          = false;
                objPhieudieutri.IdPhieudieutri = Utility.Int32Dbnull(txtTreat_ID.Text, -1);
                objPhieudieutri.NguoiSua       = globalVariables.UserName;
                objPhieudieutri.NgaySua        = globalVariables.SysDate;
                objPhieudieutri.TenMaysua      = globalVariables.gv_strComputerName;
                objPhieudieutri.IpMaysua       = globalVariables.gv_strIPAddress;
            }
            else
            {
                objPhieudieutri.TrangThai = 0;
                objPhieudieutri.IsNew     = true;
                objPhieudieutri.TenMaytao = globalVariables.gv_strComputerName;
                objPhieudieutri.IpMaytao  = globalVariables.gv_strIPAddress;
                objPhieudieutri.NguoiTao  = globalVariables.UserName;
                objPhieudieutri.NgayTao   = globalVariables.SysDate;
                objPhieudieutri.TthaiIn   = 0;
            }
            objPhieudieutri.TthaiBosung     = Utility.Bool2byte(chkPhieuBoSung.Checked);
            objPhieudieutri.IdPhieudieutri  = Utility.Int32Dbnull(txtTreat_ID.Text, -1);
            objPhieudieutri.ThongtinDieutri = Utility.DoTrim(txtBstheodoi.Text);
            objPhieudieutri.ThongtinTheodoi = Utility.DoTrim(txtDieuduongtheodoi.Text);
            objPhieudieutri.NgayDieutri     = dtNgayLapPhieu.Value.Date;
            objPhieudieutri.GioDieutri      = dtGioLapPhieu.Text;
            objPhieudieutri.Thu             = Utility.ConvertDayVietnamese(dtNgayLapPhieu.Value.DayOfWeek.ToString());
            objPhieudieutri.MaLuotkham      = Utility.sDbnull(objLuotkham.MaLuotkham, "");
            objPhieudieutri.IdKhoanoitru    = objBuongGiuong.IdKhoanoitru;
            objPhieudieutri.IdBuongGiuong   = objBuongGiuong != null?Utility.Int32Dbnull(objBuongGiuong.Id) : -1;

            objPhieudieutri.IdBuong = objBuongGiuong != null?Utility.Int32Dbnull(objBuongGiuong.IdBuong) : -1;

            objPhieudieutri.IdGiuong = objBuongGiuong != null?Utility.Int32Dbnull(objBuongGiuong.IdGiuong) : -1;

            objPhieudieutri.IdBenhnhan = Utility.Int32Dbnull(objLuotkham.IdBenhnhan, -1);
            objPhieudieutri.IdBuong    = objLuotkham.IdBuong;
            objPhieudieutri.IdGiuong   = objLuotkham.IdGiuong;
            if (cboBacSy.SelectedIndex > 0)
            {
                objPhieudieutri.IdBacsi = Utility.Int16Dbnull(cboBacSy.SelectedValue);
            }
            else
            {
                objPhieudieutri.IdBacsi = globalVariables.gv_intIDNhanvien;
            }
            ActionResult actionResult = new noitru_phieudieutri().ThemPhieudieutri(objPhieudieutri);

            switch (actionResult)
            {
            case ActionResult.Success:
                txtTreat_ID.Text = Utility.sDbnull(objPhieudieutri.IdPhieudieutri, -1);
                DataRow drv = p_TreatMent.NewRow();
                Utility.FromObjectToDatarow(objPhieudieutri, ref drv);
                drv["sngay_dieutri"] = dtNgayLapPhieu.Value.ToString("dd/MM/yyyy");
                if (cboBacSy.SelectedIndex > 0)
                {
                    drv["ten_bacsidieutri"] = cboBacSy.Text;
                }

                p_TreatMent.Rows.Add(drv);
                Utility.GotoNewRowJanus(grdList, NoitruPhieudieutri.Columns.IdPhieudieutri, objPhieudieutri.IdPhieudieutri.ToString());
                b_Cancel = true;
                Close();
                break;

            case ActionResult.Error:
                Utility.ShowMsg("Lỗi trong quá trình thêm phiếu điều trị", "Thông báo lỗi", MessageBoxIcon.Error);
                break;
            }
        }
Ejemplo n.º 5
0
        public ActionResult ThemPhieudieutri(NoitruPhieudieutri objTreatment)
        {
            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var dbscope = new SharedDbConnectionScope())
                    {

                        if (objTreatment.IdPhieudieutri<=0)
                        {
                            objTreatment.NgaySua = null;
                            objTreatment.NguoiSua = string.Empty;
                            objTreatment.IsNew = true;
                            objTreatment.Save();
                        }
                        else
                        {

                            objTreatment.MarkOld();
                            objTreatment.IsNew = false;
                            objTreatment.IsLoaded = true;
                            objTreatment.Save();
                            new Update(KcbChidinhcl.Schema)
                                .Set(KcbChidinhcl.Columns.NgayChidinh).EqualTo(objTreatment.NgayDieutri)
                                .Where(KcbChidinhcl.Columns.IdDieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute();
                            new Update(KcbDonthuoc.Schema)
                                .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objTreatment.NgayDieutri)
                                .Where(KcbDonthuoc.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute();
                        }
                        new Update(KcbLuotkham.Schema)
                               .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(2)
                               .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objTreatment.IdBenhnhan)
                               .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objTreatment.MaLuotkham).Execute();

                    }
                    scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception exception)
            {
                log.Error("loi trong qua trinh tao phieu dieu tri: {0}", exception.ToString());
                return ActionResult.Error;
            }
        }
Ejemplo n.º 6
0
        public ActionResult ThemPhieudieutri(NoitruPhieudieutri objTreatment)
        {
            try
            {
                using (var scope = new TransactionScope())
                {
                    using (var dbscope = new SharedDbConnectionScope())
                    {

                        //if(Convert.ToDateTime(objTreatment.NgayLapPhieu))
                        SqlQuery sqlQuery = new Select().From(NoitruPhieudieutri.Schema)
                            .Where(NoitruPhieudieutri.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri);
                        if (sqlQuery.GetRecordCount() <= 0)
                        {
                            objTreatment.NgaySua = null;
                            objTreatment.NguoiSua = string.Empty;
                            objTreatment.IsNew = true;
                            objTreatment.Save();
                        }
                        else
                        {
                            objTreatment.TenMaysua = globalVariables.gv_strComputerName;
                            objTreatment.IpMaysua = globalVariables.gv_strIPAddress;
                            objTreatment.NgaySua = DateTime.Now;
                            objTreatment.NguoiSua = globalVariables.UserName;
                            objTreatment.MarkOld();
                            objTreatment.IsNew = false;
                            objTreatment.IsLoaded = true;
                            objTreatment.Save();
                            new Update(KcbChidinhcl.Schema)
                                .Set(KcbChidinhcl.Columns.NgayChidinh).EqualTo(objTreatment.NgayDieutri)
                                .Where(KcbChidinhcl.Columns.IdDieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute();
                            new Update(KcbDonthuoc.Schema)
                                .Set(KcbDonthuoc.Columns.NgayKedon).EqualTo(objTreatment.NgayDieutri)
                                .Where(KcbDonthuoc.Columns.IdPhieudieutri).IsEqualTo(objTreatment.IdPhieudieutri).Execute();
                        }
                        new Update(KcbLuotkham.Schema)
                               .Set(KcbLuotkham.Columns.TrangthaiNoitru).EqualTo(2)
                               .Where(KcbLuotkham.Columns.IdBenhnhan).IsEqualTo(objTreatment.IdBenhnhan)
                               .And(KcbLuotkham.Columns.MaLuotkham).IsEqualTo(objTreatment.MaLuotkham).Execute();

                    }
                    scope.Complete();
                    return ActionResult.Success;
                }
            }
            catch (Exception exception)
            {
                log.Error("loi trong qua trinh tao phieu dieu tri: {0}", exception.ToString());
                return ActionResult.Error;
            }
        }