Esempio n. 1
0
        public DataSet ValidateUser(Signin signin)
        {
            List <SqlParameter> lstsqlparam = new List <SqlParameter>();

            lstsqlparam.Add(new SqlParameter("@EmailID", signin.EmailID));
            lstsqlparam.Add(new SqlParameter("@Password", signin.Password));
            lstsqlparam.Add(new SqlParameter("@IsAgent", signin.IsAgent));
            DataSet ds = SqlHelper.ExecuteDataset(sqlconn, "sp_Login", lstsqlparam.ToArray());

            return(ds);
        }
Esempio n. 2
0
        public bool SignIn(Signin signin)
        {
            try
            {
                List <SqlParameter> lstsqlparam = new List <SqlParameter>();
                lstsqlparam.Add(new SqlParameter("@EmailID", signin.EmailID));
                lstsqlparam.Add(new SqlParameter("@Password", signin.Password));
                lstsqlparam.Add(new SqlParameter("@IsAgent", signin.IsAgent));
                DataSet ds = SqlHelper.ExecuteDataset(sqlconn, "sp_Login", lstsqlparam.ToArray());
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        if (signin.IsAgent == false)
                        {
                            HttpContext.Current.Session["UserID"]    = ds.Tables[0].Rows[0]["UserID"].ToString();
                            HttpContext.Current.Session["FirstName"] = ds.Tables[0].Rows[0]["FirstName"].ToString();
                            HttpContext.Current.Session["LastName"]  = ds.Tables[0].Rows[0]["LastName"].ToString();
                            HttpContext.Current.Session["Email"]     = ds.Tables[0].Rows[0]["Email"].ToString();
                            HttpContext.Current.Session["Mobile"]    = ds.Tables[0].Rows[0]["Mobile"].ToString();
                        }
                        else
                        {
                            HttpContext.Current.Session["AgentId"]    = ds.Tables[0].Rows[0]["AgentID"].ToString();
                            HttpContext.Current.Session["AgentName"]  = ds.Tables[0].Rows[0]["AgentFullName"].ToString();
                            HttpContext.Current.Session["AgentEmail"] = ds.Tables[0].Rows[0]["AgentEmail"].ToString();
                        }

                        return(true);
                    }
                    return(false);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                ExceptionHandling.WriteException(ex);
                return(false);
            }
        }