1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
|
using System;
using System.ComponentModel;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Diagnostics;
using theUser=ApplicationSecurity.CurrentUser;
using Core;
namespace phComm
{
public class Desktop : Translation.TranslationPage
{
#region Variables
protected phComm.Components.InternalLinkButton ButtonPassword;
protected phComm.Components.InternalLinkButton ButtonSignOut;
public string winTitle;
public string tempSessionName;
public new string adomaine;
protected System.Web.UI.HtmlControls.HtmlInputHidden JobNumber;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label lblOnHold;
protected System.Web.UI.HtmlControls.HtmlGenericControl NewClaimSpan;
protected System.Web.UI.HtmlControls.HtmlTable tb4;
protected System.Web.UI.HtmlControls.HtmlAnchor aHrefAdmin;
protected System.Web.UI.HtmlControls.HtmlInputHidden hidden1;
protected System.Web.UI.HtmlControls.HtmlGenericControl NewClaim2;
protected System.Web.UI.HtmlControls.HtmlImage imgAdmin;
protected System.Web.UI.HtmlControls.HtmlImage imglLogoBanner;
protected System.Web.UI.HtmlControls.HtmlGenericControl bodyMenu;
protected System.Web.UI.HtmlControls.HtmlAnchor mouseOverColor1;
protected System.Web.UI.HtmlControls.HtmlAnchor mouseOverColor2;
protected System.Web.UI.HtmlControls.HtmlAnchor mouseOverColor3;
protected System.Web.UI.HtmlControls.HtmlAnchor mouseOverColor4;
protected System.Web.UI.HtmlControls.HtmlAnchor mouseOverColor5;
protected System.Web.UI.HtmlControls.HtmlAnchor mouseOverColor6;
protected System.Web.UI.HtmlControls.HtmlGenericControl NewFeatureSpan;
protected System.Web.UI.HtmlControls.HtmlAnchor lnkNewFeature;
protected System.Web.UI.HtmlControls.HtmlImage imgFeature;
protected System.Web.UI.HtmlControls.HtmlAnchor mouseOverColor7;
protected System.Web.UI.WebControls.Label IMGMENU8;
protected System.Web.UI.HtmlControls.HtmlImage Img1;
protected System.Web.UI.WebControls.Label Label1;
protected int InterfaceType; // 1-Red PH 2-BLUE NW
//protected System.Web.UI.WebControls.Repeater Repeater1;
#endregion
private void Page_Load(object sender, System.EventArgs e)
{
// Determine which domain is the master for page-browsing security
adomaine=wwwTools.GetDomainFromURI(Request.Url.AbsoluteUri);
winTitle=phComm.wwwTools.ReturnValueFromResourceFile("WindowTitle_DEFAULT",wwwTools.Cstr(Session["language"]));
hidden1.Value = wwwTools.Cstr(Session["language"]);
ButtonPassword.ActiveButton.Click+=new System.EventHandler(this.PasswordManager_Click);
ButtonSignOut.ActiveButton.Click+=new EventHandler(actButton_Click);
Label2.Text=wwwTools.ReturnValueFromResourceFile("WELCOME",wwwTools.Cstr(Session["language"]));//+" "+ theUser.Name.ToString();
currentUser.Load(null); Label3.Text=DateTime.Now.ToLongDateString();
string sVendorName=(VendorDALC.VendorNameByBusCode(theUser.BusinessCode));
if (sVendorName == "") sVendorName="l'administrateur";
//lblVendor2.Text = wwwTools.ReturnValueFromResourceFile("lblWelcome").ToString()+ sVendorName;
tempSessionName="&HiddenActiveClaim="+Guid.NewGuid().ToString();
Core.TheUser aUser=new TheUser(theUser.Name);
aUser.Load(theUser.BusinessCode);
if (aUser.IsVendor)
{
string strProv = "";
Core.Vendor aVendor=new Core.Vendor(Framework.Cvt.ToInt(aUser.BusinessCode));
strProv = Core.VendorDALC.GetLogCie(aVendor.BusinessCode);
strProv = strProv.ToUpper();
// strProv = aVendor.Address.ProvCode.Value.ToUpper();
//Banner switch
switch (strProv)
{
case "PH" : imglLogoBanner.Src= "images/logo_fondRouge.gif";DefaultMenuColor(); break;
case "AW" : imglLogoBanner.Src= "images/atlanticwindshield.gif";OthersMenuColor(); break;
case "NB" : imglLogoBanner.Src= "images/brunswick.gif";OthersMenuColor(); break;
case "BA" : imglLogoBanner.Src= "images/brunswick.gif";OthersMenuColor(); break;
case "NW" : imglLogoBanner.Src= "images/nationwide.gif";OthersMenuColor(); break;
default : imglLogoBanner.Src= "images/nationwide.gif";OthersMenuColor(); break;
}
}
else
{
}
if (wwwTools.Cstr(Session["language"])=="fr-CA")
{
if (InterfaceType==1)
imgFeature.Src = "images/newfeature_fr.gif";
else
imgFeature.Src = "images/newfeature_frBLUE.gif";
lnkNewFeature.Attributes["onClick"]="window.open('POPUPFR.HTM');";
}
else
{
if (InterfaceType==1)
imgFeature.Src = "images/newfeature_en.gif";
else
imgFeature.Src = "images/newfeature_enBLUE.gif";
lnkNewFeature.Attributes["onClick"]="window.open('POPUPEN.HTM');";
}
aUser.Load("");
if(aUser.IsInRole(theUser.ConstRoleAdministrator))
{
tb4.Visible=true;
aHrefAdmin.Visible = true;
}
else
{
tb4.Visible=false;
aHrefAdmin.Visible = false;
}
}
private void OthersMenuColor()
{
InterfaceType = 2;
string strImg = "";
if (wwwTools.Cstr(Session["language"]) == "fr-CA")
{
strImg = "fr_bgBlue";
imgMenu1.Text = "Votre panier de commande";
// les objets qui sont en commentaire, ce sont qui sont elemines
//imgMenu2.Text = "Nouvelle recherche";
//ImgMenu3.Text = "Commandes en suspend";
//IMGMENU4.Text = "Historique d'achats";
IMGMENU5.Text = "Modifier votre profil";
//IMGMENU6.Text = "Contactez-nous";
//IMGMENU7.Text = "Quitter";
IMGMENU8.Text = "Administrateur";
}
else
{
strImg = "en_bgBlue";
imgMenu1.Text = "Your shopping cart";
//imgMenu2.Text = "New search";
//ImgMenu3.Text = "Pending orders";
//IMGMENU4.Text = "Purchase history";
IMGMENU5.Text = "Modify your profile";
//IMGMENU6.Text = "Contact us";
//IMGMENU7.Text = "Logout";
IMGMENU8.Text = "Administrator";
}
//bodyMenu.Attributes["bgcolor"]="#711c1f";
bodyMenu.Attributes["bgcolor"]="#000000";
mouseOverColor1.Attributes["class"]= "menuOther";
mouseOverColor2.Attributes["class"]= "menuOther";
mouseOverColor3.Attributes["class"]= "menuOther";
mouseOverColor4.Attributes["class"]= "menuOther";
mouseOverColor5.Attributes["class"]= "menuOther";
mouseOverColor6.Attributes["class"]= "menuOther";
mouseOverColor7.Attributes["class"]= "menuOther";
aHrefAdmin.Attributes["class"]= "menuOther";
img0002.Src = "images/0002blue.gif";
//img0004.Src = "images/0004blue.gif";
//img0006.Src = "images/0006blue.gif";
//img0008.Src = "images/0008blue.gif";
img0010.Src = "images/0010blue.gif";
//img0012.Src = "images/0012blue.gif";
//img0014.Src = "images/0014blue.gif";
imgAdmin.Src = "images/0016blue.gif";
}
private void DefaultMenuColor()
{ //Menu1_en_bgRed.gif
InterfaceType = 1;
string strImg = "";
if (wwwTools.Cstr(Session["language"]) == "fr-CA")
{
strImg = "fr_bgRed";
imgMenu1.Text = "Votre panier de commande";
//imgMenu2.Text = "Nouvelle recherche";
//ImgMenu3.Text = "Commandes en suspend";
//IMGMENU4.Text = "Historique d'achats";
IMGMENU5.Text = "Modifier votre profil";
//IMGMENU6.Text = "Contactez-nous";
//IMGMENU7.Text = "Quitter";
IMGMENU8.Text = "Administrateur";
}
else
{
strImg = "en_bgRed";
imgMenu1.Text = " Your shopping cart";
//imgMenu2.Text = "New search";
//ImgMenu3.Text = "Pending orders";
//IMGMENU4.Text = "Purchase history";
IMGMENU5.Text = "Modify your profile";
//IMGMENU6.Text = "Contact us";
//IMGMENU7.Text = "Logout";
IMGMENU8.Text = "Administrator";
}
//menu text as image
//imgMenu1.ImageUrl = "images/Menu1_" + strImg + ".gif";
//imgMenu2.ImageUrl = "images/Menu2_" + strImg + ".gif";
//imgMenu3.ImageUrl = "images/Menu3_" + strImg + ".gif";
//imgMenu4.ImageUrl = "images/Menu4_" + strImg + ".gif";
//imgMenu5.ImageUrl = "images/Menu5_" + strImg + ".gif";
//imgMenu6.ImageUrl = "images/Menu6_" + strImg + ".gif";
//imgMenu7.ImageUrl = "images/Menu7_" + strImg + ".gif";
//imgMenu8.ImageUrl = "images/Menu8_" + strImg + ".gif";
//bodyMenu.Attributes["bgcolor"]="#711c1e";
bodyMenu.Attributes["bgcolor"]="#000000";
mouseOverColor1.Attributes["class"]= "menuQC";
mouseOverColor2.Attributes["class"]= "menuQC";
mouseOverColor3.Attributes["class"]= "menuQC";
mouseOverColor4.Attributes["class"]= "menuQC";
mouseOverColor5.Attributes["class"]= "menuQC";
mouseOverColor6.Attributes["class"]= "menuQC";
mouseOverColor7.Attributes["class"]= "menuQC";
aHrefAdmin.Attributes["class"]= "menuQC";
img0002.Src = "images/0002.gif";
img0004.Src = "images/0004.gif";
img0006.Src = "images/0006.gif";
img0008.Src = "images/0008.gif";
img0010.Src = "images/0010.gif";
img0012.Src = "images/0012.gif";
img0014.Src = "images/0014.gif";
imgAdmin.Src = "images/0016.gif";
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
this.PreRender += new System.EventHandler(this.Desktop_PreRender);
}
#endregion
private void PasswordManager_Click(object sender, System.EventArgs e)
{
//this one's fine
Server.Transfer("PasswordManager.aspx");
}
private void Desktop_PreRender(object sender, EventArgs e)
{
NewClaimSpan.Visible=theUser.IsInRole(theUser.ConstRoleCreator);
//GlassViewDB GVDB = new GlassViewDB();
//lblConnectionX.Text = phComm.wwwTools.ReturnValueFromResourceFile("lblConnection")+" " + GVDB.DatabaseName + " --- " + GVDB.DatabaseServerName;
}
private void actButton_Click(object sender, EventArgs e)
{
// Get ride of last order...
int currOrder = Core.OrderDALC.GetCurrentOrder(ApplicationSecurity.CurrentUser.Name,ApplicationSecurity.CurrentUser.BusinessCode.ToString(),false,false);
if (currOrder!=0)
{
Core.Order c=new Core.Order(currOrder);
// S'il y a des pièces, la mettre de côté...
if (c.Parts.Count>0)
Core.OrderDALC.PutOnHold(c);
else
Core.OrderDALC.Delete(c.OrderNumber);
}
Session.Abandon();
System.Web.Security.FormsAuthentication.SignOut();
Response.Redirect("quit.aspx",true);
}
}
} |
Partager