示例#1
0
        public bool AutenticateUser(User loginDetails)
        {
            try
            {
                //

                DataSet      ds    = null;
                SqlParameter param = new SqlParameter();
                param.ParameterName = "@Action";
                param.Value         = "Authenticate";

                SqlParameter param1 = new SqlParameter();
                param.ParameterName = "@Email";
                param.Value         = loginDetails.Email;

                SqlCommand cmd = new SqlCommand();
                cmd.Parameters.Add(param);
                cmd.Parameters.Add(param1);
                cmd.CommandText = "USP_User_ALL_OperationsAPI";
                cmd.CommandType = CommandType.StoredProcedure;

                ds = SQLDataAccessHelper.ExecuteQuery(cmd);
                if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    // perform your logic based on that return data.
                    return(true);
                }
            }
            catch (Exception ex)
            {
            }
            return(false);
        }
        public int InsertTaiKhoan(string Username, string Pass, out int Result)
        {
            System.Data.DataTable dt            = new System.Data.DataTable();
            int           kq                    = 0;
            List <object> OutputValueCollection = new List <object>();

            try {
                kq = SQLDataAccessHelper.ExecuteNoneQuerySP(spn.sp_TaiKhoan_Insert.ToString(),
                                                            new List <string> {
                    spvn.Username.ToString(), spvn.Pass.ToString(), spvn.Enable.ToString(), spvn.Note.ToString()
                },
                                                            new List <object> {
                    Username, Pass, true, string.Empty
                },
                                                            new List <string> {
                    spvn.Result.ToString()
                },
                                                            new List <SqlDbType> {
                    SqlDbType.Int
                },
                                                            out OutputValueCollection
                                                            );
                Result = (int)OutputValueCollection[0];
            }
            catch (Exception ex) { throw ex; }
            return(kq);
        }