public void CallLogin() { try{ InputField[] arr = UnityEngine.Object.FindObjectsOfType <InputField>(); string username = arr[0].text; string password = arr[1].text; if (!IsValidEmailAddress(username)) { throw new Exception("E-mail is in wrong format"); } DAO database = new DAO(); database.Register(username, password); FacebookManager.Instance().user_ID = database.LoginWithEmail(username, password); if (FacebookManager.Instance().user_ID > -1) { Texture2D tex = Resources.Load("profile") as Texture2D; FacebookManager.Instance().ProfilePic = Sprite.Create(tex , new Rect(0, 0, 336, 336), new Vector2(0, 0)); AppMaster.currentScene = "user"; AppMaster.Instance().callHit(); Application.LoadLevel("user"); } else { Debug.Log("Failed Login"); } } catch (Exception ex) { Debug.Log("Error : " + ex.Message); } }
/// <summary> /// Get application master information. /// </summary> /// <returns>RbAppMasterCache</returns> private RbAppMasterCache GetAppMasterInfo(RbHeader rbh) { AppMaster am = null; bool am_action = true; RbAppMasterCache rbappmc = null; if (rbAppMasterCacheDic.ContainsKey(rbh.AppId)) { rbappmc = (RbAppMasterCache)rbAppMasterCacheDic[rbh.AppId]; if (rbappmc.CacheExpiredDatetime >= DateTime.Now) { am_action = false; } } if (am_action) { am = new AppMaster(rbh.AppId, rbEncPassPhrase, sqlConnectionString, rbCacheExpiredTimeSec); rbappmc = am.GetAppMaster(); if (rbappmc != null) { lock (thisLock) { rbAppMasterCacheDic[rbh.AppId] = rbappmc; } } else { throw new ApplicationException("Error ** GetAppMaster() returns Null Object"); } } return(rbappmc); }
public void OnDestroy() { if (instance == this) { instance = null; } }
//c2fep //第1次请求登录 static public void sendLoginFirstAccountInfo() { c2fep.ReqLogin reqLogin = new c2fep.ReqLogin(); // 客户端版本 string appVersion = AppMaster.Version(); byte[] appVersionBytes = TextEncode.Convert.UTFString2ServerBin(appVersion); System.Array.Copy(appVersionBytes, reqLogin.client_version, appVersionBytes.Length); //用户名 string account = Game.account; //"TD" + System.Convert.ToString ( AppMaster.TimeSince1970 ); byte[] accountBytes = TextEncode.Convert.UTFString2ServerBin(account); //最大长度 int accountLength = (int)twp.app.EDef.LIMIT_LOGIN_DATA_LENGTH - 1; if (account.Length < (int)twp.app.EDef.LIMIT_LOGIN_DATA_LENGTH) { accountLength = account.Length; } System.Array.Copy(accountBytes, reqLogin.data, accountLength); reqLogin.data [accountLength] = System.Convert.ToByte('\0'); reqLogin.data_len = (UInt16)(accountLength + 1); //send NetSocket.CBoard.Instance.send(reqLogin.ToBin()); }
//第2次请求登录 static public void sendAccountAndPasswdToGameServer() { c2fep.ReqLogin reqLogin = new c2fep.ReqLogin(); // 客户端版本 string appVersion = AppMaster.Version(); byte[] appVersionBytes = TextEncode.Convert.UTFString2ServerBin(appVersion); System.Array.Copy(appVersionBytes, reqLogin.client_version, appVersionBytes.Length); //密码 string password = AppMaster.MD5ByString(Game.password); byte[] passwordBytes = TextEncode.Convert.UTFString2ServerBin(password); int passwordLength = (int)twp.app.EDef.LIMIT_LOGIN_DATA_LENGTH - 1; if (password.Length < (int)twp.app.EDef.LIMIT_LOGIN_DATA_LENGTH) { passwordLength = password.Length; } System.Array.Copy(passwordBytes, reqLogin.data, passwordLength); reqLogin.data [passwordLength] = System.Convert.ToByte('\0'); reqLogin.data_len = (UInt16)(passwordLength + 1); //send NetSocket.CBoard.Instance.send(reqLogin.ToBin()); }
// Update is called once per frame void Update() { //Debug.Log("BackButton: Update"); //Debug.Log("BackButton in scene: " + Application.loadedLevelName); // if running on Android if (Application.platform == RuntimePlatform.Android) { // if back button is pressed if (Input.GetKeyDown(KeyCode.Escape)) { // if AR scene go back to user scene if (Application.loadedLevelName == "battle") { AppMaster.currentScene = "user"; } AppMaster.Instance().callHit(); Application.LoadLevel("user"); // if user scene kill the app if (Application.loadedLevelName == "user") { Application.Quit(); } // if login scene kill the app if (Application.loadedLevelName == "login") { Application.Quit(); } } } }
IEnumerator DisplayScene() { yield return(new WaitForSeconds(timer)); AppMaster.currentScene = levelToLoad; AppMaster.Instance().callHit(); Application.LoadLevel(levelToLoad); }
static public AppMaster GetInstance() { if (_instance == null) { _instance = new AppMaster(); } return(_instance); }
// setup instance void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(this); } }
public void loadScene(string scene) { if (scene.Equals("login")) { FacebookManager.Instance().callLogout(); StartCoroutine("Logout"); } AppMaster.currentScene = scene; AppMaster.Instance().callHit(); Application.LoadLevel(scene); }
public IHttpActionResult DeleteAppMaster(AppMaster master) { try { using (MususAppEntities entity = new MususAppEntities()) { var app = entity.AppMasters.FirstOrDefault(x => x.Id == master.Id); app.IsDeleted = true; app.DeletedTime = DateTime.Now; entity.SaveChanges(); return(Ok("hosted app updated successfully")); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }
void Awake() { Debug.Log("AppMaster: Awake"); if (instance == null) { instance = this; } if (googleAnalytics != null) { googleAnalytics.LogScreen(currentScene); } // keep the gameObject otherwise this // instance won't exist DontDestroyOnLoad(gameObject); DontDestroyOnLoad(googleAnalytics); }
public IHttpActionResult PostAppMaster() { try { using (MususAppEntities entity = new MususAppEntities()) { AppMaster master = null; var httpRequest = HttpContext.Current.Request; if (httpRequest.Params["id"] != null) { var id = Guid.Parse(httpRequest.Params["id"]); master = entity.AppMasters.FirstOrDefault(x => x.Id == id); if (master != null) { UploadAttachments(master); } else { BadRequest("Application not exists"); } } else { master = new AppMaster(); master.Id = Guid.NewGuid(); master.CreatedTime = DateTime.UtcNow; master.IsDeleted = false; master.DeletedTime = null; UploadAttachments(master); entity.AppMasters.Add(master); } entity.SaveChanges(); return(Ok(master)); } } catch (Exception ex) { return(BadRequest(ex.Message)); } }
private void MapHostedAppObject(AppMaster master, AppMasterDto dto) { dto.AndriodSmartPhoneBuild = master.AndriodSmartPhoneBuild; dto.AndriodTabletBuild = master.AndriodTabletBuild; dto.CategoryId = master.CategoryId; dto.CreatedTime = master.CreatedTime; dto.DeletedTime = master.DeletedTime; dto.Description = master.Description; dto.Icon = master.Icon; dto.Id = master.Id; dto.IpadBuild = master.IpadBuild; dto.IpadPackageName = master.IpadPackageName; dto.IphoneBuild = master.IphoneBuild; dto.IphonePackageName = master.IphonePackageName; dto.IsDeleted = master.IsDeleted; dto.Published = master.Published; dto.Title = master.Title; dto.Version = master.Version; dto.Download = master.Download ?? 0; if (master.Documents != null) { var documents = master.Documents.Split(new char[] { ';' }); foreach (var doc in documents) { dto.Documents.Add(doc); } } if (master.ScreenShots != null) { var screenShots = master.ScreenShots.Split(new char[] { ';' }); foreach (var doc in screenShots) { dto.ScreenShots.Add(doc); } } }
public HttpResponseMessage ItemMaster(M_AT_Mst_ItemMasterBO ObjItem) { ArrayList items = new ArrayList(); try { HttpResponseMessage RetResponse = new HttpResponseMessage(); string var_Company_ID = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "CMPID", "0"); string var_Branch_ID = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "BRID", "0"); string var_User_ID = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "UserID", "0"); string var_User_Name = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "UserName", ""); string var_ART = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "ART", ""); string var_MItem_ID = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "HDRID", "0"); string var_Item_Type = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "Item_Type", ""); string strSQLFilter = ""; strSQLFilter = " AND Fk_Company_ID=" + var_Company_ID + " AND Fk_Branch_ID=" + var_Branch_ID; if (var_Item_Type.Length > 0) { strSQLFilter = strSQLFilter + " AND Item_Type='" + var_Item_Type + "'"; } if (var_MItem_ID.Length > 0) { if (Convert.ToInt64(var_MItem_ID) > 0) { strSQLFilter = strSQLFilter + " AND MItem_ID=" + Convert.ToInt64(var_MItem_ID); } } if (var_ART == "List") { items = AppMaster.Get_Mst_Item_Lst(Convert.ToInt64(var_MItem_ID), strSQLFilter, ""); if (items != null) { RetResponse = Request.CreateResponse(HttpStatusCode.OK, (new JsonRetMessage(false, true, "item master get successfully", items))); } else { RetResponse = Request.CreateResponse(HttpStatusCode.OK, (new JsonRetMessage(false, true, "no records found", "[]"))); } } if (var_ART == "RCUD") { string varResMsg = ""; if (ObjItem != null) { ObjItem.Fk_Company_ID = Convert.ToInt64(var_Company_ID); ObjItem.Fk_Branch_ID = Convert.ToInt64(var_Company_ID); ObjItem.MDBSC_RowCreatedByUser_ID = Convert.ToInt16(var_User_ID); ObjItem.MDBSC_RowCreatedByUserName = var_User_Name; ObjItem.MDBSC_RowLupdnByUser_ID = Convert.ToInt16(var_User_ID); ObjItem.MDBSC_RowLupdnUserName = var_User_Name; varResMsg = AppMaster.CU_Mst_Item(ObjItem); ObjItem.MItem_ID = Convert.ToInt64(varResMsg.Substring((varResMsg.IndexOf("|") + 1), (varResMsg.Length - varResMsg.IndexOf("|") - 1))); varResMsg = varResMsg.Substring((0), (varResMsg.IndexOf("|"))); if (ObjItem.MItem_ID > 0) { items = AppMaster.Get_Mst_Item_Lst(ObjItem.MItem_ID, strSQLFilter, ""); } Boolean varRetStatus = false; if ((varResMsg == "Added Successfully") || (varResMsg == "Updated Successfully")) { varRetStatus = true; } RetResponse = Request.CreateResponse(HttpStatusCode.OK, (new JsonRetMessage(false, varRetStatus, varResMsg, items))); } else { RetResponse = Request.CreateResponse(HttpStatusCode.OK, (new JsonRetMessage(false, false, "invalid item master object", "[]"))); } } return(RetResponse); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.OK, (new JsonRetMessage(true, false, "internal server error " + Environment.NewLine + ex.Message, "[]")))); } }
private void UploadAttachments(AppMaster master) { var httpRequest = HttpContext.Current.Request; master.CategoryId = Convert.ToInt16(httpRequest.Params["categoryId"]); master.Title = httpRequest.Params["title"]; master.Description = httpRequest.Params["description"]; master.Version = httpRequest.Params["version"]; master.IphonePackageName = httpRequest.Params["iphonePackageName"]; master.IpadPackageName = httpRequest.Params["ipadPackageName"]; master.Published = httpRequest.Params["published"] != null? Convert.ToBoolean(httpRequest.Params["published"]) : false; if (httpRequest.Files.Count > 0) { foreach (string file in httpRequest.Files) { var postedFile = httpRequest.Files[file]; if (postedFile != null && postedFile.ContentLength > 0) { string serverAddress = Process(postedFile); switch (file) { case "AndriodSmartPhoneBuild": master.AndriodSmartPhoneBuild = serverAddress; break; case "Icon": master.Icon = serverAddress; break; case "AndriodTabletBuild": master.AndriodTabletBuild = serverAddress; break; case "IphoneBuild": master.IphoneBuild = serverAddress; break; case "IpadBuild": master.IpadBuild = serverAddress; break; case "ScreenShots": if (master.ScreenShots != null) { master.ScreenShots += ";" + serverAddress; } else { master.ScreenShots = serverAddress; } break; case "Documents": if (master.Documents != null) { master.Documents += ";" + serverAddress; } else { master.Documents = serverAddress; } break; } } } } }
public void CallFBLogin() { AppMaster.currentScene = "user"; AppMaster.Instance().callHit(); FacebookManager.Instance().callLogin(); }
private static void GetPostComment(MususAppEntities entity, AppMaster appMaster, AppMasterDto app, string userName) { var userPost = entity.Posts.FirstOrDefault(x => x.AppId == appMaster.Id && x.UserName == userName); if (userPost != null) { var userCR = new CommentReview() { Comment = userPost.Txt, CommentDate = userPost.CreateTime, Username = userName, Id = userPost.Id }; var userComment = entity.Comments.FirstOrDefault(x => x.PostId == userPost.Id); if (userComment != null) { userCR.Review = userComment.Msg; userCR.ReviewDate = userComment.CreateTime; userCR.ReviewUsername = userComment.UserName; } app.UserComment = userCR; } if (app.UserComment == null) { var posts = entity.Posts.Where(x => x.AppId == appMaster.Id).OrderByDescending(x => x.CreateTime); if (posts != null) { foreach (var post in posts) { var review = entity.Comments.FirstOrDefault(x => x.PostId == post.Id); if (review != null) { app.CommentReviews.Add(new CommentReview() { Id = post.Id, Comment = post.Txt, CommentDate = post.CreateTime, Review = review.Msg, ReviewDate = review.CreateTime, ReviewUsername = review.UserName, Username = post.UserName }); } else { app.CommentReviews.Add(new CommentReview() { Id = post.Id, Comment = post.Txt, CommentDate = post.CreateTime }); } } } } else { var posts = entity.Posts.Where(x => x.AppId == appMaster.Id).OrderByDescending(x => x.CreateTime); if (posts != null) { foreach (var post in posts) { var review = entity.Comments.FirstOrDefault(x => x.PostId == post.Id); if (review != null) { app.CommentReviews.Add(new CommentReview() { Id = post.Id, Comment = post.Txt, CommentDate = post.CreateTime, Review = review.Msg, ReviewDate = review.CreateTime, ReviewUsername = review.UserName, Username = post.UserName }); } else { app.CommentReviews.Add(new CommentReview() { Id = post.Id, Comment = post.Txt, CommentDate = post.CreateTime }); } } } } }
public HttpResponseMessage CustomerMaster(M_AT_Mst_CustomerBO ObjCust) { ArrayList items = new ArrayList(); try { HttpResponseMessage RetResponse = new HttpResponseMessage(); string var_Company_ID = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "CMPID", "0"); string var_Branch_ID = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "BRID", "0"); string var_User_ID = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "UserID", "0"); string var_User_Name = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "UserName", ""); string var_ART = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "ART", ""); string var_M_Cust_ID = MaheshAF18.Application.CodeAssistance.GetHttpHeaderValue(Request, "HDRID", "0"); string strSQLFilter = ""; strSQLFilter = " AND Fk_Company_ID=" + var_Company_ID + " AND Fk_Branch_ID=" + var_Branch_ID; if (var_M_Cust_ID.Length > 0) { if (Convert.ToInt64(var_M_Cust_ID) > 0) { strSQLFilter = strSQLFilter + " AND M_Cust_ID=" + Convert.ToInt64(var_M_Cust_ID); } } if (var_ART == "List") { items = AppMaster.Get_Mst_Customer_Lst(Convert.ToInt64(var_M_Cust_ID), strSQLFilter, ""); if ((items != null) || (items.Count > 0)) { RetResponse = Request.CreateResponse(HttpStatusCode.OK, (new JsonRetMessage(false, true, "customer master get successfully", items))); } else { RetResponse = Request.CreateResponse(HttpStatusCode.OK, (new JsonRetMessage(false, true, "no records found", "[]"))); } } if (var_ART == "RCUD") { string varResMsg = ""; if (ObjCust != null) { ObjCust.Fk_Company_ID = Convert.ToInt64(var_Company_ID); ObjCust.Fk_Branch_ID = Convert.ToInt64(var_Company_ID); ObjCust.MDBSC_RowCreatedByUser_ID = Convert.ToInt16(var_User_ID); ObjCust.MDBSC_RowCreatedByUserName = var_User_Name; ObjCust.MDBSC_RowLupdnByUser_ID = Convert.ToInt16(var_User_ID); ObjCust.MDBSC_RowLupdnUserName = var_User_Name; //PropertyInfo[] properties =ObjCust.GetType().GetProperties(); //foreach (var property in properties) //{ // if (property.PropertyType == typeof(string) && property.GetValue( != null) // { // string newvalue = GetUpdatedValue(); // property.SetValue(this, newvalue); // } //} MPAL.ParseObject(ObjCust); varResMsg = AppMaster.CU_Mst_Customer(ObjCust); ObjCust.M_Cust_ID = Convert.ToInt64(varResMsg.Substring((varResMsg.IndexOf("|") + 1), (varResMsg.Length - varResMsg.IndexOf("|") - 1))); varResMsg = varResMsg.Substring((0), (varResMsg.IndexOf("|"))); if (ObjCust.M_Cust_ID > 0) { items = AppMaster.Get_Mst_Customer_Lst(ObjCust.M_Cust_ID, strSQLFilter, ""); } Boolean varRetStatus = false; if ((varResMsg == "Added Successfully") || (varResMsg == "Updated Successfully")) { varRetStatus = true; } RetResponse = Request.CreateResponse(HttpStatusCode.OK, (new JsonRetMessage(false, varRetStatus, varResMsg, items))); } else { RetResponse = Request.CreateResponse(HttpStatusCode.OK, (new JsonRetMessage(false, false, "invalid item master object", "[]"))); } } return(RetResponse); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.OK, (new JsonRetMessage(true, false, "internal server error " + Environment.NewLine + ex.Message, "[]")))); } }
private void callAppButton_Click(object sender, EventArgs e) { if (textBoxDllFilePath.Text == string.Empty) { MessageBox.Show("** Error ** DLL File Local Path must be set !!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (textBoxDeviceId.Text == string.Empty) { MessageBox.Show("** Error ** Device ID must be set !!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (checkBoxSkipAppRouter.Checked && textBoxClassName.Text == string.Empty) { MessageBox.Show("** Error ** Class Name must be set !!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Save the TextBox content saveTextBoxContent(); JObject jo_message = JsonConvert.DeserializeObject <JObject>(textBoxInput.Text); // Check RbHeader in detail RbHeaderBuilder hdBuilder = new RbHeaderBuilder(jo_message, textBoxDeviceId.Text); RbHeader rbh = hdBuilder.ValidateJsonSchema(); // RbBody JObject jo_temp = (JObject)jo_message[RbFormatType.RbBody]; string rbBodyString = JsonConvert.SerializeObject(jo_temp); // App Master Cache (RBFX.AppMaster) AppMaster am = new AppMaster(rbh.AppId, activeEncPassPhrase, activeSqlConnectionString, constTimeOutSec); RbAppMasterCache rbappmc = am.GetAppMaster(); // App Router Cache (RBFX.AppRouting) RbAppRouterCache rbapprc; if (checkBoxSkipAppRouter.Checked) { rbapprc = new RbAppRouterCache(); rbapprc.AppId = rbh.AppId; rbapprc.AppProcessingId = rbh.AppProcessingId; rbapprc.ClassName = textBoxClassName.Text; rbapprc.FileName = textBoxDllFilePath.Text; } else { AppRouter ar = new AppRouter(rbh.AppId, rbh.AppProcessingId, activeSqlConnectionString, constTimeOutSec); rbapprc = ar.GetAppRouting(); } // Load DLL //Assembly assembly = null; AppDomain appDomain = null; IAppRouterDll routedAppDll = null; try { //assembly = System.Reflection.Assembly.LoadFrom(textBoxDllFilePath.Text); //routedAppDll = assembly.CreateInstance(rbapprc.ClassName) as IAppRouterDll; string pid = Thread.CurrentThread.ManagedThreadId.ToString(); string appDomainName = "AppDomain_P" + pid; string cachedDirectory = Path.GetDirectoryName(textBoxDllFilePath.Text); string cachedFileName = Path.GetFileName(textBoxDllFilePath.Text); string cachedFileNameWithoutExt = Path.GetFileNameWithoutExtension(textBoxDllFilePath.Text); appDomain = createAppDomain(appDomainName, cachedDirectory); routedAppDll = appDomain.CreateInstanceAndUnwrap(cachedFileNameWithoutExt, rbapprc.ClassName) as IAppRouterDll; } catch (Exception ex) { MessageBox.Show("** Application (DLL) Load Error ** Check File Path or Class Name \n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Process Message try { rbh.ProcessingStack = activeFileName; JArrayString ja_messagesString = routedAppDll.ProcessMessage(rbappmc, rbapprc, rbh, rbBodyString); JArray ja_messages = ja_messagesString.ConvertToJArray(); textBoxOutput.Text = JsonConvert.SerializeObject(ja_messages); AppDomain.Unload(appDomain); } catch (Exception ex) { MessageBox.Show("** Error occured in Application (DLL) **\n" + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); AppDomain.Unload(appDomain); return; } }
/// <summary> /// this is the proper place to do initialization in a master page /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Init(object sender, EventArgs e) { //app specific stuff outside the base controller APPMaster = new AppMaster(); APPMaster.SetBaseMaster(this); //Returns a string that can be used in a client //event to cause postback to the server. Page.ClientScript.GetPostBackEventReference(this, String.Empty); //set the character set, since all pages derive from basemaster //this will set the encoding for all pages... Response.ContentEncoding = Encoding.UTF8; //init status info and objects m_strStatusComment = string.Empty; m_lStatusCode = -1;//-1 = success no show //04/16/2012 - Security Updates //set the timeout Timeout = (Session.Timeout < 15) ? Timeout = 15 : Timeout = Session.Timeout; //connect to the data source if (!ConnectToDataSource()) { //redirect to an error page Response.Redirect("error_database.aspx"); Response.End(); } //sec helper CSec sec = new CSec(); //DBSessionID gets set in the database when the user //logs in. this is used to cache values in the db and to determine if the //user is logged in // //reset FXUserID, only gets set in the call below FXUserID = 0; if (!String.IsNullOrEmpty(DBSessionID)) { //get actual user id from the database session created when the //user logs in string strUID = ""; if (GetSessionValue("FX_USER_ID", out strUID)) { if (strUID != "") { FXUserID = Convert.ToInt32(strUID); } //load the app specific user details //needed for the application APPMaster.LoadUserDetails(); } else { //log off if we cannot retrieve a valid session, //user timed out LogOff(); } } //user does not have access to this page //so logoff. if (!sec.AuditPageAccess(this)) { LogOff(); } string strPageName = this.GetPageName(); if (strPageName.IndexOf("event_management.aspx") != -1) { Response.AddHeader("X-UA-Compatible", "IE=8,chrome=1"); } else { Response.AddHeader("X-UA-Compatible", "IE=9,chrome=1"); } }
/// <summary> /// this is the proper place to do initialization in a master page /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Init(object sender, EventArgs e) { //app specific stuff outside the base controller APPMaster = new AppMaster(); APPMaster.SetBaseMaster(this); //Returns a string that can be used in a client //event to cause postback to the server. Page.ClientScript.GetPostBackEventReference(this, String.Empty); //set the character set, since all pages derive from basemaster //this will set the encoding for all pages... Response.ContentEncoding = Encoding.UTF8; //init status info and objects m_strStatusComment = ""; m_lStatusCode = -1;//-1 = success no show //04/16/2012 - Security Updates //set the timeout if (Session.Timeout < 15) { Timeout = 15; } else { Timeout = Session.Timeout; } //connect to the data source if (!ConnectToDataSource()) { //redirect to an error page Response.Redirect("error_database.aspx"); Response.End(); } //sec helper CSec sec = new CSec(); //auto-login with CAC/cert NO! //from the inspection user must click banner //so no auto login here /*if (!IsPostBack) * { * string strPage = GetPageName(); * if (strPage != "fx_logoff.aspx") * { * //don't try to login if we clicked the logoff option * if (Request.QueryString["logoff"] == null) * { * //attempt a cac cert login * if (Session["SessionID"] == null) * { * //auto login with the cert on the CAC... * sec.CertLogin(this); * } * } * } * }*/ //get sessionid if set - set user id if session is ok //Session["SessionID"] gets set in the database when the user //logs in. this is used to cache values in the db and also //force timeouts etc.... /* if (Session["SessionID"] != null) * { * m_strSessionID = Session["SessionID"].ToString(); * * //get actual user id * string strUID = ""; * if (GetSessionValue("FX_USER_ID", out strUID)) * { * if (strUID != "") * { * m_lFXUserID = Convert.ToInt32(strUID); * } * * //load the app specific user details * //needed for the application * APPMaster.LoadUserDetails(); * } * } * else * { * //default to ASP.net session if we have not logged in * m_strSessionID = Context.Session.SessionID; * } */ //DBSessionID gets set in the database when the user //logs in. this is used to cache values in the db and to determine if the //user is logged in // //reset FXUserID, only gets set in the call below FXUserID = 0; if (!String.IsNullOrEmpty(DBSessionID)) { //get actual user id from the database session created when the //user logs in string strUID = ""; if (GetSessionValue("FX_USER_ID", out strUID)) { if (strUID != "") { FXUserID = Convert.ToInt32(strUID); } //load the app specific user details //needed for the application APPMaster.LoadUserDetails(); } else { //log off if we cannot retrieve a valid session, //user timed out LogOff(); } } //user does not have access to this page //so logoff. if (!sec.AuditPageAccess(this)) { LogOff(); } long lNewModuleID = -1; //keep the module id, page id and random data segment if (Request.QueryString["mid"] != null) { string strModuleID; GetSessionValue("CURR_MODULE_ID", out strModuleID); if (strModuleID != Request.QueryString["mid"].ToString()) { lNewModuleID = 1; } else { lNewModuleID = -1; } m_lModuleID = Convert.ToInt32(Request.QueryString["mid"].ToString()); SetSessionValue("CURR_MODULE_ID", Convert.ToString(m_lModuleID)); } if (Request.QueryString["pid"] != null) { if (lNewModuleID != -1) { m_lPageID = -1; } else { m_lPageID = Convert.ToInt32(Request.QueryString["pid"].ToString()); } SetSessionValue("CURR_PAGE_ID", Convert.ToString(m_lPageID)); } if (Request.QueryString["rds"] != null) { m_strRDS = Request.QueryString["rds"].ToString(); } if (m_lModuleID < 1) { string strModuleID = ""; if (m_lFXUserID > 0) { GetSessionValue("CURR_MODULE_ID", out strModuleID); if (strModuleID != "") { m_lModuleID = Convert.ToInt32(strModuleID); } } } if (m_lModuleID < 1) { string strModuleID = ""; if (m_lFXUserID > 0) { GetSessionValue("CURR_MODULE_ID", out strModuleID); if (strModuleID != "") { m_lModuleID = Convert.ToInt32(strModuleID); } } } if (m_lPageID < 1) { string strPageID = ""; if (m_lFXUserID > 0) { GetSessionValue("CURR_PAGE_ID", out strPageID); if (strPageID != "") { m_lPageID = Convert.ToInt32(strPageID); } } } }