public string AssociateLogin(string EmailID, string Password)
        {
            string             str          = "0";
            BllAssociateLogin  Objassociate = new BllAssociateLogin();
            PropAssociateLogin Proassociate = new PropAssociateLogin();

            Proassociate.Mob      = EmailID;
            Proassociate.Password = Password;
            str = Objassociate.RecordSelect(Proassociate);
            return(str);
        }
Esempio n. 2
0
        /// <summary>
        /// This Method is used to Select get data for associate login
        /// </summary>
        /// <param name="objCountry">Action</param>
        /// <returns>1 for success and -1 for fail</returns>
        public string RecordSelect(PropAssociateLogin objAssociate)
        {
            DllAssociateLogin objDal = new DllAssociateLogin();

            try
            {
                return(objDal.SelectAssociate(objAssociate));
            }
            catch (Exception info)
            {
                throw info;
            }
            finally
            {
                objDal = null;
            }
        }
        /// <summary>
        /// This Method is used to check authentication of associate
        /// </summary>
        /// <param name="objadmin">Action</param>
        /// <returns>1 for success and -1 for fail</returns>
        public string SelectAssociate(PropAssociateLogin objassociate)
        {
            WcrCryptography          crypto    = new WcrCryptography();
            AssociateLogInParameters sqlParams = new AssociateLogInParameters();

            sqlParams.Mob      = crypto.EncryptUserName(objassociate.Mob.ToLower());
            sqlParams.Password = crypto.EncryptPassword(objassociate.Password);
            string ddd = WcrCryptography.SqlPassphrase;
            HttpResponseMessage resp = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest);

            using (WcrHttpClient client = new WcrHttpClient(objassociate.Mob))
            {
                resp = client.PostAsJsonAsync("api/AssociateTransactions/AssociateLogin", sqlParams).Result;
                AssociateLogin_ReturnDataModel returnModel = JsonConvert.DeserializeObject <AssociateLogin_ReturnDataModel>(resp.Content.ReadAsStringAsync().Result);
                if (returnModel == null)
                {
                    return("0");
                }
                else
                {
                    DataSet   ds    = new DataSet("dataSet");
                    DataTable table = ds.Tables.Add("associateLogin");
                    table.Columns.Add("AssociateId", typeof(int));
                    table.Columns.Add("Status", typeof(int));
                    table.Columns.Add("Mobile", typeof(string));
                    DataRow dr = table.NewRow();
                    dr["AssociateId"] = returnModel.AssociateId;
                    dr["Status"]      = returnModel.Status;
                    dr["Mobile"]      = returnModel.MobileNo;
                    table.Rows.Add(dr);
                    return(ds.GetXml());
                    //if (Id > 0)
                    //{

                    //    return Id.ToString();
                    //}
                    //else
                    //{ return "-1"; }
                }
            }
            //try
            //{
            //    WcrCryptography cardEncrypt = new WcrCryptography();
            //    SqlCommand cmd = new SqlCommand("proc_AssociateLogin", objCon.Con);
            //    cmd.CommandType = CommandType.StoredProcedure;
            //    cmd.Parameters.AddWithValue("@Mob", objassociate.Mob);
            //    cmd.Parameters.AddWithValue("@Password", objassociate.Password);
            //    cmd.Parameters.AddWithValue("@Passphrase", WcrCryptography.SqlPassphrase);
            //    if (objCon.Con.State == ConnectionState.Open)
            //    { }
            //    else
            //    {
            //        objCon.Con.Open();
            //    }
            //    SqlDataReader dr = cmd.ExecuteReader();
            //    DataTable dt = new DataTable();
            //    dt.Load(dr);
            //    objCon.Con.Close();
            //    if (dt.Rows.Count > 0)
            //    {
            //        return dt.Rows[0]["AssociateID"].ToString();
            //    }
            //    else
            //    {
            //        return "-1";
            //    }

            //}
            //catch { return null; }
        }