Exemplo n.º 1
0
 public FilterList(string ownerAndslug)
 {
     var splited = ownerAndslug.Split('/');
     if (splited.Length != 2)
         throw new ArgumentException("owner and slug must be separated as slash, once.");
     _listInfo = new ListInfo() { OwnerScreenName = splited[0], Slug = splited[1] };
 }
Exemplo n.º 2
0
        public override void Execute()
        {
            foreach (SiteCollInfo siteCollInfo in Owner.WorkingSiteCollections)
            {
                using (var siteColl = Owner.ObjectsFactory.GetSite(siteCollInfo.URL))
                {
                    foreach (SiteInfo siteInfo in siteCollInfo.Sites)
                    {
                        using(var web = siteColl.OpenWeb(siteInfo.ID))
                        {
                            Random rnd = new Random();
                            int listsToCreate = rnd.Next(WorkingDefinition.MaxNumberOfListsAndLibrariesPerSite+1);
                            int bigListsToCreate = WorkingDefinition.NumberOfBigListsPerSite;
                            Log.Write("Creating lists in site '" + web.Url + "'");
                            listsToCreate += bigListsToCreate;
                            int bigListsCreated = 0;
                            for( int s = 0; s < listsToCreate; s++ )
                            {
                                try
                                {
                                    SPDGListTemplateType listTemplate;
                                    if (bigListsCreated >= bigListsToCreate)
                                    {
                                        getNextTemplateType();

                                        listTemplate = _lastTemplateType;
                                    }
                                    else
                                    {
                                        _lastListPrefix = "List";
                                        listTemplate = SPDGListTemplateType.GenericList;
                                    }

                                    string listName = findAvailableListName(web);
                                    Guid listGuid = web.AddList(listName, string.Empty, (int)listTemplate);
                                    Owner.IncrementCurrentTaskProgress("Created List '" + listName + "' in site '" + web.Url + "'");
                                    var list = web.GetList(listGuid);
                                    web.AddNavigationNode(list.Title, list.DefaultViewUrl, NavigationNodeLocation.QuickLaunchLists);
                                    ListInfo listInfo = new ListInfo();
                                    listInfo.Name = listName;
                                    listInfo.TemplateType = listTemplate;
                                    listInfo.isLib = (listTemplate == SPDGListTemplateType.DocumentLibrary ? true : false);
                                    if (!listInfo.isLib && bigListsCreated < bigListsToCreate)
                                    {
                                        listInfo.isBigList = true;
                                        bigListsCreated++;
                                    }
                                    siteInfo.Lists.Add(listInfo);

                                }
                                catch(Exception ex )
                                {
                                    Errors.Log(ex);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 public void StartReceive(string receiverScreenName, ListInfo info)
 {
     var ai = AccountsStore.Accounts.FirstOrDefault(aset => aset.AuthenticateInfo.UnreliableScreenName == receiverScreenName);
     if (ai != null)
         StartReceive(ai.AuthenticateInfo, info);
     else
         StartReceive(info);
 }
Exemplo n.º 4
0
 public static async Task<DatabaseList> GetListDescription(ListInfo listInfo)
 {
     return await Task.Run(async () =>
     {
         var userId = UserProxy.GetId(listInfo.OwnerScreenName);
         return await Database.ListCrud.GetAsync(userId, listInfo.Slug).ConfigureAwait(false);
     }).ConfigureAwait(false);
 }
Exemplo n.º 5
0
 public static async Task<IEnumerable<long>> GetListMembers(ListInfo listInfo)
 {
     var user = await Database.UserCrud.GetAsync(listInfo.OwnerScreenName).ConfigureAwait(false);
     if (user == null) return Enumerable.Empty<long>();
     var list = await Database.ListCrud.GetAsync(user.Id, listInfo.Slug).ConfigureAwait(false);
     if (list == null) return Enumerable.Empty<long>();
     return await GetListMembers(list.Id).ConfigureAwait(false);
 }
Exemplo n.º 6
0
 public static IEnumerable<long> GetListUsers(ListInfo info)
 {
     lock (_listUserCache)
     {
         IEnumerable<long> users;
         return _listUserCache.TryGetValue(info, out users) ? users : Enumerable.Empty<long>();
     }
 }
 public void StartReceive(string receiverScreenName, ListInfo info)
 {
     var account =
         Setting.Accounts.Collection.FirstOrDefault(
             a => a.UnreliableScreenName.Equals(receiverScreenName, StringComparison.CurrentCultureIgnoreCase));
     if (account != null)
     {
         this.StartReceive(account, info);
     }
     else
     {
         this.StartReceive(info);
     }
 }
 public void StartReceive(TwitterAccount account, ListInfo info)
 {
     lock (this._listReceiverLocker)
     {
         if (this._listReceiverReferenceCount.ContainsKey(info))
         {
             this._listReceiverReferenceCount[info]++;
         }
         else
         {
             this._listReceiverReferenceCount.Add(info, 1);
             this._receiverDictionary.Add(info, new ListReceiver(account, info));
         }
     }
 }
Exemplo n.º 9
0
 public MeshBatcher()
 {
     int modelsMax = 1024 * 16;
     models = new ListInfo[modelsMax];
     for (int i = 0; i < modelsMax; i++)
     {
         models[i] = new ListInfo();
     }
     modelsCount = 0;
     BindTexture = true;
     glTextures = new int[10];
     glTexturesLength = 10;
     empty = new int[modelsMax];
     emptyCount = 0;
 }
Exemplo n.º 10
0
    public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        // Start 0000183, KuangWei, 2015-04-10
        if (isSupervisor(CurID))
        {
            TeamRecordExport.Visible = true;
        }
        // End 0000183, KuangWei, 2015-04-10

        DBFilter filter = sbinding.createFilter();
        OR       orTimeCardRecordHolder = new OR();

        orTimeCardRecordHolder.add(new Match("EmpID", CurID));
        //if (!string.IsNullOrEmpty(timeCardNo))
        orTimeCardRecordHolder.add(new Match("TimeCardRecordCardNo", GetTimeCardNo(CurID)));
        filter.add(orTimeCardRecordHolder);

        DateTime dtTimeCardRecordDate;

        if (!DateTime.TryParse(TimeCardRecordDate.Value, out dtTimeCardRecordDate))
        {
            dtTimeCardRecordDate = AppUtils.ServerDateTime().Date;
        }
        filter.add(new Match("TimeCardRecordDateTime", ">=", dtTimeCardRecordDate));
        filter.add(new Match("TimeCardRecordDateTime", "<", dtTimeCardRecordDate.AddDays(1)));


        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);


        string select = "*";
        string from   = "from " + ETimeCardRecord.db.dbclass.tableName + "";


        DataTable table = filter.loadData(dbConn, info, select, from);

        view = new DataView(table);

        ListFooter.Refresh();

        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }
        return(view);
    }
Exemplo n.º 11
0
        public StlPageChannels(string stlPageChannelsElement, PageInfo pageInfo, ContextInfo contextInfo, bool isXmlContent)
        {
            _stlPageChannelsElement = stlPageChannelsElement;
            _pageInfo = pageInfo;
            var xmlDocument = StlParserUtility.GetXmlDocument(_stlPageChannelsElement, isXmlContent);

            _node = xmlDocument.DocumentElement;
            _node = _node?.FirstChild;

            var attributes = new Dictionary <string, string>();
            var ie         = _node?.Attributes?.GetEnumerator();

            if (ie != null)
            {
                while (ie.MoveNext())
                {
                    var attr = (XmlAttribute)ie.Current;

                    var key = attr.Name;
                    if (!string.IsNullOrEmpty(key))
                    {
                        var value = attr.Value;
                        if (string.IsNullOrEmpty(value))
                        {
                            value = string.Empty;
                        }
                        attributes[key] = value;
                    }
                }
            }

            _contextInfo = contextInfo.Clone(stlPageChannelsElement, attributes, _node?.InnerXml, _node?.ChildNodes);

            DisplayInfo = ListInfo.GetListInfoByXmlNode(pageInfo, _contextInfo, EContextType.Channel);

            var channelId = StlDataUtility.GetChannelIdByLevel(pageInfo.SiteId, _contextInfo.ChannelId, DisplayInfo.UpLevel, DisplayInfo.TopLevel);

            channelId = StlDataUtility.GetChannelIdByChannelIdOrChannelIndexOrChannelName(pageInfo.SiteId, channelId, DisplayInfo.ChannelIndex, DisplayInfo.ChannelName);

            var isTotal = TranslateUtils.ToBool(DisplayInfo.Others.Get(IsTotal.Name));

            if (TranslateUtils.ToBool(DisplayInfo.Others.Get(IsAllChildren.Name)))
            {
                DisplayInfo.Scope = EScopeType.Descendant;
            }

            _dataSet = StlDataUtility.GetPageChannelsDataSet(pageInfo.SiteId, channelId, DisplayInfo.GroupChannel, DisplayInfo.GroupChannelNot, DisplayInfo.IsImageExists, DisplayInfo.IsImage, DisplayInfo.StartNum, DisplayInfo.TotalNum, DisplayInfo.OrderByString, DisplayInfo.Scope, isTotal, DisplayInfo.Where);
        }
    public DataView loadData(ListInfo info, DBManager db, DataList repeater)
    {
        DBFilter filter = binding.createFilter();

        DateTime dtPeriodFr, dtPeriodTo;

        if (DateTime.TryParse(RequestFromDate.Value, out dtPeriodFr))
        {
            filter.add(new Match("RequestOTClaimCancelCreateDateTime", ">=", dtPeriodFr));
        }
        if (DateTime.TryParse(RequestToDate.Value, out dtPeriodTo))
        {
            filter.add(new Match("RequestOTClaimCancelCreateDateTime", "<", dtPeriodTo.AddDays(1)));
        }

        filter.add(new Match("c.EmpID", this.CurID));

        if (!EmpRequestStatus.SelectedValue.Equals(string.Empty))
        {
            if (EmpRequestStatus.SelectedValue.Equals("REQUEESTSTATUS_PROCESSING"))
            {
                filter.add(EEmpRequest.EndStatusDBTerms("EmpRequestStatus", true));
            }
            else if (EmpRequestStatus.SelectedValue.Equals("REQUEESTSTATUS_END_PROCESS"))
            {
                filter.add(EEmpRequest.EndStatusDBTerms("EmpRequestStatus", false));
            }
        }

        string select = "c.RequestOTClaimCancelID, c.RequestOTClaimCancelCreateDateTime, r.EmpRequestStatus, r.EmpRequestID, r.EmpRequestLastAuthorizationWorkFlowIndex, la.* ";
        string from   = "from " + db.dbclass.tableName + " c " +
                        " LEFT JOIN " + EOTClaim.db.dbclass.tableName + " la ON c.OTClaimID = la.OTClaimID " +
                        " LEFT JOIN " + EEmpRequest.db.dbclass.tableName + " r On r.EmpRequestRecordID = c.RequestOTClaimCancelID and r.EmpRequestType = '" + EEmpRequest.TYPE_EEOTCLAIM + "'";


        DataTable table = filter.loadData(dbConn, info, select, from);

        view = new DataView(table);

        ListFooter.Refresh();

        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }
        return(view);
    }
Exemplo n.º 13
0
    public DataView loadData(ListInfo info, DBManager db, DataList repeater)
    {
        //filter.add(new Match("EmpPayrollID",EmpPayrollID.Value));

        ImportEmpPersonalInfoProcess empImport = new ImportEmpPersonalInfoProcess(dbConn, Session.SessionID);
        DataTable table = empImport.GetImportDataFromTempDatabase(info);

        if (info != null)
        {
            if (!string.IsNullOrEmpty(info.orderby))
            {
                if (info.orderby.Equals("EmpEngFullName", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!table.Columns.Contains("EmpEngFullName"))
                    {
                        table.Columns.Add("EmpEngFullName", typeof(string));
                        foreach (System.Data.DataRow row in table.Rows)
                        {
                            EUploadEmpPersonalInfo empInfo = new EUploadEmpPersonalInfo();
                            empInfo.UploadEmpID = (int)row["UploadEmpID"];
                            if (EUploadEmpPersonalInfo.db.select(dbConn, empInfo))
                            {
                                row["EmpEngFullName"] = empInfo.EmpEngFullName;
                            }
                        }
                    }
                }
            }
        }
        table = WebUtils.DataTableSortingAndPaging(table, info);

        view = new DataView(table);
        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }
        if (table.Rows.Count > 0)
        {
            ImportSection.Visible = true;
        }
        else
        {
            ImportSection.Visible = false;
        }

        return(view);
    }
Exemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            return;
        }

        if (ESystemParameter.getParameter(dbConn, ESystemParameter.PARAM_CODE_PAYSCALE_POINT_SYSTEM) != "Y")
        {
            HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "~/AccessDeny.aspx");
            return;
        }

        toolBar.FunctionCode = FUNCTION_CODE;
        if (!WebUtils.CheckPermission(Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            IsAllowEdit = false;
        }
        AddPanel.Visible    = IsAllowEdit;
        ImportPanel.Visible = IsAllowEdit;



        //binding = new Binding(dbConn, db);
        //binding.add(new TextBoxBinder(db, StatutoryHolidayDate.TextBox, StatutoryHolidayDate.ID));
        //binding.add(StatutoryHolidayDesc);
        //binding.init(Request, Session);


        binding = new Binding(dbConn, db);
        binding.add(new TextBoxBinder(db, EffectiveDate.TextBox, EffectiveDate.ID));
        binding.add(new TextBoxBinder(db, ExpiryDate.TextBox, ExpiryDate.ID));
        //binding.add(new TextBoxBinder(db, EffectiveDate.TextBox, EffectiveDate.ID));
        //binding.add(new TextBoxBinder(db, ExpiryDate.TextBox, ExpiryDate.ID));
        binding.add(SchemeCode);
        binding.add(Point);
        binding.add(Salary);

        binding.init(Request, Session);

        sbinding = new SearchBinding(dbConn, db);
        sbinding.add(new DropDownVLSearchBinder(SchemeSelect, "SchemeCode", EPayScaleMap.VLDistinctSchemeList, true));
        sbinding.init(DecryptedRequest, null);

        info = ListFooter.ListInfo;

        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);
    }
Exemplo n.º 15
0
    public DataView loadData(ListInfo info, DBManager db, DataList repeater)
    {
        //DBFilter filter = sbinding.createFilter();

        DBFilter filter = new DBFilter();
        OR       m_OR   = new OR();

        DateTime m_asAtDate = new DateTime();

        if (DateTime.TryParse(AsAtDate.TextBox.Text, out m_asAtDate))
        {
            filter.add(new Match("EffectiveDate", "<=", m_asAtDate));
            m_OR.add(new Match("ExpiryDate", ">=", m_asAtDate));
            m_OR.add(new NullTerm("ExpiryDate"));
            filter.add(m_OR);
        }
        if (SchemeSelect.SelectedIndex > 0)
        {
            DBFieldTranscoder idTranscoder = EPayScale.db.getField("SchemeCode").transcoder;
            if (idTranscoder != null)
            {
                filter.add(new Match("SchemeCode", AppUtils.Encode(EPayScaleMap.db.getField("SchemeCode"), SchemeSelect.SelectedValue.ToString())));
            }
        }

        if (info != null && info.orderby != null && !info.orderby.Equals(""))
        {
            //filter.add(info.orderby, info.order);
        }
        else
        {
            info.orderby = "SchemeCode, Point";
            info.order   = false;
        }
        string select = "*";
        string from   = "from PayscaleMap ";

        DataTable table = WebUtils.GetDataTableFromSelectQueryWithFilter(dbConn, select, from, filter, info);

        view = new DataView(table);
        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }

        return(view);
    }
Exemplo n.º 16
0
 public void StartReceive(TwitterAccount account, ListInfo info)
 {
     lock (this._listReceiverLocker)
     {
         if (this._listReceiverReferenceCount.ContainsKey(info))
         {
             this._listReceiverReferenceCount[info]++;
         }
         else
         {
             var lr = new ListReceiver(account, info);
             this._listReceiverReferenceCount.Add(info, 1);
             this._listReceiverResolver.Add(info, lr);
         }
     }
 }
Exemplo n.º 17
0
 public void StartReceive(AuthenticateInfo auth, ListInfo info)
 {
     lock (_listReceiverLocker)
     {
         if (_listReceiverReferenceCount.ContainsKey(info))
         {
             _listReceiverReferenceCount[info]++;
         }
         else
         {
             var lr = new ListReceiver(auth, info);
             _listReceiverReferenceCount.Add(info, 1);
             _listReceiverResolver.Add(info, lr);
         }
     }
 }
Exemplo n.º 18
0
 private void AllocateLists()
 {
     while (count >= lists.Count * listincrease)
     {
         GenLists();
     }
     while (count >= listinfoCount)
     {
         Array.Resize(ref listinfo, listinfoCount + listincrease);
         for (int i = listinfoCount; i < listinfoCount + listincrease; i++)
         {
             listinfo[i] = new ListInfo();
         }
         listinfoCount += listincrease;
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            return;
        }


        empSBinding = new SearchBinding(dbConn, db);
        empSBinding.initValues("EmpStatus", null, EEmpPersonalInfo.VLEmpStatus, HROne.Common.WebUtility.GetSessionUICultureInfo(Session));
        empSBinding.init(DecryptedRequest, null);

        empInfo = ListFooter.ListInfo;

        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);
    }
Exemplo n.º 20
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.ReadWrite))
        {
            return;
        }

        sbinding = new SearchBinding(dbConn, EEmpPersonalInfo.db);
        //sbinding.add(new HiddenMatchBinder(EmpID));

        sbinding.init(DecryptedRequest, null);

        info = ListFooter.ListInfo;

        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);
    }
Exemplo n.º 21
0
    // End 0000185, KuangWei, 2015-05-05

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE, WebUtils.AccessLevel.Read))
        {
            return;
        }

        // Start 0000185, KuangWei, 2015-05-05
        binding = new SearchBinding(dbConn, db);
        binding.init(DecryptedRequest, null);

        info = ListFooter.ListInfo;
        // End 0000185, KuangWei, 2015-05-05

        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);
    }
Exemplo n.º 22
0
        public static async Task <IEnumerable <long> > GetListMembers(ListInfo listInfo)
        {
            var user = await Database.UserCrud.GetAsync(listInfo.OwnerScreenName).ConfigureAwait(false);

            if (user == null)
            {
                return(Enumerable.Empty <long>());
            }
            var list = await Database.ListCrud.GetAsync(user.Id, listInfo.Slug).ConfigureAwait(false);

            if (list == null)
            {
                return(Enumerable.Empty <long>());
            }
            return(await GetListMembers(list.Id).ConfigureAwait(false));
        }
Exemplo n.º 23
0
        public void StartReceive(string receiverScreenName, ListInfo info)
        {
            var account =
                Setting.Accounts.Collection.FirstOrDefault(
                    a => a.UnreliableScreenName?.Equals(receiverScreenName,
                                                        StringComparison.CurrentCultureIgnoreCase) ?? false);

            if (account != null)
            {
                StartReceive(account, info);
            }
            else
            {
                StartReceive(info);
            }
        }
Exemplo n.º 24
0
        private ListInfo AppendNode(ListInfo listInfo, ListNode node)
        {
            node.next = null;
            if (listInfo == null)
            {
                return(new ListInfo()
                {
                    Head = node, Tail = node
                });
            }

            listInfo.Tail.next = node;
            listInfo.Tail      = node;

            return(listInfo);
        }
Exemplo n.º 25
0
        public static object Parse(PageInfo pageInfo, ContextInfo contextInfo)
        {
            var listInfo = ListInfo.GetListInfoByXmlNode(pageInfo, contextInfo, EContextType.Site);
            var siteName = listInfo.Others.Get(SiteName.Name);
            var siteDir  = listInfo.Others.Get(SiteDir.Name);
            var since    = listInfo.Others.Get(Since.Name);

            var dataSource = StlDataUtility.GetSitesDataSource(siteName, siteDir, listInfo.StartNum, listInfo.TotalNum, listInfo.Where, listInfo.Scope, listInfo.OrderByString, since);

            if (contextInfo.IsStlEntity)
            {
                return(ParseEntity(dataSource));
            }

            return(ParseElement(pageInfo, contextInfo, listInfo, dataSource));
        }
Exemplo n.º 26
0
    public MeshBatcher()
    {
        int modelsMax = 1024 * 16;

        models = new ListInfo[modelsMax];
        for (int i = 0; i < modelsMax; i++)
        {
            models[i] = new ListInfo();
        }
        modelsCount      = 0;
        BindTexture      = true;
        glTextures       = new int[10];
        glTexturesLength = 10;
        empty            = new int[modelsMax];
        emptyCount       = 0;
    }
Exemplo n.º 27
0
 private void SortListsByTexture()
 {
     if (tocallSolid == null)
     {
         tocallSolid       = new ToCall[texturesCount];
         tocallTransparent = new ToCall[texturesCount];
         for (int i = 0; i < texturesCount; i++)
         {
             tocallSolid[i]       = new ToCall();
             tocallTransparent[i] = new ToCall();
         }
         for (int i = 0; i < texturesCount; i++)
         {
             tocallSolid[i].Lists       = new int[MAX_DISPLAY_LISTS];
             tocallTransparent[i].Lists = new int[MAX_DISPLAY_LISTS];
         }
     }
     for (int i = 0; i < texturesCount; i++)
     {
         tocallSolid[i].Count       = 0;
         tocallTransparent[i].Count = 0;
     }
     for (int i = 0; i < count; i++)
     {
         ListInfo li = listinfo[i];
         if (!li.render)
         {
             continue;
         }
         if (li.empty)
         {
             continue;
         }
         if (!li.transparent)
         {
             ToCall tocall = tocallSolid[li.texture];
             tocall.Lists[tocall.Count] = GetList(i);
             tocall.Count++;
         }
         else
         {
             ToCall tocall = tocallTransparent[li.texture];
             tocall.Lists[tocall.Count] = GetList(i);
             tocall.Count++;
         }
     }
 }
Exemplo n.º 28
0
        public override DataTable GetImportDataFromTempDatabase(ListInfo info)
        {
            DBFilter sessionFilter = new DBFilter();

            sessionFilter.add(new Match("SessionID", m_SessionID));
            sessionFilter.add("EmpID", true);
            //if (info != null && info.orderby != null && !info.orderby.Equals(""))
            //    sessionFilter.add(info.orderby, info.order);
            ArrayList uploadRosterTableList = EUploadRosterTable.db.select(dbConn, sessionFilter);

            DataTable resultTable = new DataTable();

            resultTable.Columns.Add("EmpNo", typeof(string));
            resultTable.Columns.Add("EmpName", typeof(string));
            for (int day = 1; day <= 31; day++)
            {
                resultTable.Columns.Add("Roster" + day.ToString("00"), typeof(string));
            }

            int     lastEmpID      = 0;
            DataRow rosterTableRow = null;

            foreach (EUploadRosterTable uploadRosterTable in uploadRosterTableList)
            {
                if (!lastEmpID.Equals(uploadRosterTable.EmpID))
                {
                    lastEmpID      = uploadRosterTable.EmpID;
                    rosterTableRow = resultTable.NewRow();
                    resultTable.Rows.Add(rosterTableRow);

                    EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                    empInfo.EmpID = uploadRosterTable.EmpID;
                    if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                    {
                        rosterTableRow["EmpNo"]   = empInfo.EmpNo;
                        rosterTableRow["EmpName"] = empInfo.EmpEngFullName;
                    }
                }
                ERosterCode rosterCode = new ERosterCode();
                rosterCode.RosterCodeID = uploadRosterTable.RosterCodeID;
                if (ERosterCode.db.select(dbConn, rosterCode))
                {
                    rosterTableRow["Roster" + uploadRosterTable.RosterTableDate.ToString("dd")] = rosterCode.RosterCode;
                }
            }
            return(resultTable);
        }
Exemplo n.º 29
0
        public override bool TryParse(BlockProcessor state, char pendingBulletType, out ListInfo result)
        {
            result = new ListInfo();

            var c = state.CurrentChar;

            var isRomanLow = CharHelper.IsRomanLetterLowerPartial(c);
            var isRomanUp  = !isRomanLow && CharHelper.IsRomanLetterUpperPartial(c);

            // We allow to parse roman only if we start on a new list or the pending list is already a roman list)
            if ((isRomanLow || isRomanUp) && (pendingBulletType == '\0' || pendingBulletType == 'i' || pendingBulletType == 'I'))
            {
                int startChar = state.Start;
                int endChar   = 0;
                // With a roman, we can have multiple characters
                // Note that we don't validate roman numbers
                while (isRomanLow ? CharHelper.IsRomanLetterLowerPartial(c) : CharHelper.IsRomanLetterUpperPartial(c))
                {
                    endChar = state.Start;
                    c       = state.NextChar();
                }

                result.OrderedStart        = CharHelper.RomanToArabic(state.Line.Text.Substring(startChar, endChar - startChar + 1)).ToString();
                result.BulletType          = isRomanLow ? 'i' : 'I';
                result.DefaultOrderedStart = isRomanLow ? "i" : "I";
            }
            else
            {
                // otherwise we expect a regular alpha lettered list with a single character.
                var isUpper = c.IsAlphaUpper();
                result.OrderedStart        = (Char.ToUpper(c) - 64).ToString();
                result.BulletType          = isUpper ? 'A' : 'a';
                result.DefaultOrderedStart = isUpper ? "A" : "a";
                state.NextChar();
            }

            // Finally we expect to always have a delimiter '.' or ')'
            char orderedDelimiter;

            if (!TryParseDelimiter(state, out orderedDelimiter))
            {
                return(false);
            }

            result.OrderedDelimiter = orderedDelimiter;
            return(true);
        }
    public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        DBFilter filter = sbinding.createFilter();

        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);

        string select = "e.*, ep.*";
        string from   = "from [" + db.dbclass.tableName + "] ep, EmpPersonalInfo e ";

        filter.add(new MatchField("e.EmpID", "ep.EmpID"));
        filter.add(new Match("ep.EmpPayStatus", "T"));
        filter.add(new Match("ep.PayPeriodID", CurPayPeriodID));

        // Start 0000185, KuangWei, 2015-04-21
        //filter.add(WebUtils.AddRankFilter(Session, "e.EmpID", true));
        DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime());

        empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID"));
        filter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter));

        DataTable table = WebUtils.GetDataTableFromSelectQueryWithFilter(dbConn, select, from, filter, info);

        table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info);
        // End 0000185, KuangWei, 2015-04-21

        if (table.Rows.Count > 0)
        {
            btnUndo.Visible = IsAllowEdit;
        }
        else
        {
            btnUndo.Visible = false;
        }



        view = new DataView(table);

        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }

        return(view);
    }
    public DataView loadData(ListInfo info, DBManager db, Repeater repeater)
    {
        string m_year  = this.Year.Text;           // ((TextBox)EmployeeSearchControl1.AdditionElementControl.FindControl("Year")).Text;
        string m_month = this.Month.SelectedValue; //((DropDownList)EmployeeSearchControl1.AdditionElementControl.FindControl("Month")).SelectedValue;

        if (!string.IsNullOrEmpty(m_year) && !string.IsNullOrEmpty(m_month))
        {
            DBFilter filter = new DBFilter();
            filter.add(getEffRangeDBTerm(m_year, m_month, null));

            DBFilter empfilter = sbinding.createFilter();
            empfilter.add(new IN("e.EmpID", "Select distinct EmpID from " + EEmpCostCenter.db.dbclass.tableName, filter));

            // Start 0000110, Ricky So, 2014/12/16
            DBFilter m_securityFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime());
            m_securityFilter.add(new MatchField("e.EmpID", "ee.EmpID"));
            empfilter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", m_securityFilter));

            //// Start 0000129, Ricky So, 2014/11/11
            //empfilter.add(WebUtils.AddRankFilter(Session, "e.EmpID", true));
            //// End 0000129, Ricky So, 2014/11/11
            // End 0000110, Ricky So, 2014/12/16

            string select = " e.* ";
            string from   = " from " + db.dbclass.tableName + " e ";

            DataTable table = WebUtils.GetDataTableFromSelectQueryWithFilter(dbConn, select, from, empfilter, info);
            table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info);

            if (table.Rows.Count > 0)
            {
                panelPayPeriod.Visible = true;
            }

            view = new DataView(table);

            ListFooter.Refresh();

            if (repeater != null)
            {
                repeater.DataSource = view;
                repeater.DataBind();
            }
        }

        return(view);
    }
Exemplo n.º 32
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session))
        {
            return;
        }
        //toolBar.FunctionCode = FUNCTION_CODE;
        SelectAllPanel.Visible = toolBar.DeleteButton_Visible;

        info = ListFooter.ListInfo;

        HROne.Common.WebUtility.WebControlsLocalization(this, this.Controls);


        binding = new SearchBinding(dbConn, db);
        binding.init(DecryptedRequest, null);
    }
Exemplo n.º 33
0
 public void StartReceive(TwitterAccount account, ListInfo info)
 {
     lock (this._listReceiverLocker)
     {
         if (this._listReceiverReferenceCount.ContainsKey(info))
         {
             this._listReceiverReferenceCount[info]++;
         }
         else
         {
             var lmr = new ListMemberReceiver(account, info);
             lmr.ListMemberChanged += () => ListMemberChanged.SafeInvoke(info);
             this._listReceiverReferenceCount.Add(info, 1);
             this._receiverDictionary.Add(info, lmr);
         }
     }
 }
Exemplo n.º 34
0
        public void StopReceive(ListInfo info)
        {
            lock (this._listReceiverLocker)
            {
                if (!this._listReceiverReferenceCount.ContainsKey(info))
                {
                    return;
                }

                if (--this._listReceiverReferenceCount[info] != 0) return;
                // dispose connection
                this._listReceiverReferenceCount.Remove(info);
                var lr = this._listReceiverResolver[info];
                this._listReceiverResolver.Remove(info);
                lr.Dispose();
            }
        }
Exemplo n.º 35
0
        public StlPageSqlContents(string stlPageSqlContentsElement, PageInfo pageInfo, ContextInfo contextInfo, bool isXmlContent)
        {
            _pageInfo = pageInfo;
            try
            {
                var stlElementInfo = StlParserUtility.ParseStlElement(stlPageSqlContentsElement);

                _contextInfo = contextInfo.Clone(stlPageSqlContentsElement, stlElementInfo.InnerHtml, stlElementInfo.Attributes);

                _listInfo = ListInfo.GetListInfoByXmlNode(_pageInfo, _contextInfo, EContextType.SqlContent);
                _dataSet  = StlDataUtility.GetPageSqlContentsDataSet(_listInfo.ConnectionString, _listInfo.QueryString, _listInfo.StartNum, _listInfo.TotalNum, _listInfo.OrderByString);
            }
            catch
            {
                _listInfo = new ListInfo();
            }
        }
    //public DataView loadData2(ListInfo info, DBManager db, Repeater repeater)
    //{
    //    DBFilter filter = new DBFilter();
    //    filter.add(WebUtils.AddRankFilter(Session, "e.EmpID", true));

    //    int m_batchID = -1;

    //    if (!int.TryParse(BatchID.SelectedValue, out m_batchID))
    //    {
    //        m_batchID = -1;
    //    }

    //    DBFilter m_batchFilter = new DBFilter();
    //    m_batchFilter.add(new Match("HitRateProcessImportBatchID", m_batchID));

    //    filter.add(new IN("EmpID", "SELECT EmpID FROM HitRateProcess ", m_batchFilter));

    //    string select = "e.* ";
    //    string from = "from [" + db.dbclass.tableName + "] e ";

    //    DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime());
    //    empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID"));
    //    filter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter));

    //    DataTable table = filter.loadData(dbConn, null, select, from);
    //    table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info);
    //    view = new DataView(table);

    //    ListFooter.Refresh();
    //    if (repeater != null)
    //    {
    //        repeater.DataSource = view;
    //        repeater.DataBind();
    //    }
    //    return view;
    //}

    public DataView loadData(ListInfo info, DBManager db, DataList repeater)
    {
        DBFilter filter = new DBFilter();  // sbinding.createFilter();

        int m_batchID = -1;

        int.TryParse(BatchID.SelectedValue, out m_batchID);

        filter.add(new Match("c.HitRateProcessImportBatchID", m_batchID));
        filter.add(new MatchField("c.EmpID", "e.EmpID"));

        DataTable table = filter.loadData(dbConn, null, "e.*, c.* ", " from " + EHitRateProcess.db.dbclass.tableName + " c, " + EEmpPersonalInfo.db.dbclass.tableName + " e ");

        if (info != null)
        {
            if (!string.IsNullOrEmpty(info.orderby))
            {
                if (info.orderby.Equals("EmpEngFullName", StringComparison.CurrentCultureIgnoreCase))
                {
                    if (!table.Columns.Contains("EmpEngFullName"))
                    {
                        table.Columns.Add("EmpEngFullName", typeof(string));
                        foreach (System.Data.DataRow row in table.Rows)
                        {
                            EEmpPersonalInfo empInfo = new EEmpPersonalInfo();
                            empInfo.EmpID = (int)row["EmpID"];
                            if (EEmpPersonalInfo.db.select(dbConn, empInfo))
                            {
                                row["EmpEngFullName"] = empInfo.EmpEngFullName;
                            }
                        }
                    }
                }
            }
        }
        table = WebUtils.DataTableSortingAndPaging(table, info);

        view = new DataView(table);
        if (repeater != null)
        {
            repeater.DataSource = view;
            repeater.DataBind();
        }

        return(view);
    }
Exemplo n.º 37
0
        public void StopReceive(ListInfo info)
        {
            lock (this._listReceiverLocker)
            {
                if (!this._listReceiverReferenceCount.ContainsKey(info))
                {
                    return;
                }

                if (--this._listReceiverReferenceCount[info] != 0) return;
                // dispose receivers
                this._listReceiverReferenceCount.Remove(info);
                var d = _receiverDictionary[info];
                _receiverDictionary.Remove(info);
                d.Dispose();
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        binding = new SearchBinding(dbConn, db);
        binding.initValues("EmpRequestStatus", null, EEmpRequest.VLRequestStatus, null);

        binding.init(Request.QueryString, null);

        info = ListFooter.ListInfo;

        EESSUser user = WebUtils.GetCurUser(Session);

        if (user != null)
        {
            CurID       = user.EmpID;
            EmpID.Value = CurID.ToString();
        }
    }
Exemplo n.º 39
0
        /// <summary>
        /// Fills the font, color and (later!) list hashtables so they can be rendered and used by other renderers.
        /// </summary>
        private void CollectTables(DocumentObject dom)
        {
            ValueDescriptorCollection vds = Meta.GetMeta(dom).ValueDescriptors;
            int count = vds.Count;

            for (int idx = 0; idx < count; idx++)
            {
                ValueDescriptor vd = vds[idx];
                if (!vd.IsRefOnly && !vd.IsNull(dom))
                {
                    if (vd.ValueType == typeof(Color))
                    {
                    }
                    else if (vd.ValueType == typeof(Font))
                    {
                    }
                    else if (vd.ValueType == typeof(ListInfo))
                    {
                        ListInfo lst = vd.GetValue(dom, GV.ReadWrite) as ListInfo; //ReadOnly
                        if (!this.listList.Contains(lst))
                        {
                            this.listList.Add(lst);
                        }
                    }
                    if (typeof(DocumentObject).IsAssignableFrom(vd.ValueType))
                    {
                        CollectTables(vd.GetValue(dom, GV.ReadWrite) as DocumentObject); //ReadOnly
                        if (typeof(DocumentObjectCollection).IsAssignableFrom(vd.ValueType))
                        {
                            DocumentObjectCollection coll = vd.GetValue(dom, GV.ReadWrite) as DocumentObjectCollection; //ReadOnly
                            if (coll != null)
                            {
                                foreach (DocumentObject obj in coll)
                                {
                                    //In SeriesCollection kann null vorkommen.
                                    if (obj != null)
                                    {
                                        CollectTables(obj);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 40
0
        public static string Parse(string stlElement, XmlNode node, PageInfo pageInfo, ContextInfo contextInfo)
        {
            string parsedContent;

            try
            {
                var listInfo = ListInfo.GetListInfoByXmlNode(node, pageInfo, contextInfo, EContextType.Comment);

                parsedContent = listInfo.IsDynamic ? StlDynamic.ParseDynamicElement(stlElement, pageInfo, contextInfo) : ParseImpl(pageInfo, contextInfo, listInfo);
            }
            catch (Exception ex)
            {
                parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex);
            }

            return(parsedContent);
        }
Exemplo n.º 41
0
        //API StlActionsSearchController调用
        public StlPageContents(string stlPageContentsElement, PageInfo pageInfo, ContextInfo contextInfo, int pageNum, string tableName, string whereString)
        {
            _pageInfo    = pageInfo;
            _contextInfo = contextInfo;
            var xmlDocument = StlParserUtility.GetXmlDocument(stlPageContentsElement, false);

            _node = xmlDocument.DocumentElement;
            if (_node != null)
            {
                _node = _node.FirstChild;

                var attributes = new Dictionary <string, string>();
                var ie         = _node?.Attributes?.GetEnumerator();
                if (ie != null)
                {
                    while (ie.MoveNext())
                    {
                        var attr = (XmlAttribute)ie.Current;

                        var key = attr.Name;
                        if (!string.IsNullOrEmpty(key))
                        {
                            var value = attr.Value;
                            if (string.IsNullOrEmpty(value))
                            {
                                value = string.Empty;
                            }
                            attributes[key] = value;
                        }
                    }
                }

                _contextInfo = contextInfo.Clone(stlPageContentsElement, attributes, _node?.InnerXml, _node?.ChildNodes);

                ListInfo = ListInfo.GetListInfoByXmlNode(_pageInfo, _contextInfo, EContextType.Content);
            }
            ListInfo.Scope = EScopeType.All;

            ListInfo.Where += whereString;
            if (pageNum > 0)
            {
                ListInfo.PageNum = pageNum;
            }

            SqlString = StlDataUtility.GetPageContentsSqlStringBySearch(tableName, ListInfo.GroupContent, ListInfo.GroupContentNot, ListInfo.Tags, ListInfo.IsImageExists, ListInfo.IsImage, ListInfo.IsVideoExists, ListInfo.IsVideo, ListInfo.IsFileExists, ListInfo.IsFile, ListInfo.IsNoDup, ListInfo.StartNum, ListInfo.TotalNum, ListInfo.OrderByString, ListInfo.IsTopExists, ListInfo.IsTop, ListInfo.IsRecommendExists, ListInfo.IsRecommend, ListInfo.IsHotExists, ListInfo.IsHot, ListInfo.IsColorExists, ListInfo.IsColor, ListInfo.Where, ListInfo.Scope, ListInfo.GroupChannel, ListInfo.GroupChannelNot);
        }
Exemplo n.º 42
0
    //public void loadState()
    //{
    //    NotConfirmEmpInfo = NotConfirm_ListFooter.ListInfo;  //new ListInfo();
    //    //int page = 0;
    //    //if (!NotConfirm_CurPage.Value.Equals(""))
    //    //    page = Int32.Parse(NotConfirm_CurPage.Value);
    //    //NotConfirmEmpInfo.loadState(Request, page);

    //    NotTrialRunEmpInfo = NotTrialRun_ListFooter.ListInfo;  //new ListInfo();
    //    //page = 0;
    //    //if (!NotTrialRun_CurPage.Value.Equals(""))
    //    //    page = Int32.Parse(NotTrialRun_CurPage.Value);
    //    //NotTrialRunEmpInfo.loadState(Request, page);
    //}

    public DataView loadNotConfirmData(ListInfo info, DBManager db, Repeater repeater)
    {
        DBFilter filter = sNotConfirmEmpBinding.createFilter();

        //if (info != null && info.orderby != null && !info.orderby.Equals(""))
        //    filter.add(info.orderby, info.order);

        string select = "e.*, ep.EmpPayrollID";
        string from   = "from [" + db.dbclass.tableName + "] ep, EmpPersonalInfo e ";

        filter.add(new MatchField("e.EmpID", "ep.EmpID"));
        filter.add(new Match("ep.EmpPayStatus", "T"));
        filter.add(new Match("ep.PayPeriodID", CurPayPeriodID));

        // Start 0000185, KuangWei, 2015-04-21
        DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime());

        empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID"));
        filter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter));

        DataTable table = WebUtils.GetDataTableFromSelectQueryWithFilter(dbConn, select, from, filter, info);

        table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info);
        // End 0000185, KuangWei, 2015-04-21

        if (table.Rows.Count > 0)
        {
            panelNotConfirmEmployeeList.Visible = true;
            panelProcessEndOption.Visible       = false;
        }
        else
        {
            panelNotConfirmEmployeeList.Visible = false;
        }

        NotConfirmEmpView = new DataView(table);

        NotConfirm_ListFooter.Refresh();
        if (repeater != null)
        {
            repeater.DataSource = NotConfirmEmpView;
            repeater.DataBind();
        }

        return(NotConfirmEmpView);
    }
Exemplo n.º 43
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!WebUtils.CheckAccess(Response, Session, FUNCTION_CODE))
        {
            return;
        }

        info = ListFooter.ListInfo;



        binding = new SearchBinding(dbConn, db);
        binding.add(new LikeSearchBinder(CompanyDBClientCode, "CompanyDBClientCode"));
        binding.initValues("DBServerID", null, EDatabaseServer.VLDBServerList, null);
        binding.initValues("CompanyDBIsActive", null, HROne.Lib.Entities.Values.VLYesNo, null);
        binding.init(Request.QueryString, null);
    }
Exemplo n.º 44
0
 public FilterList(string ownerAndslug)
 {
     var splited = ownerAndslug.Split('/');
     if (splited.Length < 2 || splited.Length > 3)
     {
         throw new ArgumentException("owner and slug must be separated as slash, once.");
     }
     if (splited.Length == 2)
     {
         _listInfo = new ListInfo { OwnerScreenName = splited[0], Slug = splited[1] };
         _receiver = splited[0];
     }
     else
     {
         _listInfo = new ListInfo { OwnerScreenName = splited[1], Slug = splited[2] };
         _receiver = splited[0];
     }
 }
Exemplo n.º 45
0
 public FilterList(string ownerAndslug)
 {
     var splited = ownerAndslug.Split('/');
     if (splited.Length < 2 || splited.Length > 3)
     {
         throw new ArgumentException("owner and slug must be separated as slash, once.");
     }
     if (splited.Length == 2)
     {
         _listInfo = new ListInfo(splited[0], splited[1]);
         this._receiverScreenName = splited[0];
     }
     else
     {
         _listInfo = new ListInfo(splited[1], splited[2]);
         this._receiverScreenName = splited[0];
     }
     _watcher = new ListWatcher(_listInfo);
     _watcher.OnListMemberUpdated += this.RaiseInvalidateRequired;
 }
Exemplo n.º 46
0
 public void StartReceive(ListInfo info)
 {
     var ai = AccountsStore.Accounts.FirstOrDefault(aset => aset.AuthenticateInfo.UnreliableScreenName == info.OwnerScreenName);
     if (ai != null)
     {
         StartReceive(ai.AuthenticateInfo, info);
     }
     else
     {
         MainWindowModel.ShowTaskDialog(new TaskDialogOptions
         {
             MainIcon = VistaTaskDialogIcon.Error,
             MainInstruction = "リスト受信を開始できません。",
             Content = "リスト " + info + " を受信するアカウントを特定できませんでした。",
             ExpandedInfo = "自分以外が作成したリストを受信する際は、そのリストをどのアカウントで受信するかを明示的に記述しなければなりません。" + Environment.NewLine +
                            "例: receiver/user/listname",
             ExpandedByDefault = true,
             Title = "リスト受信エラー",
             CommonButtons = TaskDialogCommonButtons.Close,
         });
     }
 }
Exemplo n.º 47
0
 public void StartReceive(ListInfo info)
 {
     var account =
         Setting.Accounts.Collection.FirstOrDefault(
             a => a.UnreliableScreenName.Equals(info.OwnerScreenName, StringComparison.CurrentCultureIgnoreCase));
     if (account != null)
     {
         this.StartReceive(account, info);
     }
     else
     {
         MainWindowModel.ShowTaskDialog(new TaskDialogOptions
         {
             Title = ReceivingResources.MsgListReceiveErrorTitle,
             MainIcon = VistaTaskDialogIcon.Error,
             MainInstruction = ReceivingResources.MsgListReceiveErrorInst,
             Content = ReceivingResources.MsgListReceiveErrorContentFormat.SafeFormat(info),
             ExpandedInfo = ReceivingResources.MsgListReceiveErrorExInfo,
             ExpandedByDefault = true,
             CommonButtons = TaskDialogCommonButtons.Close,
         });
     }
 }
Exemplo n.º 48
0
 public void StartReceive(ListInfo info)
 {
     var account =
                     Setting.Accounts.Collection.FirstOrDefault(
                         a => a.UnreliableScreenName.Equals(info.OwnerScreenName, StringComparison.CurrentCultureIgnoreCase));
     if (account != null)
     {
         this.StartReceive(account, info);
     }
     else
     {
         MainWindowModel.ShowTaskDialog(new TaskDialogOptions
         {
             Title = "リスト受信エラー",
             MainIcon = VistaTaskDialogIcon.Error,
             MainInstruction = "リスト受信を開始できません。",
             Content = "リスト " + info + " を受信するアカウントを特定できませんでした。",
             ExpandedInfo = "自分以外が作成したリストを受信する際は、そのリストをどのアカウントで受信するかを明示的に記述しなければなりません。" + Environment.NewLine +
                            "例: receiver/user/listname",
             ExpandedByDefault = true,
             CommonButtons = TaskDialogCommonButtons.Close,
         });
     }
 }
Exemplo n.º 49
0
 private ListInfo GetList(XmlElement listElement)
 {
     var list = new ListInfo();
     list.Values.AddRange(from XmlElement valueElement
                             in listElement.SelectNodes(ValueInfoElement)
                          select GetValue(valueElement));
     return list;
 }
Exemplo n.º 50
0
 public void StartReceive(TwitterAccount account, ListInfo info)
 {
     lock (this._listReceiverLocker)
     {
         if (this._listReceiverReferenceCount.ContainsKey(info))
         {
             this._listReceiverReferenceCount[info]++;
         }
         else
         {
             var lmr = new ListMemberReceiver(account, info);
             lmr.ListMemberChanged += () => ListMemberChanged.SafeInvoke(info);
             this._listReceiverReferenceCount.Add(info, 1);
             this._receiverDictionary.Add(info, lmr);
         }
     }
 }
Exemplo n.º 51
0
        private static void CreateField(XElement fieldElement, ListInfo listInfo, TokenParser parser)
        {
            fieldElement = PrepareField(fieldElement);

            var fieldXml = parser.ParseString(fieldElement.ToString(), "~sitecollection", "~site");
            listInfo.SiteList.Fields.AddFieldAsXml(fieldXml, false, AddFieldOptions.AddFieldInternalNameHint);
            listInfo.SiteList.Context.ExecuteQueryRetry();
        }
Exemplo n.º 52
0
        private static Field CreateFieldRef(ListInfo listInfo, Field field, FieldRef fieldRef)
        {
            field.EnsureProperty(f => f.SchemaXmlWithResourceTokens);
            XElement element = XElement.Parse(field.SchemaXmlWithResourceTokens);

            element.SetAttributeValue("AllowDeletion", "TRUE");

            field.SchemaXml = element.ToString();

            var createdField = listInfo.SiteList.Fields.Add(field);

            createdField.Context.Load(createdField, cf => cf.Id, cf => cf.Title, cf => cf.Hidden, cf => cf.Required);
            createdField.Context.ExecuteQueryRetry();

            var isDirty = false;
            if (!string.IsNullOrEmpty(fieldRef.DisplayName) && createdField.Title != fieldRef.DisplayName)
            {
                createdField.Title = fieldRef.DisplayName;
                isDirty = true;
            }
            if (createdField.Hidden != fieldRef.Hidden)
            {
                createdField.Hidden = fieldRef.Hidden;
                isDirty = true;
            }
            if (createdField.Required != fieldRef.Required)
            {
                createdField.Required = fieldRef.Required;
                isDirty = true;
            }
            if (isDirty)
            {
                createdField.Update();
                createdField.Context.ExecuteQueryRetry();
            }

            return createdField;
        }
		public async void ConfigureWith(ListInfo listInfo)
		{
			await listInfo.FetchInfoAsync ();

			if (document != null) {
				document.DocumentDeleted -= OnListDocumentWasDeleted;
				document.Close (null);
			}

			document = new ListDocument(listInfo.Url);
			document.DocumentDeleted += OnListDocumentWasDeleted;

			NavigationItem.Title = listInfo.Name;

			TextAttributes = new UIStringAttributes {
				Font = UIFont.PreferredHeadline,
				ForegroundColor = AppColors.ColorFrom(listInfo.Color.Value)
			};
		}
Exemplo n.º 54
0
        private static Field CreateField(XElement fieldElement, ListInfo listInfo, TokenParser parser, string originalFieldXml, ClientRuntimeContext context, PnPMonitoredScope scope)
        {
            Field field = null;
            fieldElement = PrepareField(fieldElement);

            var fieldXml = parser.ParseString(fieldElement.ToString(), "~sitecollection", "~site");
            if (IsFieldXmlValid(parser.ParseString(originalFieldXml), parser, context))
            {
                field = listInfo.SiteList.Fields.AddFieldAsXml(fieldXml, false, AddFieldOptions.AddFieldInternalNameHint);
                listInfo.SiteList.Context.Load(field);
                listInfo.SiteList.Context.ExecuteQueryRetry();

                bool isDirty = false;
            #if !SP2013
                if (originalFieldXml.ContainsResourceToken())
                {
                    var originalFieldElement = XElement.Parse(originalFieldXml);
                    var nameAttributeValue = originalFieldElement.Attribute("DisplayName") != null ? originalFieldElement.Attribute("DisplayName").Value : "";
                    if (nameAttributeValue.ContainsResourceToken())
                    {
                        if (field.TitleResource.SetUserResourceValue(nameAttributeValue, parser))
                        {
                            isDirty = true;
                        }
                    }
                    var descriptionAttributeValue = originalFieldElement.Attribute("Description") != null ? originalFieldElement.Attribute("Description").Value : "";
                    if (descriptionAttributeValue.ContainsResourceToken())
                    {
                        if (field.DescriptionResource.SetUserResourceValue(descriptionAttributeValue, parser))
                        {
                            isDirty = true;
                        }
                    }
                }
            #endif
                if (isDirty)
                {
                    field.Update();
                    listInfo.SiteList.Context.ExecuteQueryRetry();
                }
            }
            else
            {
                // The field Xml was found invalid
                var tokenString = parser.GetLeftOverTokens(originalFieldXml).Aggregate(String.Empty, (acc, i) => acc + " " + i);
                scope.LogError("The field was found invalid: {0}", tokenString);
                throw new Exception(string.Format("The field was found invalid: {0}", tokenString));
            }
            return field;
        }
Exemplo n.º 55
0
        private Field UpdateField(ClientObject web, ListInfo listInfo, Guid fieldId, XElement templateFieldElement, Field existingField, PnPMonitoredScope scope, TokenParser parser, string originalFieldXml)
        {
            Field field = null;
            web.Context.Load(existingField, f => f.SchemaXmlWithResourceTokens);
            web.Context.ExecuteQueryRetry();

            var existingFieldElement = XElement.Parse(existingField.SchemaXmlWithResourceTokens);

            var equalityComparer = new XNodeEqualityComparer();

            // Is field different in template?
            if (equalityComparer.GetHashCode(existingFieldElement) != equalityComparer.GetHashCode(templateFieldElement))
            {
                // Is existing field of the same type?
                if (existingFieldElement.Attribute("Type").Value == templateFieldElement.Attribute("Type").Value)
                {
                    templateFieldElement = PrepareField(templateFieldElement);
                    if (IsFieldXmlValid(parser.ParseString(templateFieldElement.ToString()), parser, web.Context))
                    {
                        foreach (var attribute in templateFieldElement.Attributes())
                        {
                            if (existingFieldElement.Attribute(attribute.Name) != null)
                            {
                                existingFieldElement.Attribute(attribute.Name).Value = attribute.Value;
                            }
                            else
                            {
                                existingFieldElement.Add(attribute);
                            }
                        }
                        foreach (var element in templateFieldElement.Elements())
                        {
                            if (existingFieldElement.Element(element.Name) != null)
                            {
                                existingFieldElement.Element(element.Name).Remove();
                            }
                            existingFieldElement.Add(element);
                        }

                        if (existingFieldElement.Attribute("Version") != null)
                        {
                            existingFieldElement.Attributes("Version").Remove();
                        }
                        existingField.SchemaXml = parser.ParseString(existingFieldElement.ToString(), "~sitecollection", "~site");
                        existingField.UpdateAndPushChanges(true);
                        web.Context.ExecuteQueryRetry();
                        bool isDirty = false;
            #if !SP2013
                        if (originalFieldXml.ContainsResourceToken())
                        {
                            var originalFieldElement = XElement.Parse(originalFieldXml);
                            var nameAttributeValue = originalFieldElement.Attribute("DisplayName") != null ? originalFieldElement.Attribute("DisplayName").Value : "";
                            if (nameAttributeValue.ContainsResourceToken())
                            {
                                if (existingField.TitleResource.SetUserResourceValue(nameAttributeValue, parser))
                                {
                                    isDirty = true;
                                }
                            }
                            var descriptionAttributeValue = originalFieldElement.Attribute("Description") != null ? originalFieldElement.Attribute("Description").Value : "";
                            if (descriptionAttributeValue.ContainsResourceToken())
                            {
                                if (existingField.DescriptionResource.SetUserResourceValue(descriptionAttributeValue, parser))
                                {
                                    isDirty = true;
                                }
                            }
                        }
            #endif
                        if (isDirty)
                        {
                            existingField.Update();
                            web.Context.ExecuteQueryRetry();
                            field = existingField;
                        }
                    }
                    else
                    {
                        // The field Xml was found invalid
                        var tokenString = parser.GetLeftOverTokens(originalFieldXml).Aggregate(String.Empty, (acc, i) => acc + " " + i);
                        scope.LogError("The field was found invalid: {0}", tokenString);
                        throw new Exception(string.Format("The field was found invalid: {0}", tokenString));
                    }
                }
                else
                {
                    var fieldName = existingFieldElement.Attribute("Name") != null ? existingFieldElement.Attribute("Name").Value : existingFieldElement.Attribute("StaticName").Value;
                    scope.LogWarning(CoreResources.Provisioning_ObjectHandlers_ListInstances_Field__0____1___exists_in_list__2____3___but_is_of_different_type__Skipping_field_, fieldName, fieldId, listInfo.TemplateList.Title, listInfo.SiteList.Id);
                    WriteWarning(string.Format(CoreResources.Provisioning_ObjectHandlers_ListInstances_Field__0____1___exists_in_list__2____3___but_is_of_different_type__Skipping_field_, fieldName, fieldId, listInfo.TemplateList.Title, listInfo.SiteList.Id), ProvisioningMessageType.Warning);
                }
            }
            return field;
        }
Exemplo n.º 56
0
 public ListMemberReceiver(TwitterAccount auth, ListInfo listInfo)
 {
     _auth = auth;
     _listInfo = listInfo;
 }
Exemplo n.º 57
0
        private static object GetInstance(ListInfo listInfo)
        {
            // Convert a ListInfo to an actual List instance
            object instance = null;

            if (listInfo.Values.Count < 1)
                return instance;

            Type typedListType = typeof(List<>).MakeGenericType(listInfo.Values[0].Type);
            instance = Activator.CreateInstance(typedListType);

            var addMethod = typedListType.GetMethod("Add");
            foreach (ValueInfo item in listInfo.Values)
            {
                var newEntry = GetInstance(null, null, item);
                addMethod.Invoke(instance, new object[] { newEntry });
            }
            
            return instance;
        }
Exemplo n.º 58
0
 public Setter(string propertyName, ListInfo listInfo)
 {
     PropertyName = propertyName;
     ListInfo = listInfo;
 }
Exemplo n.º 59
0
 private Task<TwitterList> ReceiveListDescription(TwitterAccount account, ListInfo info)
 {
     return account.ShowListAsync(info.OwnerScreenName, info.Slug);
 }
		public void SaveAction(NSObject sender)
		{
			ListInfo listInfo = new ListInfo(FileUrl);
			listInfo.Color = selectedColor;
			listInfo.Name = selectedTitle;

			listInfo.CreateAndSaveWithCompletionHandler (success => {
				if (success) {
					MasterController.OnNewListInfo(listInfo);
				} else {
					// In your app, you should handle this error gracefully.
					Console.WriteLine ("Unable to create new document at URL: {0}", FileUrl.AbsoluteString);
					throw new InvalidProgramException();
				}
				DismissViewController(true, null);
			});
		}