コード例 #1
0
        public IHttpActionResult RegisterMailConfirmation(string otpcode)
        {
            try
            {
                decryption Decryption = new decryption();
                if (!string.IsNullOrEmpty(otpcode))
                {
                    checksecuritypin checksecuritypin = new checksecuritypin();

                    if (!checksecuritypin.CheckSecurityPin(otpcode))
                    {
                        user.ErrorCode    = 0;
                        user.ErrorMessage = "false";
                        //return Ok("error: invalid_otp_code");
                    }
                    else if (checksecuritypin.CheckSecurityPin(otpcode) == false)
                    {
                        user.ErrorCode    = 0;
                        user.ErrorMessage = "false";
                        //return Ok("error: invalid_otp_code");
                    }
                    else
                    {
                        string        custid = "";
                        SqlDataReader sdr    = conCls.GetdataReader("Select CustID from OTP_data_Code Where  Status=0 AND Type='Registration' AND OTP_Code=" + otpcode);
                        if (sdr.HasRows)
                        {
                            if (sdr.Read())
                            {
                                custid = sdr["CustID"].ToString();
                            }
                        }
                        sdr.Close();
                        sdr.Dispose();

                        int flag = 0; string errMsg = "0";
                        conCls.verification_byregistration(custid, out flag, out errMsg);
                        string NewID = "";
                        NewID = flag.ToString();

                        if (NewID.Length > 4)
                        {
                            string regsucc = "";
                            regsucc = errMsg.ToString().Trim();
                            if (regsucc.ToString() == "SUCCESS")
                            {
                                string _Cust_Name = "";
                                string _email     = "";
                                string _username  = "";
                                string sqlStr1    = "";


                                sqlStr1 = "SELECT Cust_UserName, Email, cusid, cust_name from CustRecords_preReg where cusid = " + custid;
                                SqlDataReader sdr1 = conCls.GetdataReader(sqlStr1);
                                if (sdr1.HasRows)
                                {
                                    if (sdr1.Read())
                                    {
                                        _username  = sdr1["Cust_UserName"].ToString();
                                        _email     = sdr1["Email"].ToString();
                                        _Cust_Name = sdr1["cust_name"].ToString();
                                    }
                                    else
                                    {
                                        user.ErrorCode    = 0;
                                        user.ErrorMessage = "false";
                                        //return Ok("error: record_not_available");
                                    }
                                }
                                else
                                {
                                    user.ErrorCode    = 0;
                                    user.ErrorMessage = "false";
                                    //return Ok("error: record_not_available");
                                }

                                sdr1.Close();
                                sdr1.Dispose();

                                SendSMS(NewID, _Cust_Name, _email, _username);
                                user.ErrorCode    = 1;
                                user.ErrorMessage = "true";
                                return(Ok(registrationmodel));
                                //return Ok("true");
                            }
                            else
                            {
                                user.ErrorCode    = 0;
                                user.ErrorMessage = "false";
                                //return Ok("error: please_contact_admin_or_create_support_ticket_for_activate_account");
                            }
                        }
                        else
                        {
                            user.ErrorCode    = 0;
                            user.ErrorMessage = "false";
                            //return Ok("error:email_already_exist_or_sponserid_invalid");
                        }
                    }
                }
                else
                {
                    user.ErrorCode    = 0;
                    user.ErrorMessage = "false";
                    //return Ok("error: otp_code_not_found");
                }
            }
            catch (Exception ex)
            {
                return(Ok(ex.Message.ToString()));
            }
        }