Пример #1
0
        public string Registration(RegistrationBO objRegistrationBO)
        {
            try
            {
                RegistrationDA objRegistrationDA = new RegistrationDA();
                DataTable      dtdetails         = new DataTable();

                dtdetails = objRegistrationDA.Registration(objRegistrationBO);

                if (dtdetails.Rows.Count > 0)
                {
                    if (Convert.ToString(dtdetails.Rows[0]["Status"]) == "1")
                    {
                        SendMail(objRegistrationBO.Email, objRegistrationBO.UserName, Convert.ToString(dtdetails.Rows[0]["TranPass"]), Convert.ToString(dtdetails.Rows[0]["tradPass"]), Convert.ToString(dtdetails.Rows[0]["InvPassword"]));
                        return("1");
                    }
                    else
                    {
                        return(Convert.ToString(dtdetails.Rows[0]["Status"]));
                    }
                }
                else
                {
                    return(Convert.ToString(dtdetails.Rows[0]["Status"]));
                }
            }
            finally
            {
            }
        }
Пример #2
0
 public ActionResult Index(RegistrationBO reg)
 {
     try
     {
         RegisterConsumer regSer   = new RegisterConsumer();
         IRestResponse    response = regSer.RegisterNewUser(reg);
         if ((int)response.StatusCode == 201)
         {
             return(View("RegistrationConfirmation"));
         }
         // code for user created Successfully.
         else if ((int)response.StatusCode == 409)
         {
             ModelState.AddModelError(string.Empty, "Email Id already registered. please login to continue.");
         }
         // show use that Email already registered.
         else
         {
             if (ModelState.IsValid)
             {
                 ModelState.AddModelError(string.Empty, "Something wrong, please raise the issue with support");
             }
         }
     }
     catch (Exception es)
     {
         ModelState.AddModelError(string.Empty, es.Message);
     }
     return(View());
 }
Пример #3
0
        public string UserRegistration(string userName, string transPassword, string email, string firstName, string lastName, string title, string countryId, string phone, string dob, string isSubscribed)
        {
            try
            {
                RegistrationBL objRegistrationBL = new RegistrationBL();

                RegistrationBO objRegistrationBO = new RegistrationBO();
                objRegistrationBO.UserName            = userName;
                objRegistrationBO.TransactionPassword = transPassword;
                objRegistrationBO.Email        = email;
                objRegistrationBO.FirstName    = firstName;
                objRegistrationBO.LastName     = lastName;
                objRegistrationBO.Title        = title;
                objRegistrationBO.CountryId    = countryId;
                objRegistrationBO.Phone        = phone;
                objRegistrationBO.DOB          = dob;
                objRegistrationBO.isSubscribed = isSubscribed;

                return(objRegistrationBL.Registration(objRegistrationBO));
            }
            catch (Exception ex)
            {
                HttpContext.Current.Session["Exception"] = ex;
                HttpContext.Current.Session["ExcSource"] = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
                throw ex;
            }
            finally
            {
            }
        }
        public IRestResponse RegisterNewUser(RegistrationBO regBO)
        {
            var    client      = new RestClient(Url + ApexConfig.RegisterNewUserUri);
            var    request     = new RestRequest(Method.POST);
            string jsonRequest = JsonConvert.SerializeObject(regBO);

            request.AddParameter(
                "application/json; charset=utf-8",
                jsonRequest,
                ParameterType.RequestBody);
            request.AddBody(jsonRequest);
            var response = client.Execute(request);

            return(response);
        }
Пример #5
0
        public async Task <HttpResponseMessage> Register(RegistrationBO regDetails)
        {
            try
            {
                RegisterDB regDB = new RegisterDB();
                regDetails = await regDB.register(regDetails);

                if (regDetails.isExists)
                {
                    return(Request.CreateResponse(HttpStatusCode.Conflict, FailureResponse.Message = "Email already registered"));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.Created, regDetails));
                }
            }
            catch (Exception es)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, es.Message));
            }
        }
Пример #6
0
        public DataTable Registration(RegistrationBO objRegistrationBO)
        {
            sqlParameter = new SqlParameter[11];
            try
            {
                sqlParameter[0]  = new SqlParameter("@UserName", objRegistrationBO.UserName);
                sqlParameter[1]  = new SqlParameter("@TransactionPassword", objRegistrationBO.TransactionPassword);
                sqlParameter[2]  = new SqlParameter("@Email", objRegistrationBO.Email);
                sqlParameter[3]  = new SqlParameter("@FirstName", objRegistrationBO.FirstName);
                sqlParameter[4]  = new SqlParameter("@LastName", objRegistrationBO.LastName);
                sqlParameter[5]  = new SqlParameter("@Title", objRegistrationBO.Title);
                sqlParameter[6]  = new SqlParameter("@CountryId", objRegistrationBO.CountryId);
                sqlParameter[7]  = new SqlParameter("@Phone", objRegistrationBO.Phone);
                sqlParameter[8]  = new SqlParameter("@DOB", objRegistrationBO.DOB);
                sqlParameter[9]  = new SqlParameter("@Balance", 1000);
                sqlParameter[10] = new SqlParameter("@isSubscribed", objRegistrationBO.isSubscribed);

                return(SqlHelper.ExecuteDataset(sqlConnection, CommandType.StoredProcedure, "sp_UserRregistration", sqlParameter).Tables[0]);
            }
            finally
            {
                sqlParameter = null;
            }
        }
Пример #7
0
        public async Task <RegistrationBO> register(RegistrationBO regDetails)
        {
            con = await ApexService.DataAccess.DBConnection.ApexConnection();

            cmd = new DBConnection().BuildProcedureCommand("P_INS_User", con);
            cmd.Parameters.AddWithValue("@Email", regDetails.email);
            cmd.Connection = con;
            cmd.Parameters.AddWithValue("@Password", new Authenticate().Encryptdata(regDetails.password));
            cmd.Parameters.AddWithValue("@VerificationCode", Guid.NewGuid().ToString());
            using (var reader = await cmd.ExecuteReaderAsync())
            {
                if (reader.Read())
                {
                    regDetails.id              = reader.GetInt32(reader.GetOrdinal("id"));
                    regDetails.password        = "";
                    regDetails.email           = reader.GetString(1);
                    regDetails.isEmailVerified = reader.GetInt32(2).Equals(1) ? true : false;
                    regDetails.isExists        = reader.GetString(3).Equals("Y") ? true : false;
                    regDetails.VerficationCode = reader.GetString(4);
                }
            }
            con.Close();
            return(regDetails);
        }
Пример #8
0
        protected void submitPasswordBtn_Click(object sender, EventArgs e)
        {
            //move to reset sec q
            answerSecurityQ.Visible = true;
            passwordPanel.Visible   = false;
            emailPanel.Visible      = false;
            string userId = inputIdTB.Text;


            RegistrationBO getQuestions = new RegistrationBO();
            // SecurityQuestions sqObj = new SecurityQuestions();
            SecurityQuestions sqObj    = getQuestions.GetSQById(userId);
            List <String>     templist = new List <String>();
            List <Byte[]>     getlist  = new List <Byte[]>();

            var tupleList = new List <Tuple <Byte[], String> >();

            tupleList.Add(new Tuple <Byte[], String>(sqObj.firstSecurityQ, sqObj.firstSecurityQA.ToString()));
            tupleList.Add(new Tuple <Byte[], String>(sqObj.secondSecurityQ, sqObj.secondSecurityQA.ToString()));
            tupleList.Add(new Tuple <Byte[], String>(sqObj.thirdSecurityQ, sqObj.thirdSecurityQA.ToString()));

            Shuffle(tupleList);


            for (int i = 0; i < 2; i++)
            {
                byte[] questionOne    = tupleList[0].Item1;
                string questionOneAns = tupleList[0].Item2;
                byte[] questionTwo    = tupleList[1].Item1;
                string questionTwoAns = tupleList[1].Item2;
                //   byte[] secBytes = (byte[])sqObj.secondSecurityQ;

                Image1.ImageUrl = "data:Image/;base64," + Convert.ToBase64String(questionOne);
                Image2.ImageUrl = "data:Image/;base64," + Convert.ToBase64String(questionTwo);
            }
        }
Пример #9
0
        protected void RegisterBtn_Click(object sender, EventArgs e)
        {
            bool success = isValidated();

            if (success == false)
            {
            }
            else
            {
                string User_ID      = inputNRICTB.Text;
                string password     = passwordTB.Text;
                string name         = inputNameTB.Text;
                string email        = emailTB.Text;
                string confirmEmail = "false";
                string role         = "Student";
                //String school_ID, String education_level, String education_class;
                string firstImageAns  = firstImageAnsTB.Text.Trim();
                string secondImageAns = secondImageAnsTB.Text.Trim();
                string thirdImageAns  = thirdImageAnsTB.Text.Trim();

                ////////////////////////////////////////////////////////////////////////////////////////////////

                // For 1st SQ: Read the file and convert it to Byte Array
                string filePath = imageUpload.PostedFile.FileName;
                string filename = Path.GetFileName(filePath);
                //string ext = Path.GetExtension(filename);

                // For 2nd SQ: Read the file and convert it to Byte Array
                string SecfilePath = image2Upload.PostedFile.FileName;
                string Secfilename = Path.GetFileName(SecfilePath);

                // For 3rd SQ: Read the file and convert it to Byte Array
                string thirdfilePath = image3Upload.PostedFile.FileName;
                string thirdfilename = Path.GetFileName(thirdfilePath);


                System.Drawing.Image firstUploaded = System.Drawing.Image.FromStream(imageUpload.PostedFile.InputStream);
                System.Drawing.Image secUploaded   = System.Drawing.Image.FromStream(image2Upload.PostedFile.InputStream);
                System.Drawing.Image thirdUploaded = System.Drawing.Image.FromStream(image3Upload.PostedFile.InputStream);

                int   originalWidth  = firstUploaded.Width;
                int   originalHeight = firstUploaded.Height;
                float percentWidth   = (float)256 / (float)originalWidth;
                float percentHeight  = (float)256 / (float)originalHeight;
                float percent        = percentHeight < percentWidth ? percentHeight : percentWidth;
                int   newWidth       = (int)(originalWidth * percent);
                int   newHeight      = (int)(originalHeight * percent);

                int   originalWidth2  = secUploaded.Width;
                int   originalHeight2 = secUploaded.Height;
                float percentWidth2   = (float)256 / (float)originalWidth2;
                float percentHeight2  = (float)256 / (float)originalHeight2;
                float percent2        = percentHeight2 < percentWidth2 ? percentHeight2 : percentWidth2;
                int   newWidth2       = (int)(originalWidth2 * percent2);
                int   newHeight2      = (int)(originalHeight2 * percent2);

                int   originalWidth3  = thirdUploaded.Width;
                int   originalHeight3 = thirdUploaded.Height;
                float percentWidth3   = (float)256 / (float)originalWidth3;
                float percentHeight3  = (float)256 / (float)originalHeight3;
                float percent3        = percentHeight3 < percentWidth3 ? percentHeight3 : percentWidth3;
                int   newWidth3       = (int)(originalWidth3 * percent3);
                int   newHeight3      = (int)(originalHeight3 * percent3);

                System.Drawing.Image newImage1 = new Bitmap(newWidth, newHeight);
                using (Graphics g = Graphics.FromImage(newImage1))
                {
                    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    g.DrawImage(firstUploaded, 0, 0, newWidth, newHeight);
                }

                System.Drawing.Image newImage2 = new Bitmap(newWidth, newHeight);
                using (Graphics g = Graphics.FromImage(newImage2))
                {
                    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    g.DrawImage(secUploaded, 0, 0, newWidth, newHeight);
                }

                System.Drawing.Image newImage3 = new Bitmap(newWidth, newHeight);
                using (Graphics g = Graphics.FromImage(newImage3))
                {
                    g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    g.DrawImage(thirdUploaded, 0, 0, newWidth, newHeight);
                }

                ////////////////////////////////////////////////////////////////////////////////////////////////////
                byte[] results;
                using (MemoryStream ms = new MemoryStream())
                {
                    ImageCodecInfo    codec     = ImageCodecInfo.GetImageEncoders().FirstOrDefault(c => c.FormatID == ImageFormat.Jpeg.Guid);
                    EncoderParameters jpegParms = new EncoderParameters(1);
                    jpegParms.Param[0] = new EncoderParameter(Encoder.Quality, 95L);
                    newImage1.Save(ms, codec, jpegParms);
                    results = ms.ToArray();

                    for (int i = 0; i < results.Length; i++)
                    {
                        //Stream test = firstUploaded;
                    }

                    Stream       fs    = imageUpload.PostedFile.InputStream;
                    BinaryReader br    = new BinaryReader(fs);
                    Byte[]       bytes = br.ReadBytes((Int32)fs.Length);

                    Stream       secfs    = image2Upload.PostedFile.InputStream;
                    BinaryReader secbr    = new BinaryReader(secfs);
                    Byte[]       secbytes = secbr.ReadBytes((Int32)secfs.Length);

                    Stream       thirdfs    = image3Upload.PostedFile.InputStream;
                    BinaryReader thirdbr    = new BinaryReader(thirdfs);
                    Byte[]       thirdbytes = thirdbr.ReadBytes((Int32)thirdfs.Length);
                    //Converting Byte Array To Image And Then Into Bitmap
                    ImageConverter       ic  = new ImageConverter();
                    System.Drawing.Image img = (System.Drawing.Image)ic.ConvertFrom(bytes);
                    Bitmap bmp1 = new Bitmap(img);
                    System.Drawing.Image img1 = (System.Drawing.Image)ic.ConvertFrom(secbytes);
                    Bitmap bmp2 = new Bitmap(img1);
                    System.Drawing.Image img2 = (System.Drawing.Image)ic.ConvertFrom(thirdbytes);
                    Bitmap bmp3 = new Bitmap(img2);

                    List <bool> iHash1 = GetHash(new Bitmap(img));
                    List <bool> iHash2 = GetHash(new Bitmap(img1));
                    List <bool> iHash3 = GetHash(new Bitmap(img2));

                    //determine the number of equal pixel (x of 256)
                    int equalForOneTwo   = iHash1.Zip(iHash2, (i, j) => i == j).Count(eq => eq); //compare img1 and img2 similarity
                    int equalForOneThree = iHash1.Zip(iHash3, (i, j) => i == j).Count(eq => eq); //compare img1 and img3 similarity
                    int equalForTwoThree = iHash2.Zip(iHash3, (i, j) => i == j).Count(eq => eq); //compare img2 and img3 similarity
                                                                                                 //     int equalElements3 = iHash2.Zip(iHash3, (i, j) => i == j).Count(eq => eq);

                    //    int equalElements4 = iHash3.Zip(iHash1, (i, j) => i == j).Count(eq => eq);
                    //    int equalElements5 = iHash3.Zip(iHash2, (i, j) => i == j).Count(eq => eq);

                    if (equalForOneTwo >= 150)
                    { //check if similarity is more than 60%
                        Label1.Text = "Please choose a different image For Image one and two";
                    }
                    if (equalForOneThree >= 156)
                    {
                        Label1.Text = "Please choose a different image For Image one and three";
                    }
                    if (equalForTwoThree >= 156)
                    {
                        Label1.Text = "Please choose a different image For Image two and three";
                    }
                }



                ////Calling Compare Function
                //if (Compare(bmp1, bmp2) == CompareResult.ciCompareOk)
                //{
                //    Label1.Visible = true;
                //    Label1.Text = "Images Are Same";
                //}
                //else if (Compare(bmp1, bmp2) == CompareResult.ciPixelMismatch)
                //{
                //    Label1.Visible = true;
                //    Label1.Text = "Pixel not Matching";
                //}
                //else if (Compare(bmp1, bmp2) == CompareResult.ciSizeMismatch)
                //{
                //    Label1.Visible = true;
                //    Label1.Text = "Size Is Not Same";
                //}


                //Label1.Text = equalElements.ToString() + " - "+ equalElements1.ToString() + " - " +  equalElements2.ToString();



                //////////////////////////////////////////////////////////////////////////////////////////////
                RegistrationBO addUser = new RegistrationBO();
                addUser.insertUser(User_ID, password, name, email, confirmEmail, role);
                //addUser.insertSQ(User_ID, bytes, firstImageAns, secbytes, secondImageAns, thirdbytes, thirdImageAns);

                errLblForSQ.Text      = "";
                errLblForSQ.Visible   = false;
                errLblForName.Text    = "";
                errLblForName.Visible = false;
            }
        }