且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

仅检索注册用户数据

更新时间:2023-02-02 07:50:17

在此,我正在根据供应商和客户提供解决方案,这些人员已由管理员确认

Here I am giving solution based on vendor and customer and those persons are confirmed by admin

DataSet ds = new DataSet();
           DataTable dt = new DataTable();
           CUserRegisTration commObj = new CUserRegisTration();
           BFUserRegistration bfObj = new BFUserRegistration();
           commObj.T1_LoginId = txtLoginId.Text;
           commObj.T1_Password = txtPassword.Text;
           ds = bfObj.DFLoginValidation(commObj);
           dt = ds.Tables[0];
           Session["Customer"] = dt;
           if (dt.Rows.Count >= 1 && (dt.Rows[0]["MemberType"].ToString()) == "BillAdmin")
           {
               Session["UserName"] = "Welcome," + dt.Rows[0]["FirstName"].ToString();
               Session["LoginTime"] = "Logged in at:" + DateTime.Now.ToLocalTime();
               Response.Redirect("Welcome.aspx");
           }
           else if (dt.Rows.Count >= 1 && (dt.Rows[0]["MemberType"].ToString()) == "Customer")
           {
               Session["UserName"] = "Welcome," + dt.Rows[0]["FirstName"].ToString();
               Session["LoginTime"] = "Logged in at:" + DateTime.Now.ToLocalTime();
               Response.Redirect("InventoryManagementSystem.aspx");

           }
           else if (dt.Rows.Count >= 1 && (dt.Rows[0]["MemberType"].ToString()) == "Vendor")
           {
               Session["UserName"] = "Welcome," + dt.Rows[0]["FirstName"].ToString();
               Session["LoginTime"] = "Logged in at:" + DateTime.Now.ToLocalTime();
               Response.Redirect("InventoryManagementSystem.aspx");
           }
           else
           {
               Master.ErrorMessage = "Please enter correct User name and Password.";
           }
       }


按照您的要求进行操作

1.成功登录后,将Username(emailID)分配给会话. (通过发送验证邮件来验证电子邮件ID是一种很好的做法.)

Follow the steps for your requirement

1. Assign Username(emailID) to the session after the successful login. (Its a good practice to verify the Email ID by sending a verification mail.)

Session["UEmail"]= txtUsername.Text.Trim();



注意:您可以在任何页面中检索此会话值,也可以检查登录用户的存在.

2.通过电子邮件ID(在会话中)检索用户的详细信息



Note : You can retrieve this Session Value in any page and also you can check the existence of the login User.

2. Retrieving the Details of the User through Email ID (Which is in Session)

String StrSQL="Select * from [UserDetailsTableName] where EmailID=@EmailID";
//write here code for sending parameters and assingn the value to Dataset of Datatable and do what you want to do with the Data.




谢谢




Thanks