public bool CapNhatDichVu(DichVu dichVu) { XoaDichVu(dichVu.MaDV); ThemDichVu(dichVu); return(true); }
private bool kt_ChiTiet(List <Duoc> lstDuoc, List <DichVu> qdv, string malk, string pathFile) { _listErr1Don = new List <Err>(); Err er = new Err(); bool rs = true; if (lstDuoc.Count <= 0) { er = new Err(); er.Ma_lk = malk; er.Field_err = ""; er.Mss = "File không có thuốc hoặc vật tư y tế"; er.tenfile = pathFile; _listErr1Don.Add(er); return(false); } foreach (var a in lstDuoc) { DichVu dv = qdv.Where(p => p.MaQD == a.MA_QD).FirstOrDefault();//.Where(p => p.SoQD == a.SO_QD).Where(p => p.TenHC == a.TEN_QD).FirstOrDefault(); if (dv == null) { er = new Err(); er.Ma_lk = malk; er.Field_err = "MaQD"; er.Mss = "Không tìm được dịch vụ có mã tương đương"; er.tenfile = pathFile; er.MaDV = a.MA_QD; _listErr1Don.Add(er); rs = false; } else { if (string.IsNullOrEmpty(a.DON_GIA)) { er = new Err(); er.Ma_lk = malk; er.Field_err = "DON_GIA"; er.Mss = "Đơn giá không được để trống"; er.tenfile = pathFile; er.MaDV = a.MA_QD; _listErr1Don.Add(er); rs = false; } else if (string.IsNullOrEmpty(a.SO_LUONG)) { er = new Err(); er.Ma_lk = malk; er.Field_err = "SO_LUONG"; er.Mss = "Số lượng không được để trống"; er.tenfile = pathFile; er.MaDV = a.MA_QD; _listErr1Don.Add(er); rs = false; } else if (string.IsNullOrEmpty(a.THANH_TIEN)) { er = new Err(); er.Ma_lk = malk; er.Field_err = "THANH_TIEN"; er.Mss = "Đơn giá không được để trống"; er.tenfile = pathFile; er.MaDV = a.MA_QD; _listErr1Don.Add(er); rs = false; } else { double otd; if (!Double.TryParse(a.DON_GIA, out otd)) { er = new Err(); er.Ma_lk = malk; er.Field_err = "DON_GIA"; er.Mss = "Đơn giá phải là kiểu số"; er.tenfile = pathFile; er.MaDV = a.MA_QD; _listErr1Don.Add(er); rs = false; } else if (!Double.TryParse(a.SO_LUONG, out otd)) { er = new Err(); er.Ma_lk = malk; er.Field_err = "SO_LUONG"; er.Mss = "Số lượng phải là kiểu số"; er.tenfile = pathFile; er.MaDV = a.MA_QD; _listErr1Don.Add(er); rs = false; } else if (!Double.TryParse(a.THANH_TIEN, out otd)) { er = new Err(); er.Ma_lk = malk; er.Field_err = "THANH_TIEN"; er.Mss = "Đơn giá không phải là kiểu số"; er.tenfile = pathFile; er.MaDV = a.MA_QD; _listErr1Don.Add(er); rs = false; } else if (Convert.ToDouble(a.DON_GIA) * Convert.ToDouble(a.SO_LUONG) != Convert.ToDouble(a.THANH_TIEN)) { er = new Err(); er.Ma_lk = malk; er.Field_err = ""; er.Mss = "Thành tiền không bằng đơn giá * số lượng"; er.tenfile = pathFile; er.MaDV = a.MA_QD; _listErr1Don.Add(er); rs = false; } //else if (!String.IsNullOrEmpty(a.HAN_DUNG) && !ktDateTime(a.HAN_DUNG, "yyyyMMdd")) // hạn dùng có thể để rỗng //{ // er = new Err(); // er.Ma_lk = malk; // er.Field_err = "HAN_DUNG"; // er.Mss = "Hạn dùng không đúng định dạng"; // er.tenfile = pathFile; // er.MaDV = a.MA_QD; // _listErr1Don.Add(er); // rs = false; //} } } } return(rs); }
private void btnLuu_Click(object sender, EventArgs e) { if (Ktra()) { switch (TTLuu) { case 1: //try { DichVu _newDV = new DichVu(); _newDV.MaTam = txtMaTam.Text; _newDV.TenDV = txtTenDV.Text.Trim(); _newDV.PLoai = 1; _newDV.IdTieuNhom = Convert.ToInt32(lupNhom.EditValue); _newDV.IDNhom = Convert.ToInt32(lupPhanLoai.EditValue); if (!string.IsNullOrEmpty(txtDonGia.Text)) { _newDV.DonGia = double.Parse(txtDonGia.Text); } _newDV.DonVi = cboDonVi.Text.Trim(); _newDV.HamLuong = txtHamLuong.Text.Trim(); _newDV.DuongD = txtDuongDung.Text.Trim(); _newDV.NuocSX = txtNuocSX.Text.Trim(); _newDV.TenHC = txtTenHC.Text.Trim(); _newDV.MaQD = txtMaQD.Text.Trim(); _newDV.SoDK = txtSoDK.Text.Trim(); _newDV.DangBC = txtDangBC.Text.Trim(); _newDV.NhaSX = cbo_NhaSX.Text.Trim(); _newDV.QCPC = txtQCPC.Text.Trim(); if (!String.IsNullOrEmpty(txtDinhMuc.Text)) { _newDV.DinhMuc = Convert.ToInt32(txtDinhMuc.Text); } if (lupMaCC.EditValue != null) { _newDV.MaCC = lupMaCC.EditValue.ToString(); } _newDV.TrongDM = cboTrongDM.SelectedIndex; if (chkStatus.Checked == true) { _newDV.Status = 1; } else { _newDV.Status = 0; } if (chkDY.Checked == true) { _newDV.DongY = 1; } else { _newDV.DongY = 0; } _newDV.TinhTNhap = cboTTNhap.Text.Trim(); if (chkDY.Checked) { _newDV.NguonGoc = cboNguonGoc.Text.Trim(); } else { _newDV.NguonGoc = cboNguonGocnb.Text.Trim(); } if (!string.IsNullOrEmpty(txtTLHH.Text)) { _newDV.TyLeSP = double.Parse(txtTLHH.Text); } if (!string.IsNullOrEmpty(txtTLBQ.Text)) { _newDV.TyLeBQ = double.Parse(txtTLBQ.Text); } else { _newDV.TyLeBQ = 0; } _newDV.BPDung = cboBPDung.Text.Trim(); _newDV.YCSD = cboYCSD.Text; if (!string.IsNullOrEmpty(txtBHTT.Text)) { _newDV.BHTT = Convert.ToInt32(txtBHTT.Text); } else { _newDV.BHTT = 100; } _newDV.SoTTqd = txtSoTTqd.Text; if (!string.IsNullOrEmpty(txtDonGia2.Text)) { _newDV.DonGia2 = Convert.ToDouble(txtDonGia2.Text); if (lupPhanLoai.EditValue != null && Convert.ToInt32(lupPhanLoai.EditValue) == 7 && txtTenHC.Text == "VM." + Vssoft.Data.Common.MaBV) // nếu là chi phí vận chuyển máu (gán giá bh = giá dịch vụ luôn { _newDV.DonGiaBHYT = Convert.ToDouble(txtDonGia2.Text); } } else { _newDV.DonGia2 = 0; } int _soLuongMin = 0; try { if (!string.IsNullOrEmpty(txtMin.Text)) { _soLuongMin = Convert.ToInt32(txtMin.Text.Trim()); } } catch (Exception) { _soLuongMin = 0; } _newDV.SLMin = _soLuongMin; _newDV.DonViN = cboDonViN.Text.Trim(); string[] tyle = new string[2] { "1", "1" }; tyle = QLBV_Library.QLBV_Ham.LayChuoi('/', txtTyLe.Text); _newDV.TyLeSD = Convert.ToInt32(tyle[1]); string _makpsd = ";"; for (int i = 0; i < cklKP.ItemCount; i++) { if (cklKP.GetItemCheckState(i) == CheckState.Checked) { _makpsd += cklKP.GetItemValue(i) + ";"; } } _newDV.MaKPsd = _makpsd; if (!string.IsNullOrEmpty(dt_NgayCB.Text)) { _newDV.NgayQD = dt_NgayCB.DateTime; } _newDV.SoQD = txtSoQD.Text.Trim(); if (!string.IsNullOrEmpty(txtSoLuongThau.Text)) { _newDV.SLuong = Convert.ToInt32(txtSoLuongThau.Text); } else { _newDV.SLuong = 0; } _newDV.TieuChuan = txtTieuChuan.Text.Trim(); if (!string.IsNullOrEmpty(txtLoaiThuoc.Text)) { _newDV.LThuoc = Convert.ToInt32(txtLoaiThuoc.Text); } else { _newDV.LThuoc = 1; } _newDV.NhomThau = txtNhomThau.Text; _newDV.MaNhom = txtMaNhom.Text; // gói thầu if (!string.IsNullOrEmpty(txtLoaiThau.Text)) { _newDV.LThau = Convert.ToInt32(txtLoaiThau.Text); } else { _newDV.LThau = 1; } //txtLoaiThuoc.Properties.ReadOnly = t; //txtLoaiThau.Properties.ReadOnly = t; //txtNhomThau.Properties.ReadOnly = t; _newDV.TuoiTho = txtTuoiTho.Text; _newDV.MaDuongDung = lup_MaDuongD.Text; if (!string.IsNullOrEmpty(txtSoTT.Text)) { _newDV.SoTT = Convert.ToInt32(txtSoTT.Text); } else { _newDV.SoTT = 0; } _newDV.DSDonGia = ""; _newDV.TenRG = mm_TenRG.Text; if (!string.IsNullOrEmpty(txtGiaBHGioiHanTT.Text)) { _newDV.GiaBHGioiHanTT = Convert.ToDouble(txtGiaBHGioiHanTT.Text); } _data.DichVus.Add(_newDV); if (_data.SaveChanges() == 1) { MessageBox.Show("Thêm mới thành công"); timkiem(); TTLuu = 0; if (PermissionProvider.CheckQuyenFalse("us_dmDuoc")[0]) { EnableButton(true); } else { EnableButton(false); } } } //catch (Exception ex) //{ // MessageBox.Show("Lỗi không tạo mới được: " + ex.Message); //} break; case 2: //try { var _suaDV = _data.DichVus.Single(p => p.MaDV == _madv); _suaDV.MaTam = txtMaTam.Text; _suaDV.TenDV = txtTenDV.Text.Trim(); _suaDV.PLoai = 1; _suaDV.IdTieuNhom = Convert.ToInt32(lupNhom.EditValue); _suaDV.IDNhom = Convert.ToInt32(lupPhanLoai.EditValue); if (!string.IsNullOrEmpty(txtDonGia.Text)) { _suaDV.DonGia = double.Parse(txtDonGia.Text); } _suaDV.DonVi = cboDonVi.Text; _suaDV.HamLuong = txtHamLuong.Text.Trim(); _suaDV.DuongD = txtDuongDung.Text.Trim(); _suaDV.NuocSX = txtNuocSX.Text.Trim(); _suaDV.TenHC = txtTenHC.Text.Trim(); var suamaqd = _data.DichVus.Where(p => p.MaQD == txtMaQD.Text.Trim()).Where(p => p.TenDV == txtTenDV.Text).ToList(); if (suamaqd.Count > 0) { foreach (var a in suamaqd) { var suaqd = _data.DichVus.Single(p => p.MaDV == a.MaDV); suaqd.MaQD = txtMaQD.Text.Trim(); _data.SaveChanges(); } } if (!String.IsNullOrEmpty(txtDinhMuc.Text)) { _suaDV.DinhMuc = Convert.ToInt32(txtDinhMuc.Text); } _suaDV.MaQD = txtMaQD.Text.Trim(); _suaDV.SoDK = txtSoDK.Text.Trim(); _suaDV.DangBC = txtDangBC.Text.Trim(); _suaDV.NhaSX = cbo_NhaSX.Text.Trim(); _suaDV.MaCC = lupMaCC.EditValue.ToString(); _suaDV.QCPC = txtQCPC.Text.Trim(); _suaDV.TenRG = mm_TenRG.Text; _suaDV.TrongDM = cboTrongDM.SelectedIndex; if (chkStatus.Checked == true) { _suaDV.Status = 1; } else { _suaDV.Status = 0; } if (chkDY.Checked == true) { _suaDV.DongY = 1; } else { _suaDV.DongY = 0; } _suaDV.TinhTNhap = cboTTNhap.Text; if (chkDY.Checked) { _suaDV.NguonGoc = cboNguonGoc.Text.Trim(); } else { _suaDV.NguonGoc = cboNguonGocnb.Text.Trim(); } _suaDV.SoTTqd = txtSoTTqd.Text; if (!string.IsNullOrEmpty(txtTLHH.Text)) { _suaDV.TyLeSP = double.Parse(txtTLHH.Text); } if (!string.IsNullOrEmpty(txtTLBQ.Text)) { _suaDV.TyLeBQ = double.Parse(txtTLBQ.Text); } else { _suaDV.TyLeBQ = 0; } _suaDV.BPDung = cboBPDung.Text; _suaDV.YCSD = cboYCSD.Text; if (!string.IsNullOrEmpty(txtBHTT.Text)) { _suaDV.BHTT = Convert.ToInt32(txtBHTT.Text); } else { _suaDV.BHTT = 100; } if (!string.IsNullOrEmpty(txtDonGia2.Text)) { _suaDV.DonGia2 = Convert.ToDouble(txtDonGia2.Text); } else { _suaDV.DonGia2 = 0; } int _soLuongMin = 0; try { if (!string.IsNullOrEmpty(txtMin.Text)) { _soLuongMin = Convert.ToInt32(txtMin.Text.Trim()); } } catch (Exception) { _soLuongMin = 0; } _suaDV.SLMin = _soLuongMin; _suaDV.DonViN = cboDonViN.Text.Trim(); string[] tyle = new string[2] { "1", "1" }; tyle = QLBV_Library.QLBV_Ham.LayChuoi('/', txtTyLe.Text); _suaDV.TyLeSD = Convert.ToInt32(tyle[1]); string _makpsd = ";"; for (int i = 0; i < cklKP.ItemCount; i++) { if (cklKP.GetItemCheckState(i) == CheckState.Checked) { _makpsd += cklKP.GetItemValue(i) + ";"; } } _suaDV.MaKPsd = _makpsd; if (!string.IsNullOrEmpty(dt_NgayCB.Text)) { _suaDV.NgayQD = dt_NgayCB.DateTime; } else { _suaDV.NgayQD = null; } _suaDV.SoQD = txtSoQD.Text.Trim(); if (!string.IsNullOrEmpty(txtSoLuongThau.Text)) { _suaDV.SLuong = Convert.ToInt32(txtSoLuongThau.Text); } else { _suaDV.SLuong = 0; } _suaDV.TieuChuan = txtTieuChuan.Text.Trim(); if (!string.IsNullOrEmpty(txtLoaiThuoc.Text)) { _suaDV.LThuoc = Convert.ToInt32(txtLoaiThuoc.Text); } else { _suaDV.LThuoc = 1; } _suaDV.NhomThau = txtNhomThau.Text; _suaDV.MaNhom = txtMaNhom.Text; if (!string.IsNullOrEmpty(txtLoaiThau.Text)) { _suaDV.LThau = Convert.ToInt32(txtLoaiThau.Text); } else { _suaDV.LThau = 1; } _suaDV.TuoiTho = txtTuoiTho.Text; _suaDV.MaDuongDung = lup_MaDuongD.Text; if (!string.IsNullOrEmpty(txtSoTT.Text)) { _suaDV.SoTT = Convert.ToInt32(txtSoTT.Text); } if (!string.IsNullOrEmpty(txtGiaBHGioiHanTT.Text)) { _suaDV.GiaBHGioiHanTT = Convert.ToDouble(txtGiaBHGioiHanTT.Text); } if (_data.SaveChanges() == 1) //_data.SaveChanges(); { TTLuu = 0; MessageBox.Show("Sửa thành công"); timkiem(); if (PermissionProvider.CheckQuyenFalse("us_dmDuoc")[0]) { EnableButton(true); } else { EnableButton(true); } } } //catch (Exception ex) //{ // MessageBox.Show("Không sửa được! " + ex.Message); //} break; } } }
public ActionResult xuLythemDichVu(FormCollection fc, HttpPostedFileBase hinh, DichVu dichvu) { dichvu.TenDichVu = fc["tendichvu"]; dichvu.LoaiDichVu = int.Parse(fc["loaidichvu"]); dichvu.GiaTien = fc["giatien"]; dichvu.TrangThai = fc["trangthai"]; dichvu.GhiChu = fc["ghichu"]; dichvu.MoTa = fc["mota"]; dichvu.Anh = hinh.FileName; string dd = Server.MapPath("/Content/hinhanh/anhdichvu/" + hinh.FileName); hinh.SaveAs(dd); qltc.DichVus.InsertOnSubmit(dichvu); qltc.SubmitChanges(); return(RedirectToAction("Index")); }
public bool SuaDV(DichVu dv) { return(new DichVuDAL().SuaDV(dv)); }
public int Them(DichVu dv) { return(dichvu.Them(dv)); }
public void Xem(GridControl gcDichVu) { var list = DichVu.ToList(); gcDichVu.DataSource = list; }
// POST: api/DichVu //[Auth(PerMissionName = "Admin")] public void Post([FromBody] DichVu dv) { DichVuDAO dv0 = new DichVuDAO(); dv0.insertDichVu(dv); }
public int CapNhat(Object obj) { DichVu gv = (DichVu)obj; return(1); }
public int CapNhatDichVu(DichVu dv) { throw new NotImplementedException(); }
public int Xoa(Object obj) { DichVu gv = (DichVu)obj; return(1); }
private void timer1_Tick(object sender, EventArgs e) { switch (btnName) { case "NhanVien": if (poinChange >= mPanelContainer.Size.Width) { timer1.Stop(); templateNhanVien templateNhanVien = new templateNhanVien(); templateNhanVien.Dock = DockStyle.Fill; frmMain.frmMain_.MetroContainer.Controls.Add(templateNhanVien); frmMain.frmMain_.MetroContainer.Controls["templateNhanVien"].BringToFront(); foreach (ucManHinhChinh item in frmMain.frmMain_.MetroContainer.Controls.OfType <ucManHinhChinh>()) { frmMain.frmMain_.MetroContainer.Controls.Remove(item); } } else { poinChange += 80; mPanelContainer.Location = new Point(poinChange, 0); } break; case "HeThong": if (poinChange >= mPanelContainer.Size.Width) { timer1.Stop(); HeThong HeThong = new HeThong(); HeThong.Dock = DockStyle.Fill; frmMain.frmMain_.MetroContainer.Controls.Add(HeThong); frmMain.frmMain_.MetroContainer.Controls["HeThong"].BringToFront(); foreach (ucManHinhChinh item in frmMain.frmMain_.MetroContainer.Controls.OfType <ucManHinhChinh>()) { frmMain.frmMain_.MetroContainer.Controls.Remove(item); } } else { poinChange += 80; mPanelContainer.Location = new Point(poinChange, 0); } break; case "Phong": if (poinChange >= mPanelContainer.Size.Width) { timer1.Stop(); Phong Phong = new Phong(); Phong.Dock = DockStyle.Fill; frmMain.frmMain_.MetroContainer.Controls.Add(Phong); frmMain.frmMain_.MetroContainer.Controls["Phong"].BringToFront(); foreach (ucManHinhChinh item in frmMain.frmMain_.MetroContainer.Controls.OfType <ucManHinhChinh>()) { frmMain.frmMain_.MetroContainer.Controls.Remove(item); } } else { poinChange += 80; mPanelContainer.Location = new Point(poinChange, 0); } break; case "TienNghi": if (poinChange >= mPanelContainer.Size.Width) { timer1.Stop(); TienNghi TienNghi = new TienNghi(); TienNghi.Dock = DockStyle.Fill; frmMain.frmMain_.MetroContainer.Controls.Add(TienNghi); frmMain.frmMain_.MetroContainer.Controls["TienNghi"].BringToFront(); foreach (ucManHinhChinh item in frmMain.frmMain_.MetroContainer.Controls.OfType <ucManHinhChinh>()) { frmMain.frmMain_.MetroContainer.Controls.Remove(item); } } else { poinChange += 80; mPanelContainer.Location = new Point(poinChange, 0); } break; case "DichVu": if (poinChange >= mPanelContainer.Size.Width) { timer1.Stop(); DichVu DichVu = new DichVu(); DichVu.Dock = DockStyle.Fill; frmMain.frmMain_.MetroContainer.Controls.Add(DichVu); frmMain.frmMain_.MetroContainer.Controls["DichVu"].BringToFront(); foreach (ucManHinhChinh item in frmMain.frmMain_.MetroContainer.Controls.OfType <ucManHinhChinh>()) { frmMain.frmMain_.MetroContainer.Controls.Remove(item); } } else { poinChange += 80; mPanelContainer.Location = new Point(poinChange, 0); } break; case "ThuePhong": if (poinChange >= mPanelContainer.Size.Width) { timer1.Stop(); ThuePhong ThuePhong = new ThuePhong(); ThuePhong.Dock = DockStyle.Fill; frmMain.frmMain_.MetroContainer.Controls.Add(ThuePhong); frmMain.frmMain_.MetroContainer.Controls["ThuePhong"].BringToFront(); foreach (ucManHinhChinh item in frmMain.frmMain_.MetroContainer.Controls.OfType <ucManHinhChinh>()) { frmMain.frmMain_.MetroContainer.Controls.Remove(item); } } else { poinChange += 80; mPanelContainer.Location = new Point(poinChange, 0); } break; case "TraPhong": if (poinChange >= mPanelContainer.Size.Width) { timer1.Stop(); TraPhong TraPhong = new TraPhong(); TraPhong.Dock = DockStyle.Fill; frmMain.frmMain_.MetroContainer.Controls.Add(TraPhong); frmMain.frmMain_.MetroContainer.Controls["TraPhong"].BringToFront(); foreach (ucManHinhChinh item in frmMain.frmMain_.MetroContainer.Controls.OfType <ucManHinhChinh>()) { frmMain.frmMain_.MetroContainer.Controls.Remove(item); } } else { poinChange += 80; mPanelContainer.Location = new Point(poinChange, 0); } break; case "HoaDon": if (poinChange >= mPanelContainer.Size.Width) { timer1.Stop(); HoaDon HoaDon = new HoaDon(); HoaDon.Dock = DockStyle.Fill; frmMain.frmMain_.MetroContainer.Controls.Add(HoaDon); frmMain.frmMain_.MetroContainer.Controls["HoaDon"].BringToFront(); foreach (ucManHinhChinh item in frmMain.frmMain_.MetroContainer.Controls.OfType <ucManHinhChinh>()) { frmMain.frmMain_.MetroContainer.Controls.Remove(item); } } else { poinChange += 80; mPanelContainer.Location = new Point(poinChange, 0); } break; } }
public DichVu getDichVuFromMa(string ma) { DichVu rs = qlks.DichVus.Where(t => t.MaDV == ma).FirstOrDefault(); return(rs); }
private void buttonDichVu_Click(object sender, EventArgs e) { DichVu dv = new DichVu(); dv.ShowDialog(); }
public DichVuComponent(DichVu service) { InitializeComponent(); this.service = service; }
private void btnLuu_Click(object sender, EventArgs e) { if (Ktra()) { int _int_madv = Convert.ToInt32(txtMaDV.Text); switch (TTLuu) { case 1: try { DichVu _newDV = new DichVu(); _newDV.MaDV = _int_madv; _newDV.TenDV = txtTenDV.Text.Trim(); _newDV.PLoai = 4; _newDV.IdTieuNhom = Convert.ToInt32(lupNhom.EditValue); _newDV.IDNhom = Convert.ToInt32(lupPhanLoai.EditValue); _newDV.DSDonGia = "0"; if (!string.IsNullOrEmpty(txtDonGia.Text)) { _newDV.DonGia = double.Parse(txtDonGia.Text); } _newDV.DonVi = cboDonVi.Text; _newDV.NuocSX = txtNuocSX.Text; _newDV.SoDK = txtSoDK.Text; _newDV.NhaSX = txtNhaSX.Text; _newDV.QCPC = txtQCPC.Text; _newDV.MaCC = lupMaCC.EditValue.ToString(); if (chkStatus.Checked == true) { _newDV.Status = 1; } else { _newDV.Status = 0; } _data.DichVus.Add(_newDV); if (_data.SaveChanges() == 1) { MessageBox.Show("tạo mới thành công"); Frm_DmTaiSan_Load(sender, e); TTLuu = 0; } } catch (Exception ex) { MessageBox.Show("Lỗi không tạo mới được: " + ex.Message); } break; case 2: try { var _suaDV = _data.DichVus.Single(p => p.MaDV == _madv); _suaDV.MaDV = _int_madv; _suaDV.TenDV = txtTenDV.Text.Trim(); _suaDV.PLoai = 4; _suaDV.IdTieuNhom = Convert.ToInt32(lupNhom.EditValue); _suaDV.IDNhom = Convert.ToInt32(lupPhanLoai.EditValue); if (!string.IsNullOrEmpty(txtDonGia.Text)) { _suaDV.DonGia = double.Parse(txtDonGia.Text); } _suaDV.DonVi = cboDonVi.Text; _suaDV.NuocSX = txtNuocSX.Text; _suaDV.SoDK = txtSoDK.Text; _suaDV.NhaSX = txtNhaSX.Text; _suaDV.MaCC = lupMaCC.EditValue.ToString(); if (chkStatus.Checked == true) { _suaDV.Status = 1; } else { _suaDV.Status = 0; } _suaDV.QCPC = txtQCPC.Text; if (_data.SaveChanges() == 1) //_data.SaveChanges(); { TTLuu = 0; MessageBox.Show("Sửa thành công"); Frm_DmTaiSan_Load(sender, e); } } catch (Exception ex) { MessageBox.Show("Không sửa được! " + ex.Message); } break; } } }
public IActionResult Put(DichVu pt) { unitOfWork.DichVu.Update(pt); return(Ok()); }
// PUT: api/DichVu/5 //public HttpResponseMessage Put([FromBody]DichVu dv) //{ // DichVuDAO dvO = new DichVuDAO(); // dvO.updateDichVu(dv); // var response = Request.CreateResponse<DichVu>(HttpStatusCode.Created, dv); // response.Headers.Location = new System.Uri(Request.RequestUri, "/api/DichVu/" + dv.ID); // return response; //} // PUT: api/DichVu/5 //[Auth(PerMissionName = "Admin")] public void Put([FromBody] DichVu dv) { DichVuDAO dv0 = new DichVuDAO(); dv0.updateDichVu(dv); }
private void cmbTenDichVu_SelectedIndexChanged(object sender, EventArgs e) { string tendv = cmbTenDichVu.SelectedItem.ToString(); List <DichVu> listKQTK = DichVu.GetAll(); }
public int ThemMoi(DichVu ma) { db.DichVus.Add(ma); db.SaveChanges(); return(ma.MaDichVu); }
public bool CapNhat(DichVu new_dv) { throw new NotImplementedException(); }
public int Luu(DichVu dv) { return(dichvu.Luu(dv)); }
public bool ThemDichVu(DichVu dv) { throw new NotImplementedException(); }
public void New(DichVu dv) { _context.Add(dv); _context.SaveChangesAsync(); }
public async Task <Object> GetGeneralStatistics(HoaDonDichVuStatisticsParams userParams) { var totalHoaDonDV = 0; KhachHang khachHangCoHoaDonNhieuNhat = new KhachHang(); DichVu dichVuCoHoaDonNhieuNhat = new DichVu(); var danhSachKhachHang = _context.DanhSachKhachHang.OrderBy(x => x.ThoiGianTao).ToList(); var danhSachDichVu = _context.DanhSachDichVu.OrderBy(x => x.ThoiGianTao).ToList(); var demKhachHang = new List <int>(); var demDichVu = new List <int>(); if (userParams != null && userParams.StartingTime.GetHashCode() != 0 && userParams.EndingTime.GetHashCode() != 0) { totalHoaDonDV = _context.DanhSachHoaDonDichVu.Where(x => x.ThoiGianTao >= userParams.StartingTime && x.ThoiGianTao <= userParams.EndingTime).Count(); var danhSachHoaDonDichVu = _context.DanhSachHoaDonDichVu.Where(x => x.ThoiGianTao >= userParams.StartingTime && x.ThoiGianTao <= userParams.EndingTime); var danhSachChiTietHDDV = _context.DanhSachChiTietHDDV.Where(x => x.ThoiGianTao >= userParams.StartingTime && x.ThoiGianTao <= userParams.EndingTime); foreach (var khachHang in danhSachKhachHang) { int demKH = 0; foreach (var hoaDonDichVu in danhSachHoaDonDichVu) { if (hoaDonDichVu.MaKhachHang == khachHang.MaKhachHang) { demKH = demKH + 1; } } demKhachHang.Add(demKH); } int maxKH = demKhachHang.Max(); int indexKH = demKhachHang.IndexOf(maxKH); khachHangCoHoaDonNhieuNhat = danhSachKhachHang.ElementAt(indexKH); foreach (var dichVu in danhSachDichVu) { int demDV = 0; foreach (var chiTietHDDV in danhSachChiTietHDDV) { if (chiTietHDDV.MaDichVu == dichVu.MaDichVu) { demDV = demDV + 1; } } demDichVu.Add(demDV); } int maxDV = demDichVu.Max(); int indexDV = demDichVu.IndexOf(maxDV); dichVuCoHoaDonNhieuNhat = danhSachDichVu.ElementAt(indexDV); } else { totalHoaDonDV = _context.DanhSachHoaDonDichVu.Count(); var danhSachHoaDonDichVu = _context.DanhSachHoaDonDichVu.OrderBy(x => x.ThoiGianTao); var danhSachChiTietHDDV = _context.DanhSachChiTietHDDV.OrderBy(x => x.ThoiGianTao); foreach (var khachHang in danhSachKhachHang) { int demKH = 0; foreach (var hoaDonDichVu in danhSachHoaDonDichVu) { if (hoaDonDichVu.MaKhachHang == khachHang.MaKhachHang) { demKH = demKH + 1; } } demKhachHang.Add(demKH); } int maxKH = demKhachHang.Max(); int indexKH = demKhachHang.IndexOf(maxKH); khachHangCoHoaDonNhieuNhat = danhSachKhachHang.ElementAt(indexKH); foreach (var dichVu in danhSachDichVu) { int demDV = 0; foreach (var chiTietHDDV in danhSachChiTietHDDV) { if (chiTietHDDV.MaDichVu == dichVu.MaDichVu) { demDV = demDV + 1; } } demDichVu.Add(demDV); } int maxDV = demDichVu.Max(); int indexDV = demDichVu.IndexOf(maxDV); dichVuCoHoaDonNhieuNhat = danhSachDichVu.ElementAt(indexDV); } return(new { totalHoaDonDV, khachHangCoHoaDonNhieuNhat, dichVuCoHoaDonNhieuNhat }); }
public bool ThemDichVu(DichVu dichVu) { db.DichVus.InsertOnSubmit(dichVu); db.SubmitChanges(); return(true); }
public bool CapNhatDV(DichVu DV) { return(DVDAO.CapNhatDV(DV)); }
public bool AddToDB(TongHop th, List <Duoc> lstDuoc, QLBVEntities db, List <DichVu> qdv) { db = new QLBVEntities(DungChung.Bien.StrCon); int makp = getMaKP(th.MA_BV); int idNhap = 0; bool rs = false; // var qdv = db.DichVus.ToList(); if (CheckedAndDel(makp, th.MA_LK)) { #region thêm nhapD NhapD nhapDuoc = new NhapD(); if (ktDateTime(th.NGAY_CT, "yyyyMMddHHmm")) { nhapDuoc.NgayNhap = DateTime.ParseExact(th.NGAY_CT, "yyyyMMddHHmm", null); } nhapDuoc.MaKP = makp; nhapDuoc.TenNguoiCC = th.NGUOIGIAO; byte dtuong = (byte)int.Parse(th.DOI_TUONG); nhapDuoc.Status = 3; // nhận tuyến dưới ( lưu thông tin tuyến dưới xuất dược) nhapDuoc.KieuDon = Convert.ToInt32(th.PHAN_LOAI_XUAT); nhapDuoc.PLoai = 2; // xuất dược nhapDuoc.SoCT = th.MA_LK; // ma_lk = int.Parse(ndTongHop.Element("MA_LK").Value.Trim());// Tạm nhập IDNhap vào trường MaBNhan // nhapDuoc.MaBNhan = ma_lk; db.NhapDs.AddObject(nhapDuoc); int count = db.SaveChanges(); var nhapd_new = db.NhapDs.Where(p => p.MaKP == makp && p.PLoai == 2 && p.Status == 3 && p.SoCT == th.MA_LK).OrderByDescending(p => p.IDNhap).FirstOrDefault(); if (nhapd_new != null) { idNhap = nhapd_new.IDNhap; } #endregion #region thêm nhapdct if (idNhap > 0) { foreach (var a in lstDuoc) { DichVu dv = qdv.Where(p => p.MaQD == a.MA_QD).FirstOrDefault();//.Where(p => p.SoQD == a.SO_QD).Where(p => p.TenHC == a.TEN_QD).FirstOrDefault(); NhapDct nhapdct = new NhapDct(); nhapdct.IDNhap = idNhap; nhapdct.MaDV = dv.MaDV; //? nhapdct.DonVi = dv.DonVi; nhapdct.DonGia = Convert.ToDouble(a.DON_GIA); nhapdct.SoLuongX = Convert.ToDouble(a.SO_LUONG); nhapdct.ThanhTienX = Convert.ToDouble(a.THANH_TIEN); nhapdct.IDDTBN = dtuong; // dùng riêng cho Tam Đường: Đối tượng: 1- BHYT, 2- trẻ em, 3-Đối tượng 139, 4- Khác if (ktDateTime(a.HAN_DUNG, "yyyyMMdd")) { nhapdct.HanDung = DateTime.ParseExact(a.HAN_DUNG, "yyyyMMdd", null); } db.NhapDcts.AddObject(nhapdct); } db.SaveChanges(); rs = true; } #endregion } return(rs); }
public long Them(DichVu entity) { db.DichVus.Add(entity); db.SaveChanges(); return(entity.ID); }
protected override void Render(HtmlTextWriter writer) { var sb = new StringBuilder(); var cs = this.Page.ClientScript; #region Tham số var ID = Request["ID"]; var DM_ID = Request["DM_ID"]; var Ten = Request["Ten"]; var Ma = Request["Ma"]; var MoTa = Request["MoTa"]; var GhiChu = Request["GhiChu"]; var NoiDung = Request["NoiDung"]; var ThaoTac = Request["ThaoTac"]; var Anh = Request["Anh"]; var Gia = Request["Gia"]; var ThoiGian = Request["ThoiGian"]; var Active = Request["Active"]; var KhuyenMai = Request["KhuyenMai"]; var SoLan = Request["SoLan"]; var DV_ID = Request["DV_ID"]; var SoLuong = Request["SoLuong"]; var ThuTu = Request["ThuTu"]; var HH_ID = Request["HH_ID"]; string q = Request["q"]; #endregion switch (subAct) { case "get": #region lấy dữ liệu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "ID"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc"; var pg = DichVuDal.ByDmIdUser(string.Empty, false, jgrsidx + " " + jgrsord, q, DM_ID, Security.Username, Convert.ToInt32(jgRows)); var listRow = pg.List.Select(item => new jgridRow(item.ID.ToString(), new string[] { item.ID.ToString(),item.DM_Ten, item.Ma, item.Ten, item.MoTa, item.Gia.ToString("###,###,###"), item.Active.ToString() })).ToList(); var grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, "0", "0", listRow); sb.Append(JavaScriptConvert.SerializeObject(grid)); break; #endregion case "autoCompleteByQ": #region lấy dữ liệu cho autoCompleteByQ var pgautoCompleteByQ = DichVuDal.ByDmIdUser(string.Empty, false, "DV_NgayTao desc", q, string.Empty, Security.Username, 100); sb.Append(JavaScriptConvert.SerializeObject(pgautoCompleteByQ.List)); break; #endregion case "getSub": #region lấy dữ liệu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "ID"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "asc"; var listSub = DichVuChiTietDal.SelectByDvId(DV_ID); var listRowSub = listSub.Select(item => new jgridRow(item.ID.ToString(), new string[] { item.ID.ToString(), item.ThuTu.ToString(), item.HH_Ten, item.Gia.ToString("###,###,###"), item.SoLuong.ToString(), item.Tong.ToString("###,###,###"), item.NgayTao.ToString("dd:mm:yyyy") })).ToList(); var gridSub = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, "0", "0", listRowSub); sb.Append(JavaScriptConvert.SerializeObject(gridSub)); break; #endregion case "save": #region lưu var itemSave = new DichVu(); if (!string.IsNullOrEmpty(ID)) { itemSave = DichVuDal.SelectById(new Guid(ID)); } else { itemSave.ID = Guid.NewGuid(); } if (string.IsNullOrEmpty(Ten)) { sb.Append("0"); break; } itemSave.Active = Convert.ToBoolean(Active); itemSave.Anh = Anh; if (!string.IsNullOrEmpty(DM_ID)) { itemSave.DM_ID = new Guid(DM_ID); } itemSave.SoLan = Convert.ToInt32(SoLan); itemSave.Gia = Convert.ToInt32(Gia); itemSave.KhuyenMai = Convert.ToBoolean(KhuyenMai); itemSave.Ma = Ma; itemSave.MoTa = MoTa; itemSave.NgayCapNhat = DateTime.Now; itemSave.NguoiCapNhat = Security.Username; itemSave.NoiDung = NoiDung; itemSave.Ten = Ten; itemSave.ThaoTac = ThaoTac; itemSave.GhiChu = GhiChu; itemSave.ThoiGian = Convert.ToInt32(ThoiGian); if (!string.IsNullOrEmpty(ID)) { itemSave = DichVuDal.Update(itemSave); } else { itemSave.NgayTao = DateTime.Now; itemSave.NguoiTao = Security.Username; itemSave.NgayTao = DateTime.Now; itemSave.NguoiCapNhat = Security.Username; itemSave = DichVuDal.Insert(itemSave); } sb.Append("1"); break; #endregion case "edit": #region chỉnh sửa if (!string.IsNullOrEmpty(ID)) { sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(DichVuDal.SelectById(new Guid(ID)))); } break; #endregion case "del": #region xóa if (!string.IsNullOrEmpty(ID)) { DichVuDal.DeleteById(new Guid(ID)); } break; #endregion case "saveSub": #region lưu var itemSub = new DichVuChiTiet(); if (!string.IsNullOrEmpty(ID)) { itemSub = DichVuChiTietDal.SelectById(new Guid(ID)); } else { itemSub.ID = Guid.NewGuid(); } if (!string.IsNullOrEmpty(HH_ID)) { itemSub.HH_ID = new Guid(HH_ID); } if (!string.IsNullOrEmpty(DV_ID)) { itemSub.DV_ID = new Guid(DV_ID); } itemSub.SoLuong = Convert.ToInt32(SoLuong); itemSub.Gia = Convert.ToDouble(Gia); itemSub.NgayCapNhat = DateTime.Now; itemSub.NguoiCapNhat = Security.Username; itemSub.ThuTu = Convert.ToInt32(ThuTu); if (!string.IsNullOrEmpty(ID)) { itemSub = DichVuChiTietDal.Update(itemSub); } else { itemSub.NgayTao = DateTime.Now; itemSub.NguoiTao = Security.Username; itemSub.NgayTao = DateTime.Now; itemSub.NguoiCapNhat = Security.Username; itemSub = DichVuChiTietDal.Insert(itemSub); } sb.Append("1"); break; #endregion case "editSub": #region chỉnh sửa if (!string.IsNullOrEmpty(ID)) { sb.AppendFormat("({0})", JavaScriptConvert.SerializeObject(DichVuChiTietDal.SelectById(new Guid(ID)))); } break; #endregion case "delSub": #region xóa if (!string.IsNullOrEmpty(ID)) { DichVuChiTietDal.DeleteById(new Guid(ID)); } break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(Class1), "appStore.pmSpa.danhMucDichVuMgr.JScript1.js")); break; #endregion default: #region nạp var listFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); sb.Append(Lib.GetResource(Assembly.GetExecutingAssembly(), "mdl.htm")); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(Class1), "appStore.pmSpa.danhMucDichVuMgr.JScript1.js") , "{danhMucDichVuMgr.loadgrid();}"); sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(listFn)); break; #endregion } writer.Write(sb.ToString()); base.Render(writer); }
public void EditDichVu(DichVu cus) { DichVuDAO.Instance.EditDichVu(cus); }