Пример #1
0
        //public AuthenticationModel Login(CredentialModel credentials)
        //{


        //    // var data  = PortalSequenceNumber.GetNewFeeVocherNo();

        //    var authenticationModel = new AuthenticationModel();
        //    object model = null;



        //    var sss = _context.Connection.ConnectionString;


        //    // set authentication type
        //    authenticationModel.Authenticated = model != null;


        //    _context = new DataClasses1DataContext("Data Source=DESKTOP-P1QK1CA\\SQLEXPRESS;Initial Catalog=MultiVendor;Integrated Security=True");

        //    //PublisherInfo data = new PublisherInfo();
        //    //var record =_context.Publishers.Where(s => s.Email == credentials.LoginId.Trim() && s.Password == credentials.Password.Trim()).FirstOrDefault();

        //    //if (record != null)
        //    //{

        //    //    data.LoginId = record.LoginId;
        //    //    data.Name = record.Name;
        //    //    data.Password = record.Password;
        //    //    data.CNIC = record.CNIC;
        //    //    data.Detail = record.Detail;
        //    //    data.ProfileDetail = record.ProfileDetail;
        //    //    data.Adress = record.Adress;
        //    //    data.Email = record.Email;
        //    //    data.Id = record.Id;
        //    //    if(record.Status.HasValue)
        //    //    data.Status = record.Status.Value;

        //    //    // save in session
        //    //    authenticationModel.oPublisherInfo = data;
        //    //    authenticationModel.Authenticated = true;

        //    //    SessionService.Save(SessionService.Keys.AuthenticationInfo, authenticationModel);
        //    //}
        //    //else
        //    //{
        //    //    authenticationModel.Authenticated = false;
        //    //    SessionService.Save(SessionService.Keys.AuthenticationInfo, authenticationModel);

        //    //}



        //    ////long aaaa=  GetSizeOfObject(authenticationModel);



        //    //// return
        //    //return authenticationModel;
        //}


        public static long GetSizeOfObject(AuthenticationModel obj)
        {
            long size             = 0;
            AuthenticationModel o = obj;

            using (Stream s = new MemoryStream())
            {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(s, o);
                size = s.Length / (1024 * 1024);
            }
            return(size);
        }
Пример #2
0
        public int GetCurrentUserId()
        {
            int name = 0;

            AuthenticationModel oAuthenticationModel = SessionService.GetCurrentUser();

            if (oAuthenticationModel.Authenticated && oAuthenticationModel.oPublisherInfo != null)
            {
                name = oAuthenticationModel.oPublisherInfo.Id;
            }



            return(name);
        }
Пример #3
0
        public string GetCurrentUserName()
        {
            string name = "";

            AuthenticationModel oAuthenticationModel = SessionService.GetCurrentUser();

            if (oAuthenticationModel.Authenticated && oAuthenticationModel.oPublisherInfo != null)
            {
                name = oAuthenticationModel.oPublisherInfo.Name;
            }



            return(name);
        }
Пример #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int authorId = 0;
            AuthenticationModel oAuthenticationModel = SessionService.GetCurrentUser();

            if (oAuthenticationModel.Authenticated && oAuthenticationModel.oPublisherInfo != null)
            {
                authorId = oAuthenticationModel.oPublisherInfo.Id;
            }

            MessageBox1.ClearMessage();

            if (!IsPostBack)
            {
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticationModel oAuthenticationModel = SessionService.GetCurrentUser();

            if (oAuthenticationModel.Authenticated && oAuthenticationModel.oPublisherInfo != null)
            {
                StudentId = oAuthenticationModel.oPublisherInfo.Id;
            }

            MessageBox1.ClearMessage();
            AttachmentPath = System.Configuration.ConfigurationManager.AppSettings["BookListAttachmentPath"];
            try
            {
            }
            catch (Exception ex)
            {
                MessageBox1.ShowMessage(ex.Message, Constants.MesageType.Error);
            }
        }
Пример #6
0
        public static String GetLandingPageUrl(this AuthenticationModel authenticationModel)
        {
            var result = String.Empty;

            //switch (authenticationModel.AccountType)
            //{
            //    case Backbone.Constants.UserType.Student:
            //        result = "~/StudentProfile.aspx";
            //        break;
            //    case Backbone.Constants.UserType.Author:
            //        result = "~/Default.aspx";
            //        break;
            //    case Backbone.Constants.UserType.Admin:
            //        result = "~/Default.aspx";
            //        break;
            //    default:
            //        break;
            //}

            return(result);
        }