public void MemberInformationTest()
 {
     var expected = new MemberInformation();
     var target = new CreateInstanceException( "msg", new Exception(), "info1", "info2", expected );
     target.MemberInformation.Should()
           .BeSameAs( expected );
 }
Пример #2
0
        private MemberInformation[] ConstructInjectionMembers(RegistrationContextData registrationContextData, MetaInformation metaInfo)
        {
            if (registrationContextData.InjectionMemberNames.Count == 0)
            {
                return(metaInfo.InjectionMembers);
            }

            var length  = metaInfo.InjectionMembers.Length;
            var members = new MemberInformation[length];

            for (var i = 0; i < length; i++)
            {
                var member = metaInfo.InjectionMembers[i];
                if (registrationContextData.InjectionMemberNames.TryGetValue(member.MemberInfo.Name,
                                                                             out var dependencyName))
                {
                    var copy = member.Clone();
                    copy.TypeInformation.ForcedDependency = true;
                    copy.TypeInformation.DependencyName   = dependencyName;
                    members[i] = copy;
                }
                else
                {
                    members[i] = member;
                }
            }

            return(members);
        }
Пример #3
0
 public void MemberPathTest()
 {
     var target = new MemberInformation();
     var expected = RandomValueEx.GetRandomString();
     target.MemberPath = expected;
     target.MemberPath.Should()
           .Be( expected );
 }
Пример #4
0
 public void MemberTypeTest()
 {
     var target = new MemberInformation();
     var expected = typeof (String);
     target.MemberType = expected;
     target.MemberType.Should()
           .Be( expected );
 }
Пример #5
0
        public void MemberInformationTest()
        {
            var expected = new MemberInformation();
            var target   = new CreateInstanceException("msg", new Exception(), "info1", "info2", expected);

            target.MemberInformation.Should()
            .BeSameAs(expected);
        }
Пример #6
0
 public void PropertyInfoTest()
 {
     var target = new MemberInformation();
     var expected = typeof (MemberInformation).GetPublicSettableProperties()
                                              .First();
     target.PropertyInfo = expected;
     target.PropertyInfo.Should()
           .BeSameAs( expected );
 }
Пример #7
0
        public void MemberTypeTest()
        {
            var target   = new MemberInformation();
            var expected = typeof(String);

            target.MemberType = expected;
            target.MemberType.Should()
            .Be(expected);
        }
Пример #8
0
        public void MemberPathTest()
        {
            var target   = new MemberInformation();
            var expected = RandomValueEx.GetRandomString();

            target.MemberPath = expected;
            target.MemberPath.Should()
            .Be(expected);
        }
Пример #9
0
        public void PropertyInfoTest()
        {
            var target   = new MemberInformation();
            var expected = typeof(MemberInformation).GetPublicSettableProperties()
                           .First();

            target.PropertyInfo = expected;
            target.PropertyInfo.Should()
            .BeSameAs(expected);
        }
        private async void LoadPages()
        {
            MemberInformation MemberInfor = await this._memberInformationService.GetMemberInformation();

            if (MemberInfor != null)
            {
                TxtUserID.Text    = MemberInfor.id;
                TxtcreatedAt.Text = MemberInfor.createdAt;
                TxtEmail.Text     = MemberInfor.email;
            }
        }
Пример #11
0
        private PropagatorResult CreateSimpleResult(
            IEntityStateEntry stateEntry, IExtendedDataRecord record, MemberInformation memberInformation,
            int identifier, bool isModified, int recordOrdinal, object value)
        {
            var updatableRecord = record as CurrentValueRecord;

            // construct flags for the value, which is needed for complex type and simple members
            var flags = memberInformation.Flags;

            if (!isModified)
            {
                flags |= PropagatorFlags.Preserve;
            }
            if (PropagatorResult.NullIdentifier != identifier)
            {
                // construct a key member
                PropagatorResult result;
                if ((memberInformation.IsServerGenerated || memberInformation.IsForeignKeyMember) &&
                    null != updatableRecord)
                {
                    result = PropagatorResult.CreateServerGenKeyValue(flags, value, stateEntry, identifier, recordOrdinal);
                }
                else
                {
                    result = PropagatorResult.CreateKeyValue(flags, value, stateEntry, identifier);
                }

                // we register the entity as the "owner" of an identity so that back-propagation can succeed
                // (keys can only be back-propagated to entities, not association ends). It also allows us
                // to walk to the entity state entry in case of exceptions, since the state entry propagated
                // through the stack may be eliminated in a project above a join.
                m_translator.KeyManager.RegisterIdentifierOwner(result);

                return(result);
            }
            else
            {
                if ((memberInformation.IsServerGenerated || memberInformation.IsForeignKeyMember) &&
                    null != updatableRecord)
                {
                    // note: we only produce a server gen result when
                    return(PropagatorResult.CreateServerGenSimpleValue(flags, value, updatableRecord, recordOrdinal));
                }
                else
                {
                    return(PropagatorResult.CreateSimpleValue(flags, value));
                }
            }
        }
Пример #12
0
        // Note that this is called only for association ends. Entities have key values inline.
        private PropagatorResult CreateEntityKeyResult(IEntityStateEntry stateEntry, EntityKey entityKey)
        {
            // get metadata for key
            EntityType entityType = entityKey.GetEntitySet(m_translator.MetadataWorkspace).ElementType;
            RowType    keyRowType = entityType.GetKeyRowType(m_translator.MetadataWorkspace);

            ExtractorMetadata keyMetadata = m_translator.GetExtractorMetadata(stateEntry.EntitySet, keyRowType);
            int keyMemberCount            = keyRowType.Properties.Count;

            PropagatorResult[] keyValues = new PropagatorResult[keyMemberCount];

            for (int ordinal = 0; ordinal < keyRowType.Properties.Count; ordinal++)
            {
                EdmMember keyMember = keyRowType.Properties[ordinal];
                // retrieve information about this key value
                MemberInformation keyMemberInformation = keyMetadata.m_memberMap[ordinal];

                int keyIdentifier = m_translator.KeyManager.GetKeyIdentifierForMemberOffset(entityKey, ordinal, keyRowType.Properties.Count);

                object keyValue = null;
                if (entityKey.IsTemporary)
                {
                    // If the EntityKey is temporary, we need to retrieve the appropriate
                    // key value from the entity itself (or in this case, the IEntityStateEntry).
                    IEntityStateEntry entityEntry = stateEntry.StateManager.GetEntityStateEntry(entityKey);
                    Debug.Assert(entityEntry.State == EntityState.Added,
                                 "The corresponding entry for a temp EntityKey should be in the Added State.");
                    keyValue = entityEntry.CurrentValues[keyMember.Name];
                }
                else
                {
                    // Otherwise, we extract the value from within the EntityKey.
                    keyValue = entityKey.FindValueByName(keyMember.Name);
                }
                Debug.Assert(keyValue != null, "keyValue should've been retrieved.");

                // construct propagator result
                keyValues[ordinal] = PropagatorResult.CreateKeyValue(
                    keyMemberInformation.Flags,
                    keyValue,
                    stateEntry,
                    keyIdentifier);

                // see UpdateTranslator.Identifiers for information on key identifiers and ordinals
            }

            return(PropagatorResult.CreateStructuralValue(keyValues, keyMetadata.m_type, false));
        }
Пример #13
0
        private bool CanInjectMember(MemberInformation member, IServiceRegistration serviceRegistration)
        {
            var autoMemberInjectionEnabled = this.containerContext.ContainerConfigurator.ContainerConfiguration.MemberInjectionWithoutAnnotationEnabled || serviceRegistration.RegistrationContext.AutoMemberInjectionEnabled;
            var autoMemberInjectionRule    = serviceRegistration.RegistrationContext.AutoMemberInjectionEnabled ? serviceRegistration.RegistrationContext.AutoMemberInjectionRule :
                                             this.containerContext.ContainerConfigurator.ContainerConfiguration.MemberInjectionWithoutAnnotationRule;

            if (autoMemberInjectionEnabled)
            {
                return(member.TypeInformation.HasDependencyAttribute ||
                       member.MemberInfo is FieldInfo && autoMemberInjectionRule.HasFlag(Rules.AutoMemberInjection.PrivateFields) ||
                       member.MemberInfo is PropertyInfo && (autoMemberInjectionRule.HasFlag(Rules.AutoMemberInjection.PropertiesWithPublicSetter) && ((PropertyInfo)member.MemberInfo).HasSetMethod() ||
                                                             autoMemberInjectionRule.HasFlag(Rules.AutoMemberInjection.PropertiesWithLimitedAccess)));
            }

            return(member.TypeInformation.HasDependencyAttribute);
        }
        /// <summary>
        ///
        /// </summary>
        public void SaveMemberInfo()
        {
            //arrange
            MemberInformation mArgument1 = null;
            MemberInformation mArgument2 = null;
            bool mActual1 = false;
            bool mActual2 = false;
            bool mActual3 = false;
            bool mActual4 = false;
            bool mActual5 = false;
            bool mActual6 = false;
            bool mActual7 = false;
            bool mActual8 = false;
            bool mActual9 = false;

            //act
            mArgument1 = PortableThreadLocalMemberObserver.SaveMemberInfo(EMemberStatus.IsRunning);
            mArgument2 = PortableThreadLocalMemberObserver.SaveMemberInfo(EMemberStatus.IsFinished);

            mActual1 = (mArgument2.GetCreationTime() >= mArgument1.GetCreationTime());
            mActual2 = ((mArgument2.Status == EMemberStatus.IsFinished) && (mArgument1.Status == EMemberStatus.IsRunning));
            mActual3 = (mArgument2.UniqueThreadID == mArgument1.UniqueThreadID);
            mActual4 = (mArgument2.UniqueMemberID == mArgument1.UniqueMemberID);
            mActual5 = ((mArgument2.Name == mArgument1.Name) && (mArgument2.Name == CallerService.GetThisMemberName()));
            mActual6 = ((mArgument2.FilePath == mArgument1.FilePath) && (mArgument2.FilePath == CallerService.GetThisFilePath()));
            mActual7 = (mArgument2.LineNumber > mArgument1.LineNumber);
            mActual8 = (mArgument2.Exception == mArgument1.Exception);
            mActual9 = (mArgument2.ExceptionStackTrace == mArgument1.ExceptionStackTrace);

            Debug.WriteLine(StringHelper.DefaultJoin(mArgument2.GetCreationTime().Ticks, mArgument1.GetCreationTime().Ticks, (mArgument2.GetCreationTime().Ticks - mArgument1.GetCreationTime().Ticks)));
            Debug.WriteLine(StringHelper.DefaultJoin(mArgument2.Status, mArgument1.Status));
            Debug.WriteLine(StringHelper.DefaultJoin(mArgument2.UniqueThreadID, mArgument2.UniqueMemberID));
            Debug.WriteLine(StringHelper.DefaultJoin(mArgument2.Name, mArgument2.FilePath));
            Debug.WriteLine(StringHelper.DefaultJoin(mArgument2.LineNumber, mArgument1.LineNumber, (mArgument2.LineNumber - mArgument1.LineNumber)));
            Debug.WriteLine(StringHelper.DefaultJoin(mArgument2.Exception, mArgument2.ExceptionStackTrace));

            //assert
            Contract.Assert(mActual1);
            Contract.Assert(mActual2);
            Contract.Assert(mActual3);
            Contract.Assert(mActual4);
            Contract.Assert(mActual5);
            Contract.Assert(mActual6);
            Contract.Assert(mActual7);
            Contract.Assert(mActual8);
            Contract.Assert(mActual9);
        }
Пример #15
0
        private async void LoadMemberInformation()
        {
            MemberInformation MemberInfor = await this._service.GetMemberInformation();

            TxtFirstName.Text   = MemberInfor.firstName;
            TxtLastName.Text    = MemberInfor.lastName;
            TxtAddress.Text     = MemberInfor.address;
            TxtGender.Text      = " " + MemberInfor.returnGender(MemberInfor.gender);
            ImageControl.Source = new BitmapImage(new Uri(MemberInfor.avatar, UriKind.Absolute));
            TxtEmail.Text       = MemberInfor.email;
            TxtUserID.Text      = MemberInfor.id;
            TxtPhone.Text       = MemberInfor.phone;
            TxtCreatAt.Text     = MemberInfor.createdAt;
            TxtUpdateAt.Text    = MemberInfor.updatedAt;
            TxtBirthday.Text    = MemberInfor.birthday;
            TxtPassword.Text    = MemberInfor.password;
        }
        public void CreateValueTest()
        {
            var expectedValue = RandomValueEx.GetRandomInt32();
            var expectedMemberInformation = new MemberInformation();
            IMemberInformation actualParameter = null;
            var target = new ExpressionInstanceFactory( x =>
            {
                actualParameter = x;
                return expectedValue;
            } );

            var actual = target.CreateValue( expectedMemberInformation );
            actual.Should()
                  .Be( expectedValue );
            actualParameter.Should()
                           .BeSameAs( expectedMemberInformation );
        }
        public void CreateValueTest()
        {
            var expectedValue                  = RandomValueEx.GetRandomInt32();
            var expectedMemberInformation      = new MemberInformation();
            IMemberInformation actualParameter = null;
            var target = new ExpressionInstanceFactory(x =>
            {
                actualParameter = x;
                return(expectedValue);
            });

            var actual = target.CreateValue(expectedMemberInformation);

            actual.Should()
            .Be(expectedValue);
            actualParameter.Should()
            .BeSameAs(expectedMemberInformation);
        }
Пример #18
0
        public ActionResult EditMember(int id, MemberInformation p1)
        {
            try
            {
                var kisi = db.MemberInformation.Where(i => i.MemberID == id).SingleOrDefault();
                kisi.MemberName  = p1.MemberName;
                kisi.MemberEmail = p1.MemberEmail;
                kisi.MemberPhone = p1.MemberPhone;
                kisi.MemberTcNo  = p1.MemberTcNo;

                db.SaveChanges();
                return(RedirectToAction("ViewMember", "Member"));
            }
            catch
            {
                return(View(p1));
            }
        }
Пример #19
0
        private static LoopResult memberInfoHandler()
        {
            MemberInformation mMemberInfo = null;

            while (ThreadLocalMemberObserver.MemberInfoCollection.TryDequeue(out mMemberInfo))
            {
                try
                {
                    ThreadLocalMemberObserver.MemberInfoHandler(mMemberInfo);
                }
                catch //(Exception mException)
                { }
                finally
                { }
            }

            return(LoopResult.Continue);
        }
        public void CheckMemberInPredicateIsSame()
        {
            var expected             = new MemberInformation();
            MemberInformation actual = null;
            var target = new ExpressionMemberSelectionRule(x =>
            {
                actual = x as MemberInformation;
                return(true);
            },
                                                           MemberSelectionMode.Include);

            var result = target.GetSelectionResult(expected);

            result.Should()
            .Be(MemberSelectionResult.IncludeMember);

            actual.Should()
            .BeSameAs(expected);
        }
Пример #21
0
        /// <inheritdoc />
        public bool CanInjectMember(MemberInformation member)
        {
            var autoMemberInjectionEnabled = this.containerConfigurator.ContainerConfiguration.MemberInjectionWithoutAnnotationEnabled || this.RegistrationContext.AutoMemberInjectionEnabled;
            var autoMemberInjectionRule    = this.RegistrationContext.AutoMemberInjectionEnabled ? this.RegistrationContext.AutoMemberInjectionRule :
                                             this.containerConfigurator.ContainerConfiguration.MemberInjectionWithoutAnnotationRule;

            if (autoMemberInjectionEnabled)
            {
                return(member.TypeInformation.ForcedDependency ||
                       member.TypeInformation.MemberType == MemberType.Field &&
                       (autoMemberInjectionRule & Rules.AutoMemberInjectionRules.PrivateFields) == Rules.AutoMemberInjectionRules.PrivateFields ||
                       member.TypeInformation.MemberType == MemberType.Property &&
                       ((autoMemberInjectionRule & Rules.AutoMemberInjectionRules.PropertiesWithPublicSetter) == Rules.AutoMemberInjectionRules.PropertiesWithPublicSetter &&
                        ((PropertyInfo)member.MemberInfo).HasSetMethod() ||
                        (autoMemberInjectionRule & Rules.AutoMemberInjectionRules.PropertiesWithLimitedAccess) == Rules.AutoMemberInjectionRules.PropertiesWithLimitedAccess));
            }

            return(member.TypeInformation.ForcedDependency);
        }
Пример #22
0
        public ActionResult AddBookRental(BookRent b1, MemberInformation m1)
        {
            try
            {
                var varmi = db.MemberInformation.Where(i => i.MemberTcNo == m1.MemberTcNo).SingleOrDefault();
                if (varmi == null)
                {
                    ViewBag.Message = "Girilen Tc Kimlik Numarasına Kayıtlı bir Hesap Yoktur!! ";
                    return(View());
                }
                b1.MemberID = varmi.MemberID;
                b1.BookID   = (int)Session["BookID"];
                var forstock = db.BookArchive.Where(i => i.BookID == b1.BookID).SingleOrDefault();
                forstock.BookStock = forstock.BookStock - 1;
                b1.UserID          = (int)Session["UserID"];
                b1.IsReturn        = false;
                b1.ReturnDate      = b1.RentDate.AddDays(b1.RentDay);
                db.BookRent.Add(b1);
                db.SaveChanges();
                var         varmi2 = db.BookArchive.Where(a => a.BookID == b1.BookID).SingleOrDefault();
                MailMessage eposta = new MailMessage();
                eposta.From = new MailAddress("*****@*****.**");
                eposta.To.Add(varmi.MemberEmail);
                eposta.Subject = "SMART-BOOKCASE";
                eposta.Body    = "Sayın " + varmi.MemberName + "; Kütüphanemizden " + varmi2.BookName + " İsimli Kitabı " + b1.RentDay + " gün Kiralamış bulunmaktasınız. Kİralama Başlangış tarihiniz " + b1.RentDate + " olup, Teslim tarihiniz " + b1.ReturnDate + " 'dır. İYİ OKUMALAR... ";
                SmtpClient smtp = new SmtpClient();
                smtp.Credentials = new NetworkCredential("*****@*****.**", "TeamForza5");
                smtp.Port        = 587;
                smtp.Host        = "smtp.live.com";
                smtp.EnableSsl   = true;
                smtp.Send(eposta);


                return(RedirectToAction("RentalOperations", "BookRentals"));
            }
            catch
            {
                return(RedirectToAction("RentalOperations", "BookRentals"));
            }
        }
Пример #23
0
        public ActionResult AddMember(MemberInformation p1)
        {
            try
            {
                var varmi = db.MemberInformation.Where(i => i.MemberEmail == p1.MemberEmail).SingleOrDefault();
                if (varmi != null)
                {
                    ViewBag.Message = "Girilen E-maile Kayitli bir Kullanici Hesabi Var!! ";
                    return(View());
                }
                var varmi2 = db.MemberInformation.Where(i => i.MemberTcNo == p1.MemberTcNo).SingleOrDefault();
                if (varmi2 != null)
                {
                    ViewBag.Message = "Girilen TC. No ile Kayitli bir Kullanici Hesabi Var!! ";
                    return(View());
                }

                db.MemberInformation.Add(p1);
                db.SaveChanges();

                MailMessage eposta = new MailMessage();
                eposta.From = new MailAddress("*****@*****.**");
                eposta.To.Add(p1.MemberEmail);
                eposta.Subject = "SMART-BOOKCASE";
                eposta.Body    = "Sayın " + p1.MemberName + "; Kütüphanemizde üye kaydınız başarıyla oluşturulmuştur.";
                SmtpClient smtp = new SmtpClient();
                smtp.Credentials = new NetworkCredential("*****@*****.**", "TeamForza5");
                smtp.Port        = 587;
                smtp.Host        = "smtp.live.com";
                smtp.EnableSsl   = true;
                smtp.Send(eposta);

                return(RedirectToAction("ViewMember", "Member"));
            }
            catch
            {
                return(RedirectToAction("ViewMember", "Member"));
            }
        }
Пример #24
0
        private MemberInformation getMemberInformation(int memberId)
        {
            MemberInformation memberInfo = new MemberInformation();

            foreach (MemberEntry aMember in memberEntryList)
            {
                if (aMember.memberId == memberId)
                {
                    memberInfo.memberId   = aMember.memberId;
                    memberInfo.borderName = aMember.name;
                    memberInfo.roomNo     = aMember.roomNo;
                }
            }

            int countTotalMeal = 0;

            foreach (var aMeal in mealEntryList)
            {
                if (aMeal.memberId == memberId)
                {
                    countTotalMeal += aMeal.noOfMeals;
                }
            }
            totalNoOfMeals      += countTotalMeal;
            memberInfo.noOfMeals = countTotalMeal;
            int countTotalBalance = 0;

            foreach (var balanceEntry in balanceEntryList)
            {
                if (balanceEntry.memberId == memberId)
                {
                    countTotalBalance += balanceEntry.balance;
                }
            }
            memberInfo.balance = countTotalBalance;

            return(memberInfo);
        }
Пример #25
0
        /// <summary>
        /// Requires: record must have correct type for this metadata instance.
        /// Populates a new <see cref="PropagatorResult"/> object representing a member of a record matching the
        /// type of this extractor. Given a record and a member, this method wraps the value of the member
        /// in a PropagatorResult. This operation can be performed efficiently by this class, which knows
        /// important stuff about the type being extracted.
        /// </summary>
        /// <param name="stateEntry">state manager entry containing value (used for error reporting)</param>
        /// <param name="record">Record containing value (used to find the actual value)</param>
        /// <param name="currentValues">Indicates whether we are reading current or original values.</param>
        /// <param name="key">Entity key for the state entry. Must be set for entity records.</param>
        /// <param name="ordinal">Ordinal of Member for which to retrieve a value.</param>
        /// modified (must be ordinally aligned with the type). Null indicates all members are modified.</param>
        /// <param name="modifiedPropertiesBehavior">Indicates how to determine whether a property is modified.</param>
        /// <returns>Propagator result describing this member value.</returns>
        internal PropagatorResult RetrieveMember(IEntityStateEntry stateEntry, IExtendedDataRecord record, bool useCurrentValues,
                                                 EntityKey key, int ordinal, ModifiedPropertiesBehavior modifiedPropertiesBehavior)
        {
            MemberInformation memberInformation = m_memberMap[ordinal];

            // get identifier value
            int identifier;

            if (memberInformation.IsKeyMember)
            {
                // retrieve identifier for this key member
                Debug.Assert(null != (object)key, "entities must have keys, and only entity members are marked IsKeyMember by " +
                             "the metadata wrapper");
                int keyOrdinal = memberInformation.EntityKeyOrdinal.Value;
                identifier = m_translator.KeyManager.GetKeyIdentifierForMemberOffset(key, keyOrdinal, ((EntityType)m_type).KeyMembers.Count);
            }
            else if (memberInformation.IsForeignKeyMember)
            {
                identifier = m_translator.KeyManager.GetKeyIdentifierForMember(key, record.GetName(ordinal), useCurrentValues);
            }
            else
            {
                identifier = PropagatorResult.NullIdentifier;
            }

            // determine if the member is modified
            bool isModified = modifiedPropertiesBehavior == ModifiedPropertiesBehavior.AllModified ||
                              (modifiedPropertiesBehavior == ModifiedPropertiesBehavior.SomeModified &&
                               stateEntry.ModifiedProperties != null &&
                               stateEntry.ModifiedProperties[memberInformation.Ordinal]);

            // determine member value
            Debug.Assert(record.GetName(ordinal) == memberInformation.Member.Name, "expect record to present properties in metadata order");
            if (memberInformation.CheckIsNotNull && record.IsDBNull(ordinal))
            {
                throw EntityUtil.Update(Strings.Update_NullValue(record.GetName(ordinal)), null, stateEntry);
            }
            object value = record.GetValue(ordinal);

            // determine what kind of member this is

            // entityKey (association end)
            EntityKey entityKey = value as EntityKey;

            if (null != (object)entityKey)
            {
                return(CreateEntityKeyResult(stateEntry, entityKey));
            }

            // record (nested complex type)
            IExtendedDataRecord nestedRecord = value as IExtendedDataRecord;

            if (null != nestedRecord)
            {
                // for structural types, we track whether the entire complex type value is modified or not
                var nestedModifiedPropertiesBehavior = isModified
                    ? ModifiedPropertiesBehavior.AllModified
                    : ModifiedPropertiesBehavior.NoneModified;
                UpdateTranslator translator = m_translator;

                return(ExtractResultFromRecord(stateEntry, isModified, nestedRecord, useCurrentValues, translator, nestedModifiedPropertiesBehavior));
            }

            // simple value (column/property value)
            return(CreateSimpleResult(stateEntry, record, memberInformation, identifier, isModified, ordinal, value));
        }
    private MemberInformation UnConvert(MemberMeta meta)
    {
        MemberInformation result = new MemberInformation();

        result.Birthday = meta.Birthday;
        result.City = meta.City;
        result.EmailAddress = meta.EmailAddress;
        result.FirstName = meta.FirstName;
        result.Gender = meta.Gender;
        result.LastName = meta.LastName;
        result.MiddleName = meta.MiddleName;
        result.Nation = meta.Nation;
        result.Passport = meta.Passport;
        result.Password = meta.Password;
        result.RegsterDate = meta.RegisterTime;
        result.PhoneDay = meta.PhoneDay;
        result.PhoneNight = meta.PhoneNight;
        result.Province = meta.Province;
        result.Remark = meta.Remark;
        result.StreetAddress = meta.StreetAddress;
        result.ZipCode = meta.ZipCode;
        result.MemberCode = meta.MemberCode;
        return result;
    }
Пример #27
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(lblFirstName.Text.Trim()))
            {
                btnCreate.Enabled = false;
                lblErrorMeassage.Text = "For missing name, please contact Dallas office- Christine Chiang 1-(888)-2887528 ext 6268 [email protected]";
                return;
            }

            if (string.IsNullOrEmpty(lblAccountCode.Text.Trim()))
            {
                btnCreate.Enabled = false;
                lblErrorMeassage.Text = "For missing account code, please contact Dallas office- Christine Chiang 1-(888)-2887528 ext 6268 [email protected]";
                return;
            }

            if (string.IsNullOrEmpty(lblBranch.Text.Trim()))
            {
                btnCreate.Enabled = false;
                lblErrorMeassage.Text = "For missing branch, please contact Dallas office- Christine Chiang 1-(888)-2887528 ext 6268 [email protected]";
                return;
            }

            if (!System.Text.RegularExpressions.Regex.IsMatch(txtEmail.Text.Trim(), @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"))
            {
                lblErrorMeassage.Text = "The email is unavailable";
                return;
            }

            if (string.IsNullOrEmpty(txtCompanyname.Text.Trim()))
            {
                lblErrorMeassage.Text = "Please provide Company name";
                return;
            }

            if (string.IsNullOrEmpty(txtPhoneDay.Text.Trim()))
            {
                lblErrorMeassage.Text = "Please provide Phone.";
                return;
            }

            string FirstName = lblFirstName.Text.Trim();
            string LastName = lblLastName.Text.Trim();
            string EmailAddress = txtEmail.Text.Trim();
            string PhoneDay = txtPhoneDay.Text.Trim();
            string CompanyName = txtCompanyname.Text.Trim();
            string AccountCode = lblAccountCode.Text.Trim();
            string Branch = lblBranch.Text.Trim();
            string userID = lblUserId.Text.Trim();

            string arcNumber = lblARCNumber.Text.Trim();
            string Address = txtAddress.Text.Trim();
            string City = txtCity.Text.Trim();
            string State = txtState.Text.Trim();
            string ZipCode = txtZipCode.Text.Trim();
            string Country = txtCountry.Text.Trim();
            string Fax = txtFax.Text.Trim();
            string UserRoll = lblRool.Text.Trim();

            MemberInformation memberinfo = _MemberInformationService.GetGttMemberByEmail(EmailAddress);

            if (memberinfo != null)
            {
                #region ����ע��� ֻ����GTT���󣬵��Ǹ��±�����Ϣ
                Terms.Member.Domain.MemberInfoByGTTMeta memberInfoByGTTMeta = new Terms.Member.Domain.MemberInfoByGTTMeta();

                memberInfoByGTTMeta.AccountCode = AccountCode;
                memberInfoByGTTMeta.EmailAddress = EmailAddress;
                memberInfoByGTTMeta.FirstName = FirstName;
                memberInfoByGTTMeta.LastName = LastName;
                memberInfoByGTTMeta.MemberType = 1;
                memberInfoByGTTMeta.PhoneDay = PhoneDay;
                memberInfoByGTTMeta.RegisterTime = memberinfo.RegsterDate;
                memberInfoByGTTMeta.Source = "Subagent";
                memberInfoByGTTMeta.Status = "1";
                memberInfoByGTTMeta.GTTID = userID;
                memberInfoByGTTMeta.Branch = Branch;
                memberInfoByGTTMeta.CompanyName = CompanyName;

                memberInfoByGTTMeta.City = City;
                memberInfoByGTTMeta.DirectFrom = memberinfo.DirectFrom;
                memberInfoByGTTMeta.Gender = memberinfo.Gender;
                memberInfoByGTTMeta.GroupCode = memberinfo.GroupCode;
                memberInfoByGTTMeta.MemberCode = memberinfo.MemberCode;
                memberInfoByGTTMeta.MiddleName = memberinfo.MiddleName;
                memberInfoByGTTMeta.Nation = Country;
                memberInfoByGTTMeta.Passport = memberinfo.Passport;
                memberInfoByGTTMeta.Password = memberinfo.Password;
                memberInfoByGTTMeta.Password1 = memberinfo.Password1;
                memberInfoByGTTMeta.PhoneNight = memberinfo.PhoneNight;
                memberInfoByGTTMeta.Province = State;
                memberInfoByGTTMeta.Remark = memberinfo.Remark;
                memberInfoByGTTMeta.StreetAddress = Address;
                memberInfoByGTTMeta.ZipCode = ZipCode;
                memberInfoByGTTMeta.Birthday = DateTime.MaxValue;
                //add zyl 2009-9-14
                memberInfoByGTTMeta.ARCNumber = arcNumber;
                memberInfoByGTTMeta.Fax = Fax;
                memberInfoByGTTMeta.UserRoll = UserRoll;

                string city = Branch.Replace("GTT", string.Empty);

                string HandlerName = GetHandlerName(city.Trim());

                memberInfoByGTTMeta.Handler = HandlerName;

                try
                {
                    _MemberInformationService.SaveAndUpdateNewGttMember(memberInfoByGTTMeta, true);
                }
                catch
                {
                    lblErrorMeassage.Text = "service error";
                    return;
                }

                memberinfo.Status = "1";
                memberinfo.GttId = userID;
                memberinfo.Handler = HandlerName;
                memberinfo.FirstName = FirstName;
                memberinfo.LastName = LastName;
                memberinfo.PhoneDay = PhoneDay;
                memberinfo.Source = "Subagent";

                memberinfo.City = City;
                memberinfo.Nation = Country;
                memberinfo.Province = State;
                memberinfo.ZipCode = ZipCode;
                memberinfo.ARCNumber = arcNumber;
                memberinfo.Fax = Fax;
                memberinfo.StreetAddress = Address;

                //�������ɹ���ʱ��Ӧ��ͨ��MemberCode���¶�ȡ�û���Ϣ Add zyl 2009-10-26
                memberinfo = _MemberInformationService.GetGttMemberByMember(memberInfoByGTTMeta.MemberCode);

                Utility.Transaction.IsLogin = true;
                Utility.Transaction.Member = memberinfo;

                this.Response.Redirect("Index.aspx");
                #endregion
            }
            else
            {
                #region �½����û�

                //�����û�����
                MemberInformation meta = new MemberInformation();
                Terms.Member.Domain.TOwner owner = new Terms.Member.Domain.TOwner();
                Terms.Member.Domain.MemberInfoByGTTMeta memberInfoByGTTMeta = new Terms.Member.Domain.MemberInfoByGTTMeta();

                //���Member����
                meta.EmailAddress = EmailAddress;
                meta.FirstName = FirstName;
                meta.LastName = LastName;
                meta.MemberType = 1;
                meta.PhoneDay = PhoneDay;
                meta.RegsterDate = DateTime.Now;
                meta.Source = "Subagent";
                meta.Status = "1";

                meta.MiddleName = "";
                meta.Gender = Convert.ToInt32(0);
                meta.Password = "";
                meta.Password1 = "";
                meta.City = City;
                meta.StreetAddress = Address;
                meta.Nation = Country;
                meta.Province = State;
                meta.ZipCode = ZipCode;
                meta.Remark = "";

                //��乫˾����
                owner.CompanyName = CompanyName;
                owner.ArcNum = arcNumber;

                //���GTT����
                memberInfoByGTTMeta.AccountCode = AccountCode;
                memberInfoByGTTMeta.EmailAddress = EmailAddress;
                memberInfoByGTTMeta.FirstName = FirstName;
                memberInfoByGTTMeta.LastName = LastName;
                memberInfoByGTTMeta.MemberType = 1;
                memberInfoByGTTMeta.PhoneDay = PhoneDay;
                memberInfoByGTTMeta.RegisterTime = DateTime.Now;
                memberInfoByGTTMeta.Source = "Subagent";
                memberInfoByGTTMeta.Status = "1";
                memberInfoByGTTMeta.GTTID = userID;
                memberInfoByGTTMeta.Branch = Branch;
                memberInfoByGTTMeta.CompanyName = CompanyName;

                memberInfoByGTTMeta.MiddleName = "";
                memberInfoByGTTMeta.Gender = Convert.ToInt32(0);
                memberInfoByGTTMeta.Password = "";
                memberInfoByGTTMeta.Password1 = "";
                memberInfoByGTTMeta.Remark = "";
                //add zyl 2009-9-14
                memberInfoByGTTMeta.City = City;
                memberInfoByGTTMeta.StreetAddress = Address;
                memberInfoByGTTMeta.Nation = Country;
                memberInfoByGTTMeta.Province = State;
                memberInfoByGTTMeta.ZipCode = ZipCode;
                memberInfoByGTTMeta.ARCNumber = arcNumber;
                memberInfoByGTTMeta.Fax = Fax;
                memberInfoByGTTMeta.UserRoll = UserRoll;

                memberInfoByGTTMeta.Birthday = DateTime.MaxValue;

                //����city���Handler
                string city = Branch.Replace("GTT", string.Empty);

                string HandlerName = GetHandlerName(city.Trim());

                meta.Handler = HandlerName;
                memberInfoByGTTMeta.Handler = HandlerName;

                //����
                try
                {
                    string strMemberCode = _MemberInformationService.SaveNewMemberInformation(meta, owner, memberInfoByGTTMeta, true);
                }
                catch
                {
                    lblErrorMeassage.Text = "service error";
                    return;
                }

                //meta.MemberCode = memberInfoByGTTMeta.MemberCode;
                //�������ɹ���ʱ��Ӧ��ͨ��MemberCode���¶�ȡ�û���Ϣ Add zyl 2009-10-26
                meta = _MemberInformationService.GetGttMemberByMember(memberInfoByGTTMeta.MemberCode);

                //��¼ϵͳ
                Utility.Transaction.IsLogin = true;
                Utility.Transaction.Member = meta;

                this.Response.Redirect("Index.aspx");
                #endregion
            }
        }
Пример #28
0
        internal ExtractorMetadata(EntitySetBase entitySetBase, StructuralType type, UpdateTranslator translator)
        {
            DebugCheck.NotNull(entitySetBase);
            DebugCheck.NotNull(type);
            DebugCheck.NotNull(translator);

            m_type       = type;
            m_translator = translator;

            EntityType      entityType = null;
            Set <EdmMember> keyMembers;
            Set <EdmMember> foreignKeyMembers;

            switch (type.BuiltInTypeKind)
            {
            case BuiltInTypeKind.RowType:
                // for row types (which are actually association end key records in disguise), all members
                // are keys
                keyMembers        = new Set <EdmMember>(((RowType)type).Properties).MakeReadOnly();
                foreignKeyMembers = Set <EdmMember> .Empty;
                break;

            case BuiltInTypeKind.EntityType:
                entityType        = (EntityType)type;
                keyMembers        = new Set <EdmMember>(entityType.KeyMembers).MakeReadOnly();
                foreignKeyMembers = new Set <EdmMember>(
                    ((EntitySet)entitySetBase).ForeignKeyDependents
                    .SelectMany(fk => fk.Item2.ToProperties)).MakeReadOnly();
                break;

            default:
                keyMembers        = Set <EdmMember> .Empty;
                foreignKeyMembers = Set <EdmMember> .Empty;
                break;
            }

            var members = TypeHelpers.GetAllStructuralMembers(type);

            m_memberMap = new MemberInformation[members.Count];
            // for each member, cache expensive to compute metadata information
            for (var ordinal = 0; ordinal < members.Count; ordinal++)
            {
                var member = members[ordinal];
                // figure out flags for this member
                var flags            = PropagatorFlags.NoFlags;
                var entityKeyOrdinal = default(int?);

                if (keyMembers.Contains(member))
                {
                    flags |= PropagatorFlags.Key;
                    if (null != entityType)
                    {
                        entityKeyOrdinal = entityType.KeyMembers.IndexOf(member);
                    }
                }
                if (foreignKeyMembers.Contains(member))
                {
                    flags |= PropagatorFlags.ForeignKey;
                }

                if (MetadataHelper.GetConcurrencyMode(member)
                    == ConcurrencyMode.Fixed)
                {
                    flags |= PropagatorFlags.ConcurrencyValue;
                }

                // figure out whether this member is mapped to any server generated
                // columns in the store
                var isServerGenerated = m_translator.ViewLoader.IsServerGen(entitySetBase, m_translator.MetadataWorkspace, member);

                // figure out whether member nullability is used as a condition in mapping
                var isNullConditionMember = m_translator.ViewLoader.IsNullConditionMember(
                    entitySetBase, m_translator.MetadataWorkspace, member);

                // add information about this member
                m_memberMap[ordinal] = new MemberInformation(
                    ordinal, entityKeyOrdinal, flags, member, isServerGenerated, isNullConditionMember);
            }
        }
Пример #29
0
        public void UpdatePassages()
        {
            //lastId = 0;
            //List.Children.Clear();

            Data.GymContextDataContext db = new Data.GymContextDataContext();
            var h = Domain.Dynamics.TransitFarthestHour;
            //var today = DateTime.Today;
            var passages =
                (from p in db.Passages
                 where !p.Member.IsStaff &&
                 !p.Member.IsMentor &&
                 p.Id > lastId &&
                 p.Time >= DateTime.Now.AddHours(-1 * h)
                 select new
            {
                p.Id,
                p.IsEntrance,
                p.Time,
                Member = p.Member.Firstname + " " + p.Member.Lastname,
                MemberId = p.MemberId,
                IsRegular = p.Member.IsRegular,
                Closet = db.ClosetUsages.Where(u => u.MemberId == p.MemberId && u.FromTime >= p.Time && u.FromTime <= p.Time.AddSeconds(30)).Select(c => c).FirstOrDefault()
            }).ToList();

            lastId = passages.Any() ? passages.Select(p => p.Id).Max() : lastId;

            if (passages.Count == 0)
            {
                return;
            }

            var style   = new Style();
            var trigger = new Trigger {
                Property = IsMouseOverProperty, Value = true
            };

            trigger.Setters.Add(new Setter {
                Property = OpacityProperty, Value = 1.0
            });
            var triggeroff = new Trigger {
                Property = IsMouseOverProperty, Value = false
            };

            triggeroff.Setters.Add(new Setter {
                Property = OpacityProperty, Value = 0.5
            });
            style.Triggers.Add(trigger);
            style.Triggers.Add(triggeroff);

            passages.ToList().ForEach(pass =>
            {
                StackPanel panel = new StackPanel
                {
                    Orientation   = Orientation.Horizontal,
                    FlowDirection = FlowDirection.RightToLeft,
                    Style         = style,
                };
                panel.ContextMenu = new ContextMenu();

                var enrollitem = new MenuItem {
                    Header = "فرم ثبت نام"
                };
                enrollitem.Click += (s, ce) =>
                {
                    Enroll member = new Enroll();
                    member.Owner  = Main.Home;
                    member.Show();
                    member.LoadMember(pass.MemberId);
                };
                enrollitem.IsEnabled = pass.IsRegular;
                panel.ContextMenu.Items.Add(enrollitem);

                string tip = "";
                if (pass.IsEntrance)
                {
                    var firstUsageAfter = db.ClosetUsages.Where(u => u.MemberId == pass.MemberId && u.FromTime >= pass.Time).OrderBy(u => u.FromTime).FirstOrDefault();
                    if (firstUsageAfter != null)
                    {
                        tip += "کمد: " + firstUsageAfter.ClosetId.ToString();
                    }
                }
                else
                {
                    var closetAtTheTime = db.ClosetUsages.Where(u => u.MemberId == pass.MemberId && u.FromTime <= pass.Time).OrderByDescending(u => u.FromTime).FirstOrDefault();
                    if (closetAtTheTime != null)
                    {
                        tip += "کمد: " + closetAtTheTime.ClosetId.ToString();
                    }
                }

                tip += Environment.NewLine + "تاریخ: " + pass.Time.Date.ToFa()
                       + Environment.NewLine + "زمان: " + pass.Time.ToLongTimeString()
                       + Environment.NewLine + "عضو: " + pass.Member
                       + Environment.NewLine + "وضعیت تردد : " + (pass.IsEntrance ? "ورود" : "خروج");

                panel.ToolTip = tip;

                var infoitem = new MenuItem {
                    Header = "مشاهده اطلاعات عضو"
                };
                List <string> facilities = new List <string>();
                infoitem.Click          += (s, ce) =>
                {
                    bool facilitiesCached = false;
                    if (!facilitiesCached)
                    {
                        var mmbr  = db.Members.Where(m => m.Id == pass.MemberId).FirstOrDefault();
                        var nrols = mmbr.Enrolls.Where(e => e.StartDate <= DateTime.Today &&
                                                       (e.ExpireDate == null || e.ExpireDate >= DateTime.Today)).ToList();
                        var nf     = nrols.SelectMany(n => n.EnrollFacilities).ToList();
                        facilities = nf.Select(f => f.Facility.Name).ToList();
                    }

                    MemberInformation member = new MemberInformation();
                    member.Owner             = Main.Home;
                    member.SetMember(pass.MemberId, pass.IsEntrance ? "ورود" : "خروج", facilities);
                    member.Show();
                };
                infoitem.IsEnabled = pass.IsRegular;
                panel.ContextMenu.Items.Add(infoitem);

                var financial = new MenuItem {
                    Header = "لیست تراکنش های عضو"
                };
                financial.Click += (s, ce) =>
                {
                    Enroll member = new Enroll();
                    member.Owner  = Main.Home;
                    member.Show();
                    member.LoadMember(pass.MemberId);
                    member.Section = 3;
                };
                panel.ContextMenu.Items.Add(financial);

                MaterialDesignThemes.Wpf.PackIcon icon = new MaterialDesignThemes.Wpf.PackIcon
                {
                    Kind       = pass.IsEntrance ? MaterialDesignThemes.Wpf.PackIconKind.TrendingUp : MaterialDesignThemes.Wpf.PackIconKind.TrendingDown,
                    Foreground = new SolidColorBrush(pass.IsEntrance ? Colors.DodgerBlue : Colors.DarkRed),
                    Margin     = new Thickness(0, 6, 0, 0)
                };
                Label time = new Label
                {
                    Foreground = new SolidColorBrush(pass.IsRegular ? Colors.DodgerBlue : Colors.Gray),
                    Content    = $"{pass.Time.ToString("HH:mm")} {pass.Member}",
                    Margin     = new Thickness(2, 1, 2, 1),
                    //FontWeight = pass.IsRegular ? FontWeights.Bold : FontWeights.Normal
                };

                var mem = db.Members.First(m => m.Id == pass.MemberId);

                var validUntill    = DateTime.Now.AddDays(4);
                var needsExtension = db.Enrolls.Where(n =>
                                                      n.MemberId == mem.Id &&
                                                      (n.ExpireDate <= validUntill && n.ExpireDate >= DateTime.Now)).Any();

                panel.Children.Add(icon);
                panel.Children.Add(time);
                if (needsExtension)
                {
                    MaterialDesignThemes.Wpf.PackIcon ext = new MaterialDesignThemes.Wpf.PackIcon
                    {
                        Kind       = MaterialDesignThemes.Wpf.PackIconKind.ClockEnd,
                        Foreground = new SolidColorBrush(pass.IsEntrance ? Colors.DodgerBlue : Colors.DarkRed),
                        Margin     = new Thickness(0, 6, 0, 0),
                        ToolTip    = "نیازمند تمدید"
                    };
                    panel.Children.Add(ext);
                }
                if (mem.Debtor > 0)
                {
                    panel.Children.Add(new MaterialDesignThemes.Wpf.PackIcon
                    {
                        Kind       = MaterialDesignThemes.Wpf.PackIconKind.CurrencyUsd,
                        Foreground = new SolidColorBrush(pass.IsEntrance ? Colors.DodgerBlue : Colors.DarkRed),
                        Margin     = new Thickness(0, 6, 0, 0),
                        ToolTip    = "بدهکار شهریه"
                    });
                }
                if (mem.Debtor > 0)
                {
                    panel.Children.Add(new MaterialDesignThemes.Wpf.PackIcon
                    {
                        Kind       = MaterialDesignThemes.Wpf.PackIconKind.Carrot,
                        Foreground = new SolidColorBrush(pass.IsEntrance ? Colors.DodgerBlue : Colors.DarkRed),
                        Margin     = new Thickness(0, 6, 0, 0),
                        ToolTip    = "بدهکار بوفه"
                    });
                }
                List.Children.Add(panel);

                if (List.Children.Count > 100)
                {
                    List.Children.RemoveRange(0, List.Children.Count - 100);
                }
            });



            //while (true)
            //{
            //    //return;
            //    if (DateTime.Now.Subtract(lastcheck).TotalMilliseconds < 1000)
            //        continue;

            //    lastcheck = DateTime.Now;
            //    List.Children.Add(new Label
            //    {
            //        Foreground = new SolidColorBrush(Colors.Gray),
            //        Content = DateTime.Now.ToString("HH:mm:ss")
            //    });
            //    if (List.Children.Count > 100)
            //        List.Children.RemoveAt(0);
            //}
        }
            // Whenever we encounter a StartMember, we buffer it (and any namespace nodes folllowing it)
            // until we see its contents (SO/GO/V).
            // If the content is a PropertyReferenceExtension, then we convert it to an ActivityPropertyReference
            // in the parent object's ActivityBuilder.PropertyReference collection, and dont' write out the member.
            // If the content is not a PropertyReferenceExtension, or there's no content (i.e. we hit an EM),
            // we flush the buffered SM + NS*, and continue as normal.
            public void ProcessNode(XamlReader reader, IXamlLineInfo lineInfo, XamlWriter targetWriter, out bool writeNodeToOutput)
            {
                writeNodeToOutput = true;

                switch (reader.NodeType)
                {
                    case XamlNodeType.StartMember:
                        this.bufferedMember = new MemberInformation(reader.Member, lineInfo);
                        writeNodeToOutput = false;
                        break;

                    case XamlNodeType.EndMember:
                        FlushBufferedMember(targetWriter);
                        if (this.stack.Count > 0)
                        {
                            Frame curFrame = this.stack.Peek();
                            if (curFrame.SuppressNextEndMember)
                            {
                                writeNodeToOutput = false;
                                curFrame.SuppressNextEndMember = false;
                            }
                        }
                        break;

                    case XamlNodeType.StartObject:
                        Frame newFrame;
                        if (IsPropertyReferenceExtension(reader.Type) && this.bufferedMember.IsSet)
                        {                            
                            MemberInformation targetMember = this.bufferedMember;
                            this.bufferedMember = MemberInformation.None;                            
                            WritePropertyReferenceFrameToParent(targetMember, ReadPropertyReferenceExtensionPropertyName(reader), this.stack.Peek(), lineInfo);
                            writeNodeToOutput = false;
                            break;                            
                        }
                        else
                        {
                            FlushBufferedMember(targetWriter);
                            newFrame = new Frame();
                        }
                        this.stack.Push(newFrame);
                        break;

                    case XamlNodeType.GetObject:
                        FlushBufferedMember(targetWriter);
                        this.stack.Push(new Frame());
                        break;

                    case XamlNodeType.EndObject:
                        Frame frame = this.stack.Pop();
                        if (frame.PropertyReferences != null)
                        {
                            WritePropertyReferenceCollection(frame.PropertyReferences, targetWriter, lineInfo);
                        }
                        break;

                    case XamlNodeType.Value:
                        FlushBufferedMember(targetWriter);
                        break;

                    case XamlNodeType.NamespaceDeclaration:
                        if (this.bufferedMember.IsSet)
                        {
                            if (this.bufferedMember.FollowingNamespaces == null)
                            {
                                this.bufferedMember.FollowingNamespaces = new XamlNodeQueue(this.parent.schemaContext);
                            }
                            this.bufferedMember.FollowingNamespaces.Writer.WriteNode(reader, lineInfo);
                            writeNodeToOutput = false;
                        }
                        break;
                }
            }
    private void InitMemberInfo()
    {
        member = Utility.Transaction.Member;
        Memberads = _MemberInformationService.FindMemberadsByID(member.MemberCode);
        memberToDataSource = _MemberInformationService.FindMemberToDataSourceByID(member.MemberCode);
        MemberQuestionAndAnswerList = _MemberInformationService.FindTMemberQuestionAndAnswerByID(member.MemberCode);

        this.txtCity.Text = member.City;
        this.txtFirst.Text = member.FirstName;

        this.txtLast.Text = member.LastName;
        this.txtMiddle.Text = member.MiddleName;
        this.txtPhoneDay.Text = member.PhoneDay;

        this.txtStreet.Text = member.StreetAddress;
        this.txtZip.Text = member.ZipCode;
        this.txtCity.Text = member.City;
    }
    protected void aspbtnUpdate_Click(object sender, EventArgs e)
    {
        member = Utility.Transaction.Member;
        string strFirst = string.Empty;
        string strMiddle = string.Empty;
        string strLast = string.Empty;
        string strEmail = string.Empty;
        string strPhoneDay = string.Empty;
        string strPassport = string.Empty;
        string strStreet = string.Empty;
        string strCity = string.Empty;
        string strState = string.Empty;
        string strCountry = string.Empty;
        string strZip = string.Empty;

        if (this.IsValid)
        {
            strFirst = this.txtFirst.Text.Trim();

            strMiddle = this.txtMiddle.Text.Trim();

            strLast = this.txtLast.Text.Trim();

            strPhoneDay = this.txtPhoneDay.Text.Trim();

            strStreet = this.txtStreet.Text.Trim();

            strCity = this.txtCity.Text.Trim();

            strState = this.ddlState.SelectedValue;

            strCountry = this.ddlCountry.SelectedValue;

            strZip = this.txtZip.Text.Trim();

            int iCount = _MemberInformationService.GetEmail(strEmail);

            if (iCount > 0)
            {
                return;
            }

            TMemberToDataSource _MemberToDataSource = new TMemberToDataSource();

            _MemberToDataSource.Constantid = "0";

            MemberMeta _MemberInformation = _MemberInformationService.FindMemberInformationByID(Utility.Transaction.Member.MemberCode);

            _MemberInformation.FirstName = strFirst;
            _MemberInformation.MiddleName = strMiddle;
            _MemberInformation.LastName = strLast;
            _MemberInformation.PhoneDay = strPhoneDay;
            _MemberInformation.City = strCity;
            _MemberInformation.StreetAddress = strStreet;
            _MemberInformation.Nation = strCountry;
            _MemberInformation.Province = strState;
            _MemberInformation.ZipCode = strZip;

            MemberInformation mem = UnConvert(_MemberInformation);

            _MemberInformationService.UpdateMemberInformation(mem);

            //MailMessage mailMessage = new MailMessage();

            //mailMessage.From = new MailAddress(@"*****@*****.**");
            //mailMessage.To.Add(new MailAddress(member.EmailAddress));
            //mailMessage.Subject = "Your Account of Majestic Vacations has been updated successfully.";
            //mailMessage.Body = "Dear " + strFirst + " " + strLast + ",<br> Thanks for registering our membership program." +
            //                    "The new membership number is .  You can start enjoying the membership benefits," +
            //                    "e.g., promotional travel offers, last minute deals, various tours, hotels, and sweepstakes.";

            //Terms.Member.Utility.MemberUtility.SendEmail(mailMessage, "B2BMembership");

            Utility.Transaction.Member = mem;

            this.Response.Redirect("~/B2B_SUB/Index.aspx");

        }
    }
        private PropagatorResult CreateSimpleResult(
            IEntityStateEntry stateEntry, IExtendedDataRecord record, MemberInformation memberInformation,
            int identifier, bool isModified, int recordOrdinal, object value)
        {
            var updatableRecord = record as CurrentValueRecord;

            // construct flags for the value, which is needed for complex type and simple members
            var flags = memberInformation.Flags;
            if (!isModified)
            {
                flags |= PropagatorFlags.Preserve;
            }
            if (PropagatorResult.NullIdentifier != identifier)
            {
                // construct a key member
                PropagatorResult result;
                if ((memberInformation.IsServerGenerated || memberInformation.IsForeignKeyMember)
                    && null != updatableRecord)
                {
                    result = PropagatorResult.CreateServerGenKeyValue(flags, value, stateEntry, identifier, recordOrdinal);
                }
                else
                {
                    result = PropagatorResult.CreateKeyValue(flags, value, stateEntry, identifier);
                }

                // we register the entity as the "owner" of an identity so that back-propagation can succeed
                // (keys can only be back-propagated to entities, not association ends). It also allows us
                // to walk to the entity state entry in case of exceptions, since the state entry propagated
                // through the stack may be eliminated in a project above a join.
                m_translator.KeyManager.RegisterIdentifierOwner(result);

                return result;
            }
            else
            {
                if ((memberInformation.IsServerGenerated || memberInformation.IsForeignKeyMember)
                    && null != updatableRecord)
                {
                    // note: we only produce a server gen result when 
                    return PropagatorResult.CreateServerGenSimpleValue(flags, value, updatableRecord, recordOrdinal);
                }
                else
                {
                    return PropagatorResult.CreateSimpleValue(flags, value);
                }
            }
        }
        internal ExtractorMetadata(EntitySetBase entitySetBase, StructuralType type, UpdateTranslator translator)
        {
            Contract.Requires(entitySetBase != null);
            Contract.Requires(type != null);
            Contract.Requires(translator != null);

            m_type = type;
            m_translator = translator;

            EntityType entityType = null;
            Set<EdmMember> keyMembers;
            Set<EdmMember> foreignKeyMembers;

            switch (type.BuiltInTypeKind)
            {
                case BuiltInTypeKind.RowType:
                    // for row types (which are actually association end key records in disguise), all members
                    // are keys
                    keyMembers = new Set<EdmMember>(((RowType)type).Properties).MakeReadOnly();
                    foreignKeyMembers = Set<EdmMember>.Empty;
                    break;
                case BuiltInTypeKind.EntityType:
                    entityType = (EntityType)type;
                    keyMembers = new Set<EdmMember>(entityType.KeyMembers).MakeReadOnly();
                    foreignKeyMembers = new Set<EdmMember>(
                        ((EntitySet)entitySetBase).ForeignKeyDependents
                            .SelectMany(fk => fk.Item2.ToProperties)).MakeReadOnly();
                    break;
                default:
                    keyMembers = Set<EdmMember>.Empty;
                    foreignKeyMembers = Set<EdmMember>.Empty;
                    break;
            }

            var members = TypeHelpers.GetAllStructuralMembers(type);
            m_memberMap = new MemberInformation[members.Count];
            // for each member, cache expensive to compute metadata information
            for (var ordinal = 0; ordinal < members.Count; ordinal++)
            {
                var member = members[ordinal];
                // figure out flags for this member
                var flags = PropagatorFlags.NoFlags;
                var entityKeyOrdinal = default(int?);

                if (keyMembers.Contains(member))
                {
                    flags |= PropagatorFlags.Key;
                    if (null != entityType)
                    {
                        entityKeyOrdinal = entityType.KeyMembers.IndexOf(member);
                    }
                }
                if (foreignKeyMembers.Contains(member))
                {
                    flags |= PropagatorFlags.ForeignKey;
                }

                if (MetadataHelper.GetConcurrencyMode(member)
                    == ConcurrencyMode.Fixed)
                {
                    flags |= PropagatorFlags.ConcurrencyValue;
                }

                // figure out whether this member is mapped to any server generated
                // columns in the store
                var isServerGenerated = m_translator.ViewLoader.IsServerGen(entitySetBase, m_translator.MetadataWorkspace, member);

                // figure out whether member nullability is used as a condition in mapping
                var isNullConditionMember = m_translator.ViewLoader.IsNullConditionMember(
                    entitySetBase, m_translator.MetadataWorkspace, member);

                // add information about this member
                m_memberMap[ordinal] = new MemberInformation(
                    ordinal, entityKeyOrdinal, flags, member, isServerGenerated, isNullConditionMember);
            }
        }
Пример #35
0
 public void SomeFunction(MemberInformation member)
 {
     Clients.All.functionOneClient(new MemeberInformation("hehe", member.LastName));
 }
    protected void aspbtnUpdate_Click(object sender, EventArgs e)
    {
        member = Utility.Transaction.Member;
        string strGender = string.Empty;
        string strFirst = string.Empty;
        string strMiddle = string.Empty;
        string strLast = string.Empty;
        string strEmail = string.Empty;
        string strPassword = string.Empty;
        string strPhoneDay = string.Empty;
        string strPhoneNight = string.Empty;
        DateTime dateBirthday = DateTime.MinValue;
        string strPassport = string.Empty;
        string strStreet = string.Empty;
        string strCity = string.Empty;
        string strState = string.Empty;
        string strCountry = string.Empty;
        string strZip = string.Empty;

        if (this.IsValid )
        {
            strGender = this.rblGender.SelectedValue;

            strFirst = this.txtFirst.Text.Trim();

            strMiddle = this.txtMiddle.Text.Trim();

            strLast = this.txtLast.Text.Trim();

            strPhoneDay = this.txtPhoneDay.Text.Trim();

            strPhoneNight = this.txtPhoneNight.Text.Trim();

            try
            {
                dateBirthday = Convert.ToDateTime(drpAdultMonth.SelectedValue + "/" + drpAdultDay.SelectedValue + "/" + drpAdultyear.SelectedValue).Date;
            }
            catch
            {
                return;
            }

            strPassport = this.txtPassport.Text.Trim();

            strStreet = this.txtStreet.Text.Trim();

            strCity = this.txtCity.Text.Trim();

            strState = this.ddlState.SelectedValue;

            strCountry = this.ddlCountry.SelectedValue;

            strZip = this.txtZip.Text.Trim();

            int iCount = _MemberInformationService.GetEmail(strEmail);

            //if (iCount > 0)
            //{
            //    return;
            //}

            ArrayList arr = new ArrayList();

            for (int i = 0; i < cblServer.Items.Count; i++)
            {
                if (cblServer.Items[i].Selected)
                {
                    arr.Add(cblServer.Items[i].Value.Trim());
                }
            }

            MemberadsMeta _Memberads = _MemberInformationService.FindMemberadsByID(member.MemberCode);

            _Memberads.AdsCode = Join(arr, @"/");

            ArrayList arrQuestion = new ArrayList();

            MemberQuestionAndAnswerMeta _MemberQuestionAndAnswer;

            foreach (DataGridItem item in dgServer.Items)
            {
                _MemberQuestionAndAnswer = new MemberQuestionAndAnswerMeta();

                string strQuestionCode = item.Cells[0].Text;

                string strSingleOrMultiterm = item.Cells[2].Text;

                if (strSingleOrMultiterm == "True")
                {
                    CheckBoxList cbl = (CheckBoxList)item.FindControl("cblAnswer");

                    _MemberQuestionAndAnswer.QuestionCode = strQuestionCode;

                    _MemberQuestionAndAnswer.MemberCode = member.MemberCode;

                    ArrayList arrAnswer = new ArrayList();

                    for (int i = 0; i < cbl.Items.Count; i++)
                    {
                        if (cbl.Items[i].Selected)
                        {
                            arrAnswer.Add(cbl.Items[i].Value.Trim());
                        }
                    }

                    _MemberQuestionAndAnswer.AnswerCode = Join(arrAnswer, @"/");
                }
                else
                {
                    RadioButtonList rbl = (RadioButtonList)item.FindControl("rblAnswer");

                    _MemberQuestionAndAnswer.QuestionCode = strQuestionCode;

                    _MemberQuestionAndAnswer.MemberCode = member.MemberCode;

                    _MemberQuestionAndAnswer.AnswerCode = rbl.SelectedValue.Trim();
                }

                arrQuestion.Add(_MemberQuestionAndAnswer);
            }

            TMemberToDataSource _MemberToDataSource = new TMemberToDataSource();

            _MemberToDataSource.Constantid = "0";

            MemberMeta _MemberInformation = _MemberInformationService.FindMemberInformationByID(Utility.Transaction.Member.MemberCode);// new MemberMeta();// (MemberMeta)member;

            _MemberInformation.FirstName = strFirst;
            _MemberInformation.MiddleName = strMiddle;
            _MemberInformation.LastName = strLast;
            _MemberInformation.Gender = Convert.ToInt32(strGender);
            _MemberInformation.PhoneDay = strPhoneDay;
            _MemberInformation.PhoneNight = strPhoneNight;
            _MemberInformation.Birthday = dateBirthday;
            _MemberInformation.Passport = strPassport;
            _MemberInformation.City = strCity;
            _MemberInformation.StreetAddress = strStreet;
            _MemberInformation.Nation = strCountry;
            _MemberInformation.Province = strState;
            _MemberInformation.ZipCode = strZip;
            _MemberInformation.RegisterTime = DateTime.Now.Date;

            _MemberInformationService.UpdateMemberInformation(_Memberads, _MemberInformation, arrQuestion);

            Utility.Transaction.Member = UnConvert(_MemberInformation);

            MailMessage mailMessage = new MailMessage();

            mailMessage.From = new MailAddress(@"*****@*****.**");
            mailMessage.To.Add(new MailAddress(member.EmailAddress));
            mailMessage.Subject = "Your Account of GTT has been updated successfully.";
            mailMessage.Body = "Dear " + strFirst + " " + strLast + ",<br> Thanks for registering for our membership program. " +
                                "Your User ID is: " + member.EmailAddress + " .  You can now start enjoying your membership benefits such as promotional travel offers, last minute deals, tour offers, hotel specials, and sweepstakes!";

            Terms.Member.Utility.MemberUtility.SendEmail(mailMessage, "Membership");

            this.Response.Redirect("~/Page/Common/MemberMessageForm.aspx");

        }
    }
Пример #37
0
    private void InitMemberInfo()
    {
        member = Utility.Transaction.Member;
        Memberads = _MemberInformationService.FindMemberadsByID(member.MemberCode);
        memberToDataSource = _MemberInformationService.FindMemberToDataSourceByID(member.MemberCode);
        MemberQuestionAndAnswerList = _MemberInformationService.FindTMemberQuestionAndAnswerByID(member.MemberCode);

        this.lblBirthday.Text = member.Birthday.ToString("MM/dd/yyyy");
        this.lblCity.Text = member.City;
        this.lblPassportNumber.Text = member.Passport;
        this.lblFirstName.Text = member.FirstName;
        switch (member.Gender)
        {
            case 0: this.lblGender.Text = Terms.Member.Utility.Member_Gender.Mr.ToString();
                break;
            case 1: this.lblGender.Text = Terms.Member.Utility.Member_Gender.Mrs.ToString();
                break;
            case 2: this.lblGender.Text = Terms.Member.Utility.Member_Gender.Ms.ToString();
                break;
        }

        this.lblLastName.Text = member.LastName;
        this.lblMiddleName.Text = member.MiddleName;
        this.lblNightPhoneNumber.Text = member.PhoneNight;
        this.lblDayPhoneNumber.Text = member.PhoneDay;
        this.lblStateCountry.Text =( member.Province.Equals(string.Empty) ? "  " : member.Province + " , ") + _CommonService.FindCountryById(member.Nation).FullName;
        this.lblStreetAddress.Text = member.StreetAddress;
        this.lblZip.Text = member.ZipCode;
        this.lblCity.Text = member.City;

        InitServer();
    }
    private void InitMemberInfo()
    {
        member = Utility.Transaction.Member;
        Memberads = _MemberInformationService.FindMemberadsByID(member.MemberCode);
        memberToDataSource = _MemberInformationService.FindMemberToDataSourceByID(member.MemberCode);
        MemberQuestionAndAnswerList = _MemberInformationService.FindTMemberQuestionAndAnswerByID(member.MemberCode);

        //string[] birthday = member.Birthday.ToString("d/M/yyyy").Split('-');
        //this.txtBirthday.Text = member.Birthday.ToString("MM/dd/yyyy");
        this.txtCity.Text = member.City;
        this.txtPassport.Text = member.Passport;
        this.txtFirst.Text = member.FirstName;
        this.rblGender.SelectedIndex = member.Gender;

        this.txtLast.Text = member.LastName;
        this.txtMiddle.Text = member.MiddleName;
        this.txtPhoneNight.Text = member.PhoneNight;
        this.txtPhoneDay.Text = member.PhoneDay;

        for (int i = DateTime.Now.Year; i > DateTime.Now.Year - 100; i--)
        {
            ListItem itemNew = new ListItem(i.ToString(), i.ToString());

            drpAdultyear.Items.Add(itemNew);
        }

        ListItem itemNew1 = new ListItem("--Select--", "0");
        drpAdultyear.Items.Insert(0, itemNew1);

        this.drpAdultDay.SelectedIndex = drpAdultDay.Items.IndexOf(drpAdultDay.Items.FindByText(member.Birthday.Day.ToString()));
        this.drpAdultMonth.SelectedIndex = drpAdultMonth.Items.IndexOf(drpAdultMonth.Items.FindByText(member.Birthday.Month.ToString()));
        this.drpAdultyear.SelectedIndex = drpAdultyear.Items.IndexOf(drpAdultyear.Items.FindByText(member.Birthday.Year.ToString()));

        this.txtStreet.Text = member.StreetAddress;
        this.txtZip.Text = member.ZipCode;
        this.txtCity.Text = member.City;
    }
 void WritePropertyReferenceFrameToParent(MemberInformation targetMember, string sourceProperty, Frame parentFrame, IXamlLineInfo lineInfo)
 {
     if (parentFrame.PropertyReferences == null)
     {
         parentFrame.PropertyReferences = new XamlNodeQueue(this.parent.schemaContext);
     }
     WriteSerializedPropertyReference(parentFrame.PropertyReferences.Writer, lineInfo, targetMember.Member.Name, sourceProperty);
     
     // we didn't write out the target
     // StartMember, so suppress the EndMember
     parentFrame.SuppressNextEndMember = true;
 }
 void FlushBufferedMember(XamlWriter targetWriter)
 {
     if (this.bufferedMember.IsSet)
     {
         this.bufferedMember.Flush(targetWriter);
         this.bufferedMember = MemberInformation.None;
     }
 }