예제 #1
0
        //--------------------------------------------------------
        //Method to chack Email ther is in DB or not
        public int IsAvailableEmail(String ID_Email)
        {
            int userID = 0;

            try
            {
                UTable = UDA.GetDataByID_Email(ID_Email);

                if (UTable.Rows.Count > 0) // we hava account
                {
                    for (int i = 0; i <= UTable.Rows.Count - 1; i++)
                    {
                        URow = UTable.Rows[0] as DataSet1.UserRow;
                        if (URow.ID_Email == ID_Email)
                        {
                            userID = 1;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                userID = 0;
                //"cannot add your infromation"
            }
            return(userID);
        }
예제 #2
0
        //------------------------------------------------------------
        //Method to login to the system
        public string Login(String ID_Email, String password)
        {
            bool   isVialed = false;
            String Message  = "";
            int    UserType = 0;

            try
            {
                UTable = UDA.GetDataByID_Email(ID_Email);

                {
                    URow = UTable.Rows[0] as DataSet1.UserRow;
                    if (URow.ID_Email == ID_Email && URow.Password == password)
                    {
                        UserType = URow.ID_UserType;
                        isVialed = true;
                        Message  = "Welcom " + URow.FirstName + " " + URow.LastName;
                    }
                    else
                    {
                        UserType = 0;
                        isVialed = false;
                        Message  = "Email or password Not correct !!!!";
                    }
                }
            }
            catch (Exception ex)
            {
                //"cannot add your infromation"
                UserType = 0;
                isVialed = false;
                Message  = "Email or password Not correct !!!!";
            }

            var jsonData = new
            {
                isVialed = isVialed,
                UserType = UserType,
                Message  = Message
            };

            return(ser.Serialize(jsonData));
        }