コード例 #1
0
        public PartialViewResult Entry(int?Id)
        {
            ViewBag.MsisdnFbMatching = true;
            if (!session.IsLdapQueryDone)
            {
                try
                {
                    //LDAP servis cagrilari.
                    GetUpdatePersonHandler ldapHandler  = new GetUpdatePersonHandler();
                    Msisdn2FbResponse      ldapResponse = ldapHandler.GetPerson(UserFb.Data.Msisdn);

                    if (ldapResponse.Value == null)
                    {
                        //Eger girilen msisdn icin FbId tanimli degil ise, null donuyor. Bu noktada
                        //update user diyerek yeniden tanimlatiyoruz.
                        ldapHandler.UpdatePerson(UserFb.Data.Msisdn, UserFb.Data.FbId);
                    }
                    else
                    {
                        if (ldapResponse.Value != UserFb.Data.FbId)
                        {
                            ViewBag.MsisdnFbMatching = false;
                        }
                    }

                    session.IsLdapQueryDone = true;
                }
                catch (Exception) { }
            }

            return(PartialView());
        }
コード例 #2
0
        public JsonResult LdapUpdate()
        {
            try
            {
                GetUpdatePersonHandler ldapHandler = new GetUpdatePersonHandler();
                ldapHandler.UpdatePerson(UserFb.Data.Msisdn, UserFb.Data.FbId);

                return(Json(new { result = "1" }, "text/plain", JsonRequestBehavior.AllowGet));
            }
            catch (Exception)
            {
                return(Json(new { result = "0" }, "text/plain", JsonRequestBehavior.AllowGet));
            }
        }
コード例 #3
0
        public PartialViewResult Entry(int?Id)
        {
            ViewBag.MsisdnFbMatching = true;


            if (!session.IsLdapQueryDone)
            {
                try
                {
                    //LDAP servis cagrilari.
                    GetUpdatePersonHandler ldapHandler  = new GetUpdatePersonHandler();
                    Msisdn2FbResponse      ldapResponse = ldapHandler.GetPerson(UserFb.Data.Msisdn);

                    if (ldapResponse.Value == null)
                    {
                        //Eger girilen msisdn icin FbId tanimli degil ise, null donuyor. Bu noktada
                        //update user diyerek yeniden tanimlatiyoruz.
                        ldapHandler.UpdatePerson(UserFb.Data.Msisdn, UserFb.Data.FbId);
                    }
                    else
                    {
                        if (ldapResponse.Value != UserFb.Data.FbId)
                        {
                            CookieManager cookie = new CookieManager();
                            if (cookie.Read(CookieManager.CookieType.ShowFbMsisdnMatching) == String.Empty)
                            {
                                ViewBag.MsisdnFbMatching = false;
                                cookie.Write(CookieManager.CookieType.ShowFbMsisdnMatching, UserFb.Data.FbId + "" + UserFb.Data.Msisdn);
                            }
                            else if (cookie.Read(CookieManager.CookieType.ShowFbMsisdnMatching) != UserFb.Data.FbId + "" + UserFb.Data.Msisdn)
                            {
                                ViewBag.MsisdnFbMatching = false;
                                cookie.Delete(CookieManager.CookieType.ShowFbMsisdnMatching);
                                cookie.Write(CookieManager.CookieType.ShowFbMsisdnMatching, UserFb.Data.FbId + "" + UserFb.Data.Msisdn);
                            }
                        }
                    }

                    session.IsLdapQueryDone = true;
                }
                catch (Exception) { }
            }

            return(PartialView());
        }