Пример #1
0
 /// <summary>
 /// hàm thưucj hiện việc cập nhập lại thông tin thành công
 /// </summary>
 private void UpdateData()
 {
     objBed = createBed();
     objBed.MarkOld();
     objBed.IsNew = false;
     objBed.Save();
     if (MyGetData != null)
     {
         MyGetData();
         Utility.GonewRowJanus(grdList, NoitruDmucGiuongbenh.Columns.IdGiuong, Utility.sDbnull(txtID.Text));
     }
     if (chkApDungGia.Checked)
     {
         new Delete().From(NoitruQheDoituongBuonggiuong.Schema)
         .Where(NoitruQheDoituongBuonggiuong.Columns.IdGiuong).IsEqualTo(Utility.Int32Dbnull(txtID.Text)).Execute();
         foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdQuanheGiuong.GetCheckedRows())
         {
             NoitruQheDoituongBuonggiuong objectType = new NoitruQheDoituongBuonggiuong();
             objectType.DonGia = (objectType.MaDoituongKcb == "DV" ?
                                  Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaDichvu)
                              : (objectType.MaDoituongKcb == "BHYT" ?
                                 Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaBhyt) :
                                 Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaKhac))
                                  )
             ;
             objectType.PhuthuDungtuyen = Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.PhuthuDungtuyen].Value, 0);
             objectType.PhuthuTraituyen = Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.PhuthuTraituyen].Value, 0);
             objectType.MaDoituongKcb   = Utility.sDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.MaDoituongKcb].Value);
             SqlQuery sqlQuery =
                 new Select().From(DmucDoituongkcb.Schema).Where(DmucDoituongkcb.Columns.MaDoituongKcb).IsEqualTo(
                     objectType.MaDoituongKcb);
             DmucDoituongkcb objectType1 = sqlQuery.ExecuteSingle <DmucDoituongkcb>();
             if (objectType1 != null)
             {
                 objectType.IdLoaidoituongKcb = Utility.Int32Dbnull(objectType1.IdLoaidoituongKcb);
             }
             objectType.KieuThue = "GIUONG";
             // DmucDoituongkcb objectType1=DmucDoituongkcb.FetchByID()
             objectType.IdBuong  = Utility.Int16Dbnull(txtBuong.MyID);
             objectType.IdGiuong = Utility.Int16Dbnull(objBed.IdGiuong, -1);
             objectType.IsNew    = true;
             objectType.Save();
         }
     }
     Utility.SetMsg(lblMsg, "Bạn thực hiện sửa thông tin  thành công", true);
     if (chkthemmoilientuc.Checked)
     {
         ClearControl();
     }
     else
     {
         this.Close();
     }
 }
        public void Insert(int IdBuong,int IdGiuong,decimal DonGia,decimal PhuthuDungtuyen,decimal? PhuthuTraituyen,string MotaThem,string MaDoituongKcb,int? IdLoaidoituongKcb,int? TuTuc,string KieuThue)
        {
            NoitruQheDoituongBuonggiuong item = new NoitruQheDoituongBuonggiuong();

            item.IdBuong = IdBuong;

            item.IdGiuong = IdGiuong;

            item.DonGia = DonGia;

            item.PhuthuDungtuyen = PhuthuDungtuyen;

            item.PhuthuTraituyen = PhuthuTraituyen;

            item.MotaThem = MotaThem;

            item.MaDoituongKcb = MaDoituongKcb;

            item.IdLoaidoituongKcb = IdLoaidoituongKcb;

            item.TuTuc = TuTuc;

            item.KieuThue = KieuThue;

            item.Save(UserName);
        }
Пример #3
0
        /// <summary>
        /// hàm thưucj hiện việc cập nhập lại thông tin thành công
        /// </summary>
        private void UpdateData()
        {
            objBed=  createBed();
              objBed.MarkOld();
              objBed.IsNew = false;
              objBed.Save();
            if (MyGetData != null)
            {
                MyGetData();
                Utility.GonewRowJanus(grdList, NoitruDmucGiuongbenh.Columns.IdGiuong, Utility.sDbnull(txtID.Text));
            }
            if (chkApDungGia.Checked)
            {
                new Delete().From(NoitruQheDoituongBuonggiuong.Schema)
             .Where(NoitruQheDoituongBuonggiuong.Columns.IdGiuong).IsEqualTo(Utility.Int32Dbnull(txtID.Text)).Execute();
                foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdQuanheGiuong.GetCheckedRows())
                {
                    NoitruQheDoituongBuonggiuong objectType = new NoitruQheDoituongBuonggiuong();
                    objectType.DonGia = (objectType.MaDoituongKcb == "DV" ?
                                     Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaDichvu)
                                     : (objectType.MaDoituongKcb == "BHYT" ?
                                     Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaBhyt) :
                                     Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaKhac))
                                     )
                                     ;
                    objectType.PhuthuDungtuyen = Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.PhuthuDungtuyen].Value,0);
                    objectType.PhuthuTraituyen = Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.PhuthuTraituyen].Value,0);
                    objectType.MaDoituongKcb = Utility.sDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.MaDoituongKcb].Value);
                    SqlQuery sqlQuery =
                        new Select().From(DmucDoituongkcb.Schema).Where(DmucDoituongkcb.Columns.MaDoituongKcb).IsEqualTo(
                            objectType.MaDoituongKcb);
                    DmucDoituongkcb objectType1 = sqlQuery.ExecuteSingle<DmucDoituongkcb>();
                    if (objectType1 != null)
                    {
                        objectType.IdLoaidoituongKcb = Utility.Int32Dbnull(objectType1.IdLoaidoituongKcb);
                    }
                    objectType.KieuThue = "GIUONG";
                    // DmucDoituongkcb objectType1=DmucDoituongkcb.FetchByID()
                    objectType.IdBuong = Utility.Int16Dbnull(txtBuong.MyID);
                    objectType.IdGiuong = Utility.Int16Dbnull(objBed.IdGiuong, -1);
                    objectType.IsNew = true;
                    objectType.Save();
                }

            }
            Utility.SetMsg(lblMsg, "Bạn thực hiện sửa thông tin  thành công", true);
            if (chkthemmoilientuc.Checked)
            {
                ClearControl();
            }
            else
                this.Close();
        }
Пример #4
0
        private void MultiInsertData()
        {
            try
            {
                 Int16 STTHthi=Utility.Int16Dbnull(txt_STT_HTHI.Text);
                 for (int i = Utility.Int32Dbnull(Utility.DecimaltoDbnull(txtCodefrom.Text), 0); i <= Utility.Int32Dbnull(Utility.DecimaltoDbnull(txtCode2.Text), 0); i++)
                 {
                     NoitruDmucGiuongbenh objBed = new NoitruDmucGiuongbenh();
                     objBed.IdKhoanoitru = Utility.Int16Dbnull(cboKhoaNoiTru.SelectedValue);
                     objBed.IdBuong = Utility.Int16Dbnull(txtBuong.MyID);
                     objBed.MotaThem = Utility.sDbnull(txt_Mo_Ta.Text);
                     objBed.SonguoiToida = Utility.Int16Dbnull(txtSuChua.Value);
                     objBed.SttHthi = Utility.Int16Dbnull(txt_STT_HTHI.Value);
                     objBed.MaGiuong = Utility.sDbnull(txtMa.Text)+i.ToString();
                     objBed.TenGiuong = Utility.sDbnull(txtTEN.Text)+ " "+i.ToString();
                     objBed.TenBhyt = Utility.sDbnull(txtTEN.Text) + " " + i.ToString();
                     objBed.MaDonvitinh = txtDonvitinh.myCode;
                     objBed.TthaiTunguyen = Utility.Bool2byte(chktutuc.Checked);
                     objBed.GiaDichvu = Utility.DecimaltoDbnull(txtDongia.Text, 0);
                     objBed.GiaBhyt = Utility.DecimaltoDbnull(txtGiaBHYT.Text, 0);
                     objBed.GiaKhac = Utility.DecimaltoDbnull(txtGiakhac.Text, 0);
                     objBed.PhuthuDungtuyen = Utility.DecimaltoDbnull(txtPTDT.Text, 0);
                     objBed.PhuthuTraituyen = Utility.DecimaltoDbnull(txtPTTT.Text, 0);
                     objBed.TrangThai = (byte?)(chkTrangThai.Checked ? 1 : 0);
                     NoitruDmucGiuongbenh objcheck = new Select().From(NoitruDmucGiuongbenh.Schema)
                         .Where(NoitruDmucGiuongbenh.Columns.MaGiuong).IsEqualTo(objBed.MaGiuong)
                         .And(NoitruDmucGiuongbenh.Columns.IdKhoanoitru).IsEqualTo(objBed.IdKhoanoitru)
                         .And(NoitruDmucGiuongbenh.Columns.IdBuong).IsEqualTo(objBed.IdBuong)
                         .ExecuteSingle<NoitruDmucGiuongbenh>();
                     if (objcheck != null)
                     {
                         if (chkAutoupdate.Checked)
                         {
                             objBed.IdGiuong = objcheck.IdGiuong;
                             objBed.MarkOld();
                             objBed.IsNew = false;
                         }
                         else
                         {
                             continue;
                         }
                     }
                     else
                     {
                         STTHthi += 1;
                         objBed.IsNew = true;
                     }
                     objBed.SttHthi = STTHthi;
                     objBed.Save();

                     if (objBed != null)
                     {

                         if (chkApDungGia.Checked)
                         {
                             new Delete().From(NoitruQheDoituongBuonggiuong.Schema)
                      .Where(NoitruQheDoituongBuonggiuong.Columns.IdGiuong).IsEqualTo(Utility.Int32Dbnull(txtID.Text)).Execute();
                             foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdQuanheGiuong.GetCheckedRows())
                             {
                                 NoitruQheDoituongBuonggiuong objectType = new NoitruQheDoituongBuonggiuong();
                                 objectType.DonGia =(objectType.MaDoituongKcb=="DV"?
                                     Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaDichvu)
                                     :(objectType.MaDoituongKcb=="BHYT"?
                                     Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaBhyt):
                                     Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaKhac))
                                     )
                                     ;
                                 objectType.PhuthuDungtuyen = Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.PhuthuDungtuyen].Value,0);
                                 objectType.PhuthuTraituyen = Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.PhuthuTraituyen].Value,0);
                                 objectType.MaDoituongKcb = Utility.sDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.MaDoituongKcb].Value);
                                 // DmucDoituongkcb objectType1=DmucDoituongkcb.FetchByID()
                                 SqlQuery sqlQuery =
                                    new Select().From(DmucDoituongkcb.Schema).Where(DmucDoituongkcb.Columns.MaDoituongKcb).IsEqualTo(
                                        objectType.MaDoituongKcb);
                                 DmucDoituongkcb objectType1 = sqlQuery.ExecuteSingle<DmucDoituongkcb>();
                                 if (objectType1 != null)
                                 {
                                     objectType.IdLoaidoituongKcb = Utility.Int32Dbnull(objectType1.IdLoaidoituongKcb);
                                 }
                                 objectType.KieuThue = "GIUONG";
                                 objectType.IdBuong = Utility.Int16Dbnull(txtBuong.MyID);
                                 objectType.IdGiuong = Utility.Int16Dbnull(objBed.IdGiuong, -1);

                                 objectType.IsNew = true;
                                 objectType.Save();
                             }
                         }

                     }
                 }
                 if (MyGetData != null)
                 {
                     MyGetData();
                     Utility.GonewRowJanus(grdList, NoitruDmucGiuongbenh.Columns.IdGiuong, Utility.sDbnull(txtID.Text));
                 }
                Utility.SetMsg(lblMsg, "Bạn thực hiện thêm mới thành công", true);
                if (chkthemmoilientuc.Checked) ClearControl();
                else
                    Close();

            }
            catch (Exception)
            {

            }
        }
Пример #5
0
        private void MultiInsertData()
        {
            try
            {
                Int16 STTHthi = Utility.Int16Dbnull(txt_STT_HTHI.Text);
                for (int i = Utility.Int32Dbnull(Utility.DecimaltoDbnull(txtCodefrom.Text), 0); i <= Utility.Int32Dbnull(Utility.DecimaltoDbnull(txtCode2.Text), 0); i++)
                {
                    NoitruDmucGiuongbenh objBed = new NoitruDmucGiuongbenh();
                    objBed.IdKhoanoitru    = Utility.Int16Dbnull(cboKhoaNoiTru.SelectedValue);
                    objBed.IdBuong         = Utility.Int16Dbnull(txtBuong.MyID);
                    objBed.MotaThem        = Utility.sDbnull(txt_Mo_Ta.Text);
                    objBed.SonguoiToida    = Utility.Int16Dbnull(txtSuChua.Value);
                    objBed.SttHthi         = Utility.Int16Dbnull(txt_STT_HTHI.Value);
                    objBed.MaGiuong        = Utility.sDbnull(txtMa.Text) + i.ToString();
                    objBed.MaBhyt          = Utility.sDbnull(txtMaBHYT.Text) + i.ToString();
                    objBed.TenGiuong       = Utility.sDbnull(txtTEN.Text) + " " + i.ToString();
                    objBed.TenBhyt         = Utility.sDbnull(txtTEN.Text) + " " + i.ToString();
                    objBed.MaDonvitinh     = txtDonvitinh.myCode;
                    objBed.TthaiTunguyen   = Utility.Bool2byte(chktutuc.Checked);
                    objBed.GiaDichvu       = Utility.DecimaltoDbnull(txtDongia.Text, 0);
                    objBed.GiaBhyt         = Utility.DecimaltoDbnull(txtGiaBHYT.Text, 0);
                    objBed.GiaKhac         = Utility.DecimaltoDbnull(txtGiakhac.Text, 0);
                    objBed.PhuthuDungtuyen = Utility.DecimaltoDbnull(txtPTDT.Text, 0);
                    objBed.PhuthuTraituyen = Utility.DecimaltoDbnull(txtPTTT.Text, 0);
                    objBed.TrangThai       = (byte?)(chkTrangThai.Checked ? 1 : 0);
                    NoitruDmucGiuongbenh objcheck = new Select().From(NoitruDmucGiuongbenh.Schema)
                                                    .Where(NoitruDmucGiuongbenh.Columns.MaGiuong).IsEqualTo(objBed.MaGiuong)
                                                    .And(NoitruDmucGiuongbenh.Columns.IdKhoanoitru).IsEqualTo(objBed.IdKhoanoitru)
                                                    .And(NoitruDmucGiuongbenh.Columns.IdBuong).IsEqualTo(objBed.IdBuong)
                                                    .ExecuteSingle <NoitruDmucGiuongbenh>();
                    if (objcheck != null)
                    {
                        if (chkAutoupdate.Checked)
                        {
                            objBed.IdGiuong = objcheck.IdGiuong;
                            objBed.MarkOld();
                            objBed.IsNew = false;
                        }
                        else
                        {
                            continue;
                        }
                    }
                    else
                    {
                        STTHthi     += 1;
                        objBed.IsNew = true;
                    }
                    objBed.SttHthi = STTHthi;
                    objBed.Save();

                    if (objBed != null)
                    {
                        if (chkApDungGia.Checked)
                        {
                            new Delete().From(NoitruQheDoituongBuonggiuong.Schema)
                            .Where(NoitruQheDoituongBuonggiuong.Columns.IdGiuong).IsEqualTo(Utility.Int32Dbnull(txtID.Text)).Execute();
                            foreach (Janus.Windows.GridEX.GridEXRow gridExRow in grdQuanheGiuong.GetCheckedRows())
                            {
                                NoitruQheDoituongBuonggiuong objectType = new NoitruQheDoituongBuonggiuong();
                                objectType.DonGia = (objectType.MaDoituongKcb == "DV"?
                                                     Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaDichvu)
                                     :(objectType.MaDoituongKcb == "BHYT"?
                                       Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaBhyt):
                                       Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.DonGia].Value, objBed.GiaKhac))
                                                     )
                                ;
                                objectType.PhuthuDungtuyen = Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.PhuthuDungtuyen].Value, 0);
                                objectType.PhuthuTraituyen = Utility.DecimaltoDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.PhuthuTraituyen].Value, 0);
                                objectType.MaDoituongKcb   = Utility.sDbnull(gridExRow.Cells[NoitruQheDoituongBuonggiuong.Columns.MaDoituongKcb].Value);
                                // DmucDoituongkcb objectType1=DmucDoituongkcb.FetchByID()
                                SqlQuery sqlQuery =
                                    new Select().From(DmucDoituongkcb.Schema).Where(DmucDoituongkcb.Columns.MaDoituongKcb).IsEqualTo(
                                        objectType.MaDoituongKcb);
                                DmucDoituongkcb objectType1 = sqlQuery.ExecuteSingle <DmucDoituongkcb>();
                                if (objectType1 != null)
                                {
                                    objectType.IdLoaidoituongKcb = Utility.Int32Dbnull(objectType1.IdLoaidoituongKcb);
                                }
                                objectType.KieuThue = "GIUONG";
                                objectType.IdBuong  = Utility.Int16Dbnull(txtBuong.MyID);
                                objectType.IdGiuong = Utility.Int16Dbnull(objBed.IdGiuong, -1);

                                objectType.IsNew = true;
                                objectType.Save();
                            }
                        }
                    }
                }
                if (MyGetData != null)
                {
                    MyGetData();
                    Utility.GonewRowJanus(grdList, NoitruDmucGiuongbenh.Columns.IdGiuong, Utility.sDbnull(txtID.Text));
                }
                Utility.SetMsg(lblMsg, "Bạn thực hiện thêm mới thành công", true);
                if (chkthemmoilientuc.Checked)
                {
                    ClearControl();
                }
                else
                {
                    Close();
                }
            }
            catch (Exception)
            {
            }
        }