/// <summary> /// 设置COOKIE /// </summary> /// <param name="var">变量</param> /// <returns>结果</returns> private double SETCOOKIE(CVariable var) { string cookieName = m_indicator.GetText(var.m_parameters[0]); UserCookieService cookieService = DataCenter.UserCookieService; UserCookie cookie = new UserCookie(); cookie.m_key = cookieName; cookie.m_value = m_indicator.GetText(var.m_parameters[1]); return(cookieService.AddCookie(cookie)); }
/// <summary> /// 登录 /// </summary> public void Login() { DataCenter.LoadData(1); Close(); return; int state = DataCenter.Connect(); if (state == -1) { m_mainFrame.ShowMessageBox("无法连接服务器!", "提示", 0); return; } TabControlA tabLogin = GetTabControl("tabLogin"); TabPageA selectedTabpage = tabLogin.SelectedTabPage; TextBoxA txtUserName = GetTextBox("txtUserName"); TextBoxA txtPassword = GetTextBox("txtPassword"); String userName = txtUserName.Text; String passWord = txtPassword.Text; if (userName.Length == 0) { m_mainFrame.ShowMessageBox("请输入邮箱!", "提示", 0); return; } if (userName.IndexOf("@") == -1) { m_mainFrame.ShowMessageBox("邮箱格式不符合要求!", "提示", 0); return; } if (passWord.Length == 0) { m_mainFrame.ShowMessageBox("请输入密码!", "提示", 0); return; } int ret = m_loginService.Login(userName, passWord, m_loginRequestID); if (ret != -1) { UserCookieService cookieService = DataCenter.UserCookieService; UserCookie cookie = new UserCookie(); cookie.m_key = "LOGININFO"; cookie.m_value = userName + "," + passWord; cookieService.AddCookie(cookie); m_window.Enabled = false; } }