// ======================================================= // NAME: Commit // TASK: Override Commit() method to save data // PARAM: // RETURN: TRUE = successfully, FALSE = fail // THROW: // REV: // 2003-12- // ======================================================= /// <summary> /// Save data /// </summary> public override bool Commit() { // remember current Action State HPA.Component.Framework.Base.EActionState eOldActionState = ActionState; try { // switch to COMMITING state ActionState = HPA.Component.Framework.Base.EActionState.BUSY; // wait-cursor this.Cursor = Cursors.WaitCursor; try { DBEngine.beginTransaction(); // TODO - add code here to perform commiting tasks DBEngine.commit(); } catch (Exception ex) { DBEngine.rollback(); throw(ex); } // restore cursor this.Cursor = Cursors.Default; // restore action state ActionState = eOldActionState; } catch (Exception e) { // restore cursor this.Cursor = Cursors.Default; // show error HPA.Common.Helper.ShowException(e, this.Name + ".Commit()", null); // restore action state ActionState = eOldActionState; // unable to commit return(false); } // commit successfully return(true); }
// ======================================================= // NAME: OnDelete // TASK: Override OnDelete() method to perform delete tasks. // PARAM: // RETURN: TRUE = successfully, FALSE = fail // THROW: // REV: // 2003-12- // ======================================================= /// <summary> /// Perform delete tasks /// </summary> public override bool OnDelete() { if (!base.OnDelete()) { return(false); } // remember current Action State HPA.Component.Framework.Base.EActionState eOldActionState = ActionState; try { // switch to DELETING state ActionState = HPA.Component.Framework.Base.EActionState.BUSY; // wait-cursor this.Cursor = Cursors.WaitCursor; // TODO - add code here to perform delete tasks // restore cursor this.Cursor = Cursors.Default; // restore action state ActionState = eOldActionState; } catch (Exception e) { // restore cursor this.Cursor = Cursors.Default; // show error HPA.Common.Helper.ShowException(e, this.Name + ".OnDelete()", null); // restore action state ActionState = eOldActionState; // unable to delete return(false); } // delete successfully return(true); }
public override bool Commit() { // remember current Action State HPA.Component.Framework.Base.EActionState eOldActionState = ActionState; try { // switch to COMMITING state ActionState = HPA.Component.Framework.Base.EActionState.BUSY; // wait-cursor this.Cursor = Cursors.WaitCursor; try { if (DBEngine == null) { string strServer, strDatabase, strUser, strPassword; try { DBConnection dbCon = new DBConnection(); dbCon.getDBConnectionInfo(out strServer, out strDatabase, out strUser, out strPassword); DBEngine = new EzSql2(strServer, strDatabase, strUser, strPassword); DBEngine.open(); } catch (Exception ex) { HPA.Common.Helper.ShowException(ex, ex.Message, "Commit"); } } object objRetVal = DBEngine.execReturnValue("SC_UserPassword_Update", "@p_UserName", xteUserID.Text, "@p_OldPassword", Encryption.EncryptText(xteOldPass.Text, true), "@p_NewPassword", Encryption.EncryptText(xteNewPass.Text, true)); int iRetVal = Convert.ToInt32(objRetVal); switch (iRetVal) { case 0: UIMessage.ShowMessage("PASS_CHANGED_SUCCESSFULL", MessageBoxButtons.OK, MessageBoxIcon.Information); break; case 1: UIMessage.ShowMessage("USER_NOT_EXISTS", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); xteUserID.Focus(); break; case 2: UIMessage.ShowMessage("PASS_WRONG", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); xteOldPass.Focus(); break; } } catch (Exception ex) { throw (ex); } // restore cursor this.Cursor = Cursors.Default; // restore action state ActionState = eOldActionState; } catch (Exception e) { // restore cursor this.Cursor = Cursors.Default; // show error HPA.Common.Helper.ShowException(e, this.Name + ".Commit()", null); // restore action state ActionState = eOldActionState; // unable to commit return(false); } // commit successfully return(true); }