private List <AgentState> GetStateInner() { List <AgentState> locList = new List <AgentState>(); AgentState locAgentState = new AgentState(); locAgentState.name = "Привет, " + Name + "!"; if (Name != "гость") { Database locDatabase = new Database(); locDatabase.ConectDB("GetAgentState ('" + Name + "')", Reader); } locList.Add(this); return(locList); }
protected void Page_Load(object sender, EventArgs e) { if (Context.User.Identity.Name != "") { Session["UserName"] = Context.User.Identity.Name; AgentState locState = AgentState.GetInstance((string)Session["UserName"]); // Это случай когда регистрация уже произошла if (locState.Name != Context.User.Identity.Name) { locState.Name = Context.User.Identity.Name; DataBind(); } if (locState.BonusStepCountInt > 0) { RptArt.Items[0].FindControl("BonusButton").Visible = true; } else { RptArt.Items[0].FindControl("BonusButton").Visible = false; } if (locState.Dead == "1") { RptArt.Items[0].FindControl("Dead").Visible = true; } } else { } //if (PreviousPage != null) //{ // Button button = (Button)PreviousPage.FindControl("Button1"); // Label1.Text = "Вызов выполнен кнопкой: " + button.Text; // TextBox textBox = (TextBox)PreviousPage.FindControl("TextBox1"); // TextBox1.Text = textBox.Text; //} }
public AgentState(string argUserName) { int Found = -1; for (int i = 0; i < AllAgent.Count; i++) { AgentState locAgentState = AllAgent[i] as AgentState; if (locAgentState.Name == argUserName) { Found = i; break; } } if (Found == -1) { AllAgent.Add(this); CurrentInstance = this; } else { CurrentInstance = AllAgent[Found] as AgentState; } }