private void btnOK_Click(object sender, EventArgs e) { try { //DateTime ngayGhi = dateNgayGhi.EditValue != null ? dateNgayGhi.DateTime : DateTime.Now; //objChungTu.sohieu = txtSoHieu_CT.Text; //objChungTu.ngay = dateNgay_CT.EditValue != null ? dateNgay_CT.DateTime : DateTime.Now; int soLuong = Convert.ToInt32(txtSoLuong.EditValue); TinhTrang tinhTrang = TinhTrang.getById(lookUpTinhTrang.EditValue); String ghiChu = txtGhiChu.Text; CTTaiSan re = objCTTaiSan.chuyenTinhTrang(objCTTaiSan.chungtu, tinhTrang, soLuong, ghiChu); if (re != null && DBInstance.commit() > 0) { XtraMessageBox.Show("Chuyển tình trạng thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); //Guid id = CTTaiSan.getQuery().Where(c => c.taisan_id == objCTTaiSan.taisan_id && c.tinhtrang_id == tinhTrang.id && c.soluong == soLuong).FirstOrDefault().id; if (reloadAndFocused != null) { reloadAndFocused(re.id); } this.Close(); } else { XtraMessageBox.Show("Chuyển tình trạng không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { Debug.WriteLine(this.Name + "->btnOK_Click: " + ex.Message); } }
private void barBtnDown_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (node.Equals(typeof(CoSo).Name)) { objCoSo.moveDown(); DBInstance.commit(); reLoadAndSelectNode(objCoSo.id); } else if (node.Equals(typeof(Dayy).Name)) { objDay.moveDown(); DBInstance.commit(); reLoadAndSelectNode(objDay.id); } else if (node.Equals(typeof(Tang).Name)) { objTang.moveDown(); DBInstance.commit(); reLoadAndSelectNode(objTang.id); } } catch (Exception ex) { Debug.WriteLine(this.Name + "->barBtnDown_ItemClick: " + ex.Message); } }
private void deleteObj() { try { if (XtraMessageBox.Show("Bạn có chắc là muốn xóa quản trị viên này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (Global.current_quantrivien_login == null) { return; } if (Global.current_quantrivien_login.id == objQTV.id) { MessageBox.Show("Không thể xóa bản thân!"); return; } int re = objQTV.delete(); if (re > 0) { if (DBInstance.commit() > 0) { MessageBox.Show("Xóa thành công!"); loadData(); return; } } MessageBox.Show("Xóa KHÔNG thành công"); } } catch (Exception ex) { Debug.WriteLine(this.Name + "->deleteObj: " + ex.Message); } }
public static int save() { Boolean re = true; Setting obj = Setting.getByKey("smtp_host"); obj.value = smtp_host; re = re && obj.addOrUpdate() > 0; obj = Setting.getByKey("smtp_username"); obj.value = smtp_username; re = re && obj.addOrUpdate() > 0; obj = Setting.getByKey("smtp_password"); obj.value = smtp_password; re = re && obj.addOrUpdate() > 0; obj = Setting.getByKey("smtp_port"); obj.value = smtp_port == null ? "0" : smtp_port.ToString(); re = re && obj.addOrUpdate() > 0; obj = Setting.getByKey("smtp_usessl"); obj.value = smtp_usessl == null || smtp_usessl == false ? "0" : "1"; re = re && obj.addOrUpdate() > 0; re = re && DBInstance.commit() > 0; if (re) { reload(); } return(re ? 1 : -1); }
public void deleteObj() { try { //if (XtraMessageBox.Show("Bạn có chắc là muốn loại thiết bị ra khỏi phòng không?", "Xác nhận", MessageBoxButtons.YesNo) == DialogResult.Yes) String str = String.Format("Bạn có chắc là muốn loại thiết bị {0}\n ra khỏi phòng {1} không?", objCTThietBi.thietbi.ten, objCTThietBi.phong.ten); frmRemoveThietBi frm = new frmRemoveThietBi(str); if (frm.ShowDialog() == DialogResult.OK) { objCTThietBi.mota = frm.mota; if (objCTThietBi.delete() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Loại thiết bị ra khỏi phòng thành công!"); reLoadCTThietBisOnly(); } else { XtraMessageBox.Show("Không thể loại thiết bị ra khỏi phòng!"); } } } catch (Exception ex) { Debug.WriteLine(this.Name + "=>deleteObj: " + ex.Message); } }
public static int save() { Boolean re = true; Setting obj = Setting.getByKey("ftp_image_host"); obj.value = host_name; re = re && obj.addOrUpdate() > 0; obj = Setting.getByKey("ftp_image_username"); obj.value = user_name; re = re && obj.addOrUpdate() > 0; obj = Setting.getByKey("ftp_image_password"); obj.value = pass_word; re = re && obj.addOrUpdate() > 0; obj = Setting.getByKey("ftp_image_prepath"); obj.value = pre_path; re = re && obj.addOrUpdate() > 0; obj = Setting.getByKey("ftp_image_port"); obj.value = port; re = re && obj.addOrUpdate() > 0; re = re && DBInstance.commit() > 0; if (re) { reload(); } return(re ? 1 : -1); }
private void deleteObj() { try { if (objLoaiPhong.phongs != null && objLoaiPhong.phongs.Count > 0) { XtraMessageBox.Show("Không thể xóa loại phòng này!\r\nNguyên do: Có phòng thuộc loại phòng này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (XtraMessageBox.Show("Bạn có chắc là muốn xóa loại phòng này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (objLoaiPhong.delete() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Xóa loại phòng thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); loadData(); } else { XtraMessageBox.Show("Xóa loại phòng không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch (Exception ex) { Debug.WriteLine(this.Name + "->deleteObj: " + ex.Message); } }
private void editObj() { try { ThietBi obj = objCTThietBi.thietbi; obj.subId = txtMa.Text; obj.ten = txtTen.Text; obj.mota = txtMoTa.Text; obj.loaithietbi = _ucTreeLoaiTB.getLoaiThietBi(); obj.ngaymua = dateMua.EditValue != null ? dateMua.DateTime : obj.ngaymua; obj.hinhanhs = listHinh; if (obj.update() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Sửa thiết bị thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); reLoadCTThietBisOnlyAndFocused(objCTThietBi.id); } else { XtraMessageBox.Show("Không thể sửa thiết bị!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { Debug.WriteLine(this.Name + "=>editObj:" + ex.Message); } }
private void barButtonXoaQTV_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (Global.current_quantrivien_login == null) { return; } if (Global.current_quantrivien_login.id == objQuanTriVien.id) { MessageBox.Show("Không thể xóa bản thân!"); return; } int re = objQuanTriVien.delete(); if (re > 0) { if (DBInstance.commit() > 0) { MessageBox.Show("Xóa thành công!"); //reload reLoad(); return; } } MessageBox.Show("Xóa KHÔNG thành công"); }
public void deleteObj() { try { if (objGroup.quantriviens.Count > 0) { XtraMessageBox.Show("Không thể xóa nhóm quyền này!\r\nNguyên do: Có quản trị viên thuộc nhóm quyền này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (XtraMessageBox.Show("Bạn có chắc là muốn xóa nhóm quyền này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (objGroup.delete() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Xóa nhóm quyền thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); loadData(); } else { XtraMessageBox.Show("Xóa nhóm quyền không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch (Exception ex) { Debug.WriteLine(this.Name + "->deleteObj: " + ex.Message); } }
protected void ButtonLuuThongTinCaNhan_Click(object sender, EventArgs e) { QuanTriVien _QuanTriVien = QuanTriVien.getByUserName(Convert.ToString(Session["UserName"])); Session["HoTen"] = _QuanTriVien.hoten = TextBoxHoTen.Text; ((Site)Page.Master).HoTen_Changed = Session["HoTen"].ToString(); _QuanTriVien.email = TextBoxEmail.Text; if (!TextBoxMatKhauMoi.Text.Equals("")) { _QuanTriVien.setPassword(TextBoxMatKhauMoi.Text); } _QuanTriVien.donvi = TextBoxDonVi.Text; _QuanTriVien.mota = TextBoxGhiChu.Text; if (_QuanTriVien.update() > 0 && DBInstance.commit() > 0) { Session["HoTen"] = _QuanTriVien.hoten; PanelThongBaoThanhCong.Visible = true; LabelThongBaoThanhCong.Text = "Cập nhật thông tin tài khoản thành công"; ShowPanelThongTinCaNhan(true); LoadThongTinCaNhan(); } else { PanelThongBaoThatBai.Visible = true; LabelThongBaoThatBai.Text = "Có lỗi trong khi chỉnh sửa. Vui lòng xem lại!"; } }
private void deleteObj() { try { if (objTinhTrang.ctthietbis.Count > 0 || objTinhTrang.logthietbis.Count > 0) { XtraMessageBox.Show("Không thể xóa tình trạng này!\r\nNguyên do: Có các thiết bị thuộc tình trạng này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (objTinhTrang.sucophongs.Count > 0 || objTinhTrang.logsucophongs.Count > 0) { XtraMessageBox.Show("Không thể xóa tình trạng này!\r\nNguyên do: Có các sự cố phòng thuộc tình trạng này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (XtraMessageBox.Show("Bạn có chắc là muốn xóa tình trạng này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (objTinhTrang.delete() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Xóa loại tình trạng thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); loadData(); } else { XtraMessageBox.Show("Xóa loại tình trạng không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch (Exception ex) { Debug.WriteLine(this.Name + "->deleteObj: " + ex.Message); } }
private void deleteObj() { try { if (objDonVi.childs != null && objDonVi.childs.Count > 0) { XtraMessageBox.Show("Không thể xóa đơn vị này!\r\nNguyên do: Có đơn vị thuộc đơn vị này này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if ((objDonVi.cttaisan_dangquanlys != null && objDonVi.cttaisan_dangquanlys.Count > 0) || (objDonVi.cttaisan_dangsudungs != null && objDonVi.cttaisan_dangsudungs.Count > 0)) { XtraMessageBox.Show("Không thể xóa đơn vị này!\r\nNguyên do: Có tài sản thuộc đơn vị này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (XtraMessageBox.Show("Bạn có chắc là muốn xóa đơn vị này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { Guid id = objDonVi.parent != null ? objDonVi.parent.id : Guid.Empty; if (objDonVi.delete() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Xóa đơn vị thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); reLoadAndSelectNode(id, true); } else { XtraMessageBox.Show("Xóa đơn vị không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } catch (Exception ex) { Debug.WriteLine(this.Name + "->deleteObj: " + ex.Message); } }
private Guid AddObj(ThietBi objThietBi, TinhTrang objTinhTrang, int SoLuong, String GhiChu) { try { CTThietBi obj = new CTThietBi(); obj.phong = objPhong; obj.thietbi = objThietBi; obj.tinhtrang = objTinhTrang; obj.soluong = SoLuong; obj.mota = GhiChu; obj.ngay = dateEdit1.EditValue == null ? DateTime.Now : dateEdit1.DateTime; if (obj.add() > 0 && DBInstance.commit() > 0) { text += "Thêm thiết bị " + objThietBi.ten + " vào phòng thành công!" + Environment.NewLine; return(objPhong.ctthietbis.Where(c => c.thietbi == objThietBi && c.tinhtrang == objTinhTrang).FirstOrDefault().id); } else { text += "Thêm thiết bị " + objThietBi.ten + " vào phòng không thành công!" + Environment.NewLine; } return(Guid.Empty); } catch (Exception ex) { Debug.WriteLine(this.Name + "->AddObj: " + ex.Message); return(Guid.Empty); } }
private void btnOK_Click(object sender, EventArgs e) { try { if (CheckInput()) { if (function.Equals("add")) { objSuCo = new SuCoPhong(); objSuCo.ten = txtTen.Text; objSuCo.phong = objPhong; objSuCo.tinhtrang = lookUpEditTinhTrang.GetSelectedDataRow() as TinhTrang; objSuCo.mota = txtMota.Text; //objSuCo.phisuachua = spinPhiSuaChua != null ? long.Parse(spinPhiSuaChua.EditValue.ToString()) : 0; objSuCo.hinhanhs = listHinhs; objSuCo.ngay = dateEdit1.EditValue != null ? dateEdit1.DateTime : DateTime.Now; if (objSuCo.add() > 0 && DBInstance.commit() > 0) { DevExpress.XtraEditors.XtraMessageBox.Show("Thêm sự cố thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objSuCo.id; reLoadAndFocused(id); } else { DevExpress.XtraEditors.XtraMessageBox.Show("Thêm sự cố không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (function.Equals("edit")) { if (checkworking()) { objSuCo.ten = txtTen.Text; objSuCo.tinhtrang = lookUpEditTinhTrang.GetSelectedDataRow() as TinhTrang; objSuCo.mota = txtMota.Text; //objSuCo.phisuachua = spinPhiSuaChua != null ? long.Parse(spinPhiSuaChua.EditValue.ToString()) : 0; objSuCo.hinhanhs = listHinhs; objSuCo.ngay = dateEdit1.EditValue != null ? dateEdit1.DateTime : DateTime.Now; if (objSuCo.update() > 0 && DBInstance.commit() > 0) { DevExpress.XtraEditors.XtraMessageBox.Show("Sửa sự cố thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objSuCo.id; reLoadAndFocused(id); } else { DevExpress.XtraEditors.XtraMessageBox.Show("Sửa sự cố không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { DevExpress.XtraEditors.XtraMessageBox.Show("Không thể cập nhật nếu không có thay đổi!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } } catch (Exception ex) { Debug.WriteLine(this.Name + "->btnOK_Click: " + ex.Message); } }
private void editObj(String _type) { try { switch (_type) { case "CoSo": objCoSo.ten = txtTen.Text; objCoSo.mota = txtMoTa.Text; if (objCoSo.update() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Sửa cơ sở thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); reLoadAndSelectNode(objCoSo.id); } else { XtraMessageBox.Show("Sửa cơ sở không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case "Dayy": objDay.ten = txtTen.Text; objDay.mota = txtMoTa.Text; ViTri _vitri = _ucComboBoxCoSo.ViTri; objDay.coso = _vitri.coso; if (objDay.update() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Sửa dãy thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); reLoadAndSelectNode(objDay.id); } else { XtraMessageBox.Show("Sửa dãy không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; case "Tang": objTang.ten = txtTen.Text; objTang.mota = txtMoTa.Text; ViTri _vitri2 = _ucComboBoxDay.ViTri; objTang.day = _vitri2.day; if (objTang.update() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Sửa tầng thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); reLoadAndSelectNode(objTang.id); } else { XtraMessageBox.Show("Sửa tầng không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } break; } } catch (Exception ex) { Debug.WriteLine(this.Name + "->editObj: " + ex.Message); } }
private void btnOK_Click(object sender, EventArgs e) { if (save) { ct2.attachments = ct.attachments; ct2.update(); DBInstance.commit(); } this.Close(); }
public void deleteObj() { try { if (XtraMessageBox.Show("Bạn có chắc là muốn xóa loại thiết bị này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { bool check = true; Guid id = Guid.Empty; if (objLoaiThietBi.parent_id != null) { id = GUID.From(objLoaiThietBi.parent_id); } if (objLoaiThietBi.loaichung) { if (objLoaiThietBi.thietbis.Count > 0) { foreach (ThietBi obj in objLoaiThietBi.thietbis.ToList()) { if (obj.delete() <= 0) { check = false; XtraMessageBox.Show("Không thể xóa loại thiết bị này!\r\nNguyên do: Loại thiết bị này có chứa các thiết bị hoặc loại thiết bị con", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); //reLoad(); break; } } } } if (check) { if (objLoaiThietBi.delete() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Xóa loại thiết bị thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); if (id != Guid.Empty) { reLoadAndFocused(id); } else { reLoad(); } } else { XtraMessageBox.Show("Không thể xóa loại thiết bị này!\r\nNguyên do: Loại thiết bị này có chứa các thiết bị hoặc loại thiết bị con", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); //reLoad(); } } } } catch (Exception ex) { Debug.WriteLine(this.Name + "=>deleteObj: " + ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "no-cache"; Response.AddHeader("Pragma", "no-cache"); Response.Expires = -1; if (!IsPostBack) { // Đặt tên để set class, đặt tên in hoa Default SetClassActive = this.Master as Default; SetClassActive.page = "QUANLYMUONPHONG"; try { if (Convert.ToString(Session["Username"]).Equals(String.Empty)) { PanelDangNhap.Visible = true; } else { PanelQuanLyPhongMuon.Visible = true; QuanLyPhongMuon(); if (Page.Request.QueryString["op"] != null) { if (Page.Request.QueryString["op"].Equals("xoa")) { Guid ID_PMP = GUID.From(Page.Request.QueryString["id"]); PhieuMuonPhong _PhieuMuonPhong = PhieuMuonPhong.getById(ID_PMP); HideAllAlert(); if (_PhieuMuonPhong.delete() > 0 && DBInstance.commit() > 0) { ucSuccess.LabelInfo.Text = "Đã xóa phiếu mượn phòng này"; ucSuccess.Visible = true; Response.Redirect("QuanLyMuonPhong.aspx"); } else { ucWarning.LabelInfo.Text = "Có lỗi xảy ra trong khi xóa. Vui lòng kiểm tra lại."; ucWarning.Visible = true; } } } } } catch (Exception ex) { ucDanger.LabelInfo.Text = "Có lỗi xảy ra. Vui lòng tải lại trang."; ucDanger.Visible = true; Console.WriteLine(ex); } } }
protected void ButtonLuu_Click(object sender, EventArgs e) { try { QuanTriVien _QuanTriVien = QuanTriVien.getById(HiddenFieldID.Value); if (!PermissionHelper.QuyenSuaQuanTriVien()) { PanelThatBai.Visible = true; LabelThongBaoThatBai.Text = "Bạn không có quyền sửa tài khoản này"; return; } _QuanTriVien.hoten = TextBoxHoTen.Text; _QuanTriVien.email = TextBoxEmail.Text; QuanTriVien _QuanTriVienDangNhap = QuanTriVien.getByUserName(Session["UserName"].ToString()); if (!_QuanTriVienDangNhap.id.Equals(_QuanTriVien.id)) { _QuanTriVien.group = Group.getById(DropDownListNhom.SelectedValue.ToString()); } else { Session["HoTen"] = _QuanTriVien.hoten; ((Default)Page.Master).HoTen_Changed = Session["HoTen"].ToString(); } _QuanTriVien.username = TextBoxTaiKhoan.Text; if (!TextBoxMatKhau.Text.Equals(string.Empty)) { _QuanTriVien.setPassword(TextBoxMatKhau.Text); } _QuanTriVien.donvi = TextBoxKhoa.Text; _QuanTriVien.mota = TextBoxGhiChu.Text; if (_QuanTriVien.update() > 0 && DBInstance.commit() > 0) { PanelThanhCong.Visible = true; LabelThongBaoThanhCong.Text = "Chỉnh sửa tài khoản <strong>" + _QuanTriVien.username + "</strong> thành công"; _QuanLyTaiKhoan(); } else { PanelThatBai.Visible = true; LabelThongBaoThatBai.Text = "Có lỗi trong khi chỉnh sửa"; } } catch (Exception ex) { Console.Write(ex); } }
private void btnOK_Click(object sender, EventArgs e) { try { if (checkInput()) { switch (function) { case "add": objQTV = new QuanTriVien(); setDataObj(); objQTV.setPassword(txtMatKhauQuanTriVien.Text); if (objQTV.add() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Thêm quản trị viên thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objQTV.id; reloadAndFocused(id); } else { XtraMessageBox.Show("Thêm quản trị viên không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case "edit": setDataObj(); if (!txtMatKhauQuanTriVien.Text.Equals("") && !txtXacNhanMK.Text.Equals("")) { objQTV.changePassword(txtMatKhauQuanTriVien.Text); } if (objQTV.update() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Sửa quản trị viên thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objQTV.id; reloadAndFocused(id); } else { XtraMessageBox.Show("Sửa quản trị viên không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; } } } catch (Exception ex) { Debug.WriteLine(this.Name + "->btnOk_Click: " + ex.Message); } }
private void barBtnDown_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { if (objTinhTrang != null && objTinhTrang.id != Guid.Empty) { objTinhTrang.moveDown(); DBInstance.commit(); reloadAndFocused(objTinhTrang.id); } } catch (Exception ex) { Debug.WriteLine(this.Name + "->barBtnUp_ItemClick: " + ex.Message); } }
private void btnR_Down_Click(object sender, EventArgs e) { try { if (objLoaiDonVi != null && objLoaiDonVi.id != Guid.Empty) { objLoaiDonVi.moveDown(); DBInstance.commit(); reloadAndFocused(objLoaiDonVi.id); } } catch (Exception ex) { Debug.WriteLine(this.Name + "->btnR_Down_Click: " + ex.Message); } }
private void btnUp_r_Click(object sender, EventArgs e) { try { if (objTinhTrang != null && objTinhTrang.id != Guid.Empty) { objTinhTrang.moveUp(); DBInstance.commit(); reloadAndFocused(objTinhTrang.id); } } catch (Exception ex) { Debug.WriteLine(this.Name + "->btnUp_r_Click: " + ex.Message); } }
private void btnOK_Click(object sender, EventArgs e) { if (Global.current_quantrivien_login == null) { this.Close(); } //cap nhat mat khau if (!viewSuaThongTinCaNhan1.textEdit_oldpass.Text.Equals("") || !viewSuaThongTinCaNhan1.textEdit_newpass.Text.Equals("") || !viewSuaThongTinCaNhan1.textEdit_newpass_confirm.Text.Equals("")) { if (QuanTriVien.checkLoginById(Global.current_quantrivien_login.id, QuanTriVien.hashPassword(viewSuaThongTinCaNhan1.textEdit_oldpass.Text))) { if (viewSuaThongTinCaNhan1.textEdit_newpass.Text.Equals("") || viewSuaThongTinCaNhan1.textEdit_newpass_confirm.Text.Equals("")) { XtraMessageBox.Show("Mật khẩu không được để trống!"); return; } else { if (viewSuaThongTinCaNhan1.textEdit_newpass.Text.Equals(viewSuaThongTinCaNhan1.textEdit_newpass_confirm.Text)) { Global.current_quantrivien_login.setPassword(viewSuaThongTinCaNhan1.textEdit_newpass.Text); } else { XtraMessageBox.Show("Mật khẩu không khớp!"); return; } } } else { XtraMessageBox.Show("Sai mật khẩu cũ!"); return; } } //cap nhat thuoc tinh don le Global.current_quantrivien_login.mota = viewSuaThongTinCaNhan1.memoEdit_mota.Text; Global.current_quantrivien_login.hoten = viewSuaThongTinCaNhan1.textEdit_hoten.Text; Global.current_quantrivien_login.email = viewSuaThongTinCaNhan1.textEdit_email.Text; if (Global.current_quantrivien_login.update() > 0 && DBInstance.commit() > 0) { this.Close(); return; } XtraMessageBox.Show("KHÔNG thành công!"); }
private void btnOK_Click(object sender, EventArgs e) { try { if (checkInput()) { switch (function) { case "add": objDonVi = new DonVi(); setDataObj(); if (objDonVi.add() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Thêm đơn vị thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objDonVi.id; reLoadAndSelectNode(id); } else { XtraMessageBox.Show("Thêm đơn vị không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case "edit": setDataObj(); if (objDonVi.update() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Sửa đơn vị thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objDonVi.id; reLoadAndSelectNode(id); } else { XtraMessageBox.Show("Sửa đơn vị không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; } } } catch (Exception ex) { Debug.WriteLine(this.Name + "->btnOk_Click: " + ex.Message); } }
private void btnOk_Click(object sender, EventArgs e) { try { if (checkInput()) { switch (function) { case "add": objTinhTrang = new TinhTrang(); setDataObj(); if (objTinhTrang.add() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Thêm tình trạng thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objTinhTrang.id; reloadAndFocused(id); } else { XtraMessageBox.Show("Thêm tình trạng không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; case "edit": setDataObj(); if (objTinhTrang.update() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Sửa tình trạng thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objTinhTrang.id; reloadAndFocused(id); } else { XtraMessageBox.Show("Sửa tình trạng không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; } } } catch (Exception ex) { Debug.WriteLine(this.Name + "->btnOk_Click: " + ex.Message); } }
private void CRU() { try { switch (function) { case "add": objLoaiThietBi = new LoaiThietBi(); setDataObj(); if (objLoaiThietBi.add() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Thêm loại thiết bị thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objLoaiThietBi.id; reLoadAndFocused(id); } else { XtraMessageBox.Show("Đã có lỗi xảy ra!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); reLoad(); } break; case "edit": setDataObj(); if (objLoaiThietBi.update() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Sửa loại thiết bị thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Guid id = objLoaiThietBi.id; reLoadAndFocused(id); } else { XtraMessageBox.Show("Đã có lỗi xảy ra!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); reLoad(); } break; } } catch (Exception ex) { Debug.WriteLine(this.Name + " : CRU : " + ex.Message); } }
private void deleteObj() { CTTaiSan obj = ucGridControlTaiSan1.CTTaiSan; if (obj != null) { if (XtraMessageBox.Show("Tài sản bị xóa sẽ mất log và không thể thống kê được nữa. \n Bạn có chắc là muốn xóa tài sản này?", "Xác nhận", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { if (obj.taisan.delete() > 0 && DBInstance.commit() > 0) { XtraMessageBox.Show("Xóa tài sản thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); Search(); } else { XtraMessageBox.Show("Xóa tài sản không thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
public static int save() { Boolean re = true; Setting obj = Setting.getByKey("default_title_template"); obj.value = default_title_template; re = re && obj.addOrUpdate() > 0; obj = Setting.getByKey("default_content_template"); obj.value = default_content_template; re = re && obj.addOrUpdate() > 0; re = re && DBInstance.commit() > 0; if (re) { reload(); } return(re ? 1 : -1); }