Exemplo n.º 1
0
    /// <summary>
    /// The branch menu item click event handler.
    /// </summary>
    private void Branch_ItemClick(object sender, PXListItemEventArgs e)
    {
        var targetBranch = int.Parse(e.Item.Value);

        if (targetBranch < 1)
        {
            return;
        }

        PXDropDown dropDown = this.GetBranchCombo();

        foreach (PXAccess.BranchCollection.Info item in GetBranches())
        {
            if (targetBranch.Equals(item.Id))
            {
                PXContext.SetBranchID(targetBranch);
                HttpCookie branchCooky = HttpContext.Current.Response.Cookies["UserBranch"];
                if (dropDown != null)
                {
                    dropDown.Value = item.Id;
                }

                //if (this.Page is PXPage) ((PXPage)this.Page).ResetCurrentUser(HttpContext.Current);

                string branchObj = targetBranch.ToString();
                if (branchCooky == null)
                {
                    HttpContext.Current.Response.Cookies.Add(new HttpCookie("UserBranch", branchObj));
                }
                else
                {
                    branchCooky.Value = branchObj;
                }
                break;
            }
        }
    }
Exemplo n.º 2
0
	/// <summary>
	/// The branch menu item click event handler.
	/// </summary>
	private void Branch_ItemClick(object sender, PXListItemEventArgs e)
	{
		var targetBranch = int.Parse(e.Item.Value);
		if (targetBranch < 1) return;

		PXDropDown dropDown = this.GetBranchCombo();
		foreach (PXAccess.BranchCollection.Info item in GetBranches())
			if (targetBranch.Equals(item.Id))
			{
				PXContext.SetBranchID(targetBranch);
				HttpCookie branchCooky = HttpContext.Current.Response.Cookies["UserBranch"];
				if (dropDown != null) dropDown.Value = item.Id;

				//if (this.Page is PXPage) ((PXPage)this.Page).ResetCurrentUser(HttpContext.Current);
				
				string branchObj = targetBranch.ToString();
				if (branchCooky == null)
					HttpContext.Current.Response.Cookies.Add(new HttpCookie("UserBranch", branchObj));
				else
					branchCooky.Value = branchObj;
				break;
			}
	}