コード例 #1
0
ファイル: Login.cs プロジェクト: SmrutiPanda007/new
        public JObject QrCodeLogout(JObject jobj, string sConnString, int userId)
        {
            JObject jresponse = new JObject();
            string  qrCode = string.Empty;
            int     retVal = 0; string message = string.Empty;

            try
            {
                string pusherAppId     = System.Configuration.ConfigurationManager.AppSettings["pusherAppId"].ToString();
                string pusherAppKey    = System.Configuration.ConfigurationManager.AppSettings["pusherAppKey"].ToString();
                string pusherAppsecret = System.Configuration.ConfigurationManager.AppSettings["pusherAppsecret"].ToString();

                if (jobj.SelectToken("QrCode") != null)
                {
                    GT.DataAccessLayer.V_1_5.Login loginObj = new DataAccessLayer.V_1_5.Login(sConnString);
                    retVal = loginObj.QrCodeLogOut(userId, out message);
                    if (retVal == 1)
                    {
                        qrCode = Convert.ToString(jobj.SelectToken("QrCode"));

                        Pusher         pusherObj      = new Pusher(pusherAppId, pusherAppKey, pusherAppsecret);
                        ITriggerResult pusherResponse = null;
                        pusherResponse = pusherObj.Trigger(qrCode, "Logout", new
                        {
                            QrCode      = qrCode,
                            IsLoggedOut = 1
                        });
                        jresponse = new JObject(new JProperty("Success", true),
                                                new JProperty("Message", "Success"));
                        if (HttpContext.Current.Request.Cookies["SessionId"] != null || HttpContext.Current.Request.Cookies["UserData"] != null)
                        {
                            HttpContext.Current.Request.Cookies["SessionId"].Expires = DateTime.Now.AddDays(-1);
                            HttpContext.Current.Request.Cookies["UserData"].Expires  = DateTime.Now.AddDays(-1);
                        }
                    }
                    else
                    {
                        jresponse = new JObject(new JProperty("Success", false),
                                                new JProperty("Message", "Log Out Failed"));
                    }
                }
                else
                {
                    jresponse = new JObject(new JProperty("Success", false),
                                            new JProperty("Message", "Invalid QrCode"));
                }
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in QrCodeLogout : " + ex.ToString());
                jresponse = new JObject(new JProperty("Success", false),
                                        new JProperty("Message", "Something Went Wrong"));
            }
            return(jresponse);
        }
コード例 #2
0
ファイル: Login.cs プロジェクト: SmrutiPanda007/new
        public JObject QR_Code_Check(string sConnString, JObject jObj, int userID)
        {
            JObject responseJobj = new JObject();
            string  qrCode = Convert.ToString(jObj.SelectToken("QrCode"));
            string  deviceId = Convert.ToString(jObj.SelectToken("DeviceUniqueId"));
            string  deviceToken = Convert.ToString(jObj.SelectToken("DeviceToken"));
            int     osId = Convert.ToInt32(jObj.SelectToken("OsId"));
            int     retVal = 0;
            string  retMsg = ""; string qrCodeAccessToken = "";
            DataSet ds              = new DataSet();
            string  pusherAppId     = System.Configuration.ConfigurationManager.AppSettings["PusherAppId"].ToString();
            string  pusherAppKey    = System.Configuration.ConfigurationManager.AppSettings["PusherAppKey"].ToString();
            string  pusherAppsecret = System.Configuration.ConfigurationManager.AppSettings["PusherAppsecret"].ToString();

            Logger.TraceLog(pusherAppId + pusherAppKey + pusherAppsecret);
            DataAccessLayer.V_1_5.Login loginObj = new DataAccessLayer.V_1_5.Login(sConnString);
            ds = loginObj.QRCodeChecking(userID, qrCode, deviceId, deviceToken, osId, out retVal, out retMsg);

            if (retVal == 1)
            {
                if (ds.Tables.Count != 0)
                {
                    if (ds.Tables[0].Rows.Count != 0)
                    {
                        qrCodeAccessToken = ds.Tables[0].Rows[0]["QrCodeAccessToken"].ToString();
                    }
                }


                Pusher pusherObj = new Pusher(pusherAppId, pusherAppKey, pusherAppsecret);

                ITriggerResult PusherResponse = null;
                PusherResponse = pusherObj.Trigger(qrCode, "Login", new
                {
                    IsloggedIn        = 0,
                    QrCode            = qrCode,
                    QrCodeAccessToken = qrCodeAccessToken,
                    DeviceUniqueId    = deviceId,
                    DeviceToken       = deviceToken,
                    OsId = osId
                });

                Logger.TraceLog("PusherResponse" + PusherResponse.Body);
                responseJobj = new JObject(new JProperty("Success", true),
                                           new JProperty("Message", "Succes"));
            }
            else
            {
                responseJobj = new JObject(new JProperty("Success", false),
                                           new JProperty("Message", retMsg));
            }
            return(responseJobj);
        }
コード例 #3
0
ファイル: Login.cs プロジェクト: SmrutiPanda007/new
        public JObject WebLoginCheck(string sConnString, int userId)
        {
            JObject jresponse  = new JObject();
            int     retVal     = 0;
            string  retMessage = string.Empty;
            int     isLoggedIn = 0;

            try
            {
                GT.DataAccessLayer.V_1_5.Login loginObj = new DataAccessLayer.V_1_5.Login(sConnString);
                DataTable dt = loginObj.WebLoginCheck(userId, out retVal, out retMessage);
                if (retVal == 1)
                {
                    if (dt.Rows.Count != 0)
                    {
                        jresponse = new JObject();
                        jresponse.Add(new JProperty("Success", true));
                        jresponse.Add(new JProperty("Message", "Success"));


                        foreach (DataColumn dc in dt.Columns)
                        {
                            if (dc.ColumnName != "LoginBrowser")
                            {
                                jresponse.Add(new JProperty(dc.ColumnName, dt.Rows[0][dc.ColumnName]));
                            }
                            else
                            {
                                jresponse.Add(new JProperty("browserName", ConfigurationManager.AppSettings["WebUrl"].ToString() + "/images/" + dt.Rows[0][dc.ColumnName] + ".png"));
                            }
                        }
                    }
                }
                else
                {
                    jresponse = new JObject(new JProperty("Success", false),
                                            new JProperty("Message", retMessage));
                }
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in WebLoginCheck : " + ex.ToString());
                jresponse = new JObject(new JProperty("Success", false),
                                        new JProperty("Message", "Something Went Wrong"));
            }
            return(jresponse);
        }
コード例 #4
0
ファイル: Login.cs プロジェクト: SmrutiPanda007/new
        public JObject ValidateQrCode(string sConnString, string qrCodeAccessToken, string qrCode, string deviceUniqueId, string deviceToken, string loginIp, string browserName, Int16 osID, string osName)
        {
            Logger.TraceLog("QrCode retval BAl " + qrCodeAccessToken);
            JObject jresponseObj    = new JObject();
            Int16   retVal          = 0;
            string  retMessage      = "";
            DataSet ds              = new DataSet();
            string  pusherAppId     = System.Configuration.ConfigurationManager.AppSettings["pusherAppId"].ToString();
            string  pusherAppKey    = System.Configuration.ConfigurationManager.AppSettings["pusherAppKey"].ToString();
            string  pusherAppsecret = System.Configuration.ConfigurationManager.AppSettings["pusherAppsecret"].ToString();

            try
            {
                DataAccessLayer.V_1_5.Login loginObj = new DataAccessLayer.V_1_5.Login(sConnString);
                string locationAddress = GetLocationName(loginIp);
                ds = loginObj.ValidateQrCode(qrCodeAccessToken, qrCode, deviceUniqueId, deviceToken, loginIp, locationAddress, browserName, osName, osID, out retVal, out retMessage);
                Logger.TraceLog("QrCode retval" + retVal.ToString());
                if (retVal == 1)
                {
                    if (ds.Tables.Count != 0)
                    {
                        if (ds.Tables[0].Rows.Count != 0)
                        {
                            jresponseObj.Add(new JProperty("Success", true));
                            jresponseObj.Add(new JProperty("Message", "Success"));
                            //jresponseObj.Add(new JProperty("RedirectURL", ConfigurationManager.AppSettings["WebUrl"] + "mygrptalks.aspx"));
                            foreach (DataRow dr in ds.Tables[0].Rows)
                            {
                                foreach (DataColumn dc in ds.Tables[0].Columns)
                                {
                                    jresponseObj.Add(new JProperty(dc.ColumnName, dr[dc.ColumnName]));
                                }
                            }
                            if (Convert.ToInt32(ds.Tables[0].Rows[0]["UserType"]) == 1)
                            {
                                //Logger.ExceptionLog("Entered here mygrps.aspx" + ds.Tables[0].Rows[0]["UserType"].ToString());
                                jresponseObj.Add(new JProperty("RedirectURL", ConfigurationManager.AppSettings["WebUrl"] + "mygroup.aspx"));
                            }
                            else
                            {
                                //Logger.ExceptionLog("Entered here mygrptalks.aspx" + ds.Tables[0].Rows[0]["UserType"].ToString());
                                jresponseObj.Add(new JProperty("RedirectURL", ConfigurationManager.AppSettings["WebUrl"] + "mygrptalks.aspx"));
                            }

                            Pusher         pusherObj      = new Pusher(pusherAppId, pusherAppKey, pusherAppsecret);
                            ITriggerResult PusherResponse = null;



                            PusherResponse = pusherObj.Trigger(qrCode, "Login", new
                            {
                                IsloggedIn  = 1,
                                OsName      = osName,
                                browserName = ConfigurationManager.AppSettings["WebUrl"].ToString() + "/images/" + browserName + ".png",
                                Location    = locationAddress
                            });
                        }
                        else
                        {
                            jresponseObj.Add(new JProperty("Success", false));
                            jresponseObj.Add(new JProperty("Message", "Failed"));
                        }
                    }
                    else
                    {
                        jresponseObj.Add(new JProperty("Success", false));
                        jresponseObj.Add(new JProperty("Message", "Failed"));
                    }
                }
                else
                {
                    jresponseObj.Add(new JProperty("Success", false));
                    jresponseObj.Add(new JProperty("Message", retMessage));
                }
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in ValidateQrCode BAL is " + ex.ToString());
                jresponseObj = new JObject(new JProperty("Success", false),
                                           new JProperty("Message", "Something Went Wrong"),
                                           new JProperty("ErrorCode", "101"));
            }

            return(jresponseObj);
        }
コード例 #5
0
ファイル: Login.cs プロジェクト: SmrutiPanda007/new
        public JObject Registration(string sConnString, JObject paramObj, string clientIpAddr, string txnID, Boolean isResend, int countryID)
        {
            DataAccessLayer.V_1_5.Login loginObj = new DataAccessLayer.V_1_5.Login(sConnString);
            DataSet        ds = new DataSet();
            JObject        jObj;
            JArray         jArr = new JArray();
            Int16          retVal = 0, isExisted = 0;
            int            errorCode = 0;
            string         retMessage = "", mobile = "";
            BusinessHelper businessHelperObj = new BusinessHelper();
            string         missedCallNumber  = "";
            string         senderIds         = ConfigurationManager.AppSettings["senderId"].ToString();

            if (countryID == 19)
            {
                missedCallNumber = ConfigurationManager.AppSettings["BahrainMissedCallNumber"].ToString();
            }
            else if (countryID == 239)
            {
                missedCallNumber = ConfigurationManager.AppSettings["UAEMissedCallNumber"].ToString();
            }
            else if (countryID == 241)
            {
                missedCallNumber = ConfigurationManager.AppSettings["USAMissedCallNumber"].ToString();
            }
            else if (countryID == 173)
            {
                missedCallNumber = ConfigurationManager.AppSettings["OmanMissedCallNumber"].ToString();
            }
            else if (countryID == 199)
            {
                missedCallNumber = ConfigurationManager.AppSettings["SaudiMissedCallNumber"].ToString();
            }
            else if (countryID == 124)
            {
                missedCallNumber = ConfigurationManager.AppSettings["KuwaitMissedCallNumber"].ToString();
            }
            else if (countryID == 188)
            {
                missedCallNumber = ConfigurationManager.AppSettings["QatarMissedCallNumber"].ToString();
            }
            else
            {
                missedCallNumber = ConfigurationManager.AppSettings["IndiaMissedCallNumber"].ToString();
            }
            try
            {
                RegistrationDetails detailsObj = new RegistrationDetails();


                if (paramObj.SelectToken("MobileNumber") == null)
                {
                    jObj = new JObject(new JProperty("Success", false),
                                       new JProperty("Message", "Unable to read MobileNumber"),
                                       new JProperty("ErrorCode", "107"));
                    return(jObj);
                }

                mobile = paramObj.SelectToken("MobileNumber").ToString();
                businessHelperObj.GetOnlyNumeric(ref mobile);
                businessHelperObj.RemoveZeroPrefix(ref mobile);


                detailsObj.Mobile          = mobile;
                detailsObj.DeviceUniqueID  = paramObj.SelectToken("DeviceUniqueID").ToString();
                detailsObj.DeviceToken     = paramObj.SelectToken("DeviceToken").ToString();
                detailsObj.OsID            = Int16.Parse(paramObj.SelectToken("OsID").ToString());
                detailsObj.ClientIpAddress = clientIpAddr;
                detailsObj.TxnID           = txnID;
                if (detailsObj.OsID != 3)
                {
                    detailsObj.UserName = paramObj.SelectToken("UserName").ToString();
                }
                if (isResend)
                {
                    detailsObj.IsResend = "Yes";
                }
                else
                {
                    detailsObj.IsResend = "";
                }


                ds = loginObj.Registration(detailsObj, out isExisted, out retVal, out retMessage, out errorCode);



                if (retVal == 1)
                {
                    jObj = new JObject(new JProperty("Success", true),
                                       new JProperty("IsExisted", isExisted),
                                       new JProperty("MissedCallNumber", missedCallNumber),
                                       new JProperty("SenderIds", senderIds),
                                       new JProperty("Message", retMessage), new JProperty("ErrorCode", errorCode));
                }
                else
                {
                    jObj = new JObject(new JProperty("Success", false),
                                       new JProperty("Message", retMessage), new JProperty("ErrorCode", errorCode));
                }
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in LoginBusiness is " + ex.ToString());
                jObj = new JObject(new JProperty("Success", false),
                                   new JProperty("Message", "Something Went Wrong"),
                                   new JProperty("ErrorCode", "101"));
            }
            return(jObj);
        }
コード例 #6
0
ファイル: Login.cs プロジェクト: SmrutiPanda007/new
        public JObject ValidateOTP(string sConnString, string mobile, string OTP, string txnID, int isRegisteredFromWeb, int countryID)
        {
            DataAccessLayer.V_1_5.Login loginObj = new DataAccessLayer.V_1_5.Login(sConnString);
            DataSet        ds = new DataSet();
            JObject        jObj;
            JArray         jArr              = new JArray();
            Int16          retVal            = 0;
            string         retMessage        = "";
            int            errorCode         = 0;
            string         minimumBalance    = "";
            BusinessHelper businessHelperObj = new BusinessHelper();

            try
            {
                businessHelperObj.GetOnlyNumeric(ref mobile);
                businessHelperObj.RemoveZeroPrefix(ref mobile);
                ds = loginObj.ValidateOTP(mobile, OTP, txnID, isRegisteredFromWeb, out retVal, out retMessage, out errorCode);

                if (retVal == 1)
                {
                    if (countryID == 19)
                    {
                        minimumBalance = ConfigurationManager.AppSettings["BahrainMinimumBalance"].ToString();
                    }
                    else if (countryID == 239)
                    {
                        minimumBalance = ConfigurationManager.AppSettings["UAEMinimumBalance"].ToString();
                    }
                    else if (countryID == 241)
                    {
                        minimumBalance = ConfigurationManager.AppSettings["UsaMinimumbalance"].ToString();
                    }
                    else if (countryID == 199)
                    {
                        minimumBalance = ConfigurationManager.AppSettings["SaudiMinimumbalance"].ToString();
                    }
                    else if (countryID == 173)
                    {
                        minimumBalance = ConfigurationManager.AppSettings["OmanMinimumbalance"].ToString();
                    }
                    else if (countryID == 188)
                    {
                        minimumBalance = ConfigurationManager.AppSettings["QatarMinimumbalance"].ToString();
                    }
                    else if (countryID == 124)
                    {
                        minimumBalance = ConfigurationManager.AppSettings["KuwaitMinimumbalance"].ToString();
                    }
                    else
                    {
                        minimumBalance = ConfigurationManager.AppSettings["IndiaMinimumBalance"].ToString();
                    }
                    jObj = new JObject(new JProperty("Success", true),
                                       new JProperty("Message", retMessage), new JProperty("ErrorCode", errorCode));
                    if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                    {
                        foreach (DataColumn _Column in ds.Tables[0].Rows[0].Table.Columns)
                        {
                            jObj.Add(new JProperty(_Column.ColumnName, ds.Tables[0].Rows[0][_Column.ColumnName]));
                        }
                    }
                    jObj.Add(new JProperty("MinimumBalance", minimumBalance));
                    jObj.Add(new JProperty("MinMemberCount", 1));
                }
                else
                {
                    jObj = new JObject(new JProperty("Success", false),
                                       new JProperty("Message", retMessage), new JProperty("ErrorCode", errorCode));
                }
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("Exception in loginBusiness is " + ex.ToString());
                jObj = new JObject(new JProperty("Success", false),
                                   new JProperty("Message", "Something Went Wrong"), new JProperty("ErrorCode", "101"));
                //new JProperty("Message", ex.ToString()));
            }
            return(jObj);
        }
コード例 #7
0
ファイル: Login.cs プロジェクト: SmrutiPanda007/new
        public JObject OtpCall(string sConnString, string mobile)
        {
            JObject        responseObj = new JObject();
            DataSet        Ds          = new DataSet();
            int            retVal;
            int            isConfirmed;
            string         retMsg     = "";
            string         otp        = "";
            string         fromNumber = "";
            BusinessHelper _helper    = new BusinessHelper();

            _helper.GetOnlyNumeric(ref mobile);
            _helper.RemoveZeroPrefix(ref mobile);

            DataAccessLayer.V_1_5.Login loginObj = new DataAccessLayer.V_1_5.Login(sConnString);
            try
            {
                Ds = loginObj.OtpCall(mobile, out retVal, out retMsg, out isConfirmed, out otp);

                if (retVal != 1)
                {
                    responseObj = new JObject(new JProperty("Success", false),
                                              new JProperty("Message", retMsg), new JProperty("ErrorCode", "110"),
                                              new JProperty("MobileNumber", mobile));
                    return(responseObj);
                }
                else
                {
                    if (isConfirmed == 1)
                    {
                        responseObj = new JObject(new JProperty("Success", false),
                                                  new JProperty("Message", "User Already Confirmed"), new JProperty("ErrorCode", "109"),
                                                  new JProperty("MobileNumber", mobile));
                        return(responseObj);
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(otp))
                        {
                            if (!string.IsNullOrEmpty(otp))
                            {
                                if (mobile.Replace(" ", "").StartsWith("1"))
                                {
                                    fromNumber = ConfigurationManager.AppSettings["USACallMeNumber"].ToString();
                                }
                                else if (mobile.Replace(" ", "").StartsWith("971"))
                                {
                                    fromNumber = ConfigurationManager.AppSettings["UAECallMeNumber"].ToString();
                                }
                                else if (mobile.Replace(" ", "").StartsWith("973"))
                                {
                                    fromNumber = ConfigurationManager.AppSettings["BahrainCallMeNumber"].ToString();
                                }
                                else if (mobile.Replace(" ", "").StartsWith("968"))
                                {
                                    fromNumber = ConfigurationManager.AppSettings["OmanCallMeNumber"].ToString();
                                }
                                else if (mobile.Replace(" ", "").StartsWith("966"))
                                {
                                    fromNumber = ConfigurationManager.AppSettings["SaudiCallMeNumber"].ToString();
                                }
                                else if (mobile.Replace(" ", "").StartsWith("974"))
                                {
                                    fromNumber = ConfigurationManager.AppSettings["QatarCallMeNumber"].ToString();
                                }
                                else if (mobile.Replace(" ", "").StartsWith("965"))
                                {
                                    fromNumber = ConfigurationManager.AppSettings["KuwaitCallMeNumber"].ToString();
                                }
                                else
                                {
                                    fromNumber = ConfigurationManager.AppSettings["IndiaCallMeNumber"].ToString();
                                }
                                if (mobile.Replace(" ", "") == "18036584329")
                                {
                                    ApiOtpCall("919052485271", otp, ConfigurationManager.AppSettings["IndiaCallMeNumber"].ToString());
                                }
                                if (mobile.Replace(" ", "") == "18036102779")
                                {
                                    ApiOtpCall("919040767686", otp, ConfigurationManager.AppSettings["IndiaCallMeNumber"].ToString());
                                }
                            }
                            ApiOtpCall(mobile, otp, fromNumber);
                        }
                    }
                    responseObj = new JObject(new JProperty("Success", true),
                                              new JProperty("Message", retMsg), new JProperty("ErrorCode", "117"));
                }
            }
            catch (Exception ex)
            {
                Logger.ExceptionLog("exception in otpcall :" + ex.ToString());
                responseObj = new JObject(new JProperty("Success", false),
                                          new JProperty("Message", "Something Went Wrong"),
                                          new JProperty("ErrorCode", "101"));
            }



            return(responseObj);
        }