예제 #1
0
            /// <summary>
            /// Initializes a new instance of the <see cref="FilterSettings"/> class.
            /// </summary>
            /// <param name="clientParameters">The ClientParameters.</param>
            public FilterSettings(ClientParameters clientParameters)
            {
                PersonWhereSearch = ArrayQSFilterSetting.CreateInstance().InitFromQueryString("PersonWhereSearch", clientParameters.PersonWhereSearch).SetEnable(true);
                PersonHowSearch   = PersonHowSearchFilterSetting.CreateInstance().InitFromQueryString("PersonHowSearch", clientParameters.PersonHowSearch).SetEnable(true);

                Search        = StringQSFilterSetting.CreateInstance().InitFromQueryString("Search", "");
                PersonValidAt = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonValidAt", "");

                PersonType = ArrayQSFilterSetting.CreateInstance().InitFromQueryString("PersonType", clientParameters.PersonType);
                Veracity   = ArrayQSFilterSetting.CreateInstance().InitFromQueryString("PersonCheck", clientParameters.PersonCheck);

                Uri    myUri             = new Uri(HttpContext.Current.Request.Url.AbsoluteUri);
                string PersonAllBProject = HttpUtility.ParseQueryString(myUri.Query).Get("PersonAllBProject");

                clientParameters.PersonAllBProject = Convert.ToInt32(PersonAllBProject);

                BusinessProject = BusinessProjectFilterSetting.CreateInstance().InitFromQS(
                    "PersonBProject", (clientParameters.PersonBProject == "" ? "0" : clientParameters.PersonBProject),
                    "PersonSubBProject ", clientParameters.PersonSubBProject,
                    "PersonAllBProject ", clientParameters.PersonAllBProject);
                if (clientParameters.PersonAllBProject != 0)
                {
                    BusinessProject.SetEnable(true);
                }

                PersonArea    = PersonAreaFilterSetting.CreateInstance().InitFromQueryString("PersonArea", clientParameters.PersonArea == "" ? "0" : clientParameters.PersonArea);
                PersonOPForma = UniqueIdQSFilterSetting.CreateInstance().InitFromQueryString("PersonOPForma", clientParameters.PersonOPForma);

                PersonUsers = PersonUsersFilterSetting.CreateInstance()
                              .SetListAccessor(ids => Kesco.Employees.BusinessLogic.Repository.Employees.GetListByIds(ids))
                              .InitFromQueryString("PersonUsers", clientParameters.PersonUsers);

                PersonThemes = PersonThemesFilterSetting.CreateInstance()
                               .SetListAccessor(ids => Repository.PersonThemes.GetListByIds(ids))
                               .InitFromQS("PersonThemes", clientParameters.PersonThemes,
                                           "PersonSubThemes", clientParameters.PersonSubThemes);

                PersonTUnion = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonTUnion", "");
                PersonLink   = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonLink", "");

                int personID;

                if (int.TryParse(PersonLink.GetValue(), out personID))
                {
                    var p = Repository.Persons.GetInstance(personID);
                    PersonLinkNickname = p != null ? p.Nickname : "#PersonLink";
                }
                else
                {
                    PersonLinkNickname = "";
                }

                PersonLinkType = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonLinkType", "");

                PersonForSend = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonForSend", "0");

                PersonAdvSearch = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonAdvSearch", "");

                //PersonSelectTop = PersonSelectTopFilterSetting.CreateInstance().InitFromQueryString("PersonSelectTop", 30);
            }
        public ViewModel(int personID, int[] sectionIDs, bool forceReload)
            : base()
        {
            forceReload     = true;
            this.sectionIDs = sectionIDs;

            Model.PersonID = UniqueIdQSFilterSetting.CreateInstance().InitFromQueryString("id", personID).GetValue();

            Model.PersonMainMenu = StringQSFilterSetting.CreateInstance().InitFromQueryString("PersonMainMenu", "true").GetValue() == "true";

            AccessLevel = LoadPersonAccessLevel();
            if (AccessLevel == PersonAccessLevel.None)
            {
                return;
            }

            Person = Repository.Persons.GetInstance(Model.PersonID);

            Kesco.Employees.ObjectModel.Employee employee = null;
            if (Model.PersonID != 0)
            {
                employee = Kesco.Employees.BusinessLogic.Repository.Employees.GetEmployeeByPersonID(Model.PersonID);

                if (Person == null || (Person != null && Person.PersonType == Kesco.Persons.ObjectModel.PersonCardType.Natural))
                {
                    Model.EmployeeID = employee != null ? employee.ID : 0;
                }
            }

            if (Person != null)
            {
                if (Person.PersonType == Kesco.Persons.ObjectModel.PersonCardType.Natural)
                {
                    settings = TypeAccessor <ClientParametersN> .CreateInstanceEx();
                }
                else
                {
                    settings = TypeAccessor <ClientParametersJ> .CreateInstanceEx();
                }

                Params.Width  = Configuration.AppSettings.Width;
                Params.Height = Configuration.AppSettings.Height;
                LoadSettings(Params);

                Model.HasLogotypes = Kesco.Persons.BusinessLogic.Repository.Logotypes.GetLogotypeCountByPersonID(Person.ID) > 0;
                Model.IsBProject   = Person.BusinessProjectID.HasValue;

                if (Person.Verified)
                {
                    Model.Verified = Person.Verified;

                    CheckedBy   = Person.ChangedBy;
                    CheckedDate = Person.ChangedDate.HasValue ? (Person.ChangedDate.Value.FromUtcToClient().ToString("F")) : "---";
                }
                else
                {
                    Model.Verified = false;
                }

                Init(forceReload);
            }
            else
            {
                DocumentTitle = employee.EmployerID + " " + employee.FullName;
                settings      = TypeAccessor <ClientParameters> .CreateInstanceEx();

                Params.Width  = Configuration.AppSettings.Width;
                Params.Height = Configuration.AppSettings.Height;
            }
        }
예제 #3
0
 public ViewModel() : base()
 {
     PageTitle      = global::Resources.Resources.Persons_Dossier_Delete_PageTitle;
     Model.PersonID = UniqueIdQSFilterSetting.CreateInstance().InitFromQueryString("id", 0).GetValue();
 }