Ejemplo n.º 1
0
        public bool TestConnection()
        {
            //HPA.Component.Framework.CRunableObjectManager objManager = new HPA.Component.Framework.CRunableObjectManager();
            EzSql2 EzSQL = null;
            try
            {
                EzSQL = new EzSql2(m_strServer, m_strDatabase, m_strUser, m_strPassword);
                EzSQL.open();

                EzSQL.close();
                return true;
            }
            catch
            {
                EzSQL.close();
                return false;
            }
        }
Ejemplo n.º 2
0
        public bool checkConnectionInfo(string strServer, string strDatabase, string strUserName, string strPassword)
        {
            EzSql2 EzSQL = null;
            try
            {
                EzSQL = new EzSql2(strServer, strDatabase, strUserName, strPassword);
                EzSQL.open();

                EzSQL.close();
                return true;
            }
            catch
            {
                EzSQL.close();
                return false;
            }
        }
Ejemplo n.º 3
0
        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;
        }