Example #1
0
        private void btnSure_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(cmbOrgList.Text))
            {
                OrgInfos sub = AppConfigInfos.LimitsUserInfos.OrgList.orgList.Find(oi => oi.OrgIDCode.ToLower().Contains(cmbOrgList.Text.ToLower()) || oi.OrgName.ToLower().Contains(cmbOrgList.Text.ToLower()));
                if (sub == null)
                {
                    tbMsg.Text = TryFindResource("MediaSearchControlError").ToString();
                    return;
                }
            }
            ModelResponsible.Instance.ClearMediaList();

            SearchManager.GetInstance().MediaLogsSerach.UserImp = cmbFileImp.SelectValue;

            SearchManager.GetInstance().MediaLogsSerach.UserGuid = cmbUserList.SelectValue;
            SearchManager.GetInstance().MediaLogsSerach.OrgID = cmbOrgList.SelectValue;
            SearchManager.GetInstance().MediaLogsSerach.UploadState = cmbUpLoadState.SelectValue;
            SearchManager.GetInstance().MediaLogsSerach.OrgName = cmbOrgList.Text;
            SearchManager.GetInstance().MediaLogsSerach.DeviceID = tbDeviceID.Text;
            SearchManager.GetInstance().MediaLogsSerach.UserTag = tbUserTag.Text;

            SearchManager.GetInstance().MediaLogsSerach.PageIndex = 1;
            SearchManager.GetInstance().MediaLogsSerach.IsAdvanced = true;
            SearchManager.GetInstance().MediaLogsSerach.SearchTime = DateTime.Now.AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss");
            SearchManager.GetInstance().SearchMediaLogCount(SearchManager.GetInstance().MediaLogsSerach);
            SearchManager.GetInstance().SearchMediaLogDetail(SearchManager.GetInstance().MediaLogsSerach);
            SearchManager.GetInstance().SendOperationLog("CollectHighSearch");
            if (CloseEvent != null)
            {
                CloseEvent(true);
            }
            LogHelper.Instance.WirteLog(string.Format("MediaSearchControl: UserCode:{0} btnSure MediaLogsSerach", AppConfigInfos.CurrentUserInfos.UserCode), LogLevel.LogDebug);
        }
Example #2
0
        private void FindOrgChildren(OrgInfos oi)
        {
            if (AppConfigInfos.LimitsUserInfos.OrgList == null)
            {
                return;
            }
            oi.Children.Clear();
            List <OrgInfos> sub = AppConfigInfos.LimitsUserInfos.OrgList.orgList.Where((org, match) => oi.OrgID.Equals(org.ParentID)).ToList();

            if (sub != null)
            {
                LogHelper.Instance.WirteLog(string.Format("TreeViewControl Loaded OrgList OrgInfos OrgID:{1} SubCount:{0}", sub.Count, oi.OrgID), LogLevel.LogDebug);
                foreach (OrgInfos suboi in sub)
                {
                    suboi.Level    = oi.Level + 1;
                    suboi.Children = new List <OrgInfos>();
                    oi.Children.Add(suboi);
                    oi.HasItem = true;
                    FindOrgChildren(suboi);
                }
            }
            else
            {
                return;
            }
        }
Example #3
0
        /// <summary>
        /// 下拉框选择
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmbMain_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            OrgInfos userInfo = cmbMain.SelectedItem as OrgInfos;

            if (userInfo != null)
            {
                Text        = userInfo.OrgName;
                SelectValue = FindSubOrgID(userInfo) + userInfo.OrgID;
            }
        }
Example #4
0
        private string FindSubOrgID(OrgInfos selectedItem)
        {
            string ordIDstr = string.Empty;

            foreach (OrgInfos oi in selectedItem.Children)
            {
                ordIDstr += oi.OrgID + ",";
                ordIDstr += FindSubOrgID(oi);
            }
            return(ordIDstr);
        }
Example #5
0
        private void btnSure_Click(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrEmpty(cmbOrgList.Text))
            {
                OrgInfos sub = AppConfigInfos.LimitsUserInfos.OrgList.orgList.Find(oi => oi.OrgIDCode.ToLower().Contains(cmbOrgList.Text.ToLower()) || oi.OrgName.ToLower().Contains(cmbOrgList.Text.ToLower()));
                if (sub == null)
                {
                    tbMsg.Text = TryFindResource("MediaSearchControlError").ToString();
                    return;
                }
            }

            if (this.DataContext is CollectLogsSerach)
            {
                ModelResponsible.Instance.ClearCollectLogs();
                SearchManager.GetInstance().CollectLogsSerach.UserGuid = cmbUserList.SelectValue;
                SearchManager.GetInstance().CollectLogsSerach.OrgID = cmbOrgList.SelectValue;
                SearchManager.GetInstance().CollectLogsSerach.UploadState = cmbUpLoadState.SelectValue;
                SearchManager.GetInstance().CollectLogsSerach.OrgName = cmbOrgList.Text;
                SearchManager.GetInstance().CollectLogsSerach.PageIndex = 1;
                SearchManager.GetInstance().CollectLogsSerach.LogType = "1";
                SearchManager.GetInstance().CollectLogsSerach.IsAdvanced = true;
                SearchManager.GetInstance().SearchCollectLogCount(SearchManager.GetInstance().CollectLogsSerach);
                SearchManager.GetInstance().SearchCollectLogDetail(SearchManager.GetInstance().CollectLogsSerach);
                LogHelper.Instance.WirteLog(string.Format("LogsSearchControl: UserCode:{0} btnSure CollectLogsSerach", AppConfigInfos.CurrentUserInfos.UserCode), LogLevel.LogDebug);

                SearchManager.GetInstance().SendOperationLog("CollectLogHighSearch");
            }
            else if (this.DataContext is CameraLogsSerach)
            {
                ModelResponsible.Instance.ClearCameraLogs();
                SearchManager.GetInstance().CameraLogsSerach.PageIndex = 1;
                SearchManager.GetInstance().CameraLogsSerach.UserGuid = cmbUserList.SelectValue;
                SearchManager.GetInstance().CameraLogsSerach.OrgID = cmbOrgList.SelectValue;
                SearchManager.GetInstance().CameraLogsSerach.UploadState = cmbUpLoadState.SelectValue;
                SearchManager.GetInstance().CameraLogsSerach.OrgName = cmbOrgList.Text;

                SearchManager.GetInstance().CameraLogsSerach.LogType = "2";
                SearchManager.GetInstance().CameraLogsSerach.IsAdvanced = true;

                SearchManager.GetInstance().SearchCameraLogCount(SearchManager.GetInstance().CameraLogsSerach);
                SearchManager.GetInstance().SearchCameraLogDetail(SearchManager.GetInstance().CameraLogsSerach);
                LogHelper.Instance.WirteLog(string.Format("LogsSearchControl: UserCode:{0} btnSure CameraLogsSerach", AppConfigInfos.CurrentUserInfos.UserCode), LogLevel.LogDebug);

                SearchManager.GetInstance().SendOperationLog("CollectCameraLogHighSearch");
            }

            if (CloseEvent != null)
            {
                CloseEvent(true);
            }
        }
Example #6
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            ObservableCollection <OrgInfos> OrgInfoList = new ObservableCollection <OrgInfos>();
            int      levelCode = 1000;
            OrgInfos orgInfo   = new OrgInfos()
            {
                OrgID      = AppConfigInfos.LimitsUserInfos.OrgID,
                OrgIDCode  = AppConfigInfos.LimitsUserInfos.OrgIDCode,
                OrgName    = AppConfigInfos.LimitsUserInfos.OrgName,
                IsExpanded = false,
                IsSelected = true,
                Level      = 1,
                Children   = new List <OrgInfos>()
            };

            //调度员方才创建机构树
            if (AppConfigInfos.LimitsUserInfos.UserType == "1")
            {
                foreach (OrgInfos os in AppConfigInfos.LimitsUserInfos.OrgList.orgList)
                {
                    if (!string.IsNullOrEmpty(os.LevelCode) && Int32.Parse(os.LevelCode) < levelCode)
                    {
                        levelCode = Int32.Parse(os.LevelCode);
                        orgInfo   = os;
                    }
                }

                orgInfo.Level      = 1;
                orgInfo.IsExpanded = false;
                orgInfo.IsSelected = true;
                FindOrgChildren(orgInfo);
            }

            OrgInfoList.Add(orgInfo);

            treeComboBox.ItemsSource = null;
            treeComboBox.ItemsSource = OrgInfoList;
            treeComboBox.Text        = orgInfo.OrgName;
            SelectValue = orgInfo.OrgID;

            TreeView treeView = treeComboBox.Template.FindName("tree", treeComboBox) as TreeView;

            if (treeView != null)
            {
                treeView.ItemsSource = OrgInfoList;
            }
        }
Example #7
0
        /// <summary>
        /// 窗口加载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void my_Loaded(object sender, RoutedEventArgs e)
        {
            tv = cmbMain.Template.FindName("tree", cmbMain) as TreeView;
            if (Items == null)
            {
                Items = new ObservableCollection <OrgInfos>();
                int      LevelCode = 1000;
                OrgInfos oi        = new OrgInfos()
                {
                    OrgID = AppConfigInfos.LimitsUserInfos.OrgID, OrgIDCode = AppConfigInfos.LimitsUserInfos.OrgIDCode, OrgName = AppConfigInfos.LimitsUserInfos.OrgName, IsExpanded = false, IsSelected = true, Level = 1, Children = new List <OrgInfos>()
                };

                LogHelper.Instance.WirteLog(string.Format("TreeViewControl Loaded OrgList Count:{0}", AppConfigInfos.LimitsUserInfos.OrgList.orgList.Count), LogLevel.LogDebug);

                //调度员方才创建机构树
                if (AppConfigInfos.LimitsUserInfos.UserType == "1")
                {
                    foreach (OrgInfos os in AppConfigInfos.LimitsUserInfos.OrgList.orgList)
                    {
                        if (!string.IsNullOrEmpty(os.LevelCode) && Int32.Parse(os.LevelCode) < LevelCode)
                        {
                            LevelCode = Int32.Parse(os.LevelCode);
                            oi        = os;
                        }
                    }

                    oi.Level      = 1;
                    oi.IsExpanded = false;
                    oi.IsSelected = true;
                    if (string.IsNullOrEmpty(Text))
                    {
                        Text = oi.OrgName;
                    }
                    FindOrgChildren(oi);
                }

                Items.Add(oi);
            }
            cmbMain.ItemsSource = Items;
            if (tv != null)
            {
                tv.ItemsSource = Items;
            }
        }
Example #8
0
 private void EditableTextBoxChanged(object state)
 {
     this.Dispatcher.Invoke(new Action(() =>
     {
         if (AppConfigInfos.LimitsUserInfos.OrgList == null || string.IsNullOrEmpty(Text))
         {
             return;
         }
         OrgInfos sub = AppConfigInfos.LimitsUserInfos.OrgList.orgList.Find(oi => oi.OrgIDCode.ToLower().Contains(Text.ToLower()) || oi.OrgName.ToLower().Contains(Text.ToLower()));
         if (tv == null || sub == null)
         {
             Text = string.Empty;
             return;
         }
         if (cmbMain.SelectedItem != null && (((OrgInfos)cmbMain.SelectedItem).OrgIDCode.ToLower().Contains(Text.ToLower()) || ((OrgInfos)cmbMain.SelectedItem).OrgName.ToLower().Contains(Text.ToLower())))
         {
             sub = cmbMain.SelectedItem as OrgInfos;
         }
         FindTreeViewItem(tv, sub);
         cmbMain.IsDropDownOpen = true;
     }));
 }
Example #9
0
        private void FindOrgChildren(OrgInfos orgInfo)
        {
            if (AppConfigInfos.LimitsUserInfos.OrgList == null)
            {
                return;
            }

            orgInfo.Children.Clear();

            List <OrgInfos> orgInfoChild = AppConfigInfos.LimitsUserInfos.OrgList.orgList.Where((org, match) => orgInfo.OrgID.Equals(org.ParentID)).ToList();

            if (orgInfoChild != null)
            {
                foreach (OrgInfos item in orgInfoChild)
                {
                    item.Level    = orgInfo.Level + 1;
                    item.Children = new List <OrgInfos>();
                    orgInfo.Children.Add(item);
                    orgInfo.HasItem = true;
                    FindOrgChildren(item);
                }
            }
        }
Example #10
0
        private string DoReplaceCode(string code, EmailQueueTo emailqueueto = null)
        {
            if (code.StartsWith("<style"))
            {
                return(code);
            }
            switch (code.ToLower())
            {
            case "{address}":
                return(person.PrimaryAddress);

            case "{address2}":
                if (person.PrimaryAddress2.HasValue())
                {
                    return("<br>" + person.PrimaryAddress2);
                }
                return("");

            case "{amtdue}":
                return(pi?.AmountDue.ToString2("c") ?? code);

            case "{amtpaid}":
                return(pi?.AmountPaid.ToString2("c") ?? code);

            case "{amount}":
                if (pi != null)
                {
                    return(pi.Amount.ToString2("c"));
                }
                break;

            case "{barcode}":
                return($"<img src='{db.ServerLink("/Track/Barcode/" + person.PeopleId)}' />");

            case "{birthdate}":
                return(Person.FormatBirthday(person.BirthYr, person.BirthMonth, person.BirthDay, "not available", emailqueueto?.PeopleId));

            case "{campus}":
                return(person.CampusId != null ? person.Campu.Description : $"No {Util2.CampusLabel} Specified");

            case "{cellphone}":
                return(person.CellPhone.HasValue() ? person.CellPhone.FmtFone() : "no cellphone on record");

            case "{city}":
                return(person.PrimaryCity);

            case "{csz}":
                return(Util.FormatCSZ(person.PrimaryCity, person.PrimaryState, person.PrimaryZip));

            case "{country}":
                return(person.PrimaryCountry);

            case "{createaccount}":
                if (emailqueueto != null)
                {
                    return(CreateUserLinkReplacement(emailqueueto));
                }
                break;

            case "{church}":
                return(db.Setting("NameOfChurch", "No NameOfChurch in Settings"));

            case "{churchphone}":
                return(db.Setting("ChurchPhone", "No ChurchPhone in Settings"));

            case "{cmshost}":
                return(db.ServerLink());

            case "{dob}":
                return(person.DOB);

            case "{employer}":
                return(person.EmployerOther);

            case "{estatement}":
                if (person.ElectronicStatement == true)
                {
                    return("Online Electronic Statement Only");
                }
                return("Printed Statement in Addition to Online Option");

            case "{emailhref}":
                if (emailqueueto != null)
                {
                    return(db.ServerLink("/EmailView/" + emailqueueto.Id));
                }
                break;

            case "{first}":
                if (person != null)
                {
                    return(person.PreferredName.Contains("?") || person.PreferredName.Contains("unknown", true) ? "" : person.PreferredName);
                }
                break;

            case "{firstorjoint}":
                return(FirstOrJoint());

            case "{fromemail}":
                return(from.Address);

            case "{homephone}":
                return(person.HomePhone.HasValue() ? person.HomePhone.FmtFone() : "no homephone on record");

            case "{last}":
                if (person != null)
                {
                    return(person.LastName);
                }
                break;

            case "{name}":
                return(person.Name.Contains("?") || person.Name.Contains("unknown", true) ? "" : person.Name);

            case "{nextmeetingtime}":
                if (emailqueueto != null)
                {
                    return(NextMeetingDate(emailqueueto.OrgId, emailqueueto.PeopleId) ?? code);
                }
                break;

            case "{nextmeetingtime0}":
                if (emailqueueto != null)
                {
                    return(NextMeetingDate0(emailqueueto.OrgId) ?? code);
                }
                break;

            case "{occupation}":
                return(person.OccupationOther);

            case "{orgname}":
            case "{org}":
                return(OrgInfos.Name(emailqueueto?.OrgId));

            case "{orgid}":
                return(OrgInfos.Name(emailqueueto?.OrgId));

            case "{orgmembercount}":
                return(OrgInfos.Count(emailqueueto?.OrgId));

            case "{paylink}":
                if (pi != null && pi.PayLink.HasValue())
                {
                    return($"<a href=\"{pi.PayLink}\">Click this link to make a payment and view your balance.</a>");
                }
                break;

            case "{peopleid}":
                return(person.PeopleId.ToString());

            case "{receivesms}":
                return(person.ReceiveSMS ? "Yes" : "No");

            case "{salutation}":
                if (emailqueueto != null)
                {
                    return(db.GoerSupporters.Where(ee => ee.Id == emailqueueto.GoerSupportId)
                           .Select(ee => ee.Salutation).SingleOrDefault());
                }
                break;

            case "{state}":
                return(person.PrimaryState);

            case "{statementtype}":
                return(StatementTypeReplacement());

            case "{email}":
            case "{toemail}":
                if (ListAddresses?.Count > 0)
                {
                    return(ListAddresses[0].Address);
                }
                return(person.EmailAddress);

            case "{today}":
                return(Util.Today.ToShortDateString());

            case "{title}":
                if (person.TitleCode.HasValue())
                {
                    return(person.TitleCode);
                }
                return(person.ComputeTitle());

            case "{track}":
                if (emailqueueto != null)
                {
                    return(emailqueueto.Guid.HasValue ?
                           $"<img src=\"{db.ServerLink("/Track/Key/" + emailqueueto.Guid.Value.GuidToQuerystring())}\" />"
                            : "");
                }
                break;

            case "{unsubscribe}":
                if (emailqueueto != null)
                {
                    return(UnsubscribeReplacement(emailqueueto));
                }
                break;

            default:
                var eq = emailqueueto ?? new EmailQueueTo()
                {
                    PeopleId = person.PeopleId,
                    OrgId    = db.CurrentSessionOrgId
                };

                if (AddSmallGroupRe.IsMatch(code))
                {
                    return(AddSmallGroupReplacement(code, eq));
                }

                if (PledgeRe.IsMatch(code))
                {
                    return(PledgeReplacement(code, eq));
                }

                if (PledgeFundRe.IsMatch(code))
                {
                    return(PledgeFundReplacement(code));
                }

                if (SettingRe.IsMatch(code))
                {
                    return(SettingReplacement(code));
                }

                if (SettingUrlRe.IsMatch(code))
                {
                    return(SettingUrlReplacement(db, code));
                }

                if (PythonDataRe.IsMatch(code))
                {
                    return(PythonDataReplacement(code));
                }

                if (ExtraValueRe.IsMatch(code))
                {
                    return(ExtraValueReplacement(code, eq));
                }

                if (FirstOrSubstituteRe.IsMatch(code))
                {
                    return(FirstOrSubstituteReplacement(code));
                }

                if (SubGroupsRe.IsMatch(code))
                {
                    return(SubGroupsReplacement(code, eq));
                }

                if (OrgExtraRe.IsMatch(code))
                {
                    return(OrgExtraReplacement(code, eq));
                }

                if (SmallGroupRe.IsMatch(code))
                {
                    return(SmallGroupReplacement(code, eq));
                }

                if (OrgMemberRe.IsMatch(code))
                {
                    return(OrgMemberReplacement(code, eq));
                }

                if (OrgBarCodeRe.IsMatch(code))
                {
                    return(OrgBarCodeReplacement(code, eq));
                }

                if (RegTextRe.IsMatch(code))
                {
                    return(RegTextReplacement(code, eq));
                }

                if (DateFormattedRe.IsMatch(code))
                {
                    return(DateFormattedReplacement(code));
                }

                if (RegisterLinkRe.IsMatch(code))
                {
                    return(RegisterLinkReplacement(code, eq));
                }

                if (RegisterLinkHrefRe.IsMatch(code))
                {
                    return(RegisterLinkHrefReplacement(code, eq));
                }

                if (RegisterTagRe.IsMatch(code))
                {
                    return(RegisterTagReplacement(code, eq));
                }

                if (RsvpLinkRe.IsMatch(code))
                {
                    return(RsvpLinkReplacement(code, eq));
                }

                if (SendLinkRe.IsMatch(code))
                {
                    return(SendLinkReplacement(code, eq));
                }

                if (SupportLinkRe.IsMatch(code))
                {
                    return(SupportLinkReplacement(code, eq));
                }

                if (MasterLinkRe.IsMatch(code))
                {
                    return(MasterLinkReplacement(code, eq));
                }

                if (VolReqLinkRe.IsMatch(code))
                {
                    return(VolReqLinkReplacement(code, eq));
                }

                if (VolSubLinkRe.IsMatch(code))
                {
                    return(VolSubLinkReplacement(code, eq));
                }

                if (VoteLinkRe.IsMatch(code))
                {
                    return(VoteLinkReplacement(code, eq));
                }

                if (DropFromOrgTagRe.IsMatch(code))
                {
                    return(DropFromOrgTagReplacement(code, eq));
                }

                if (SqlLookupRe.IsMatch(code))
                {
                    return(SqlLookupReplacement(code, eq));
                }

                break;
            }
            return(code); // nothing matched
        }