protected void Button1_Click(object sender, EventArgs e) { // mycon = new SqlConnection("server=localhost\\sqlexpress;user id=sa;password=password@1;database=flipkart"); // { // eno = "Select Email_Id,password from customer where Email_Id='" + Textbox1.Text + "'and password='******'"; // mycmd = new SqlCommand(eno, mycon); // mycmd.Connection = mycon; // myadapter = new SqlDataAdapter(mycmd); // //myadapter.SelectCommand = mycmd; // DataSet dt = new DataSet(); // myadapter.Fill(dt, "customer"); // { // if (dt.Tables[0].Rows.Count != 0) // { // lblMsg.Text = "Login Successful!"; // } // else // { // lblMsg.Text = "Invalid UserName or Password"; // } // //Response.Redirect("Home.aspx"); // } // } // LoginFun lObj = new LoginFun(); DataTable da = new DataTable(); int check; check = lObj.log_in(Textbox1.Text, Textbox2.Text, out da); if (check == 1) { GetName uObj = new GetName(); user_name = uObj.User(Textbox1.Text, out da); //Textbox1.Text = ""; //Textbox2.Text = ""; Session["UserName"] = user_name; lblMsg.Text = "Login Successful"; Response.Redirect("Home2.aspx"); } else { lblMsg.Text = "Invalid User Name or Password"; } }
private void LOGINmain() { if (txtUSERNAME.Text == "") { MessageBox.Show("请输入账户!"); return; } if (txtPASSWORD.Text == "") { MessageBox.Show("请输入密码!"); return; } if (ddlMW.SelectedValue.ToString() == "0") { MessageBox.Show("请选择门卫!"); return; } CRM_LoginInfo tokeninfo = crmModels.CRM_Login.Login(txtUSERNAME.Text.Trim(), txtPASSWORD.Text.Trim(), "", "", 1, 0); if (tokeninfo.TokenInfo.access_token == null) { if (tokeninfo.TokenInfo.MSG == "E") { MessageBox.Show(tokeninfo.TokenInfo.MESSAGE); return; } else { MessageBox.Show("用户名或密码错误!"); return; } } else { //登录成功 SSO_TOKEN_USERNAMEDY cxmodel = new SSO_TOKEN_USERNAMEDY(); cxmodel.STAFFID = tokeninfo.TokenInfo.STAFFID; cxmodel.ZHLB = 6; SSO_TOKEN_USERNAMEDY_SELECT data = ssoModels.TOKEN_TOKENIDINFO.USERNAMEDY_SELECT(cxmodel, tokeninfo.TokenInfo.access_token); if (data.MES_RETURN.TYPE == "S") { if (data.SSO_TOKEN_USERNAMEDY.Length > 0) { int ISLOHIN = mainService.CheckMWQX(data.SSO_TOKEN_USERNAMEDY[0].ZHUSERID, ddlMW.SelectedValue.ToString()); if (ISLOHIN == 2) { MessageBox.Show("没有该门卫权限!"); return; } else { ////储存选择的机器到本地 //StreamWriter sw = new StreamWriter WritePrivateProfileString(strSec, "USERNAME", txtUSERNAME.Text, strFilePath); WritePrivateProfileString(strSec, "ddlMW", ddlMW.SelectedValue.ToString(), strFilePath); Appclass.token = tokeninfo.TokenInfo.access_token; Appclass.STAFFID = tokeninfo.TokenInfo.STAFFID; this.Hide(); main Main = new main(ddlMW.SelectedValue.ToString(), data.SSO_TOKEN_USERNAMEDY[0].ZHUSERNAME, loginfun = this.ContentValue); Main.Show(); } } else { MessageBox.Show("没有对应的帐号!"); return; } } else { MessageBox.Show("登录失败!"); return; } } //int ISLOHIN = mainService.LOGIN(txtUSERNAME.Text, txtPASSWORD.Text, ddlMW.SelectedValue.ToString()); //if (ISLOHIN == 1) //{ // MessageBox.Show("用户名或密码错误!"); // return; //} //else if (ISLOHIN == 2) //{ // MessageBox.Show("没有该门卫权限!"); // return; //} //else //{ // WritePrivateProfileString(strSec, "USERNAME", txtUSERNAME.Text, strFilePath); // WritePrivateProfileString(strSec, "ddlMW", ddlMW.SelectedValue.ToString(), strFilePath); // this.Hide(); // main Main = new main(ddlMW.SelectedValue.ToString(), txtUSERNAME.Text); // Main.Show(); //} }