protected void Button1_Click(object sender, EventArgs e) { string redirect; redirect = RadioButtonList1.SelectedItem.Text; if (redirect == "Update Bio") { UserInfoClass currentUser = new UserInfoClass(); currentUser.UserName = Label1.Text; Session["UserInfo"] = currentUser; Response.Redirect("UpdateBio.aspx"); } else if (redirect == "Form Teams") { UserInfoClass currentUser = new UserInfoClass(); currentUser.UserName = Label1.Text; Session["UserInfo"] = currentUser; Response.Redirect("FormTeams.aspx"); } else if (redirect == "Choose project") { UserInfoClass currentUser = new UserInfoClass(); currentUser.UserName = Label1.Text; Session["UserInfo"] = currentUser; Response.Redirect("ChooseProject.aspx"); } else if (redirect == "Promote Completed Project") { UserInfoClass currentUser = new UserInfoClass(); currentUser.UserName = Label1.Text; Session["UserInfo"] = currentUser; Response.Redirect("PromoteCompletedProject.aspx"); } }
private void btn_login_Click(object sender, EventArgs e) { CommunicateToServer cts = new CommunicateToServer(); CommResult cr = cts.Login(GlobalClass.strLoginUrlModel, this.txt_user.Text, this.txt_password.Text); if (cr == null) { MessageBox.Show("无法返回对象!"); return; } if (cr.Succ == false) { MessageBox.Show(cr.Message); return; } UserInfoClass ret = cr.Result[0] as UserInfoClass; Program.gc.ClientUserName = ret.BaseInfo.UserCode; Program.gc.ClientPassword = ret.BaseInfo.Password; Program.gc.Odds = ret.BaseInfo.Odds; this.Hide(); MainWindow mw = new MainWindow(); mw.Show(); }
//Set all Userinformation with Id that is given by the LoginHandler Script public static void SetUserInfo(int ID) { //create connection and open it MySqlConnection connection = DbInfo.Connection(); //try to connect to database try { //Build Mysql command MySqlCommand cmd = connection.CreateCommand(); cmd.CommandText = "SELECT `ID`, `Firstname`, `Middlename`, `Lastname`, `Email`, `Password`, `Pin` FROM `users` WHERE `ID`=" + ID; MySqlDataReader reader = cmd.ExecuteReader(); //if match is found if (reader.Read()) { //MessageBox.Show(reader["Firstname"] + " "+ reader["Middlename"].ToString()); Userinformation = new UserInfoClass(ID, reader["Firstname"].ToString(), reader["Middlename"].ToString(), reader["Lastname"].ToString(), reader["Email"].ToString()); } } //finally finally { connection.Close(); } }
void OnCertificateUserRPC(string usrName, string password, NetworkMessageInfo info) { bool certFlag = true; string warning = ""; if (!GlobalInfo.gameStarted) { foreach (UserInfoClass uf in GlobalInfo.userInfoList) { if (uf.name.Equals(usrName)) { certFlag = false; warning = warn1; break; } } } else { certFlag = false; warning = warn2; } networkView.RPC("OnCertficateResultRPC", info.sender, certFlag, warning); if (certFlag) { UserInfoClass uf = new UserInfoClass(); uf.name = usrName; uf.password = password; uf.ipAddress = info.sender.ipAddress; GlobalInfo.userInfoList.Add(uf); GlobalInfo.eventHandler.SendMessage("OnUpdateUserList", SendMessageOptions.DontRequireReceiver); } }
void OnServerInitialized() { UserInfoClass uf = new UserInfoClass(); uf.name = ""; uf.password = ""; GlobalInfo.userInfoList.Add(uf); GlobalInfo.serverFound = true; }
int GetShootRate(UserInfoClass uf) { if (uf.shootCount == 0) { return(0); } else { float a = uf.hitCount * 100 / uf.shootCount; return(Mathf.FloorToInt(a)); } }
protected void Button1_Click(object sender, EventArgs e) { /* SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString); * conn.Open(); * string checkUser = "******" + TextBoxUN.Text + "'"; * SqlCommand com = new SqlCommand(checkUser, conn); * string Role = com.ExecuteScalar().ToString(); * if (Role == "admin") * { * Response.Redirect("admin.aspx"); * } * conn.Close();*/ DataClassesDataContext dc = new DataClassesDataContext(); var userInfo = from q in dc.userInfos where q.Username == TextBoxUN.Text && q.Password == TextBoxPW.Text select q; foreach (var userInfo1 in userInfo) { if (userInfo1.Role == "admin") { UserInfoClass currentUser = new UserInfoClass(); currentUser.UserName = TextBoxUN.Text; Session["UserInfo"] = currentUser; Response.Redirect("admin.aspx"); } else if (userInfo1.Role == "student") { UserInfoClass currentUser = new UserInfoClass(); currentUser.UserName = TextBoxUN.Text; Session["UserInfo"] = currentUser; Response.Redirect("student.aspx"); } else if (userInfo1.Role == "public") { UserInfoClass currentUser = new UserInfoClass(); currentUser.UserName = TextBoxUN.Text; Session["UserInfo"] = currentUser; Response.Redirect("public1.aspx"); } } }
public CommResult Login(string loginUrl, string username, string pwd) { CommResult ret = new CommResult(); string url = string.Format(loginUrl, username, pwd); string json = AccessWebServerClass.GetData(url, Encoding.Default); UserInfoClass user = UserInfoClass.GetUserInfo(json); if (user == null) { ret.Message = json; return(ret); } ret.Succ = true; ret.Message = null; ret.Json = ""; ret.Result = new List <RecordObject>(); ret.Result.Add(user); return(ret); }
void OnDownLoadUserListRPC(bool firstFlag, string name, string password, int team, int equip, float score, int hitCount, int shootCount, bool joined, bool destroyed, bool isReady, NetworkViewID playerViewID) { if (firstFlag) { GlobalInfo.userInfoList.Clear(); } UserInfoClass uf = new UserInfoClass(); uf.name = name; uf.password = password; uf.team = (TeamKind)team; uf.joined = joined; uf.destroyed = destroyed; uf.isReady = isReady; uf.equipment = (EquipmentKind)equip; uf.score = score; uf.hitCount = hitCount; uf.shootCount = shootCount; uf.playerViewID = playerViewID; GlobalInfo.userInfoList.Add(uf); }
public UserRegistryResult UserRegistry(string ProvinceID, string SPID, string RegistrationStyle, string TimeStamp, UserInfo UserDetailInfo) { UserRegistryResult Result = new UserRegistryResult(); Result.Result = ErrorDefinition.BT_IError_Result_UnknowError_Code; Result.ErrorDescription = "初始"; Result.CustID = UserDetailInfo.CustID; Result.ProvinceID = "35"; Result.SPID = SPID; Result.UserAccount = UserDetailInfo.UserAccount; Result.ExtendField = ""; string Message = ""; try { #region MyRegion if (UserDetailInfo.UserAccount == null) { UserDetailInfo.UserAccount = ""; } if (UserDetailInfo.Password == null) { UserDetailInfo.Password = ""; } if (UserDetailInfo.CustID == null) { UserDetailInfo.CustID = ""; } if (UserDetailInfo.Birthday == null) { UserDetailInfo.Birthday = ""; } if (UserDetailInfo.EduLevel == null) { UserDetailInfo.EduLevel = ""; } if (UserDetailInfo.Favorite == null) { UserDetailInfo.Favorite = ""; } if (UserDetailInfo.IncomeLevel == null) { UserDetailInfo.IncomeLevel = ""; } if (UserDetailInfo.Email == null) { UserDetailInfo.Email = ""; } if (UserDetailInfo.PaymentAccount == null) { UserDetailInfo.PaymentAccount = ""; } if (UserDetailInfo.PaymentAccountPassword == null) { UserDetailInfo.PaymentAccountPassword = ""; } if (UserDetailInfo.PaymentAccountType == null) { UserDetailInfo.PaymentAccountType = ""; } if (UserDetailInfo.EnterpriseID == null) { UserDetailInfo.EnterpriseID = ""; } if (UserDetailInfo.ExtendField == null) { UserDetailInfo.ExtendField = ""; } if (UserDetailInfo.CustContactTel == null) { UserDetailInfo.CustContactTel = ""; } #endregion #region 判断是否是特殊的SPID string OldSPID = System.Configuration.ConfigurationManager.AppSettings["OldType_SPID"]; int SIP = OldSPID.IndexOf(SPID); if (SIP >= 0) { // userType = ""; switch (UserDetailInfo.UserType) { case "01": UserDetailInfo.UserType = "14"; break; case "02": UserDetailInfo.UserType = "20"; break; case "03": UserDetailInfo.UserType = "12"; break; case "09": UserDetailInfo.UserType = "90"; break; case "11": UserDetailInfo.UserType = "30"; break; case "00": UserDetailInfo.UserType = "42"; break; default: UserDetailInfo.UserType = "90"; break; } } #endregion UserInfoClass userObj = new UserInfoClass(UserDetailInfo); #region 数据校验 if (CommonUtility.IsEmpty(ProvinceID)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidProvinceID_Msg + ",不能为空"; return Result; } if (ProvinceID.Length != ConstDefinition.Length_ProvinceID) { Result.Result = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidProvinceID_Msg + ",长度有误"; return Result; } //IP是否允许访问 Result.Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out Result.ErrorDescription); if (Result.Result != 0) { return Result; } //接口访问权限判断 Result.Result = CommonBizRules.CheckInterfaceLimit(SPID, "UserRegistry", this.Context, out Result.ErrorDescription); if (Result.Result != 0) { return Result; } if (CommonUtility.IsEmpty(SPID)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidSPID_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidSPID_Msg + ",不能为空"; return Result; } if (SPID.Length != ConstDefinition.Length_SPID) { Result.Result = ErrorDefinition.BT_IError_Result_InValidSPID_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidSPID_Msg + ",长度有误"; return Result; } if (CommonUtility.IsEmpty(RegistrationStyle)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidRegistrationStyle_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidRegistrationStyle_Msg + ",不能为空"; return Result; } if (RegistrationStyle.Length != 2) { Result.Result = ErrorDefinition.BT_IError_Result_InValidRegistrationStyle_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidRegistrationStyle_Msg + ",长度有误"; return Result; } if (ConstDefinition.Span_RegistrationStyle.IndexOf(RegistrationStyle) < 0) { Result.Result = ErrorDefinition.BT_IError_Result_InValidRegistrationStyle_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidRegistrationStyle_Msg + ",无该注册类型"; return Result; } string VoicePwdSPID = System.Configuration.ConfigurationManager.AppSettings["VoicePwd_SPID"]; int SIP1 = VoicePwdSPID.IndexOf(SPID); if (SIP1 < 0) { if (CommonUtility.IsEmpty(UserDetailInfo.Password)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidPassword_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidPassword_Msg + ",密码不能为空"; return Result; } if (!CommonUtility.IsNumeric(UserDetailInfo.Password)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidParameter_Code; ; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidParameter_Msg + "只能是数字"; return Result; } } string MBesttoneSPID = System.Configuration.ConfigurationManager.AppSettings["MBesttoneSPID"]; //string NetBesttoneSPID = ConfigurationManager.AppSettings["NetBesttoneSPID"]; //if (SPID == MBesttoneSPID or SPID = ) //如果是 移百,网百,或世博注册,则赋初值 //bool IsPersonalUserName = false; if (RegistrationStyle == "05" || RegistrationStyle == "06") { //IsPersonalUserName = true ; //赋初值 UserDetailInfo.UserType = "00"; //UserDetailInfo.AreaCode = "10"; //UserDetailInfo.UProvinceID = "01"; //对密码进行校验,必须用户自己设密码 if (CommonUtility.IsEmpty(UserDetailInfo.Password)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidPassword_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidPassword_Msg + ",密码不能为空"; return Result; } if (!CommonUtility.IsNumeric(UserDetailInfo.Password)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidParameter_Code; ; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidParameter_Msg + "只能是数字"; return Result; } } //数据校验 Result.Result = userObj.UserInfoCommonCheck(out Result.ErrorDescription, this.Context); if (Result.Result != 0) return Result; #endregion //bool IsDistributePassword = false; //如果卡号为空则代表该用户是自动分配密码 //如果密码为空则自动分配密码 if (CommonUtility.IsEmpty(userObj.UserAccount) & CommonUtility.IsEmpty(userObj.Password)) { Random rd = new Random(); userObj.Password = rd.Next(111111, 999999).ToString(); } Result.Result = userObj.UserInfoRegistry(this.Context, RegistrationStyle, SPID, out Result.ErrorDescription); Result.ProvinceID = "35"; Result.UserAccount = userObj.UserAccount; Result.CustID = userObj.CustID; //如果注册成功通知积分系统,并发短信通知用户 // 网百和移百是否通知积分系统? if (Result.Result == 0) { string ErrMsg = ""; //通知积分系统 //CommonBizRules.CustInfoNotify(userObj.CustID, userObj.UserAccount, "", "0", "", userObj.PaymentAccountPassword); CIP2BizRules.InsertCustInfoNotify(userObj.CustID, "2", SPID, "", "0", out ErrMsg); //移百系统注册的用户不发短信 if (SIP1 >= 0) { if (CommonUtility.IsEmpty(UserDetailInfo.CustID)) Message = "您已成为号码百事通商旅卡客户,卡号:" + Result.UserAccount + "密码:" + userObj.Password + ",欢迎使用号百商旅服务!此短信免费。"; else Message = "尊敬的" + UserDetailInfo.RealName + ",您的补卡操作已经成功,您的新卡号:" + Result.UserAccount + "密码:" + userObj.Password + ",请您注意查收。如有疑问请您拨打114/118114进行咨询.此短信免费。"; //通知短信网关 //CommonBizRules.SendMessage(userObj.CustContactTel, Message, "35000000"); CommonBizRules.SendMessageV3(userObj.CustContactTel, Message, SPID); } } } catch (Exception e) { Result.Result = ErrorDefinition.IError_Result_System_UnknowError_Code; Result.ErrorDescription = ErrorDefinition.IError_Result_System_UnknowError_Msg + e.Message; } finally { try { #region WriteLog StringBuilder msg = new StringBuilder(); msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n\r\n"); msg.Append("用户注册接口 " + DateTime.Now.ToString("u") + "\r\n"); msg.Append("ProvinceID - " + ProvinceID); msg.Append(";SPID - " + SPID); msg.Append(";RegistrationStyle - " + RegistrationStyle); msg.Append(";TimeStamp - " + TimeStamp + "\r\n"); //记录UserDetailInfo UserInfoClass.WriteLogForUserInfo(UserDetailInfo, ref msg); msg.Append("处理结果 - " + Result.Result); msg.Append("; 错误描述 - " + Result.ErrorDescription + "\r\n"); msg.Append("ProvinceID - " + Result.ProvinceID); msg.Append("; SPID - " + Result.SPID); msg.Append("; UserAccount - " + Result.UserAccount); msg.Append("; CustID - " + Result.CustID); msg.Append("; Message - " + Message); msg.Append("; ExtendField - " + Result.ExtendField + "\r\n"); msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n"); BTUCenterInterfaceLog.CenterForBizTourLog("UserRegistry", msg); #endregion CommonBizRules.WriteDataLog(SPID, UserDetailInfo.CustID, UserDetailInfo.UserAccount, Result.Result, Result.ErrorDescription, "", "UserRegistry"); } catch { } } return Result; }
public UserInfoModifyResult UserInfoModify(string ProvinceID, string SPID, string TimeStamp, UserInfo UserDetailInfo) { //ProvinceID 请求的省份代码 //SPID 请求发起方在认证鉴权系统登记的spid //TimeStamp yyyy-MM-dd HH:m:ss 其中HH 取值为00-23,时区为东八区 //UserDetailInfo 用户基本资料 //注:不允许修改CustID,UserAccount,CertificateCode;若修改密码,则调用"用户密码重置接口" //;若修改绑定主叫号码,则调用"电话号码绑定接口" UserInfoModifyResult Result = new UserInfoModifyResult(); Result.ProvinceID = "35"; Result.Result = ErrorDefinition.BT_IError_Result_UnknowError_Code; Result.CustID = UserDetailInfo.CustID; Result.UserAccount = UserDetailInfo.UserAccount; Result.ErrorDescription = "初始"; Result.ExtendField = ""; #region 判断是否是特殊的SPID string OldSPID = System.Configuration.ConfigurationManager.AppSettings["OldType_SPID"]; int SIP = OldSPID.IndexOf(SPID); if (SIP >= 0) { switch (UserDetailInfo.UserType) { case "01": UserDetailInfo.UserType = "14"; break; case "02": UserDetailInfo.UserType = "20"; break; case "03": UserDetailInfo.UserType = "12"; break; case "09": UserDetailInfo.UserType = "90"; break; case "11": UserDetailInfo.UserType = "30"; break; case "00": UserDetailInfo.UserType = "42"; break; default: UserDetailInfo.UserType = "90"; break; } } #endregion UserInfoClass userObj = new UserInfoClass(UserDetailInfo); try { #region 数据校验 if (CommonUtility.IsEmpty(ProvinceID)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidProvinceID_Msg + ",不能为空"; return Result; } if (ProvinceID.Length != ConstDefinition.Length_ProvinceID) { Result.Result = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidProvinceID_Msg + ",长度有误"; return Result; } ProvinceInfoManager proObject = new ProvinceInfoManager(); object proDataObject = proObject.GetProvinceData(this.Context); if (proObject.GetPropertyByProvinceID(ProvinceID, "ProvinceCode", proDataObject) == "") { Result.Result = ErrorDefinition.BT_IError_Result_InValidProvinceID_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidProvinceID_Msg + ",无该省代码"; return Result; } if (CommonUtility.IsEmpty(SPID)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidSPID_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidSPID_Msg + ",不能为空"; return Result; } if (SPID.Length != ConstDefinition.Length_SPID) { Result.Result = ErrorDefinition.BT_IError_Result_InValidSPID_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidSPID_Msg + "长度有误"; return Result; } if (CommonUtility.IsEmpty(UserDetailInfo.CustID)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidCustID_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidCustID_Msg + "不能为空"; return Result; } if (CommonUtility.IsEmpty(UserDetailInfo.UserAccount)) { Result.Result = ErrorDefinition.BT_IError_Result_InValidUserAccount_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidUserAccount_Msg + ",不能为空"; return Result; } if (UserDetailInfo.UserAccount.Length < ConstDefinition.Length_Min_UserAccount) { Result.Result = ErrorDefinition.BT_IError_Result_InValidUserAccount_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidUserAccount_Msg + ",长度有误"; return Result; } if (UserDetailInfo.UserAccount.Length > ConstDefinition.Length_Max_UserAccount) { Result.Result = ErrorDefinition.BT_IError_Result_InValidUserAccount_Code; Result.ErrorDescription = ErrorDefinition.BT_IError_Result_InValidUserAccount_Msg + ",长度有误"; return Result; } Result.Result = userObj.UserInfoCommonCheck(out Result.ErrorDescription, this.Context); if (Result.Result != 0) return Result; #endregion Result.Result = CommonBizRules.CheckIPLimit(SPID, HttpContext.Current.Request.UserHostAddress, this.Context, out Result.ErrorDescription); if (Result.Result != 0) { return Result; } //接口访问权限判断 Result.Result = CommonBizRules.CheckInterfaceLimit(SPID, "UserInfoModify", this.Context, out Result.ErrorDescription); if (Result.Result != 0) { return Result; } Result.Result = userObj.ModifyUserInfo(SPID, out Result.ErrorDescription); //如果修改成功通知积分系统 string ErrorMsg = ""; if (Result.Result == 0) CIP2BizRules.InsertCustInfoNotify(UserDetailInfo.CustID, "2", SPID, "", "0", out ErrorMsg); } catch (Exception e) { Result.Result = ErrorDefinition.IError_Result_System_UnknowError_Code; Result.ErrorDescription = ErrorDefinition.IError_Result_System_UnknowError_Msg + e.Message; } finally { try { #region WriteLog StringBuilder msg = new StringBuilder(); msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n\r\n"); msg.Append("用户信息修改接口 " + DateTime.Now.ToString("u") + "\r\n"); msg.Append("ProvinceID - " + ProvinceID); msg.Append(";SPID - " + SPID); msg.Append(";TimeStamp - " + TimeStamp + "\r\n"); //记录UserDetailInfo UserInfoClass.WriteLogForUserInfo(UserDetailInfo, ref msg); msg.Append("处理结果 - " + Result.Result); msg.Append("; 错误描述 - " + Result.ErrorDescription + "\r\n"); msg.Append("ProvinceID - " + Result.ProvinceID); msg.Append("; UserAccount - " + Result.UserAccount); msg.Append("; CustID - " + Result.CustID); msg.Append("; ExtendField - " + Result.ExtendField + "\r\n"); msg.Append("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\r\n"); BTUCenterInterfaceLog.CenterForBizTourLog("ModifyUserInfo", msg); #endregion CommonBizRules.WriteDataLog(SPID, UserDetailInfo.CustID, UserDetailInfo.UserAccount, Result.Result, Result.ErrorDescription, "", "UserInfoModify"); } catch { } } return Result; }
private void btn_login_Click(object sender, EventArgs e) { this.btn_login.Enabled = false; this.Cursor = Cursors.WaitCursor; if (this.ddl_websites.SelectedIndex < 0) { MessageBox.Show("请选择平台!"); return; } if (Program.allGc == null) { Program.allGc = Program.gc.CopyTo <GlobalClass>(); } // GlobalClass.resetTypeDataPoints();//必须重新设置,每个平台投注品种不一样 Program.gc.ClientUserName = this.txt_user.Text.Trim(); Program.gc.ClientPassword = this.txt_password.Text.Trim(); Program.gc.ForWeb = this.ddl_websites.SelectedValue.ToString(); GlobalClass.SetConfig(); GlobalClass sgc = new GlobalClass(this.ddl_websites.SelectedValue.ToString()); if (sgc.loadSucc) { Program.gc = sgc; //Program.gc.ForWeb = this.ddl_websites.SelectedValue.ToString(); //return; } CommunicateToServer cts = new CommunicateToServer(); CommResult cr = cts.Login(GlobalClass.strLoginUrlModel, this.txt_user.Text, this.txt_password.Text); if (cr == null) { this.Cursor = Cursors.Default; MessageBox.Show("无法返回对象!"); this.btn_login.Enabled = true; return; } if (cr.Succ == false) { this.Cursor = Cursors.Default; MessageBox.Show(cr.Message); this.btn_login.Enabled = true; return; } this.Cursor = Cursors.WaitCursor; this.Hide(); UserInfoClass ret = cr.Result[0] as UserInfoClass; Program.UserId = ret.BaseInfo.UserId; Program.gc.ClientUserName = ret.BaseInfo.UserCode; Program.gc.ClientPassword = ret.BaseInfo.Password; Program.gc.Odds = ret.BaseInfo.Odds; Program.gc.WXLogNoticeUser = ret.BaseInfo.WXToUser; Program.gc.ClientAliasName = string.IsNullOrEmpty(ret.BaseInfo.AliasName)?ret.BaseInfo.UserCode:ret.BaseInfo.AliasName; XmlDocument xmldoc = new XmlDocument(); try { string strXml = HttpUtility.UrlDecode(ret.BaseInfo.AssetConfig, Encoding.UTF8); xmldoc.LoadXml(strXml); XmlNodeList items = xmldoc.SelectNodes("config[@type='AssetUnits']/item"); Dictionary <string, AssetInfoConfig> assetconfig = new Dictionary <string, AssetInfoConfig>(); if (items.Count > 0) { for (int i = 0; i < items.Count; i++) { string key = items[i].SelectSingleNode("@key").Value; //int val = int.Parse(items[i].SelectSingleNode("@value").Value); //if (!assetconfig.ContainsKey(key)) // assetconfig.Add(key, val); AssetInfoConfig aic = new AssetInfoConfig(GlobalClass.readXmlItems(items[i].OuterXml)); if (!assetconfig.ContainsKey(key)) { assetconfig.Add(key, aic); } } } Program.gc.AssetUnits = assetconfig; } catch (Exception ce) { //return; } if (Program.gc.SvrConfigUrl != null)//获取服务器默认配置 { string strConfig = AccessWebServerClass.GetData(string.Format(Program.gc.SvrConfigUrl, Program.gc.InstHost), Encoding.UTF8); if (strConfig != null && strConfig.Trim().Length > 0) { SvrConfigClass scc = new SvrConfigClass().getObjectByJsonString(strConfig); if (scc.DefaultExchangeHost != null) { Program.gc.LoginDefaultHost = scc.DefaultExchangeHost; } if (scc.WXSvrHost != null) { Program.gc.WXSVRHost = scc.WXSvrHost; } if (scc.DefaultNavHost != null) { Program.gc.NavHost = scc.DefaultNavHost; } } } try { //Program.gc.LoginDefaultHost = WebRuleBuilder.Create(Program.gc).GetChanle(Program.gc.WebNavUrl, Program.gc.LoginDefaultHost); ; GlobalClass.SetConfig(Program.gc.ForWeb); this.Hide(); this.Cursor = Cursors.Default; //必须重新指定登录用户 Program.wxl = new WolfInv.com.LogLib.WXLogClass(Program.gc.ClientAliasName, Program.gc.WXLogNoticeUser, Program.gc.WXLogUrl); MainWindow mw = new MainWindow(); //testWeb mw = new testWeb(); DialogResult res = mw.ShowDialog(); //////while ( res == DialogResult.OK)//如果frm退出是因为要求重启 //////{ ////// if (mw.ForceReboot) ////// { ////// mw.ForceReboot = false; ////// Program.Reboot = false; ////// mw = new MainWindow(); ////// res = mw.ShowDialog(); ////// } ////// //GC.SuppressFinalize(frm); //////} Application.Exit(); } catch (Exception ce1) { MessageBox.Show(string.Format("{0}:{1}", ce1.Message, ce1.StackTrace)); } }