public static int update(DBInstance dbmgr, List <Param> request, int id = 0) { //id=0为插入新字段 using (DbConnection conn = dbmgr.GetDbConnection()) { conn.Open(); using (DbTransaction tx = conn.BeginTransaction()) { string sql = ""; if (id == 0) { id = dbmgr.getNewId("tb_payment"); sql = "insert into tb_payment (id,created_user,created_date,updated_user,updated_date,`orderno`,`time_end`,`openid`,`total_fee`,`trade_type`,`transaction_id`,`result_code` ) values (" + id.ToString() + ",-2,now(),-2,now(),@orderno ,@time_end ,@openid ,@total_fee ,@trade_type ,@transaction_id ,@result_code )"; } else { sql = "update tb_payment set updated_user=-2, updated_date=now() ,`orderno`=@orderno ,`time_end`=@time_end ,`openid`=@openid ,`total_fee`=@total_fee ,`trade_type`=@trade_type ,`transaction_id`=@transaction_id ,`result_code`=@result_code where id=" + id.ToString(); } dbmgr.ExecuteNonQuery(tx, sql, request); tx.Commit(); return(id); } } }
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); } }
public void CreatingAndRemovingTableInDB() { DBInstance dbInstance = new DBInstance("sensor_readings"); dbInstance.InitialiseSQLiteConnection(); string newTableName = "test"; dbInstance.ExecuteNonQuery( SensorReadingTableDetails.CreateTableSQLString(newTableName)); bool doesTableExistAfterCreation = dbInstance.DoesTableExistInDB(newTableName); Debug.Log("Table '" + newTableName + "' should now exist: " + doesTableExistAfterCreation); dbInstance.ExecuteNonQuery( SensorReadingTableDetails.DropTableSQLString(newTableName)); bool doesTableExistAfterRemoved = dbInstance.DoesTableExistInDB(newTableName); Debug.Log("Table '" + newTableName + "' should now not exist: " + doesTableExistAfterRemoved); dbInstance.CloseSQLiteConnection(); if ((doesTableExistAfterCreation) && (!doesTableExistAfterRemoved)) { Assert.Pass(); } else { Assert.Fail(); } }
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 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"); }
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 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); } }
/// <summary> /// 摘要:根据驱动创建数据库核心实例。 /// </summary> /// <param name="connectionString">数据库连接串</param> /// <param name="path">数据库驱动配置文件路径</param> /// <returns>返回DB实例对象,若返回值为null为不可识别的数据库类型。</returns> public static DBCoreBase CreateDBByProvider(string connectionString, string path) { DBCoreBase DB = null; if (connectionString == string.Empty) { return(DB); } string provider = connectionString.Split(';')[0].Split('=')[1].ToString(); string DBName = string.Empty; DBInstance DBi = new DBInstance(); DBi.TagData = path; List <string[]> where = new List <string[]>(); where.Add(new string[] { "Provider LIKE '%{0}%'", provider }); DataTable dt = DBi.GetDataSet("SELECT * From DBType", where); if (dt.Rows.Count > 0) { DBName = dt.Rows[0]["Name"].ToString(); DB = (DBCoreBase)Assembly.Load("Service.Common").CreateInstance("Service.Common.DB." + DBName + "Core"); DB.DBprovider = provider; DB.ConnectionString = connectionString; } return(DB); }
public MainForm() { InitializeComponent(); Instance = this; DBInstance.Init(Path.Combine(Application.StartupPath, "static.db")); }
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); } }
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 async Task LoadScriptMods(DBInstance modsDbConnection) { await this.Dispatcher.Invoke(async() => { this.ModsRootFolder = Path.Combine(SettingsHandler.ModsDirectory, "Script Mods"); this.ScriptModAPI = new ScriptModAPI(this.ModsRootFolder, modsDbConnection); if (!Directory.Exists(this.ModsRootFolder)) { Directory.CreateDirectory(this.ModsRootFolder); this.ScriptMods = new ObservableCollection <ScriptMod>(); this.ScriptMods.Add(await this.ScriptModAPI.CreateScriptMod("Your mod name - Click to edit", 0, "Your mod's brief description to help you identify it (optional).\nClick to edit.\n'Enter' key to create a new line.\n'Ctrl+Enter'/click anywhere else to confirm.", false)); // UI margins act odd when datagrid is empty and a new script mod is added for the first time manually. Adding one by default. } else { List <ScriptMod> scriptModsFromDb = await this.ScriptModAPI.GetAllScriptMods(); if (scriptModsFromDb == null) { this.ScriptMods = new ObservableCollection <ScriptMod>(); this.ScriptMods.Add(await this.ScriptModAPI.CreateScriptMod("Your mod name - Click to edit", 0, "Your mod's brief description to help you identify it (optional).\nClick to edit.\n'Enter' key to create a new line.\n'Ctrl + Enter'/click anywhere else to confirm.", false)); // UI margins act odd when datagrid is empty and a new script mod is added for the first time manually. Adding one by default. } else { this.ScriptMods = new ObservableCollection <ScriptMod>(scriptModsFromDb); } } this.ScriptModsDataGrid.ItemsSource = this.ScriptMods; }); }
public async Task FinishSetup() { SettingsHandler.IsFirstLaunch = false; SettingsHandler.GTAVDirectory = this.GTAVDirectoryPage.GTAVDirectoryConfirmedLocation.FullName; SettingsHandler.IsSteamDRM = this.GTAVDirectoryPage.IsSteamDRM; SettingsHandler.ModsDirectory = this.ModsDirectoryPage.ModsDirectoryConfirmedLocation.FullName; SettingsHandler.SaveAllSettings(); DBInstance modsDbConnection = new DBInstance(this.ModsDirectoryPage.ModsDirectoryConfirmedLocation.FullName); await modsDbConnection.VerifyTablesState(); ScriptModAPI scriptModAPI = new ScriptModAPI(Path.Combine(this.ModsDirectoryPage.ModsDirectoryConfirmedLocation.FullName, "Script Mods"), modsDbConnection); if (await scriptModAPI.GetAllScriptMods() == null) { await scriptModAPI.CreateScriptMod("Script Hook V + ASI Loader", 0, "Script Hook V + ASI Loader © - not included, please download yourself.\nRequired to load most modifications. Should be up-to-date as new GTAV updates are released to ensure compatibility and avoid crashes.", false); await scriptModAPI.CreateScriptMod("OpenIV.ASI", 1, "OpenIV.ASI © - not included, please download yourself (usually included with OpenIV ©.)\nRequired to load asset mods (the modified .rpf packages).", false); } MainWindow mainWindow = new MainWindow(modsDbConnection); mainWindow.Show(); this.Close(); }
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); }
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); } }
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 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 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); } }
private async Task <DBInstance> RestoreFromSnapshot(DBInstance instance, DBSnapshot snapshot) { _logger.Info("Creating new instance from snapshot."); RestoreDBInstanceFromDBSnapshotRequest restoreRequest = new RestoreDBInstanceFromDBSnapshotRequest() { DBSnapshotIdentifier = snapshot.DBSnapshotIdentifier, LicenseModel = instance.LicenseModel, DBInstanceClass = instance.DBInstanceClass, MultiAZ = instance.MultiAZ, StorageType = instance.StorageType, DBInstanceIdentifier = instance.DBInstanceIdentifier, DBSubnetGroupName = instance.DBSubnetGroup.DBSubnetGroupName, AvailabilityZone = instance.AvailabilityZone, AutoMinorVersionUpgrade = instance.AutoMinorVersionUpgrade, VpcSecurityGroupIds = instance.VpcSecurityGroups.Select(x => x.VpcSecurityGroupId).ToList() }; var restoreResponse = await _rdsClient.RestoreDBInstanceFromDBSnapshotAsync(restoreRequest); await WaitForDBToBeAvailable(restoreResponse.DBInstance.DbiResourceId); _logger.Info("Creation Successful."); return(restoreResponse.DBInstance); }
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); } }
public static int update(DBInstance dbmgr, List <Param> request, int id = 0) { //id=0为插入新字段 using (DbConnection conn = dbmgr.GetDbConnection()) { conn.Open(); using (DbTransaction tx = conn.BeginTransaction()) { string sql = ""; if (id == 0) { id = dbmgr.getNewId("tb_notify_log"); sql = "insert into tb_notify_log (id,created_user,created_date,updated_user,updated_date,`notify_time`,`log_request`,`log_url` ) values (" + id.ToString() + ",-2,now(),-2,now(),@notify_time ,@log_request ,@log_url )"; } else { sql = "update tb_notify_log set updated_user=-2, updated_date=now() ,`notify_time`=@notify_time ,`log_request`=@log_request ,`log_url`=@log_url where id=" + id.ToString(); } dbmgr.ExecuteNonQuery(tx, sql, request); tx.Commit(); return(id); } } }
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!"; } }
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); } }
public void init() { DBConfig.DBConn = "Server=localhost;Port=5432;Database=DVD;User id=postgres;Password=Starfish123"; DBConfig.Provider = "Npgsql"; dBManager = DBInstance.init(); dBManager.getallActors(); createTimers(); }
public void GetSensorReadingsFromTableInDB() { DBInstance dbInstance = new DBInstance(databaseName); dbInstance.InitialiseSQLiteConnection(); SensorReadings = dbInstance.GetSensorReadingsFromTable(tableNameInDatabase); dbInstance.CloseSQLiteConnection(); }
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); } }
public void Setup() { _dbInstance = new DBInstance { DBInstanceIdentifier = "DBInstance Name", AllocatedStorage = 42 }; _rdsDataProvider = new RdsAlarmDataProvider(); }
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); } }
private async Task DeleteInstance(DBInstance instance) { _logger.Info("Deleting old instance."); string finalSnapshotID = $"beta-final-snap-{SystemClock.Instance.GetToday().ToISOString()}-{Guid.NewGuid().ToString()[0]}"; var deleteRequest = new DeleteDBInstanceRequest() { DBInstanceIdentifier = instance.DBInstanceIdentifier, FinalDBSnapshotIdentifier = finalSnapshotID }; await _rdsClient.DeleteDBInstanceAsync(deleteRequest); }