示例#1
0
        protected void LoginUser_Click(object sender, EventArgs e)
        {
            Registrations registrationObj = new Registrations();
            string        Pass            = registrationObj.encryptpass(Password.Text);


            GenerateQuery QueryObj = new GenerateQuery();

            string[,] ReplaceValues = new string[2, 2];
            ReplaceValues[0, 0]     = "_UserName_";
            ReplaceValues[0, 1]     = UserName.Text;
            ReplaceValues[1, 0]     = "_Password_";
            ReplaceValues[1, 1]     = Password.Text;
            long   UserId = 0;
            string User   = "";

            Registration registration = null;

            string Query = QueryObj.GetQueryViaFileAndTagName("LogIn.xml", "ValidUserOrNot");

            Query = Query.Replace("_UserName_", UserName.Text.ToString());
            Query = Query.Replace("_Password_", Password.Text.ToString());
            if (Query != "")
            {
                UserId = QueryObj.GetSingleNumericValueViaQuery(Query, ReplaceValues, Connection);
                User   = QueryObj.GetSingleStringValueViaQuery(Query, ReplaceValues, Connection);
                if (UserId > 0)
                {
                    Response.Redirect("ListPage.aspx?UserId=" + UserId);
                }
                else
                {
                    UserName.Text = "";
                    Password.Text = "";
                    Label1.Text   = "Enter User Name And Password is incurrect please try again.";
                }
            }
            if (Query != "")
            {
                registration = QueryObj.GetCollectionOfDataViaQuery(Query);
                DataTable DataTableObj = new DataTable("DataTable");
                DataTableObj = QueryObj.GetCollectionOfDataSetViaQuery(Query);
                if (DataTableObj != null)
                {
                    //Data Set havinf data now retrive it to its sutiable properties
                }
            }
            if (Query != "")
            {
                registration = QueryObj.GetCollectionSearchDataViaQuery(Query, ReplaceValues, null, null, "", registration);
            }
        }