⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userapplicationbean.java

📁 THIS IS A FINANCIAL BANK APPLICATION
💻 JAVA
字号:
package org.pcrdpg.web;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import javax.faces.context.FacesContext;
import javax.faces.el.ValueBinding;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import ma.bmce.bean.MapBean;
import ma.bmce.tools.Context_;

import Pcrd.Subscription.Beans.*;
import Pcrd.Subscription.Entities.Bank;
import Pcrd.Subscription.Entities.Branch;
import Pcrd.Subscription.Entities.UsersProfile;
import Pcrd.Subscription.Sessions.*;

public class UserApplicationBean {

	private String userName = "BMCE_DEV";
	private String userPasswd = "pcard001";

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserPasswd() {
		return userPasswd;
	}

	public void setUserPasswd(String userPasswd) {
		this.userPasswd = userPasswd;
	}

	@SuppressWarnings("deprecation")
	public String login() {
		/*
		 * //ecrire javax.faces.context.FacesContext context =
		 * javax.faces.context.FacesContext.getCurrentInstance();
		 * 
		 * javax.faces.el.ValueBinding binding =
		 * context.getApplication().createValueBinding("#{usersProfile}");
		 * 
		 * binding.setValue(context,usersProfile);
		 * 
		 * 
		 * //lire javax.faces.context.FacesContext context =
		 * javax.faces.context.FacesContext.getCurrentInstance();
		 * 
		 * javax.faces.el.ValueBinding binding =
		 * context.getApplication().createValueBinding("#{usersProfile}");
		 * 
		 * UsersProfile usersProfile = (UsersProfile) binding.getValue(context);
		 */

		Context context;
		try {
			context = new InitialContext();
			UsersProfileManager ub = (UsersProfileManager) context
					.lookup("UsersProfileManagerBean/remote");

			BranchManager brm = (BranchManager) context
					.lookup("BranchManagerBean/remote");
			BankManager bkm = (BankManager) context
					.lookup("BankManagerBean/remote");

			Object obj = FacesContext.getCurrentInstance().getApplication()
					.getVariableResolver().resolveVariable(
							FacesContext.getCurrentInstance(), "mapBean");
			MapBean mapbean = (MapBean) obj;

			System.out.print("login :");
			if (userName != null && userPasswd != null) {
				UsersProfile usersProfile = ub.connection(this.userName,
						this.userPasswd);
				// /Ecrire dans le usersProfile
				if (usersProfile != null) {
					FacesContext cont = javax.faces.context.FacesContext
							.getCurrentInstance();
					ValueBinding binding = cont.getApplication()
							.createValueBinding("#{usersProfile}");
					binding.setValue(cont, usersProfile);
					
					binding = cont.getApplication()
					.createValueBinding("#{user}");
			        binding.setValue(cont, usersProfile);
					
			        // //
					Context_ ctx=new Context_();
					UsersProfile users=(UsersProfile)ctx.recupererObjet();
					// UsersProfile user_infos=CardPB.listerInfosPV("BOP_ENH");
					Bank bk = bkm.affichrLabelBank(usersProfile
							.getDefaultBank());

					System.out.print(usersProfile.getDefaultBank() + "--\n");
					System.out.print(bk.getBankName() + "--\n");
					mapbean.setBank(usersProfile.getDefaultBank() + "--"
							+ bk.getBankName());
					mapbean.setCf(usersProfile.getDefaultBranch());
					Branch branch = brm.affichrLabelBranch(usersProfile
							.getDefaultBranch(), usersProfile.getDefaultBank());
					System.out.println("######## Agence : "
							+ usersProfile.getDefaultBranch() + "--\n");
					if (branch != null) {
						mapbean.setAgence(branch.getBranchName());
					}

					// this.setDate_sousc();

					Locale locale = Locale.getDefault();
					Date actuelle = new Date();
					DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
					String dat = dateFormat.format(actuelle);
					mapbean.setDate_sousc(dat);
					mapbean.setDate_maj(dat);
					//System.out.print("#######affichage USSD :"+this.getCanaux(
					// ).get
					// (0));
					mapbean
							.setRac_ag_vente(usersProfile
									.getUserTerminalGroup());

					// //////////

					System.out.println("sucess");
					
					//System.out.println("bank : "+user_infos.getDefaultBank());
					return "accueil";
				} else {
					System.out.print("error :");

					return "error";

				}
			} else {
				System.out.print("error :");

				return "error";

			}

		} catch (Exception e) {
			System.out.println("Exception:" + e.getMessage());
			e.printStackTrace();
		}
		return "error";
	}

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -