Exemplo n.º 1
0
        /// <summary>
        /// This Method is used to check authentication of Consumer
        /// </summary>
        /// <param name="objadmin">Action</param>
        /// <returns>1 for success and -1 for fail</returns>
        public string SelectConsumer(PropConsumerRegistration objConsumer)
        {
            WcrCryptography         crypto    = new WcrCryptography();
            ConsumerLoginParameters sqlParams = new ConsumerLoginParameters();
            string _Email = objConsumer.MobileNo.ToLower();

            // sqlParams.Mob = crypto.EncryptUserName(objConsumer.MobileNo);
            sqlParams.Mob      = crypto.EncryptUserName(_Email);
            sqlParams.Password = crypto.EncryptPassword(objConsumer.Password);
            HttpResponseMessage resp = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest);

            using (WcrHttpClient client = new WcrHttpClient(objConsumer.MobileNo))
            {
                resp = client.PostAsJsonAsync("api/ConsumerTransactions/ConsumerLogin", sqlParams).Result;
                ConsumerLogin_ReturnDataModel returnModel = JsonConvert.DeserializeObject <ConsumerLogin_ReturnDataModel>(resp.Content.ReadAsStringAsync().Result);
                DataSet   ds    = new DataSet("dataSet");
                DataTable table = ds.Tables.Add("consumerLogin");
                table.Columns.Add("Id", typeof(int));
                table.Columns.Add("Flag", typeof(int));
                DataRow dr = table.NewRow();
                dr["Id"]   = returnModel.Id;
                dr["Flag"] = returnModel.Flag;
                table.Rows.Add(dr);
                return(ds.GetXml());
            }
        }
        /// <summary>
        /// This Methos will be used to update consumer detail
        /// </summary>
        /// <param name="objConsumerRegistration"></param>
        /// <returns></returns>
        public string UpdateData(PropConsumerRegistration objConsumerRegistration)
        {
            WcrCryptography     crypto    = new WcrCryptography();
            ConsumersParameters sqlParams = new ConsumersParameters();

            sqlParams.Name     = crypto.WcrSimpleEncrypt(objConsumerRegistration.Name);
            sqlParams.Address  = crypto.WcrSimpleEncrypt(objConsumerRegistration.Address);
            sqlParams.Mob      = crypto.WcrSimpleEncrypt(objConsumerRegistration.MobileNo);
            sqlParams.UserName = crypto.WcrSimpleEncrypt(objConsumerRegistration.UserName);
            sqlParams.EmailId  = crypto.EncryptUserName(objConsumerRegistration.EmailID);
            sqlParams.Password = crypto.EncryptPassword(objConsumerRegistration.Password);
            sqlParams.ZipCode  = crypto.WcrSimpleEncrypt(objConsumerRegistration.ZipCode);
            sqlParams.LastName = crypto.WcrSimpleEncrypt(objConsumerRegistration.LastName);
            sqlParams.Unit_Apt = crypto.WcrSimpleEncrypt(objConsumerRegistration.Unit_Apt);
            sqlParams.City     = crypto.WcrSimpleEncrypt(objConsumerRegistration.City);
            sqlParams.StateId  = crypto.WcrSimpleEncrypt(objConsumerRegistration.StateID);
            sqlParams.Id       = Convert.ToInt32(objConsumerRegistration.ID);
            HttpResponseMessage resp = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest);

            using (WcrHttpClient client = new WcrHttpClient(objConsumerRegistration.EmailID))
            {
                resp = client.PostAsJsonAsync("api/ConsumerTransactions/ConsumersEditConsumer", sqlParams).Result;
                int Id = JsonConvert.DeserializeObject <int>(resp.Content.ReadAsStringAsync().Result);
                if (Id > 0)
                {
                    return(Id.ToString());
                }
                else
                {
                    return(ClsCommon.InactiveValue.ToString());
                }
            }
            //SqlCommand cmd = new SqlCommand("proc_Consumers", objCon.Con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //objCon.Con.Open();
            //cmd.Parameters.AddWithValue("@Name", objConsumerRegistration.Name);
            //cmd.Parameters.AddWithValue("@address", objConsumerRegistration.Address);
            //cmd.Parameters.AddWithValue("@mob", objConsumerRegistration.MobileNo);
            //cmd.Parameters.AddWithValue("@userName", objConsumerRegistration.UserName);
            //cmd.Parameters.AddWithValue("@password", objConsumerRegistration.Password);
            //cmd.Parameters.AddWithValue("@emailID", objConsumerRegistration.EmailID);
            //cmd.Parameters.AddWithValue("@ZipCode", objConsumerRegistration.ZipCode);
            //cmd.Parameters.AddWithValue("@lastName", objConsumerRegistration.LastName);
            //cmd.Parameters.AddWithValue("@Unit_Apt", objConsumerRegistration.Unit_Apt);
            //cmd.Parameters.AddWithValue("@city", objConsumerRegistration.City);
            //cmd.Parameters.AddWithValue("@stateID", objConsumerRegistration.StateID);
            //cmd.Parameters.AddWithValue("@id", objConsumerRegistration.ID);
            //cmd.Parameters.AddWithValue("@Action", "EditConsumer");
            //cmd.Parameters.AddWithValue("@Passphrase", WcrCryptography.SqlPassphrase);
            //int a = cmd.ExecuteNonQuery();
            //objCon.Con.Close();
            //if (a > 0)
            //{
            //    return a.ToString();
            //}
            //else
            //{ return ClsCommon.InactiveValue.ToString(); }
        }
        public string ConsumerLogin(string EmailID, string Password)
        {
            string                   str          = string.Empty;
            BllAssociateLogin        Objassociate = new BllAssociateLogin();
            PropConsumerRegistration Proconsumer  = new PropConsumerRegistration();

            Proconsumer.MobileNo = EmailID;
            Proconsumer.Password = Password;
            str = Objassociate.Selectconsumer(Proconsumer);
            return(str);
        }
        public string DeleteConsumer()
        {
            string str = string.Empty;
            PropConsumerRegistration objProperty = new PropConsumerRegistration();

            objProperty.ID = Convert.ToInt16(Session["consumer"]);
            BllConsumerRegistration Objconsumer = new BllConsumerRegistration();

            str = Objconsumer.DeleteConsumer(objProperty);
            Session.Abandon();
            return(str);
        }
        /// <summary>
        /// This Method is used to Post data into tbl_sale table
        /// </summary>
        /// <param name="objAssociateRegistration"></param>
        /// <returns>1 for success and -1 for fail</returns>

        public string InsertData(PropConsumerRegistration objConsumerRegistration)
        {
            WcrCryptography     crypto    = new WcrCryptography();
            ConsumersParameters sqlParams = new ConsumersParameters();

            sqlParams.Name     = crypto.WcrSimpleEncrypt(objConsumerRegistration.Name);
            sqlParams.EmailId  = crypto.EncryptUserName(objConsumerRegistration.EmailID.ToLower());
            sqlParams.Password = crypto.EncryptPassword(objConsumerRegistration.Password);
            sqlParams.Address  = crypto.WcrSimpleEncrypt(objConsumerRegistration.Address);
            sqlParams.ZipCode  = crypto.WcrSimpleEncrypt(objConsumerRegistration.ZipCode);
            sqlParams.Mob      = crypto.WcrSimpleEncrypt(objConsumerRegistration.MobileNo);
            HttpResponseMessage resp = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest);

            using (WcrHttpClient client = new WcrHttpClient(WcrVault.Gateway.getwcrusername, WcrVault.Gateway.getwcrpassword))
            {
                resp = client.PostAsJsonAsync("api/AccountCreation/ConsumersAdd", sqlParams).Result;
                int Id = JsonConvert.DeserializeObject <int>(resp.Content.ReadAsStringAsync().Result);
                if (Id > 0)
                {
                    return(Id.ToString());
                }
                else
                {
                    return(ClsCommon.InactiveValue.ToString());
                }
            }
            #region
            //SqlCommand cmd = new SqlCommand("proc_Consumers", objCon.Con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //objCon.Con.Open();
            //cmd.Parameters.AddWithValue("@Name", objConsumerRegistration.Name);
            //cmd.Parameters.AddWithValue("@EmailID", objConsumerRegistration.EmailID);
            //cmd.Parameters.AddWithValue("@Password", objConsumerRegistration.Password);
            //cmd.Parameters.AddWithValue("@address", objConsumerRegistration.Address);
            //cmd.Parameters.AddWithValue("@ZipCode", objConsumerRegistration.ZipCode);
            //cmd.Parameters.AddWithValue("@Action", "Add");
            //cmd.Parameters.AddWithValue("@Passphrase", WcrCryptography.SqlPassphrase);
            //int a = Convert.ToInt16(cmd.ExecuteScalar());
            //objCon.Con.Close();
            //if (a > 0)
            //{
            //    return a.ToString();
            //}
            //else
            //{ return ClsCommon.InactiveValue.ToString(); }
            #endregion
        }
        public string DeleteConsumer(PropConsumerRegistration objProperty)
        {
            DllConsumerRegistration objDal = new DllConsumerRegistration();

            try
            {
                return(objDal.DeleteConsumer(objProperty));
            }
            catch (Exception info)
            {
                throw info;
            }
            finally
            {
                objDal = null;
            }
        }
        public string UpdatePhote(PropConsumerRegistration objProperty)
        {
            DllConsumerRegistration objDal = new DllConsumerRegistration();

            try
            {
                return(objDal.UpdateConsumerPhoto(objProperty));
            }
            catch (Exception info)
            {
                throw info;
            }
            finally
            {
                objDal = null;
            }
        }
        /// <summary>
        /// This Method will be used to insert Consumer Data into Database
        /// </summary>
        /// <param name="objProperty"></param>
        /// <returns></returns>
        public string RecordInsert(PropConsumerRegistration objProperty)
        {
            DllConsumerRegistration objDal = new DllConsumerRegistration();

            try
            {
                return(objDal.InsertData(objProperty));
            }
            catch (Exception info)
            {
                throw info;
            }
            finally
            {
                objDal = null;
            }
        }
Exemplo n.º 9
0
        public string ResetConsumerPass(PropConsumerRegistration objConsumer)
        {
            DllAssociateLogin objDal = new DllAssociateLogin();

            try
            {
                return(objDal.ResetConsumerPass(objConsumer));
            }
            catch (Exception info)
            {
                throw info;
            }
            finally
            {
                objDal = null;
            }
        }
Exemplo n.º 10
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (context.Request.Files.Count > 0)
            {
                string str      = string.Empty;
                string assId    = string.Empty;
                string _mainImg = string.Empty;

                HttpFileCollection files = context.Request.Files;
                for (int i = 0; i < files.Count; i++)
                {
                    HttpPostedFile file = files[i];
                    string         fname;

                    string m = string.Empty;
                    if (HttpContext.Current.Request.Browser.Browser.ToUpper() == "IE" || HttpContext.Current.Request.Browser.Browser.ToUpper() == "INTERNETEXPLORER")
                    {
                        string[] testfiles = file.FileName.Split(new char[] { '\\' });
                        fname = testfiles[testfiles.Length - 1];
                    }
                    else
                    {
                        fname = file.FileName;
                        assId = fname;
                    }
                    if (i == 0)
                    {
                        fname = Path.Combine(context.Server.MapPath("../ConsumerPhoto/"), Convert.ToInt16(context.Session["consumer"]).ToString() + ".png");
                        file.SaveAs(fname);
                        _mainImg = Convert.ToInt16(context.Session["consumer"]).ToString() + ".png";
                        BllConsumerRegistration  objUpdatePic            = new BllConsumerRegistration();
                        PropConsumerRegistration objConsumerRegistration = new PropConsumerRegistration();
                        objConsumerRegistration.Photo = _mainImg;
                        objConsumerRegistration.ID    = Convert.ToInt16(context.Session["consumer"]);
                        str = objUpdatePic.UpdatePhote(objConsumerRegistration);
                        context.Response.Write(str);
                    }
                }
            }
        }
        public string UpdateConsumerPhoto(PropConsumerRegistration objConsumerRegistration)
        {
            WcrCryptography     crypto    = new WcrCryptography();
            ConsumersParameters sqlParams = new ConsumersParameters();

            sqlParams.ConPhoto = objConsumerRegistration.Photo;
            sqlParams.Id       = objConsumerRegistration.ID;
            HttpResponseMessage resp = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest);

            using (WcrHttpClient client = new WcrHttpClient(objConsumerRegistration.EmailID))
            {
                resp = client.PostAsJsonAsync("api/ConsumerTransactions/ConsumersUpdatePhoto", sqlParams).Result;
                int Id = JsonConvert.DeserializeObject <int>(resp.Content.ReadAsStringAsync().Result);
                if (Id > 0)
                {
                    return(Id.ToString());
                }
                else
                {
                    return(ClsCommon.InactiveValue.ToString());
                }
            }


            //SqlCommand cmd = new SqlCommand("proc_Consumers", objCon.Con);
            //cmd.CommandType = CommandType.StoredProcedure;
            //objCon.Con.Open();
            //cmd.Parameters.AddWithValue("@ConPhoto", objConsumerRegistration.Photo);
            //cmd.Parameters.AddWithValue("@id", objConsumerRegistration.ID);
            //cmd.Parameters.AddWithValue("@Action", "UpdatePhoto");
            //int a = cmd.ExecuteNonQuery();
            //objCon.Con.Close();
            //if (a > 0)
            //{
            //    return a.ToString();
            //}
            //else
            //{ return ClsCommon.InactiveValue.ToString(); }
        }
Exemplo n.º 12
0
        /// <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 SendConsumerPassonEmail(PropConsumerRegistration objConsumer)
        {
            WcrCryptography crypto = new WcrCryptography();
            ChangeConsumerPasswordParameters sqlParams = new ChangeConsumerPasswordParameters();

            sqlParams.Email = crypto.EncryptUserName(objConsumer.EmailID);
            HttpResponseMessage resp = new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest);

            using (WcrHttpClient client = new WcrHttpClient(objConsumer.EmailID))
            {
                resp = client.PostAsJsonAsync("api/ConsumerTransactions/SendPasswordResetEmail", sqlParams).Result;
                int Id = JsonConvert.DeserializeObject <int>(resp.Content.ReadAsStringAsync().Result);
                if (Id >= 0)
                {
                    return(Id.ToString());
                }
                else
                {
                    return("-1");
                }
            }
        }
        public string UpdateConsumer(string FirstName, string Address, string userName, string MobileNo, string password, string emailID, string ZipCode, string lastName, string Unit_Apt, string city, string stateID)
        {
            string str = string.Empty;
            PropConsumerRegistration proConsumerRegistration = new PropConsumerRegistration();

            proConsumerRegistration.Name     = FirstName;
            proConsumerRegistration.Address  = Address;
            proConsumerRegistration.UserName = userName;
            proConsumerRegistration.MobileNo = MobileNo;
            proConsumerRegistration.Password = password;
            proConsumerRegistration.EmailID  = emailID;
            proConsumerRegistration.ZipCode  = ZipCode;
            proConsumerRegistration.LastName = lastName;
            proConsumerRegistration.Unit_Apt = Unit_Apt;
            proConsumerRegistration.City     = city;
            proConsumerRegistration.StateID  = stateID;
            proConsumerRegistration.ID       = Convert.ToInt16(Session["consumer"].ToString());
            BllConsumerRegistration objConsumer = new BllConsumerRegistration();

            str = objConsumer.RecordUpdate(proConsumerRegistration);
            return(str);
        }