Пример #1
0
        public Rectangle Layout(Graphics graphics, ISimpleContainer container)
        {
            if (graphics == null)
            {
                throw new ArgumentNullException("graphics");
            }

            if (container == null)
            {
                throw new ArgumentNullException("container");
            }

            BaseReportItem containerItem = container as BaseReportItem;
//			container.Items.SortByLocation();
            Rectangle desiredContainerRectangle = new Rectangle(containerItem.Location, containerItem.Size);

            System.Collections.Generic.IEnumerable <BaseReportItem> canGrowShrinkCollection = from bt in container.Items where bt.CanGrow == true select bt;

            if (canGrowShrinkCollection.Count() > 0)
            {
                int       extend         = containerItem.Size.Height - canGrowShrinkCollection.First().Size.Height;
                Rectangle surroundingRec = FindSurroundingRectangle(graphics, canGrowShrinkCollection);

                if (surroundingRec.Height > desiredContainerRectangle.Height)
                {
                    desiredContainerRectangle = new Rectangle(containerItem.Location.X,
                                                              containerItem.Location.Y,
                                                              containerItem.Size.Width,
                                                              surroundingRec.Size.Height + extend);
                }
            }

            return(desiredContainerRectangle);
        }
Пример #2
0
        public override object CreateMultiResolutionImage(System.Collections.Generic.IEnumerable <object> images)
        {
            var refImg = (WpfImage)images.First();
            var f      = refImg.Frames[0];
            var frames = images.Cast <WpfImage> ().Select(img => new WpfImage.ImageFrame(img.Frames[0].ImageSource, f.Width, f.Height));

            return(new WpfImage(frames));
        }
Пример #3
0
        /// <summary>
        /// Function that append records to xml file
        /// </summary>
        /// <param name="client">Object Client</param>
        private static void WriteQueueToAppendXml(Client client)
        {
            XDocument xDocument = XDocument.Load(filePath);
            XElement  root      = xDocument.Element("Clients");

            System.Collections.Generic.IEnumerable <XElement> rows = root.Descendants("Client");
            XElement firstRow = rows.First();

            firstRow.AddBeforeSelf(
                new XElement("Client",
                             new XElement("Num", client.Num.ToString()),
                             new XElement("Priority", client.Priority.ToString()),
                             new XElement("Data", client.Data.ToString()),
                             new XElement("Type", client.Type)));
            xDocument.Save(filePath);
        }
        public override void UpdateUser(MembershipUser _user)
        {
            var dbContext = new DBContext();
            MembershipPerson personData = (_user as MembershipPerson);
            User             usr        = dbContext.GetUser(personData.person.PersonID);

            if (usr == null)
            {
                usr        = new User();
                usr.Person = dbContext.GetPerson(personData.person.PersonID);
                if (usr.Person == null)
                {
                    return;
                }
            }
            usr.Person.Avatar    = personData.person.Avatar;
            usr.Person.Name      = personData.person.Name;
            usr.Person.Gender    = personData.person.Gender;
            usr.UserName         = personData.UserName;
            usr.UserEmailAddress = personData.Email;

            IQueryable <Photo> photos = (from p in dbContext.Photos where p.PersonID == usr.Person.PersonID select p);

            foreach (Photo p in photos)
            {
                System.Collections.Generic.IEnumerable <Photo> ps = personData.person.Photos.Select(x => x).Where(x => x.PhotoID == p.PhotoID);
                if (ps.Count() == 0)
                {
                    dbContext.Entry(p).State = System.Data.EntityState.Deleted;
                }
                else
                {
                    p.PhotoStream = ps.First().PhotoStream;
                }
            }
            IEnumerable <Photo> photosToAdd = personData.person.Photos.Where(x => x.PhotoID == 0).Select(x => x);

            foreach (Photo p in photosToAdd)
            {
                dbContext.AddPhoto(p);
            }
            dbContext.SaveChanges();
        }
Пример #5
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (base.IsPost)
            {
                RegType regType      = (RegType)System.Enum.Parse(typeof(RegType), WebUtils.GetFormString("_regtype", "Normal"));
                string  strGroupName = WebUtils.GetFormString("_usergroupname", "个人会员");
                System.Collections.Generic.IEnumerable <UserGroupInfo> source = from p in UserGroup.GetCacheUserGroupList()
                                                                                where p.GroupName.Equals(strGroupName)
                                                                                select p;
                System.Collections.Generic.IEnumerable <UserLevelInfo> source2 = (from p in UserLevel.GetCacheUserLevelList()
                                                                                  orderby p.Integral
                                                                                  select p).Take(1);
                TaoBaoAreaInfo iPAreaFromTaoBao = IPUtils.GetIPAreaFromTaoBao(IPUtils.GetIP());
                UserInfo       userInfo         = new UserInfo
                {
                    UserName      = WebUtils.GetFormString("_regname"),
                    Password      = WebUtils.GetFormString("_regpwd"),
                    GroupID       = ((source.Count <UserGroupInfo>() > 0) ? source.First <UserGroupInfo>().AutoID : 0),
                    LevelID       = ((source2.Count <UserLevelInfo>() > 0) ? source2.First <UserLevelInfo>().AutoID : 0),
                    Email         = ((regType == RegType.ByEmail) ? WebUtils.GetFormString("_regname") : WebUtils.GetFormString("_regemail")),
                    Mobile        = ((regType == RegType.ByMobile) ? WebUtils.GetFormString("_regname") : WebUtils.GetFormString("_regmobile")),
                    Country       = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.country),
                    Province      = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.region),
                    City          = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.city),
                    County        = ((iPAreaFromTaoBao == null) ? string.Empty : iPAreaFromTaoBao.data.country),
                    Status        = 99,
                    AutoTimeStamp = System.DateTime.Now
                };
                string[] array = PageBase.config.SysUserName.Split(new char[]
                {
                    ','
                });
                string strA = string.Empty;
                switch (regType)
                {
                case RegType.ByMobile:
                {
                    SMSInfo lastCheckCode = SMS.GetLastCheckCode(userInfo.Mobile);
                    if (lastCheckCode != null)
                    {
                        strA = lastCheckCode.ValidateCode;
                    }
                    goto IL_27A;
                }

                case RegType.ByEmail:
                {
                    SMSInfo lastCheckCode = SMS.GetLastCheckCode(userInfo.Email);
                    if (lastCheckCode != null)
                    {
                        strA = lastCheckCode.ValidateCode;
                    }
                    goto IL_27A;
                }
                }
                strA = base.ValidateCode;
IL_27A:
                if (PageBase.config.VerifycodeForReg && string.Compare(strA, WebUtils.GetFormString("_regyzm"), true) != 0)
                {
                    base.WriteJsonTip(base.GetCaption("ValidateCodeIncorrect"));
                }
                else if (userInfo.GroupID.Equals(0) || userInfo.LevelID.Equals(0))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_MemberInfoNotComplete"));
                }
                else if (!SinGooCMS.BLL.User.IsValidUserName(userInfo.UserName) && !ValidateUtils.IsEmail(userInfo.UserName) && !ValidateUtils.IsMobilePhone(userInfo.UserName))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_InvalidUserName"));
                }
                else if (array.Length > 0 && array.Contains(userInfo.UserName))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_SystemRetainsUserName").Replace("${username}", userInfo.UserName));
                }
                else if (SinGooCMS.BLL.User.IsExistsByName(userInfo.UserName))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_UserNameAlreadyExists"));
                }
                else if (userInfo.Password.Length < 6)
                {
                    base.WriteJsonTip(base.GetCaption("Reg_UserPwdLenNeed"));
                }
                else if (userInfo.Password != WebUtils.GetFormString("_regpwdagain"))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_2PwdInputNoMatch"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Email) && !ValidateUtils.IsEmail(userInfo.Email))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_EmailTypeError"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Email) && SinGooCMS.BLL.User.IsExistsByEmail(userInfo.Email))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_EmailAddressAlreadyExists"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Mobile) && !ValidateUtils.IsMobilePhone(userInfo.Mobile))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_MobileTypeError"));
                }
                else if (!string.IsNullOrEmpty(userInfo.Mobile) && SinGooCMS.BLL.User.IsExistsByMobile(userInfo.Mobile))
                {
                    base.WriteJsonTip(base.GetCaption("Reg_MobileAlreadyExists"));
                }
                else
                {
                    int autoID = 0;
                    System.Collections.Generic.IList <UserFieldInfo> fieldListByModelID      = UserField.GetFieldListByModelID(userInfo.GroupID, true);
                    System.Collections.Generic.Dictionary <string, UserFieldInfo> dictionary = new System.Collections.Generic.Dictionary <string, UserFieldInfo>();
                    foreach (UserFieldInfo current in fieldListByModelID)
                    {
                        current.Value = WebUtils.GetFormString(current.FieldName);
                        dictionary.Add(current.FieldName, current);
                    }
                    UserStatus userStatus = SinGooCMS.BLL.User.Reg(userInfo, dictionary, ref autoID);
                    if (userStatus.Equals(UserStatus.Success))
                    {
                        new MsgService(userInfo).SendRegMsg();
                        new MsgService().SendRegMsg2Mger();
                        if (PageBase.config.RegGiveIntegral > 0)
                        {
                            userInfo.AutoID = autoID;
                            AccountDetail.AddIntegral(userInfo, 1, (double)PageBase.config.RegGiveIntegral, "注册赠送积分");
                        }
                        UserInfo    userInfo2   = new UserInfo();
                        LoginStatus loginStatus = SinGooCMS.BLL.User.UserLogin(userInfo.UserName, userInfo.Password, ref userInfo2);
                        string      text        = base.Server.UrlDecode(WebUtils.GetFormString("_regreturnurl"));
                        if (!string.IsNullOrEmpty(text))
                        {
                            base.WriteJsonTip(true, base.GetCaption("Reg_Success"), text);
                        }
                        else
                        {
                            base.WriteJsonTip(true, base.GetCaption("Reg_Success"), "/user/regsuccess.html?info=" + base.Server.UrlEncode(base.GetCaption("Reg_SuccessWillJumpMemberCenter")));
                        }
                    }
                    else
                    {
                        base.WriteJsonTip(base.GetCaption("Reg_FailWithMsg").Replace("${msg}", base.GetCaption("UserStatus_" + userStatus.ToString())));
                    }
                }
            }
            else
            {
                System.Collections.Generic.IEnumerable <UserGroupInfo> source3 = from p in UserGroup.GetCacheUserGroupList()
                                                                                 where p.GroupName.Equals("个人会员")
                                                                                 select p;
                base.Put("usermodel", UserField.GetFieldListByModelID((source3.Count <UserGroupInfo>() > 0) ? source3.First <UserGroupInfo>().AutoID : 0, true));
                base.Put("returnurl", WebUtils.GetQueryString("returnurl"));
                base.UsingClient("user/注册.html");
            }
        }
Пример #6
0
 public void Initialize(string ignoreTablesFile, string docName, bool ignoreSpecificTables = false)
 {
     this.IgnoreTables.Clear();
     try
     {
         if (!System.IO.File.Exists(ignoreTablesFile))
         {
             Log.WriteLine("Config file not found");
         }
         else
         {
             Log.WriteLine("Config file found");
             using (System.IO.StreamReader streamReader = new System.IO.StreamReader(ignoreTablesFile, true))
             {
                 XElement xElement  = XElement.Load(streamReader);
                 XElement xElement2 = null;
                 System.Collections.Generic.IEnumerable <XElement> source = from t in xElement.Elements("Tables")
                                                                            where t.Attribute("file") != null && t.Attribute("file").Value == docName
                                                                            select t;
                 if (source.Count <XElement>() > 0)
                 {
                     xElement2 = source.First <XElement>();
                     if (xElement2 != null)
                     {
                         foreach (XElement current in xElement2.Elements("Table"))
                         {
                             this.IgnoreTables.Add(current.Attribute("name").Value);
                             Log.WriteLine("Config: Not supported table: " + current.Attribute("name").Value);
                         }
                         System.Collections.Generic.IEnumerable <XElement> source2 = xElement2.Elements("SharedParameters");
                         if (source2.Count <XElement>() > 0)
                         {
                             this.IgnoreSharedParameters = true;
                             XElement xElement3 = source2.First <XElement>();
                             System.Collections.Generic.IEnumerable <XAttribute> source3 = xElement3.Attributes("ignore");
                             if (source3.Count <XAttribute>() > 0)
                             {
                                 bool ignoreSharedParameters;
                                 if (!bool.TryParse(source3.First <XAttribute>().Value, out ignoreSharedParameters))
                                 {
                                     ignoreSharedParameters = true;
                                 }
                                 this.IgnoreSharedParameters = ignoreSharedParameters;
                             }
                             System.Collections.Generic.IEnumerable <XElement> enumerable = xElement3.Elements("Except");
                             foreach (XElement current2 in enumerable)
                             {
                                 System.Collections.Generic.IEnumerable <XAttribute> source4 = current2.Attributes("name");
                                 if (source4.Count <XAttribute>() > 0)
                                 {
                                     this.IgnoreSharedParametersExceptions.Add(source4.First <XAttribute>().Value);
                                 }
                             }
                         }
                         Log.WriteLine("IgnoreSharedParameters: " + this.IgnoreSharedParameters);
                         if (this.IgnoreSharedParametersExceptions.Count > 0)
                         {
                             Log.WriteLine("Except: ");
                         }
                         foreach (string current3 in this.IgnoreSharedParametersExceptions)
                         {
                             Log.WriteLine("\t" + current3);
                         }
                     }
                 }
             }
             if (ignoreSpecificTables)
             {
                 this.IgnoreTables.Add("ProjectInformation");
                 this.IgnoreTables.Add("ElementLevel");
                 this.IgnoreTables.Add("ElementPhase");
                 this.IgnoreTables.Add("RoomTags");
                 this.IgnoreTables.Add("CurtainWallMullions");
                 this.IgnoreTables.Add("ElementPhase");
                 this.IgnoreTables.Add("MaterialQuantities");
                 this.IgnoreTables.Add("DoorWall");
                 this.IgnoreTables.Add("CurtainWallPanelOnWall");
                 this.IgnoreTables.Add("WindowWall");
                 this.IgnoreTables.Add("MechanicalEquipmentOnWall");
                 this.IgnoreTables.Add("PlumbingFixtureOnWall");
                 this.IgnoreTables.Add("LightingFixtureOnWall");
                 this.IgnoreTables.Add("OpeningOnWall");
                 this.IgnoreTables.Add("GenericModelOnWall");
                 this.IgnoreTables.Add("CaseworkOnWall");
             }
         }
     }
     catch (System.Exception ex)
     {
         Log.WriteLine(ex.ToString());
     }
 }