Example #1
0
 internal CacheContainer(bool isReadOnly)
 {
     _collection = isReadOnly
         ? (BaseCollection)new ReadonlyCacheCollection()
         : new CacheCollection(true);
     LoadingStatus = LoadingStatus.None;
 }
		public BaseCollection<DCTFile> DCMQueryDocByField(BaseCollection<DCTFileField> fields)
		{
			BaseCollection<DCTFile> files = new BaseCollection<DCTFile>();
			using (DocLibContext clientContext = new DocLibContext(ServiceHelper.GetDocumentLibraryName()))
			{
				CamlQuery query = new CamlQuery();
				CamlExpression caml = null;
				foreach (DCTFileField item in fields)
				{
					string valueText = string.Empty;
					switch (item.Field.ValueType)
					{
						case DCTFieldType.Boolean:
							break;
						case DCTFieldType.DateTime:
							break;
						case DCTFieldType.Decimal:
							break;
						case DCTFieldType.Integer:
							valueText = "Counter";
							break;
						case DCTFieldType.Note:
							break;
						case DCTFieldType.Text:
							valueText = "Text";
							break;
						case DCTFieldType.User:
							break;
						default:
							break;
					}
					if (caml == null)
					{
						caml = Caml.Field(item.Field.InternalName).Eq(Caml.Value(valueText, item.FieldValue));
					}
					else
					{
						caml = caml.And(Caml.Field(item.Field.InternalName).Eq(Caml.Value(valueText, item.FieldValue)));
					}
				}

				query.ViewXml = Caml.SimpleView(caml, CamlBuilder.ViewType.RecursiveAll).ToCamlString();

				ListItemCollection items = clientContext.BaseList.GetItems(query);
				clientContext.Load(items);

				clientContext.ExecuteQuery();

				foreach (ListItem item in items)
				{
					DCTFile file = new DCTFile();
					DCTConverterHelper.Convert(item, file);
					files.Add(file);
				}
			}
			return files;
		}
Example #3
0
        public BaseCollection <BitplateUserGroup> GetUserGroups(string sort, string searchString)
        {
            string where = String.Format("FK_Site = '{0}' ", SessionObject.CurrentSite.ID);
            if (searchString != "")
            {
                where += String.Format(" AND (Name like '%{0}%')", searchString);
            }
            BaseCollection <BitplateUserGroup> usergroups = BaseCollection <BitplateUserGroup> .Get(where, sort);

            return(usergroups);
        }
Example #4
0
        internal string CalculateNewRootOrderingNumber()
        {
            string sql = String.Format(@"SELECT ID, Name, 'Item' AS Title, OrderingNumber From DataItem WHERE FK_DataCollection = '{0}' AND FK_Parent_Group IS NULL 
UNION SELECT ID, Name, 'Group' AS Title, OrderingNumber From DataGroup WHERE FK_DataCollection = '{0}' AND FK_Parent_Group IS NULL", this.ID);
            BaseCollection <BaseDataObject> dataObjects = BaseCollection <BaseDataObject> .LoadFromSql(sql);

            int    newOrderNumber          = dataObjects.Count + 1;
            string newOrderingNumberString = newOrderNumber.ToString("0000");

            return(newOrderingNumberString);
        }
        private void fillMenuPages()
        {
            string html = "";
            BaseCollection <CmsPage> pages = SessionObject.CurrentSite.Pages;

            foreach (CmsPage page in pages)
            {
                html += String.Format("<li><a href=\"javascript:BITEDITPAGE.loadPage('{0}');\">{1}</a></li>", page.ID, page.RelativeUrl);
            }
            ulMenuPages.InnerHtml = html;
        }
Example #6
0
        public static UserVoucher GetUserVoucher(Cxt cxt, string voucherNo)
        {
            UserVoucher userVoucher = null;
            DataTable   dt          = BaseCollection.ExecuteSql(InfiChess.UserVoucher, "SELECT * FROM UserVoucher where VoucherNo = @p1", voucherNo);

            if (dt.Rows.Count > 0)
            {
                userVoucher = new UserVoucher(cxt, dt.Rows[0]);
            }
            return(userVoucher);
        }
Example #7
0
        private static string GetCheckBoxListHtml <T>(BaseCollection <T> dataList, string propertyName) where T : BaseDomainObject, new()
        {
            string html = "";

            foreach (T t in dataList)
            {
                html += String.Format("<input type='checkbox' value='{0}'> {1}<br/>", t.ID, t.Name);
            }

            return(html);
        }
        public EquipmentWnd(BaseCollection <EquipmentView> equipments, int?typeId = null, int?id = null)
            : this()
        {
            this.id         = id;
            this.equipments = equipments;
            this.typeId     = typeId;

            if (id.HasValue)
            {
                mainGrid.DataContext = equipments.ToList().Where(x => x.Id == id).First();
            }
        }
        public BaseCollection <BitPlate.Domain.Logging.EventLog> GetAllErrors(int pager, int recordLimit, string orderby, string searchstring)
        {
            string sql = "FK_Site = '" + SessionObject.CurrentSite.ID.ToString() + "'";

            if (searchstring != "")
            {
                sql += " AND CONCAT(Description, Type, Name, CreateDate, username) LIKE '%" + searchstring + "%'";
            }
            BaseCollection <BitPlate.Domain.Logging.EventLog> logs = BaseCollection <BitPlate.Domain.Logging.EventLog> .Get(sql, orderby, pager, recordLimit);

            return(logs);
        }
Example #10
0
        private static string GetDropDownListHtml <T>(BaseCollection <T> dataList, string propertyName) where T : BaseDomainObject, new()
        {
            string html = String.Format("<select name='{0}'>", propertyName);

            html += String.Format("<option value='{0}'>{1}</option>", "", "");
            foreach (T t in dataList)
            {
                html += String.Format("<option value='{0}'>{1}</option>", t.ID, t.Name);
            }
            html += "</select>";
            return(html);
        }
        public new async Task <IList <User> > ListBy(Expression <Func <User, bool> > filter)
        {
            var users = await BaseCollection.Find(filter).ToListAsync();

            foreach (var user in users)
            {
                user.Longitude = user.Location.Coordinates.Longitude;
                user.Latitude  = user.Location.Coordinates.Latitude;
                user.Password  = null;
            }
            return(users);
        }
Example #12
0
        public override void Save()
        {
            BaseCollection <NewsletterGroup> selectedGroups = BaseCollection <NewsletterGroup> .Get("FK_Site='" + this.Site.ID.ToString() + "' AND Name='" + this.Name + "'");

            //if (selectedGroups.Count > 0)
            //{
            //    throw new Exception("Kan de nieuwsgroep niet opslaan, omdat er al een groep bestaat onder deze naam.");
            //}

            base.Save();
            //Directory.CreateDirectory(HttpContext.Current.Server.MapPath("") + "\\Newsletters\\" + this.Name);
        }
Example #13
0
        private static string GetDropDownFolderHtml(BaseCollection <CmsPageFolder> dataList, string propertyName)
        {
            string html = String.Format("<select name='{0}'>", propertyName);

            html += String.Format("<option value='{0}'>{1}</option>", "", "");
            foreach (CmsPageFolder folder in dataList)
            {
                html += String.Format("<option value='{0}'>{1}</option>", folder.ID, folder.RelativePath);
            }
            html += "</select>";
            return(html);
        }
Example #14
0
 /// <summary>
 /// 更新字段
 /// </summary>
 public void Update()
 {
     ServiceProxy.SingleCall<IDCSStorageService>(client.Binding, client.StorageEndpointAddress, client.UserBehavior, action =>
             {
                 BaseCollection<DCTFileField> fileFields = new BaseCollection<DCTFileField>();
                 foreach (DCTFileField filefield in effectedFileField)
                 {
                     fileFields.Add(filefield);
                 }
                 action.DCMSetFileFields(this.ID, fileFields);
             });
 }
Example #15
0
        public static void SendActivationEmail(Cxt cxt)
        {
            BaseCollection items = BaseCollection.SelectItems(InfiChess.User, "StatusID", 3);

            for (int i = 0; i < items.Count; i++)
            {
                if (EmailTemplate.Send(cxt, EmailTemplateE.NewAccount, new User(cxt, items[i])) != MailVerifyResult.Ok)
                {
                    System.Threading.Thread.Sleep(5000);
                }
            }
        }
    public void AddAndAccessItems()
    {
        BaseCollection <int> collection = new BaseCollection <int>();

        collection.Add(1);
        collection.Add(2);

        Assert.AreEqual(1, collection[0]);
        Assert.AreEqual(1, collection.ElementAt(0));
        Assert.AreEqual(2, collection[1]);
        Assert.AreEqual(2, collection.ElementAt(1));
    }
Example #17
0
 public static DataTable GetTournamentUsers(int TournamentID, int TeamID, UserStatusE UserStatusID, TournamentEntityTypeE TournamentEntityTypeID)
 {
     if (TournamentEntityTypeID == TournamentEntityTypeE.RegisteredUser)
     {
         return(BaseCollection.Execute("GetTournamentRegisteredUsers", TournamentID, TeamID));
         //ExecuteSql("GetTournamentRegisteredUsers @p", );
     }
     else
     {
         return(BaseCollection.Execute("GetTournamentUsers", TournamentID, TeamID, UserStatusID.ToString("d")));
     }
 }
Example #18
0
        public override void Delete()
        {
            //template modules verwijderen
            BaseCollection <BaseModule> Modules = this.GetTemplateModules();

            foreach (BaseModule module in Modules)
            {
                module.Delete();
            }
            base.Delete();
            UnpublishedItem.Set(this, "Template", ChangeStatusEnum.Deleted);
        }
Example #19
0
        public DocumentCache(BaseCollection parent, NodeContext nodeContext)
        {
            _parent     = parent;
            _cacheSpace = parent.DbContext.CacheSpace;

            _cacheSpace.AddConsumer(this);
            _storageManager        = parent.DbContext.StorageManager;
            _dirtyDocuments        = new Dictionary <long, PersistenceOperation>();
            _unpersistedOperations = _parent.DbContext.UnpersistedOperations;
            _nodeContext           = nodeContext;
            _statsCollector        = StatsManager.Instance.GetStatsCollector(_parent.DbContext.StatsIdentity);
        }
 /// <inheritdoc />
 public object Get(Type featureType)
 {
     if (featureType == typeof(IAspNetCoreFeature))
     {
         if (feature == null)
         {
             feature = AspNetCoreFeature.FromHttpContext(Context);
         }
         return(feature);
     }
     return(BaseCollection?.Get(featureType));
 }
        public object GetNewsletterLicenseInfo()
        {
            int usedMailings = BaseCollection <NewsletterMailing> .Get("FK_Site = '" + SessionObject.CurrentSite.ID.ToString() + "'").Count();

            int maxNumberOfNewsletterMailings = (SessionObject.CurrentLicense.MaxNumberOfNewsletterMailings != null) ? (int)SessionObject.CurrentLicense.MaxNumberOfNewsletterMailings : -1;
            Dictionary <string, string> newsletterLicenseInfo = new Dictionary <string, string>();

            newsletterLicenseInfo.Add("sentNewletterCount", (maxNumberOfNewsletterMailings != 1) ? maxNumberOfNewsletterMailings.ToString() : "Onbeperkt");
            newsletterLicenseInfo.Add("sendNewletterCount", usedMailings.ToString());
            newsletterLicenseInfo.Add("UnusedSentTickets", (maxNumberOfNewsletterMailings != 1) ? (maxNumberOfNewsletterMailings - usedMailings).ToString() : "-");
            return(newsletterLicenseInfo);
        }
Example #22
0
 internal void AddPasswordToHistory(DateTime time, string password)
 {
     if (Enabled && !string.IsNullOrEmpty(password))   //change only if enabled and not empty
     {
         BaseCollection.Add(new PasswordHistoryItem(this, time, password));
         while (BaseCollection.Count > MaximumCount)
         {
             BaseCollection.RemoveAt(0);
         }
         MarkAsChanged();
     }
 }
Example #23
0
        public static DataSet GetLastInprogressGame(int userId)
        {
            DataSet ds = BaseCollection.ExecuteDataset("GetLastInprogressGame", userId);

            ds.Tables[0].TableName = "Challenge";
            ds.Tables[1].TableName = "Game";
            ds.Tables[2].TableName = "Users";
            ds.Tables[3].TableName = "Engines";
            ds.Tables[4].TableName = "TournamentMatch";
            ds.Tables[5].TableName = "Tournament";
            return(ds);
        }
Example #24
0
        public override List <ChanceClass> getChances(BaseCollection sc, ExpectData ed)
        {
            List <ChanceClass> ret = new List <ChanceClass>();
            ExpectList         el  = sc.orgData;
            List <ChanceClass> scs = new List <ChanceClass>();
            strag_CommOldClass coc = new strag_CommOldClass();

            coc.CommSetting = this.CommSetting;
            coc.ChipCount   = this.ChipCount;
            coc.FixChipCnt  = true;
            //coc.AllowMaxHoldTimeCnt = this.AllowMaxHoldTimeCnt;
            coc.BySer = this.BySer;
            //coc.ReviewExpectCnt = ;
            coc.InputMinTimes = this.InputMinTimes;
            coc.StagSetting   = new StagConfigSetting();
            if (!this.IsTracing)//未持仓时才计算过往概率
            {
                double sucrate = double.NaN;
                if (this.CommSetting.UseLocalWaveData)//如果使用本地数据,获取该期本地数据
                {
                    sucrate = this.LocalWaveData[el.LastData.Expect];
                }
                if (double.IsNaN(sucrate))               //如果数据异常,继续去寻找
                {
                    sucrate = getSucRate(el, coc, true); //该类策略全部是一次性机会,可反复下注
                }
                if (this.RateDic == null)
                {
                    this.RateDic = new Dictionary <string, double>();
                }
                if (!this.RateDic.ContainsKey(this.LastUseData().LastData.Expect))//加入胜率队列
                {
                    RateDic.Add(this.LastUseData().LastData.Expect, sucrate);
                }
                if (!this.CheckEnableIn())
                {
                    return(ret);
                }

                this.IsTracing = true;//满足条件,开始持仓
                //this.debug_maxRate = 0;
            }
            BaseCollection scc = new ExpectListProcess(el).getSerialData(InputMinTimes, BySer) as BaseCollection;

            ret = coc.getChances(scc, el.LastData);
            for (int i = 0; i < ret.Count; i++)
            {
                ret[i].NeedConditionEnd  = true;
                ret[i].OnCheckTheChance += CheckNeedEndTheChance;
            }
            return(ret);
        }
Example #25
0
        private void LoadData(Guid dataCollectionID)
        {
            int viewMode = 1;//int.Parse(this.ViewModeCheckBoxList.SelectedValue);

            //DataCollection dataCollection = BaseObject.GetById<DataCollection>(dataCollectionID);
            string treeRoot  = this.treeViewTemplate;
            string rootNodes = "";

            string where = String.Format("FK_DataCollection = '{0}' AND FK_Parent_group Is Null", dataCollectionID);
            BaseCollection <DataGroup> rootGroups = BaseCollection <DataGroup> .Get(where);

            //foreach (DataGroup group in dataCollection.Groups.Where(c => c.ParentGroup == null))
            foreach (DataGroup group in rootGroups)

            {
                //todo:  vanonderstaande code en BuildTreeNode() meer 1 functie van maken (met eventueel extra parameter

                //string drillDownLink = String.Format(@"<div style=""display: none;""><asp:LinkButton runat=""server"" ID=""dummyLinkButton{0:N}"" ClientIDMode=""AutoID"" OnClick=""DrillDownLink_Click"" Text='<%# DataBinder.Eval(Container.DataItem,""ID"") %>' CommandArgument='<%# DataBinder.Eval(Container.DataItem,""ID"") %>'>dummy<%# DataBinder.Eval(Container.DataItem,""ID"") %></asp:LinkButton></div>", this.ModuleID);
                //        drillDownLink += String.Format(@"<asp:HyperLink ClientIDMode=""AutoID""  ID=""link{0:N}"" runat=""server"" NavigateUrl='<%#DataBinder.Eval(Container.DataItem,""RewriteUrl"")%>' CssClass=""showDetailsInModules"">", this.ModuleID);
                string drillDownLink = buildDrillDownLink(group);
                string rootNode      = this.treeNodeTemplate;
                rootNode = rootNode
                           .Replace("{TreeNode.DrillDownLink}", drillDownLink)
                           .Replace("{TreeNode.Name}", group.Name)
                           .Replace("{/TreeNode.DrillDownLink}", "</a>")
                           .Replace("{TreeNode.ID}", "TreeNode" + group.ID.ToString("N"))
                           .Replace("{TreeNode.ChildNodes}", this.BuildTreeNode(rootNode, group, viewMode));

                rootNodes += rootNode;

                /* TreeNode node = new TreeNode();
                 * node.Text = group.Name;
                 * node.Value = group.ID.ToString();
                 * node.NavigateUrl = group.RewriteUrl;
                 * node = BuildTreeNode(node, group, viewMode);
                 * DataCollectionTreeView.Nodes.Add(node); */
            }


            /* if (viewMode == 2)
             * {
             *  foreach (DataItem item in dataCollection.Items)
             *  {
             *      TreeNode itemNode = new TreeNode();
             *      itemNode.Text = itemNode.Text;
             *      itemNode.Value = item.ID.ToString();
             *      DataCollectionTreeView.Nodes.Add(itemNode);
             *  }
             * } */
            treeRoot = treeRoot.Replace("{ReplaceNodes}", rootNodes);
            this.treeViewLiteral.Text = "<div class=\"bitTree\" id=\"BitTree" + this.ModuleID.ToString("N") + "\" data-tree-selected-id=\"" + this.selectedTreeNode + "\">" + treeRoot + "</div>";
        }
Example #26
0
        public void Load()
        {
            this.NewsletterGroups = BaseCollection <NewsletterGroup> .Get("FK_Site = '" + SessionObject.CurrentSite.ID.ToString() + "'");

            TextboxEmail      = (TextBox)this.FindControl("TextboxEmail" + this.ModuleID.ToString("N"));
            TextboxForeName   = (TextBox)this.FindControl("TextboxForeName" + this.ModuleID.ToString("N"));
            TextboxName       = (TextBox)this.FindControl("TextboxName" + this.ModuleID.ToString("N"));
            TextboxNamePrefix = (TextBox)this.FindControl("TextboxNamePrefix" + this.ModuleID.ToString("N"));
            TextboxCompany    = (TextBox)this.FindControl("TextboxCompany" + this.ModuleID.ToString("N"));

            RadioSexeCompany = (RadioButton)this.FindControl("RadioSexeCompany" + this.ModuleID.ToString("N"));
            RadioSexeFemale  = (RadioButton)this.FindControl("RadioSexeFemale" + this.ModuleID.ToString("N"));
            RadioSexeMale    = (RadioButton)this.FindControl("RadioSexeMale" + this.ModuleID.ToString("N"));

            NewsGroupCheckBoxList         = (CheckBoxList)this.FindControl("NewsGroupenCheckBoxList" + this.ModuleID.ToString("N"));
            LinkSubmitButton              = (LinkButton)this.FindControl("SubmitLinkButton" + this.ModuleID.ToString("N"));
            SubmitButton                  = (Button)this.FindControl("SubmitButton" + this.ModuleID.ToString("N"));
            ResendVerificationButton      = (LinkButton)this.FindControl("ResendVerificationButton" + this.ModuleID.ToString("N"));
            this.PanelRegisterFrom        = (HtmlControl)this.FindControl("PanelRegisterFrom" + this.ModuleID.ToString("N"));
            this.PanelSuccessRegister     = (HtmlControl)this.FindControl("PanelSuccessRegister" + this.ModuleID.ToString("N"));
            this.PanelErrorRegister       = (HtmlControl)this.FindControl("PanelErrorRegister" + this.ModuleID.ToString("N"));
            this.PanelVerificationRequest = (HtmlControl)this.FindControl("PanelVerificationRequest" + this.ModuleID.ToString("N"));


            if (TextboxEmail == null)
            {
                if (this.LabelMsg != null)
                {
                    this.LabelMsg.Text += "Plaats de tag {TextboxEmailAddress}.<br />";
                }
                this.TextboxEmail = new TextBox();
            }

            this.LoadSettings();

            this.SetNewsletterMode();

            if (LinkSubmitButton != null)
            {
                LinkSubmitButton.Click += SubmitButton_Click;
            }

            if (SubmitButton != null)
            {
                SubmitButton.Click += SubmitButton_Click;
            }

            if (ResendVerificationButton != null)
            {
                ResendVerificationButton.Click += ResendVerificationButton_Click;
            }
        }
        public string RetrieveStatistics()
        {
            string html = "";
            BaseCollection <CMSEnvironment> environments = BaseCollection <CMSEnvironment> .Get("FK_License = '" + this.ID + "'");

            foreach (CMSEnvironment env in environments)
            {
                html += "Statistieken voor " + env.Name + "<br/>";
                html += env.GetStatisticsHtmlTable();
                html += "<br/><br/>";
            }
            return(html);
        }
Example #28
0
        public static void CreateRegisterUsers(Cxt cxt, SqlTransaction sqlTrans, DataTable dt)
        {
            foreach (DataRow dr in dt.Rows)
            {
                TournamentUser tournamentUser = new TournamentUser(cxt, dr);

                BaseCollection.Execute(sqlTrans, "CreateTournamentRegisterUser",
                                       tournamentUser.TournamentID, tournamentUser.UserID,
                                       tournamentUser.StatusID, tournamentUser.TeamID,
                                       tournamentUser.EloBefore, cxt.CurrentUser.UserID,
                                       DateTime.Now);
            }
        }
Example #29
0
        //public CmsBitplateUser ConvertToType()
        //{
        //    CmsBitplateUser returnvalue = this;
        //    if (this.Role.RoleType == RoleEnum.WebshopCustomers)
        //    {
        //        DataCollections.Webshop.Customer customer = BaseObject.GetById<DataCollections.Webshop.Customer>(this.ID);
        //        returnvalue = customer;
        //    }
        //    return returnvalue;
        //}

        //public void UpdateAllUsersWithSameEmail()
        //{
        //    //naw gegevens van alle gebruikers met hetzelfde emailadres gelijk trekken
        //    //BaseCollection<CmsUser> users = BaseCollection<CmsUser>.Get("Email = '" + this.Email + "'");
        //    string where = " EXISTS (SELECT * FROM role WHERE user.FK_Role = role.ID AND role.RoleType IN(2,3)) AND Email = '" + this.Email + "' ";

        //    BaseCollection<CmsBitplateUser> users = BaseCollection<CmsUser>.Get(where);
        //    foreach (CmsBitplateUser user in users)
        //    {
        //        if (!user.Equals(this) && !user.Role.IsClientRol)
        //        {
        //            user.Name = this.Name;
        //            user.NamePrefix = this.NamePrefix;
        //            user.Password = this.Password;
        //            user.Plaats = this.Plaats;
        //            user.PostCode = this.PostCode;
        //            user.Sexe = this.Sexe;
        //            user.Telefoon = this.Telefoon;
        //            user.Adres = this.Adres;
        //            user.CompanyName = this.CompanyName;
        //            user.ForeName = this.ForeName;
        //            user.GeboorteDatum = this.GeboorteDatum;
        //            user.Land = this.Land;
        //            user.Save();
        //        }
        //    }
        //}

        public static T GetUserOrNewByEmail <T>(string email) where T : BaseUser, new()
        {
            T user = new T();

            user.Email = email;
            BaseCollection <T> users = BaseCollection <T> .Get("Email = '" + email + "'");

            if (users.Count == 1)
            {
                user = users[0];
            }
            return(user);
        }
Example #30
0
        /// <summary>
        /// <see cref="IList{T}.Insert(int, T)" />
        /// </summary>
        public void Insert(int index, T item)
        {
            var oldItem = TryGetOldItem(index);

            BaseCollection.Insert(index, item);
            RaiseCollectionEvents();

            var e = new NotifyCollectionChangedEventArgs(action: NotifyCollectionChangedAction.Move,
                                                         changedItem: oldItem,
                                                         index: index + 1, oldIndex: index);

            RaiseCollectionChanged(e);
        }
Example #31
0
        private string FillLookUpDropDown(Tag tag)
        {
            string options   = "";
            string fieldName = tag.Name.Replace("{DropDown", "").Replace("}", "");
            string sql       = "SELECT datalookupvalue.* FROM `datalookupvalue` JOIN datafield ON datalookupvalue.FK_DataField = datafield.ID WHERE datafield.Name = '" + fieldName + "' AND datafield.FK_DataCollection = '" + this.DataCollection.ID.ToString() + "'";
            BaseCollection <DataLookupValue> lookUpValues = BaseCollection <DataLookupValue> .LoadFromSql(sql);

            foreach (DataLookupValue lookUpValue in lookUpValues)
            {
                options += "<option value=\"" + lookUpValue.ID + "\">" + lookUpValue.Name + "</option>";
            }
            return(tag.ReplaceValue.Replace("{options}", options));
        }
Example #32
0
        public AutoLinkGenerator(HPatternInstance instance)
        {
            // Read all the instances of this type to find links.
            m_Instances = new BaseCollection<HPatternInstance>();
            m_Instances.Add(instance);

            // For performance reasons it is unfeasible to actually read the updated versions here.
            foreach (PatternInstance otherInstance in PatternInstance.GetInstances(instance.Model, HPatternPattern.Definition, PatternInstance.OpenOptions.SkipUpdate))
            {
                if (otherInstance.Id != instance.Id)
                    m_Instances.Add(HPatternInstance.FastLoad(otherInstance));
            }
        }
Example #33
0
        internal PasswordHistoryCollection(RecordCollection records)
        {
            Records = records;

            if (Records.Contains(RecordType.PasswordHistory))
            {
                var text = Records[RecordType.PasswordHistory].Text;
                if ((text != null) && (text.Length >= 5))
                {
                    _enabled = (text[0] != '0');
                    if (!int.TryParse(text.AsSpan(1, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out _maximumCount))
                    {
                        _maximumCount = DefaultMaximumCount;
                    }

                    if (int.TryParse(text.AsSpan(3, 2), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var count))
                    {
                        var j = 5; //where parsing starts
                        for (var i = 0; i < count; i++)
                        {
                            if (text.Length >= j + 12)
                            {
                                if (int.TryParse(text.AsSpan(j, 8), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var time) &&
                                    int.TryParse(text.AsSpan(j + 8, 4), NumberStyles.HexNumber, CultureInfo.InvariantCulture, out var length))
                                {
                                    j += 12; //skip time and length
                                    if (text.Length >= j + length)
                                    {
                                        var item = new PasswordHistoryItem(this, UnixEpoch.AddSeconds(time), text.Substring(j, length));
                                        BaseCollection.Add(item);
                                        j += length; //skip password
                                    }
                                    else
                                    {
                                        break; //something is wrong with parsing
                                    }
                                }
                                else
                                {
                                    break; //something is wrong with parsing
                                }
                            }
                            else
                            {
                                break; //something is wrong with parsing
                            }
                        }
                    }
                }
            }
        }
		public BaseCollection<DCTFile> DCMQueryDocByCaml(string camlText)
		{
			BaseCollection<DCTFile> files = new BaseCollection<DCTFile>();

			using (DocLibContext clientContext = new DocLibContext(ServiceHelper.GetDocumentLibraryName()))
			{
				CamlQuery query = new CamlQuery();
				query.ViewXml = camlText;
				ListItemCollection items = clientContext.BaseList.GetItems(query);
				clientContext.Load(items);
				clientContext.ExecuteQuery();
				foreach (ListItem item in items)
				{
					DCTFile file = new DCTFile();
					DCTConverterHelper.Convert(item, file);
					files.Add(file);
				}
			}
			return files;
		}
Example #35
0
        public static BaseCollection<GridColumnPropertieElement> MergeGridColumnProperties(GridColumnPropertiesElement props, HPatternSettings sett)
        {
            BaseCollection<GridColumnPropertieElement> ret = null;
            if (props == null)
            {
                ret = new BaseCollection<GridColumnPropertieElement>();
            }
            else
            {
                ret = new BaseCollection<GridColumnPropertieElement>(props);
            }
            if (sett.Grid.GridProperties != null && sett.Grid.GridProperties.GridColumnProperties != null)
            {
                foreach (SettingsGridColumnPropertieElement prop in sett.Grid.GridProperties.GridColumnProperties)
                {
                    // Vamos verificar se já tem
                    bool tem = false;
                    foreach (GridColumnPropertieElement prope in ret)
                    {
                        if (prope.Name == prop.Name)
                        {
                            tem = true;
                            break;
                        }
                    }

                    // Não tem
                    if (tem == false)
                    {
                        GridColumnPropertieElement propi = new GridColumnPropertieElement(prop.Name);
                        propi.Valor = prop.Valor;
                        ret.Add(propi);
                    }
                }
            }
            return ret;
        }
    public void InitControl()
    {
        BaseCollection c = new BaseCollection(UData.ToTable2("CategoryTask", "TaskID"));
        BaseItem i = null;

        i = c.NewItem();
        c.Add(i);
        i.SetColumn(0, TaskE.SearchItem.ToString("d"));

        if (UWeb.IsAuthenticated)
        {
            bool show = true;

            if (Cxt.Service.ServiceTypeID == ServiceTypeE.Membership)
            {
                if (UWeb.UserID != 1)
                {
                    show = false;
                }
            }

            if (show)
            {
                i = c.NewItem();
                c.Add(i);
                i.SetColumn(0, TaskE.NewItem.ToString("d"));

                i = c.NewItem();
                c.Add(i);
                i.SetColumn(0, TaskE.MyItem.ToString("d"));
            }
        }

        gv1.DataSource = c.DataTable;
        gv1.DataBind();
    }
		public BaseCollection<DCTFileVersion> DCMGetVersions(int fileId)
		{
			using (DocLibContext context = new DocLibContext(ServiceHelper.GetDocumentLibraryName()))
			{
				File file = getFileById(fileId, context);
				context.Load(file.Versions);
				context.ExecuteQuery();

				BaseCollection<DCTFileVersion> results = new BaseCollection<DCTFileVersion>();

				foreach (FileVersion version in file.Versions)
				{
					context.Load(version.CreatedBy);
					context.ExecuteQuery();
					DCTFileVersion dctFileVersion = new DCTFileVersion();
					dctFileVersion.AbsoluteUri = UriHelper.CombinePath(context.Url, version.Url);
					DCTConverterHelper.Convert(version, dctFileVersion);

					results.Add(dctFileVersion);
				}

				return results;
			}
		}
Example #38
0
 /// <summary>
 /// 释放
 /// </summary>
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         //释放 托管资源 
         if (_collection != null)
         {
             _collection.Dispose();
         }
         _collection = null;
     }
     base.Dispose(disposing);
 }
		public BaseCollection<DCTSearchResult> DCMSearchDoc(string[] keyWords)
		{
			MCS.Library.Core.ServerInfo serverInfo = MossServerInfoConfigurationSettings.GetConfig().Servers["documentServer"].ToServerInfo();
			System.Net.NetworkCredential Credentials = new System.Net.NetworkCredential(serverInfo.Identity.LogOnName, serverInfo.Identity.Password, serverInfo.Identity.Domain);
			string searchServiceUrl = MCS.Library.Core.UriHelper.CombinePath(MossServerInfoConfigurationSettings.GetConfig().Servers["documentServer"].ServerName, MossServerInfoConfigurationSettings.GetConfig().Servers["documentServer"].MossSearchServiceUrl);
			QueryService queryService = new QueryService(searchServiceUrl, Credentials);

			BaseCollection<DCTSearchResult> result = new BaseCollection<DCTSearchResult>();
			StringBuilder queryXml = new StringBuilder();
			queryXml.Append("<QueryPacket xmlns=\"urn:Microsoft.Search.Query\" Revision=\"1000\">");
			queryXml.Append("<Query domain=\"QDomain\">");
			queryXml.Append("<SupportedFormats>");
			queryXml.Append("<Format>");
			queryXml.Append("urn:Microsoft.Search.Response.Document.Document");
			queryXml.Append("</Format>");
			queryXml.Append("</SupportedFormats>");
			queryXml.Append("<Range>");
			queryXml.Append("<Count>50</Count>");
			queryXml.Append("</Range>");
			queryXml.Append("<Context>");
			queryXml.Append("<QueryText language=\"en-US\" type=\"STRING\">");
			foreach (string item in keyWords)
			{
				queryXml.Append(string.Format("{0} ", item));
			}

			queryXml.Append("</QueryText>");
			queryXml.Append("</Context>");
			queryXml.Append("</Query>");

			queryXml.Append("</QueryPacket>");
			try
			{
				using (DocLibContext context = new DocLibContext(ServiceHelper.GetDocumentLibraryName()))
				{
					DataSet dsQueryResult = queryService.QueryEx(queryXml.ToString());
					IEnumerable<DataRow> drQueryResult = from row in dsQueryResult.Tables[0].AsEnumerable()
														 where row.Field<bool>("IsDocument") == true
														 select row;
					foreach (var item in drQueryResult)
					{
						DCTSearchResult searchResult = new DCTSearchResult();
						searchResult.Title = item["Title"].ToString();
						searchResult.Size = int.Parse(item["Size"].ToString());
						searchResult.HitHighlightedSummary = item["HitHighlightedSummary"].ToString();
						searchResult.LastModifiedDate = DateTime.Parse(item["Write"].ToString());
						searchResult.Path = item["Path"].ToString().ToLower().Replace(context.Url.ToLower(), "");
						result.Add(searchResult);
					}
					return result;
				}
			}
			catch (SoapException ex)
			{
				throw ex;
			}
		}
        public BaseCollection<DCTStorageObject> DCMGetChildren(DCTFolder folder, DCTContentType contentType)
        {
            BaseCollection<DCTStorageObject> childs = new BaseCollection<DCTStorageObject>();
            BaseCollection<DCTFile> childFiles = new BaseCollection<DCTFile>();
            BaseCollection<DCTFolder> childFolders = new BaseCollection<DCTFolder>();

            using (DocLibContext clientContext = new DocLibContext(ServiceHelper.GetDocumentLibraryName()))
            {
                Folder clientOMFolder = clientContext.Web.GetFolderByServerRelativeUrl(folder.Uri);
                CamlQuery query = new CamlQuery();
                query.FolderServerRelativeUrl = LoadUri(folder, clientContext);
                query.ViewXml = Caml.SimpleView(Caml.EmptyCaml(), CamlBuilder.ViewType.Default).ToCamlString();

                ListItemCollection items = clientContext.BaseList.GetItems(query);

                clientContext.Load(items);
                clientContext.ExecuteQuery();

                foreach (ListItem item in items)
                {
                    switch (item.FileSystemObjectType)
                    {
                        case FileSystemObjectType.File:
                            if ((contentType & DCTContentType.File) != DCTContentType.None)
                            {
                                DCTFile itemFile = new DCTFile();
                                DCTConverterHelper.Convert(item, itemFile);

                                childs.Add(itemFile);
                                //childFiles.Add(itemFile);
                            }
                            break;
                        case FileSystemObjectType.Folder:
                            if ((contentType & DCTContentType.Folder) != DCTContentType.None)
                            {
                                DCTFolder itemFolder = new DCTFolder();

                                DCTConverterHelper.Convert(item, itemFolder);

                                childs.Add(itemFolder);
                                //childFolders.Add(itemFolder);
                            }
                            break;
                        case FileSystemObjectType.Invalid:
                            break;
                        case FileSystemObjectType.Web:
                            break;
                        default:
                            break;
                    }
                }
            }

            foreach (DCTFolder item in childFolders)
                childs.Add(item);

            foreach (DCTFile item in childFiles)
                childs.Add(item);

            return childs;
        }
Example #41
0
		/// <summary>
		/// 查询文件
		/// </summary>
		/// <param name="keyValuePairs">键值对</param>
		/// <returns></returns>
		public BaseCollection<DCTClientFile> QueryFile(Dictionary<string, string> keyValuePairs)
		{
			BaseCollection<DCTFileField> fileFields = new BaseCollection<DCTFileField>();

			foreach (var pair in keyValuePairs)
			{
				var curField = Fields;
				if (!curField.ContainsKey(pair.Key))
					continue;
				fileFields.Add(new DCTFileField() { Field = Fields[pair.Key], FieldValue = pair.Value });

			}

			BaseCollection<DCTFile> files = new BaseCollection<DCTFile>();
			BaseCollection<DCTClientFile> results = new BaseCollection<DCTClientFile>();
			ServiceProxy.SingleCall<IDCSFetchService>(binding, searchEndpointAddress, userBehavior, action =>
			{
				files = action.DCMQueryDocByField(fileFields);
				foreach (var file in files)
				{
					results.Add(file.To<DCTClientFile>());
				}
			});

			return results;
		}
Example #42
0
		/// <summary>
		/// 搜索
		/// </summary>
		/// <param name="keywords">关键字</param>
		/// <returns></returns>
		public BaseCollection<DCTClientSearchResult> Search(params string[] keywords)
		{
			BaseCollection<DCTClientSearchResult> results = new BaseCollection<DCTClientSearchResult>();
			ServiceProxy.SingleCall<IDCSFetchService>(binding, searchEndpointAddress, userBehavior, action =>
			{
				var allDocs = action.DCMSearchDoc(keywords);
				foreach (var doc in allDocs)
				{
					DCTClientSearchResult result = doc.To<DCTClientSearchResult>();
					result.Client = this;
					results.Add(result);
				}
			});
			return results;
		}
        public static void UpdateStats(Cxt cxt, int serviceID, int categoryID)
        {
            string sql = "";

            sql = "SELECT CategoryID, ServiceID, COUNT(CategoryID) ItemCount FROM Item where ServiceID=@p1 AND CategoryID=@p2 group by CategoryID, ServiceID";

            BaseCollection items = new BaseCollection(BaseCollection.ExecuteSql(RsOneItemTable.Unknown, sql, serviceID, categoryID));

            UpdateStats(cxt, items);
        }
        private static string UpdateRules(HPatternInstance instance, HPatternSettings settings, Transaction transaction)
        {
            StringBuilder rules = new StringBuilder();

            StringBuilder eventCodeAfterTrn = new StringBuilder();
            //if (transaction.IsBusinessComponent)
            //{
            rules.AppendLine("[web]");
            rules.AppendLine("{");
            //}

            // Add 'parm' rule
            rules.Append(instance.Transaction.GeraParm(false));

            // Add Prompts rule
            rules.Append(Helpers.Template.PromptRules(instance.Transaction.Form, settings));

            // Add 'primary key rules'
            foreach (TransactionAttribute trnAtt in transaction.Structure.Root.PrimaryKey)
            {
                rules.AppendFormat("\r\n{0} = &{0} if not &{0}.IsEmpty();", trnAtt.Name);

                bool edita = false;
                bool sai = false;

                foreach (RowElement row in Helpers.Template.GetRows(instance.Transaction, ""))
                {
                    foreach (ColumnElement col in row.Columns)
                    {
                        foreach (AttributeElement att in col.Attributes)
                        {
                            if (att.AttributeName == trnAtt.Name)
                            {
                                if (att.Readonly || att.Visible == false || row.Visible == false)
                                {
                                    edita = true;

                                }
                                sai = true;
                                break;
                            }
                        }

                        if (sai)
                            break;

                    }

                    if (sai)
                        break;
                }

                if (edita || (transaction.Structure.Root.PrimaryKey.Count == 1 && trnAtt.Attribute.GetPropertyValue<bool>(Properties.ATT.Autonumber)))
                    rules.AppendFormat("\r\nnoaccept({0});", trnAtt.Name);
                else
                    rules.AppendFormat("\r\nnoaccept({0}) if not &{0}.IsEmpty();", trnAtt.Name);
            }

            // Add 'noprompt' rule.
            rules.AppendFormat("\r\nnoprompt({0});", GetList(transaction.Structure.Root.PrimaryKey));

            // Add context rules if applicable.
            if (settings.Template.UseTransactionContext)
            {
                rules.AppendLine();
                foreach (TransactionAttribute trnAtt in ContextAttributes(transaction))
                {
                    rules.AppendFormat("\r\n{0} = &Insert_{0} if &Mode = TrnMode.Insert and not &Insert_{0}.IsEmpty();", trnAtt.Name);
                    rules.AppendFormat("\r\nnoaccept({0}) if &Mode = TrnMode.Insert and not &Insert_{0}.IsEmpty();", trnAtt.Name);
                }
            }

            if (settings.Security.RuleCode != String.Empty) {
                rules.AppendLine(settings.Security.RuleCode);
            }

            rules.AppendLine();
            rules.Append(Helpers.Template.HMaskRuleSave(instance.Transaction, "", ""));
            rules.AppendLine();

            //if (transaction.IsBusinessComponent)
            //{
            rules.AppendLine("}");
            //}

            string ruledate = settings.Template.RuleDate;
            string valueruledate = settings.Template.ValueRuleDate;
            string ruledatetime = settings.Template.RuleDateTime;
            string valueruledatetime = settings.Template.ValueRuleDateTime;
            string defaultvalue = "";
            string defaultrule = "";

                IBaseCollection<RowElement> lista = new BaseCollection<RowElement>();
                lista = instance.Transaction.GetRows("",true,true);

                foreach (RowElement row in lista)
                {

                    foreach (ColumnElement col in row.Columns)
                    {
                        foreach (AttributeElement att in col.Attributes)
                        {
                            if (att.Attribute != null)
                            {

                                // Atributo Requerido

                                bool required = att.getRequired(transaction);

                                if (required)
                                {
                                    string message = settings.Template.RequiredNotNullMessage;
                                    if (att.RequiredMessage != String.Empty && att.RequiredMessage.ToLower() != "default")
                                    {
                                        message = att.RequiredMessage;
                                    }

                                    message = String.Format(message, (att.Description.Substring(0,1) == "=" ? att.Attribute.Description : att.Description ));

                                    if (att.RequiredAfterVal)
                                    {
                                        rules.AppendLine(String.Format("Error('{0}') if {1}.IsEmpty() on AfterValidate;", message, att.AttributeName));
                                    }
                                    else
                                    {
                                        rules.AppendLine(String.Format("Error('{0}') if {1}.IsEmpty();", message, att.AttributeName));
                                    }

                                }

                                // Regra para o atributo
                                defaultvalue = att.ValueRule;
                                if (defaultvalue == "<default>" || defaultvalue == String.Empty)
                                {
                                    defaultvalue = "";
                                    switch (att.Attribute.Type)
                                    {
                                        case eDBType.DATE:
                                            defaultvalue = valueruledate;
                                            break;

                                        case eDBType.DATETIME:
                                            defaultvalue = valueruledatetime;
                                            break;

                                    }
                                }

                                defaultrule = att.Rule;
                                if (defaultrule.ToLower() == "<default>")
                                {
                                    defaultrule = "";
                                    switch (att.Attribute.Type)
                                    {
                                        case eDBType.DATE:
                                            defaultrule = ruledate;
                                            break;

                                        case eDBType.DATETIME:
                                            defaultrule = ruledatetime;
                                            break;

                                    }
                                }

                                if (defaultvalue != String.Empty && defaultrule != String.Empty)
                                {

                                    switch (defaultrule)
                                    {
                                        case AttributeElement.RuleValue.DefaultRule: // "defaultrule":
                                            rules.AppendLine(String.Format("Default({0},{1});", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.AfterValidate: // "aftervalidate":
                                            rules.AppendLine(String.Format("{0} = {1} On AfterValidate;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.AfterInsert:
                                            rules.AppendLine(String.Format("{0} = {1} On AfterInsert;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.AfterUpdate:
                                            rules.AppendLine(String.Format("{0} = {1} On AfterUpdate;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.AfterDelete:
                                            rules.AppendLine(String.Format("{0} = {1} On AfterDelete;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.BeforeValidate:
                                            rules.AppendLine(String.Format("{0} = {1} On BeforeValidate;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.BeforeInsert:
                                            rules.AppendLine(String.Format("{0} = {1} On BeforeInsert;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.BeforeUpdate:
                                            rules.AppendLine(String.Format("{0} = {1} On BeforeUpdate;", att.AttributeName, defaultvalue));
                                            break;

                                        case AttributeElement.RuleValue.BeforeDelete:
                                            rules.AppendLine(String.Format("{0} = {1} On BeforeDelete;", att.AttributeName, defaultvalue));
                                            break;
                                    }
                                }

                            }
                        }
                    }
                }
            //}

            string codes = TemplateInternal.RuleCodes(TemplateInternal.CodeType.Transaction, settings);
            if (!String.IsNullOrEmpty(codes))
            {
                rules.Append(codes);
            }

            return AppendRules(transaction, rules.ToString());
        }
Example #45
0
 void MenuCollection_ChangedEvent(object sender, BaseCollection<VSMenuCommand>.ChangedArgs e)
 {
     if (ChangedEvent != null)
     {
         ChangedEvent(this, new MenuChangedArgs(e.Item, e.ChangeType, e.Item));
     }
 }
        private static void UpdateStats(Cxt cxt, BaseCollection items)
        {
            for (int i = 0; i < items.Count; i++)
            {
                ServiceCategory c = new ServiceCategory(cxt, items[i].GetColInt32("ServiceID"), items[i].GetColInt32("CategoryID"));

                c.ConfigAttributes.Set(AttributeE.ServiceCategoryItemCount, items[i].GetCol("ItemCount"));

                c.ConfigAttributes.Save();
            }
        }
        private void AddSuborTabTransaction(ViewElement viewElement, string tabId, TransactionLevelRelation relation)
        {
            // Do not include the attributes "known due to context" (for example, when browsing the client's invoices, drop ClientId, ClientName, and ClientAddress).
            BaseCollection<TransactionAttribute> attrisInTab = new BaseCollection<TransactionAttribute>(relation.RelatedTransaction.Structure.Root.Attributes);
            attrisInTab.RemoveAll(delegate(TransactionAttribute trnAtt) { return relation.ContainsRelatedAttribute(trnAtt.Attribute); });

            // This may leave us with nothing to add, actually...
            if (attrisInTab.Count > 0)
            {
                TabElement tabElement = viewElement.AddTab(tabId);
                tabElement.Name = (relation.GroupRelation != null ? relation.GroupRelation.Description : relation.RelatedTransaction.Description);
                tabElement.Wcname = relation.BaseTransaction.Name + tabId + "WC";
                tabElement.Description = (relation.GroupRelation != null ? relation.GroupRelation.Description : relation.RelatedTransaction.Description);
                tabElement.Type = TabElement.TypeValue.Grid;
                tabElement.Page = TabElement.PageValue.Default;

                // If the attribute names in the subordinated tab differ from those in the view, they
                // must be explicitly listed (for "trn level subordination", they are known to be equal).
                bool hasDifferentAttris = false;
                IList<Gx.Attribute> paramAttris = new List<Gx.Attribute>();
                foreach (AttributeRelation subordAttr in relation.KeyAttributes)
                {
                    paramAttris.Add(subordAttr.Related);
                    hasDifferentAttris = hasDifferentAttris || (subordAttr.Base != subordAttr.Related);
                }

                if (hasDifferentAttris)
                {
                    foreach (Gx.Attribute paramAttri in paramAttris)
                        AddParameter(tabElement.Parameters, paramAttri.Name, true);
                }

                AddTrn(relation.RelatedTransaction, tabElement);
                AddGridTabAttributes(tabElement, relation.RelatedTransaction, relation.RelatedTransaction.Structure.Root, attrisInTab);
                tabElement.Modes = new ModesElement();
                tabElement.Modes.InsertCondition = viewElement.Instance.Settings.StandardActions.Insert.Condition;
                tabElement.Modes.UpdateCondition = viewElement.Instance.Settings.StandardActions.Update.Condition;
                tabElement.Modes.DeleteCondition = viewElement.Instance.Settings.StandardActions.Delete.Condition;
                tabElement.Modes.DisplayCondition = viewElement.Instance.Settings.StandardActions.Display.Condition;
                tabElement.Modes.ExportCondition = viewElement.Instance.Settings.StandardActions.Export.Condition;

            }
        }