public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            ChangePasswordVo inVo = (ChangePasswordVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Update m_login_password");
            sqlQuery.Append(" Set password = :password ");
            sqlQuery.Append(" Where	user_cd = :usercode ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("password", inVo.Password);
            sqlParameter.AddParameterString("usercode", inVo.UserCode);

            ChangePasswordVo outVo = new ChangePasswordVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
示例#2
0
        /// <summary>
        /// ok button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            if (CheckMandatory())
            {
                try
                {
                    ChangePasswordVo inVo = new ChangePasswordVo
                    {
                        UserCode = UserData.GetUserData().UserCode,
                        Password = encryptDecrypt.Encrypt(Password_txt.Text)
                    };

                    ChangePasswordVo outcheckVo = (ChangePasswordVo)DefaultCbmInvoker.Invoke(new CheckPasswordCbm(), inVo);

                    if (outcheckVo.AffectedCount == 0)
                    {
                        messageData = new MessageData("llce00013", Properties.Resources.llce00013, null);
                        Logger.Info(messageData);
                        popUpMessage.Warning(messageData, Text);
                        return;
                    }

                    if (Password_txt.Text == NewPwd_txt.Text)
                    {
                        messageData = new MessageData("llce00012", Properties.Resources.llce00012, null);
                        Logger.Info(messageData);
                        popUpMessage.Warning(messageData, Text);
                        return;
                    }

                    inVo.Password = encryptDecrypt.Encrypt(NewPwd_txt.Text);
                    ChangePasswordVo outVo = (ChangePasswordVo)DefaultCbmInvoker.Invoke(new ChangePasswordCbm(), inVo);

                    if (outVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("llci00001", Properties.Resources.llci00001, null);
                        Logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);
                        this.Close();

                        FormCollection forms = Application.OpenForms;

                        for (int formCount = forms.Count - 1; formCount >= 0; formCount--)
                        {
                            if (forms[formCount].GetType().BaseType != typeof(FormCommonBase))
                            {
                                forms[formCount].Close();
                            }
                        }
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    Logger.Error(exception.GetMessageData());
                    return;
                }
            }
        }
示例#3
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            ChangePasswordVo inVo = (ChangePasswordVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Select count(user_cd) as UserCount from m_login_password");
            sqlQuery.Append(" Where	user_cd = :usercode ");
            sqlQuery.Append(" and ");
            sqlQuery.Append(" password = :password ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("password", inVo.Password);
            sqlParameter.AddParameterString("usercode", inVo.UserCode);

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            ChangePasswordVo outVo = new ChangePasswordVo();

            outVo.AffectedCount = 0;

            while (dataReader.Read())
            {
                outVo.AffectedCount = Convert.ToInt32(dataReader["UserCount"].ToString());
            }

            dataReader.Close();

            return(outVo);
        }