Exemple #1
0
 public OperationResult Insert(SubjectType subjectType)
 {
     base.UnitOfWork.TransactionEnabled = true;
     var re= _subjectTypeRepository.Insert(subjectType);
     re= UnitOfWork.SaveChanges();
     return new OperationResult(OperationResultType.Success);
 }
Exemple #2
0
 public Subject(SubjectType s)
 {
     SubjectName = s;
     comfortThreshold = 0;
     considerationThreshold = 0;
     curiosityThreshold = 0;
 }
Exemple #3
0
        public bool Delete(SubjectType subjectType, int subjectId, int tagId)
        {
            var response = _client.Execute<Tag>(new RestRequest(String.Format("{0}/{1}/tags/{2}.xml",
                subjectType.ToString().ToLower(), subjectId, tagId), Method.DELETE));

            return response.StatusCode == HttpStatusCode.OK;
        }
Exemple #4
0
        static void Main(string[] args)
        {
            Assembly assembly = Assembly.GetAssembly(typeof(SubjectTypeMap));
            DatabaseInitializer.AddMapperAssembly(assembly);

            using (ETVS.Repositories.ETVSContext etv = new ETVS.Repositories.ETVSContext())
            {
                //IRepository<SubjectType, int> re = new Repository<SubjectType, int>(re.UnitOfWork);
                //etv.TransactionEnabled = true;
                var model = new SubjectType
                {
                    Name = "abc"
                };
                etv.SubjectTypes.Add(model);

                etv.SaveChanges();

            }

            //Assembly assembly = Assembly.GetExecutingAssembly();
            //assembly = Assembly.GetAssembly(typeof(SubjectTypeMap));
            //DatabaseInitializer.AddMapperAssembly(assembly);
            //var a= DatabaseInitializer.EntityMappers;
            //DatabaseInitializer.Initialize();
        }
Exemple #5
0
 public Subject()
 {
     SubjectName = SubjectType.Cave;
     comfortThreshold = 0;
     considerationThreshold = 0;
     curiosityThreshold = 0;
 }
 public IEnumerable<Task> Get(SubjectType subjectType, int subjectId)
 {
     var url = String.Format("{0}/{1}/tasks.xml", subjectType.ToString().ToLower(),subjectId);
     var response = _client.Execute<List<Task>>(new RestRequest(url, Method.GET));
     var tasks = response.Data;
     return tasks;
 }
Exemple #7
0
 public override bool AddSubjectProducts(SubjectType subjectType, IList<int> productIds)
 {
     if (productIds.Count <= 0)
     {
         return false;
     }
     foreach (int num in productIds)
     {
         RemoveSubjectProduct(subjectType, num);
     }
     DbCommand sqlStringCommand = database.GetSqlStringCommand("INSERT INTO distro_SubjectProducts(DistributorUserId, SubjectType, ProductId) VALUES (@DistributorUserId, @SubjectType, @ProductId)");
     database.AddInParameter(sqlStringCommand, "DistributorUserId", DbType.Int32, HiContext.Current.User.UserId);
     database.AddInParameter(sqlStringCommand, "SubjectType", DbType.Int32, (int)subjectType);
     database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32);
     try
     {
         foreach (int num2 in productIds)
         {
             database.SetParameterValue(sqlStringCommand, "ProductId", num2);
             database.ExecuteNonQuery(sqlStringCommand);
         }
         return true;
     }
     catch
     {
         return false;
     }
 }
Exemple #8
0
        public Subject(SubjectType s, float comfort, float consideration, float curiosity)
        {
            SubjectName = s;

            comfortThreshold = comfort;
            considerationThreshold = consideration;
            curiosityThreshold = curiosity;
        }
        public Note Create(SubjectType subjectType, int subjectId, Note note)
        {
            var request = new RestRequest(String.Format("{0}/{1}/notes.xml",
                subjectType.ToString().ToLower(), subjectId), Method.POST)
            { XmlSerializer = new XmlSerializer() };
            request.AddBody(note);

            var response = _client.Execute<Note>(request);
            return response.Data;
        }
        public IEnumerable<Email> Get(SubjectType subjectType, int subjectId, DateTime since, int? offset = null)
        {
            var url = offset.HasValue
                         ? String.Format("/{0}/{1}/emails.xml?since={2}&n={3}", subjectType.ToString().ToLower(), subjectId, since, offset.Value)
                         : String.Format("/{0}/{1}/emails.xml?since={2}", subjectType.ToString().ToLower(), subjectId, since);

            var response = _client.Execute<List<Email>>(new RestRequest(url, Method.GET));
            var results = response.Data;
            return results;
        }
        public Email Create(SubjectType subjectType, int subjectId, Email email)
        {
            var request = new RestRequest(String.Format("{0}/{1}/emails.xml",
                subjectType.ToString().ToLower(), subjectId), Method.POST)
            { XmlSerializer = new XmlSerializer() };
            request.AddBody(email);

            var response = _client.Execute<Email>(request);
            return response.Data;
        }
Exemple #12
0
        public Tag Create(SubjectType subjectType, int subjectId, Tag tag)
        {
            var request = new RestRequest(String.Format("{0}/{1}/tags.xml",
                subjectType.ToString().ToLower(), subjectId), Method.POST) { XmlSerializer = new XmlSerializer() };

            request.AddParameter("name", tag.Name);

            var response = _client.Execute<Tag>(request);
            return response.Data;
        }
        public IEnumerable<Note> Get(SubjectType subjectType, int subjectId, int? offset = null)
        {
            var url = offset.HasValue
                         ? String.Format("/{0}/{1}/notes.xml?n={2}", subjectType.ToString().ToLower(), subjectId, offset.Value)
                         : String.Format("/{0}/{1}/notes.xml", subjectType.ToString().ToLower(), subjectId);

            var response = _client.Execute<List<Note>>(new RestRequest(url, Method.GET));
            var results = response.Data;
            return results;
        }
Exemple #14
0
        public static string GetDesc(this CollectionStatusType status,
                                     SubjectType subjectType)
        {
            string ret = status switch
            {
                CollectionStatusType.Wish => "想做",
                CollectionStatusType.Collect => "做过",
                CollectionStatusType.Do => "在做",
                CollectionStatusType.OnHold => "搁置",
                CollectionStatusType.Dropped => "抛弃",
                _ => throw new NotImplementedException(),
            };

            return(subjectType switch
            {
                SubjectType.Book => ret.Replace("做", "读"),
                SubjectType.Music => ret.Replace("做", "听"),
                SubjectType.Game => ret.Replace("做", "玩"),
                _ => ret.Replace("做", "看"),
            });
        public static async Task <string> FetchTypeCollectionList(
            string headString,
            string loc_id,
            uint start,
            uint count,
            double minised,
            SubjectType type    = SubjectType.Books,
            RequestType request = RequestType.Groups)
        {
            var refer_sub_type =
                type == SubjectType.Books ? "book" :
                type == SubjectType.Movies ? "movie" :
                type == SubjectType.Music ? "music" :
                "tv";
            var formatPath = request == RequestType.SubjectCollection ? SubjectCollectionPath : TypePath;

            return(await DoubanWebProcess.GetMDoubanResponseAsync(string.Format(formatPath, new object[] { headString, start, count, loc_id, minised }),
                                                                  "m.douban.com",
                                                                  $"{"https:"}//m.douban.com/{refer_sub_type}/"));
        }
Exemple #16
0
        void GetRandomSubject(SubjectType type)
        {
            switch (type)
            {
            case SubjectType.Esay:
                Subjects = GetSubject(System.Environment.CurrentDirectory + @"\Subject\Esay.sdt");
                break;

            case SubjectType.Normal:
                Subjects = GetSubject(System.Environment.CurrentDirectory + @"\Subject\Normal.sdt");
                break;

            case SubjectType.Herd:
                Subjects = GetSubject(System.Environment.CurrentDirectory + @"\Subject\Herd.sdt");
                break;

            case SubjectType.Master:
                Subjects = GetSubject(System.Environment.CurrentDirectory + @"\Subject\Master.sdt");
                break;
            }
        }
Exemple #17
0
 protected void setData(SubjectType st)
 {
     this.TheType = st;
     if (!this.boxType.IsEmptyOrWhiteSpace)
     {
         this.TheType.TypeTitle = this.boxType.Text;
     }
     if (!this.boxHours.IsEmptyOrWhiteSpace && this.boxHours.IsNumeric())
     {
         this.TheType.HoursPerUnit = Convert.ToByte(this.boxHours.NumericText);
     }
     if (!this.boxSalary.IsEmptyOrWhiteSpace && this.boxSalary.IsNumeric())
     {
         this.TheType.SalaryPerUnit = Convert.ToInt32(this.boxSalary.NumericText);
     }
     if (!this.boxPrice.IsEmptyOrWhiteSpace && this.boxPrice.IsNumeric())
     {
         this.TheType.PricePerUnit = Convert.ToInt32(this.boxPrice.NumericText);
     }
     this.TheType.Theory = this.boxTheoryCheck.Checked;
 }
Exemple #18
0
    /// <summary>
    /// 创建新场景
    /// </summary>
    public void CreateNewScene(SubjectType sjType, OperateType opType)
    {
        //实例化PC和VR必备物体
        DeskCanvasGameObject    = Instantiate(DeskCanvasGamePrefab);
        StartUICanvasGameObject = Instantiate(StartUICanvasPrefab);
        GameObject EventSystemGameObject     = Instantiate(eventSystemGamePrefab);
        GameObject VRTK_SDKManagerGameObject = Instantiate(VRTK_SDKManagerPrefab);
        GameObject VRTK_ScriptsGameObject    = Instantiate(VRTK_ScriptsPrefab);

        //加载场景所需必要的脚本和物体
        gm = Instantiate(GameManager).GetComponent <GameManagerT2>();
        gm.InitCameraGameObject(GameObject.Find("Main Camera"), VRTK_SDKManagerGameObject, VRTK_ScriptsGameObject);
        gm.subjectType = sjType;

        uiCtrl = gm.GetComponent <UIControllerT2>();
        uiCtrl.InitUICanvas(StartUICanvasGameObject, DeskCanvasGameObject,
                            VRTK_SDKManagerGameObject.transform.GetChild(0).GetChild(3).GetChild(0).GetChild(0).gameObject,
                            VRTK_SDKManagerGameObject.transform.GetChild(0).GetChild(3).GetChild(0).GetChild(3).GetChild(0).GetChild(0).gameObject);

        VRTK_SDKManagerGameObject.GetComponent <VRTK_SDKManager>().scriptAliasLeftController  = VRTK_ScriptsGameObject.transform.Find("LeftController").gameObject;
        VRTK_SDKManagerGameObject.GetComponent <VRTK_SDKManager>().scriptAliasRightController = VRTK_ScriptsGameObject.transform.Find("RightController").gameObject;
    }
Exemple #19
0
 /// <summary>
 /// Retoune la liste de mesures du fichier ouvert.
 /// </summary>
 /// <param name="file"></param>
 /// <returns>La liste de groupes</returns>
 public BGroup getRootGroup(SubjectType subjectType)
 {
     try
     {
         var request = new RestRequest(ResourcePath + "/root/" + subjectType.label, Method.GET);
         request.DateFormat = "dd/MM/yyyy";
         RestResponse queryResult = (RestResponse)RestClient.Execute(request);
         try
         {
             BGroup root = RestSharp.SimpleJson.DeserializeObject <BGroup>(queryResult.Content);
             return(root);
         }
         catch (Exception)
         {
             return(null);
         }
     }
     catch (Exception e)
     {
         throw new BcephalException("Unable to Return Measures.", e);
     }
 }
        public static bool TrySendMail(string message, SubjectType subjectType, out Exception ex, string replyAddress = "")
        {
            IsSending = true;
            ex        = null;
            bool success = true;

            Message.Body    = message;
            Message.Subject = SubjectBeginning + subjectType.ToString() + (replyAddress == "" ? "" : $" | From {replyAddress}");

            try
            {
                Client.Send(Message);
            }
            catch (Exception e)
            {
                ex      = e;
                success = false;
            }

            IsSending = false;
            return(success);
        }
Exemple #21
0
        /// <summary>
        /// 转换成字符串
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("{0}{1}", BillItemID.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", BillID.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", Subject.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrSubject, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", SubjectType.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", Amount.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", DueAmt.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", ReceivedAmt.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", PenaltyIntAmt.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", CreateTime.ToString("yyyy-MM-dd HH:mm:ss"), WebServiceConst.Separater_1);

            if (FullPaidTime.HasValue)
            {
                sb.AppendFormat("{0}{1}", FullPaidTime.Value.ToString("yyyy-MM-dd HH:mm:ss"), WebServiceConst.Separater_1);
            }
            else
            {
                sb.AppendFormat("{0}{1}", "", WebServiceConst.Separater_1);
            }

            sb.AppendFormat("{0}{1}", OperatorID.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", IsCurrent.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", IsShelve.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", BusinessID.ToString(), WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrAmount, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrDueAmt, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrReceivedAmt, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrReceived, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", StrReceivable, WebServiceConst.Separater_1);
            sb.AppendFormat("{0}{1}", Display, WebServiceConst.Separater_1);
            sb.Append(StrCreateTime);

            return(sb.ToString());
        }
        private List <Subject> getSubjects(Schools school, List <SubjectType> subjectTypes)
        {
            List <Subject>  tmp      = new List <Subject>();
            List <Subjects> subjects = db.Subjects.Where(g => g.SchoolsId == school.Id).ToList();

            foreach (Subjects s in subjects)
            {
                SubjectType subjectType = null;
                foreach (SubjectType st in subjectTypes)
                {
                    if (s.SubjectTypes.Id.Equals(st.getName()))
                    {
                        subjectType = st;
                        break;
                    }
                }

                tmp.Add(new Subject(s.Id, subjectType));
            }


            return(tmp);
        }
Exemple #23
0
 private void LoadParameters()
 {
     if (!string.IsNullOrEmpty(base.Request.QueryString["Keywords"]))
     {
         keywords = base.Request.QueryString["Keywords"];
     }
     if (!string.IsNullOrEmpty(base.Request.QueryString["CategoryId"]))
     {
         int result = 0;
         if (int.TryParse(base.Request.QueryString["CategoryId"], out result))
         {
             categoryId = new int?(result);
         }
     }
     if (!string.IsNullOrEmpty(base.Request.QueryString["subjectType"]))
     {
         int num2 = 0;
         if (int.TryParse(base.Request.QueryString["subjectType"], out num2))
         {
             subjectType = (SubjectType)num2;
         }
     }
 }
        private AttributeQueryType getAttributeQuery(string userId, string[] attributeNames)
        {
            AttributeQueryType attributeQuery = new AttributeQueryType();
            SubjectType        subject        = new SubjectType();
            NameIDType         subjectName    = new NameIDType();

            subjectName.Value      = userId;
            subject.Items          = new Object[] { subjectName };
            attributeQuery.Subject = subject;

            if (null != attributeNames)
            {
                List <AttributeType> attributes = new List <AttributeType>();
                foreach (string attributeName in attributeNames)
                {
                    AttributeType attribute = new AttributeType();
                    attribute.Name = attributeName;
                    attributes.Add(attribute);
                }
                attributeQuery.Attribute = attributes.ToArray();
            }
            return(attributeQuery);
        }
        public static string GetValue(this SubjectType subjectType)
        {
            switch (subjectType)
            {
            case SubjectType.Book:
                return("book");

            case SubjectType.Anime:
                return("anime");

            case SubjectType.Music:
                return("music");

            case SubjectType.Game:
                return("game");

            case SubjectType.Real:
                return("real");

            default:
                return(subjectType.ToString());
            }
        }
Exemple #26
0
    /// <summary>
    /// 创建新场景
    /// </summary>
    public void CreateNewScene(SubjectType sjType, OperateType opType)
    {
        //实例化PC和VR必备物体,加载场景所需必要的脚本和物体
        GameObject camera = Instantiate(mainCamera);

        camera.name = "Main Camera T3";
        GameObject oldCamera = GameObject.Find("Main Camera");

        oldCamera.SetActive(false);

        GameObject EventSystemGameObject = Instantiate(EventSystem);

        StartUICanvasGameObject     = Instantiate(StartUICanvasPrefab);
        DesktopGameCanvasGameObject = Instantiate(DesktopGameCanvasPrefab);
        GameObject VRTK_SDKManagerGameObject = Instantiate(VRTK_SDKManagerPrefab);
        GameObject VRTK_ScriptsGameObject    = Instantiate(VRTK_ScriptsPrefab);

        gm = Instantiate(GameManager).GetComponent <GameManagerT3>();
        gm.InitCameraGameObject(camera, StartUICanvasGameObject, DesktopGameCanvasGameObject, VRTK_SDKManagerGameObject, VRTK_ScriptsGameObject);
        gm.subjectType = sjType;

        GameObject PipeGroupParentGameObject = Instantiate(pipeGroupParent);
        GameObject StateSetsParentGameObject = Instantiate(stateSetParent);
        GameObject UISetParentGameObject     = Instantiate(uiSetParent);


        uiCtrl = gm.GetComponent <UIControllerT3>();
        uiCtrl.InitUICanvas(StartUICanvasGameObject, DesktopGameCanvasGameObject,
                            VRTK_SDKManagerGameObject.transform.GetChild(0).GetChild(3).GetChild(0).GetChild(0).gameObject,
                            VRTK_SDKManagerGameObject.transform.GetChild(0).GetChild(3).GetChild(0).GetChild(3).GetChild(0).GetChild(0).gameObject);


        VRTK_SDKManagerGameObject.GetComponent <VRTK_SDKManager>().scriptAliasLeftController =
            VRTK_ScriptsGameObject.transform.Find("LeftController").gameObject;
        VRTK_SDKManagerGameObject.GetComponent <VRTK_SDKManager>().scriptAliasRightController =
            VRTK_ScriptsGameObject.transform.Find("RightController").gameObject;
    }
Exemple #27
0
        /// <summary>
        /// Retrieves the subjects that have ACL entries set for a directory.
        /// </summary>
        /// <param name="provider">The provider.</param>
        /// <param name="directory">The directory.</param>
        /// <returns>The subjects.</returns>
        public static SubjectInfo[] RetrieveSubjectsForDirectory(IFilesStorageProviderV30 provider, string directory)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

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

            if (directory.Length == 0)
            {
                throw new ArgumentException("Directory cannot be empty", "directory");
            }

            AclEntry[] entries = SettingsProvider.AclManager.RetrieveEntriesForResource(Actions.ForDirectories.ResourceMasterPrefix + AuthTools.GetDirectoryName(provider, directory));

            List <SubjectInfo> result = new List <SubjectInfo>(entries.Length);

            for (int i = 0; i < entries.Length; i++)
            {
                SubjectType type = AuthTools.IsGroup(entries[i].Subject) ? SubjectType.Group : SubjectType.User;

                // Remove the subject qualifier ('U.' or 'G.')
                string name = entries[i].Subject.Substring(2);

                if (result.Find(delegate(SubjectInfo x) { return(x.Name == name && x.Type == type); }) == null)
                {
                    result.Add(new SubjectInfo(name, type));
                }
            }

            return(result.ToArray());
        }
Exemple #28
0
        /*****
        ** Other
        ****/
        /// <summary>Get the display type for a character.</summary>
        /// <param name="npc">The lookup target.</param>
        /// <param name="type">The NPC type.</param>
        private static string GetTypeName(Character npc, SubjectType type)
        {
            switch (type)
            {
            case SubjectType.Villager:
                return(L10n.Types.Villager());

            case SubjectType.Monster:
                return(L10n.Types.Monster());

            case SubjectType.Pet:
            {
                string typeName = Game1.content.LoadString($"Strings\\StringsFromCSFiles:Event.cs.{(npc is Cat ? "1242" : "1243")}");
                if (typeName?.Length > 1)
                {
                    typeName = char.ToUpperInvariant(typeName[0]) + typeName.Substring(1);
                }
                return(typeName);
            }

            default:
                return(npc.GetType().Name);
            }
        }
Exemple #29
0
    /// <summary>
    /// 创建新场景
    /// </summary>
    public void CreateNewScene(SubjectType sjType, OperateType opType)
    {
        //实例化PC和VR必备物体
        StartUICanvasGameObject  = Instantiate(StartUICanvasPrefab);
        infoBoardParentTransform = Instantiate(InfoBoardParent).transform;
        unitParentTransform      = Instantiate(UnitParent).transform;
        GameObject EventSystemGameObject = Instantiate(EventSystem);

        DesktopGameCanvasGameObject = Instantiate(DesktopGameCanvasPrefab);
        GameObject VRTK_SDKManagerGameObject = Instantiate(VRTK_SDKManagerPrefab);
        GameObject VRTK_ScriptsGameObject    = Instantiate(VRTK_ScriptsPrefab);


        //属性赋值
        gm = Instantiate(GameManager).GetComponent <GameManagerT1>();
        gm.InitCameraGameObject(GameObject.Find("Main Camera"), VRTK_SDKManagerGameObject, VRTK_ScriptsGameObject);
        gm.subjectType = sjType;

        //操作交互方式由课件启动的时候决定,这里不在定义
        //gm.operateType = opType;

        uiCtrl = gm.GetComponent <UIControllerT1>();
        uiCtrl.InitUICanvas(StartUICanvasGameObject, DesktopGameCanvasGameObject,
                            VRTK_SDKManagerGameObject.transform.GetChild(0).GetChild(3).GetChild(0).GetChild(0).gameObject,
                            VRTK_SDKManagerGameObject.transform.GetChild(0).GetChild(3).GetChild(0).GetChild(3).GetChild(0).GetChild(0).gameObject);


        VRTK_SDKManagerGameObject.GetComponent <VRTK_SDKManager>().scriptAliasLeftController =
            VRTK_ScriptsGameObject.transform.Find("LeftController").gameObject;
        VRTK_SDKManagerGameObject.GetComponent <VRTK_SDKManager>().scriptAliasRightController =
            VRTK_ScriptsGameObject.transform.Find("RightController").gameObject;

        ClearIntroPart();
        ClearShowTransformPart();
        ClearUnitPart();
    }
 public AdminControl(SubjectType type)
 {
     InitializeComponent();
     DataContext = new AdminViewModel(type);
 }
Exemple #31
0
        /// <summary>
        /// Creates a Version 1.1 Saml Assertion
        /// </summary>
        /// <param name="issuer">Issuer</param>
        /// <param name="subject">Subject</param>
        /// <param name="attributes">Attributes</param>
        /// <returns>returns a Version 1.1 Saml Assertion</returns>
        private static AssertionType CreateSamlAssertion(string issuer, string recipient, string domain, string subject, Dictionary <string, string> attributes)
        {
            // Here we create some SAML assertion with ID and Issuer name.
            AssertionType assertion = new AssertionType();

            assertion.ID = "_" + Guid.NewGuid().ToString();

            NameIDType issuerForAssertion = new NameIDType();

            issuerForAssertion.Value = issuer.Trim();

            assertion.Issuer  = issuerForAssertion;
            assertion.Version = "2.0";

            assertion.IssueInstant = System.DateTime.UtcNow;

            //Not before, not after conditions
            ConditionsType conditions = new ConditionsType();

            conditions.NotBefore             = DateTime.UtcNow;
            conditions.NotBeforeSpecified    = true;
            conditions.NotOnOrAfter          = DateTime.UtcNow.AddMinutes(5);
            conditions.NotOnOrAfterSpecified = true;

            AudienceRestrictionType audienceRestriction = new AudienceRestrictionType();

            audienceRestriction.Audience = new string[] { domain.Trim() };

            conditions.Items = new ConditionAbstractType[] { audienceRestriction };

            //Name Identifier to be used in Saml Subject
            NameIDType nameIdentifier = new NameIDType();

            nameIdentifier.NameQualifier = domain.Trim();
            nameIdentifier.Value         = subject.Trim();

            SubjectConfirmationType     subjectConfirmation     = new SubjectConfirmationType();
            SubjectConfirmationDataType subjectConfirmationData = new SubjectConfirmationDataType();

            subjectConfirmation.Method = "urn:oasis:names:tc:SAML:2.0:cm:bearer";
            subjectConfirmation.SubjectConfirmationData = subjectConfirmationData;
            //
            // Create some SAML subject.
            SubjectType samlSubject = new SubjectType();

            AttributeStatementType attrStatement = new AttributeStatementType();
            AuthnStatementType     authStatement = new AuthnStatementType();

            authStatement.AuthnInstant = DateTime.UtcNow;
            AuthnContextType context = new AuthnContextType();

            context.ItemsElementName   = new ItemsChoiceType5[] { ItemsChoiceType5.AuthnContextClassRef };
            context.Items              = new object[] { "AuthnContextClassRef" };
            authStatement.AuthnContext = context;

            samlSubject.Items = new object[] { nameIdentifier, subjectConfirmation };

            assertion.Subject = samlSubject;

            IPHostEntry ipEntry =
                Dns.GetHostEntry(System.Environment.MachineName);

            SubjectLocalityType subjectLocality = new SubjectLocalityType();

            subjectLocality.Address = ipEntry.AddressList[0].ToString();

            attrStatement.Items = new AttributeType[attributes.Count];
            int i = 0;

            // Create userName SAML attributes.
            foreach (KeyValuePair <string, string> attribute in attributes)
            {
                AttributeType attr = new AttributeType();
                attr.Name              = attribute.Key;
                attr.NameFormat        = "urn:oasis:names:tc:SAML:2.0:attrname-format:basic";
                attr.AttributeValue    = new object[] { attribute.Value };
                attrStatement.Items[i] = attr;
                i++;
            }
            assertion.Conditions = conditions;

            assertion.Items = new StatementAbstractType[] { authStatement, attrStatement };

            return(assertion);
        }
 public abstract DbQueryResult GetSubjectProducts(SubjectType subjectType, Pagination page);
 public abstract bool AddSubjectProducts(SubjectType subjectType, IList <int> productIds);
 /// <summary>
 /// Determines whether a subject is already in a list.
 /// </summary>
 /// <param name="subject">The subject to test.</param>
 /// <param name="type">The type of the subject.</param>
 /// <param name="allSubjects">The subject list.</param>
 /// <returns><c>true</c> if the subject is present in <b>allSubjects</b>, <c>false</c> otherwise.</returns>
 private bool IsAlreadyPresent(string subject, SubjectType type, SubjectInfo[] allSubjects)
 {
     foreach(SubjectInfo current in allSubjects) {
         if(current.Type == type && current.Name == subject) {
             return true;
         }
     }
     return false;
 }
Exemple #35
0
 public void addSubject(SubjectType subjectName, float comfort, float consideration, float curious)
 {
     Subjects.Add(new Subject(subjectName, comfort, consideration, curious));
 }
Exemple #36
0
 public override bool RemoveSubjectProduct(SubjectType subjectType, int productId)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("DELETE FROM Hishop_SubjectProducts WHERE SubjectType = @SubjectType AND ProductId = @ProductId");
     database.AddInParameter(sqlStringCommand, "SubjectType", DbType.Int32, (int)subjectType);
     database.AddInParameter(sqlStringCommand, "ProductId", DbType.Int32, productId);
     return (database.ExecuteNonQuery(sqlStringCommand) >= 1);
 }
Exemple #37
0
 public override bool ClearSubjectProducts(SubjectType subjectType)
 {
     DbCommand sqlStringCommand = database.GetSqlStringCommand("DELETE FROM Hishop_SubjectProducts WHERE SubjectType = @SubjectType");
     database.AddInParameter(sqlStringCommand, "SubjectType", DbType.Int32, (int)subjectType);
     return (database.ExecuteNonQuery(sqlStringCommand) > 0);
 }
 public EmailSubject(SubjectType subjectType, string subject)
 {
     Type = subjectType;
     Subject = subject;
 }
Exemple #39
0
 public static bool AddSubjectProducts(SubjectType subjectType, IList<int> productIds)
 {
     return ProductProvider.Instance().AddSubjectProducts(subjectType, productIds);
 }
Exemple #40
0
 public static bool ClearSubjectProducts(SubjectType subjectType)
 {
     return ProductProvider.Instance().ClearSubjectProducts(subjectType);
 }
 public Subject(int id, String name, SubjectType type)
 {
     this.id   = id;
     this.name = name;
     this.type = type;
 }
Exemple #42
0
 public static DbQueryResult GetSubjectProducts(SubjectType subjectType, Pagination page)
 {
     return ProductProvider.Instance().GetSubjectProducts(subjectType, page);
 }
 private void LoadParameters()
 {
     if (!string.IsNullOrEmpty(base.Request.QueryString["Keywords"]))
     {
         keywords = base.Request.QueryString["Keywords"];
     }
     if (!string.IsNullOrEmpty(base.Request.QueryString["CategoryId"]))
     {
         int result = 0;
         if (int.TryParse(base.Request.QueryString["CategoryId"], out result))
         {
             categoryId = new int?(result);
         }
     }
     if (!string.IsNullOrEmpty(base.Request.QueryString["subjectType"]))
     {
         int num2 = 0;
         if (int.TryParse(base.Request.QueryString["subjectType"], out num2))
         {
             subjectType = (SubjectType)num2;
         }
     }
 }
Exemple #44
0
 public override DbQueryResult GetSubjectProducts(SubjectType subjectType, Pagination page)
 {
     return DataHelper.PagingByRownumber(page.PageIndex, page.PageSize, page.SortBy, page.SortOrder, page.IsCount, "vw_Hishop_BrowseProductList", "ProductId", string.Format("ProductId IN (SELECT ProductId FROM Hishop_SubjectProducts WHERE SubjectType = {0})", (int)subjectType), "ProductId, ProductCode, ProductName, ThumbnailUrl40, MarketPrice, SalePrice, Stock, DisplaySequence");
 }
        /// <summary>
        /// Displays the permissions for a subject in the actions matrix.
        /// </summary>
        /// <param name="subject">The subject.</param>
        /// <param name="type">The subject type.</param>
        private void DisplaySubjectPermissions(string subject, SubjectType type)
        {
            lblSelectedSubject.Text = subject;

            string[] grants = null;
            string[] denials = null;

            switch(CurrentResourceType) {
                case AclResources.Namespaces:
                    if(type == SubjectType.Group) {
                        grants = AuthReader.RetrieveGrantsForNamespace(
                            Users.FindUserGroup(subject),
                            Pages.FindNamespace(CurrentResourceName));
                        denials = AuthReader.RetrieveDenialsForNamespace(
                            Users.FindUserGroup(subject),
                            Pages.FindNamespace(CurrentResourceName));
                    }
                    else {
                        grants = AuthReader.RetrieveGrantsForNamespace(
                            Users.FindUser(subject),
                            Pages.FindNamespace(CurrentResourceName));
                        denials = AuthReader.RetrieveDenialsForNamespace(
                            Users.FindUser(subject),
                            Pages.FindNamespace(CurrentResourceName));
                    }
                    break;
                case AclResources.Pages:
                    if(type == SubjectType.Group) {
                        grants = AuthReader.RetrieveGrantsForPage(
                            Users.FindUserGroup(subject),
                            Pages.FindPage(CurrentResourceName));
                        denials = AuthReader.RetrieveDenialsForPage(
                            Users.FindUserGroup(subject),
                            Pages.FindPage(CurrentResourceName));
                    }
                    else {
                        grants = AuthReader.RetrieveGrantsForPage(
                            Users.FindUser(subject),
                            Pages.FindPage(CurrentResourceName));
                        denials = AuthReader.RetrieveDenialsForPage(
                            Users.FindUser(subject),
                            Pages.FindPage(CurrentResourceName));
                    }
                    break;
                case AclResources.Directories:
                    string directory = CurrentResourceName;
                    IFilesStorageProviderV30 prov = Collectors.FilesProviderCollector.GetProvider(CurrentFilesProvider);
                    if(type == SubjectType.Group) {
                        grants = AuthReader.RetrieveGrantsForDirectory(
                            Users.FindUserGroup(subject),
                            prov, directory);
                        denials = AuthReader.RetrieveDenialsForDirectory(
                            Users.FindUserGroup(subject),
                            prov, directory);
                    }
                    else {
                        grants = AuthReader.RetrieveGrantsForDirectory(
                            Users.FindUser(subject),
                            prov, directory);
                        denials = AuthReader.RetrieveDenialsForDirectory(
                            Users.FindUser(subject),
                            prov, directory);
                    }
                    break;
                default:
                    throw new NotSupportedException();
            }

            aclActionsSelector.GrantedActions = grants;
            aclActionsSelector.DeniedActions = denials;

            btnSave.Enabled = true;
            btnRemove.Enabled = true;
        }
 /// <summary>
 /// Constructeur
 /// </summary>
 public InputGridSheetForm(SubjectType subjectType)
 {
     this.SubjectType = subjectType;
     InitializeComponents();
 }
Exemple #47
0
 public IEnumerable<Tag> Get(SubjectType subjectType, int subjectId)
 {
     var response = _client.Execute<List<Tag>>(new RestRequest(String.Format("{0}/{1}/tags.xml", subjectType.ToString().ToLower(), subjectId), Method.GET));
     return response.Data;
 }
Exemple #48
0
 public Room(string aName, SubjectType aType)
 {
     Name = aName;
     Type = aType;
 }
 public abstract bool ClearSubjectProducts(SubjectType subjectType);
Exemple #50
0
 public IEnumerable <Email> Get(SubjectType subjectType, int subjectId, DateTime startDate, int?offset = null)
 {
     throw new NotImplementedException();
 }
 public abstract bool RemoveSubjectProduct(SubjectType subjectType, int productId);
Exemple #52
0
 public EmailSubject(SubjectType subjectType, string subject)
 {
     Type    = subjectType;
     Subject = subject;
 }
Exemple #53
0
        /// <summary>
        /// Displays the permissions for a subject in the actions matrix.
        /// </summary>
        /// <param name="subject">The subject.</param>
        /// <param name="type">The subject type.</param>
        private void DisplaySubjectPermissions(string subject, SubjectType type)
        {
            lblSelectedSubject.Text = subject;

            string[] grants  = null;
            string[] denials = null;

            switch (CurrentResourceType)
            {
            case AclResources.Namespaces:
                if (type == SubjectType.Group)
                {
                    grants = AuthReader.RetrieveGrantsForNamespace(
                        Users.FindUserGroup(subject),
                        Pages.FindNamespace(CurrentResourceName));

                    denials = AuthReader.RetrieveDenialsForNamespace(
                        Users.FindUserGroup(subject),
                        Pages.FindNamespace(CurrentResourceName));
                }
                else
                {
                    grants = AuthReader.RetrieveGrantsForNamespace(
                        Users.FindUser(subject),
                        Pages.FindNamespace(CurrentResourceName));
                    denials = AuthReader.RetrieveDenialsForNamespace(
                        Users.FindUser(subject),
                        Pages.FindNamespace(CurrentResourceName));
                }
                break;

            case AclResources.Pages:
                if (type == SubjectType.Group)
                {
                    grants = AuthReader.RetrieveGrantsForPage(
                        Users.FindUserGroup(subject),
                        Pages.FindPage(CurrentResourceName));
                    denials = AuthReader.RetrieveDenialsForPage(
                        Users.FindUserGroup(subject),
                        Pages.FindPage(CurrentResourceName));
                }
                else
                {
                    grants = AuthReader.RetrieveGrantsForPage(
                        Users.FindUser(subject),
                        Pages.FindPage(CurrentResourceName));
                    denials = AuthReader.RetrieveDenialsForPage(
                        Users.FindUser(subject),
                        Pages.FindPage(CurrentResourceName));
                }
                break;

            case AclResources.Directories:
                string directory = CurrentResourceName;
                IFilesStorageProviderV30 prov = Collectors.FilesProviderCollector.GetProvider(CurrentFilesProvider);
                if (type == SubjectType.Group)
                {
                    grants = AuthReader.RetrieveGrantsForDirectory(
                        Users.FindUserGroup(subject),
                        prov, directory);
                    denials = AuthReader.RetrieveDenialsForDirectory(
                        Users.FindUserGroup(subject),
                        prov, directory);
                }
                else
                {
                    grants = AuthReader.RetrieveGrantsForDirectory(
                        Users.FindUser(subject),
                        prov, directory);
                    denials = AuthReader.RetrieveDenialsForDirectory(
                        Users.FindUser(subject),
                        prov, directory);
                }
                break;

            default:
                throw new NotSupportedException();
            }

            aclActionsSelector.GrantedActions = grants;
            aclActionsSelector.DeniedActions  = denials;

            btnSave.Enabled   = true;
            btnRemove.Enabled = true;
        }
Exemple #54
0
 public override IList<int> GetSubjectProductIds(SubjectType subjectType)
 {
     IList<int> list = new List<int>();
     DbCommand sqlStringCommand = database.GetSqlStringCommand("SELECT ProductId FROM Hishop_SubjectProducts WHERE SubjectType=@SubjectType");
     database.AddInParameter(sqlStringCommand, "SubjectType", DbType.Int32, (int)subjectType);
     using (IDataReader reader = database.ExecuteReader(sqlStringCommand))
     {
         while (reader.Read())
         {
             list.Add((int)reader["ProductId"]);
         }
     }
     return list;
 }
Exemple #55
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="codex">Provides subject entries for target values.</param>
        /// <param name="gameHelper">Provides utility methods for interacting with the game code.</param>
        /// <param name="npc">The lookup target.</param>
        /// <param name="type">The NPC type.</param>
        /// <param name="metadata">Provides metadata that's not available from the game data directly.</param>
        /// <param name="translations">Provides translations stored in the mod folder.</param>
        /// <param name="reflectionHelper">Simplifies access to private game code.</param>
        /// <param name="progressionMode">Whether to only show content once the player discovers it.</param>
        /// <param name="highlightUnrevealedGiftTastes">Whether to highlight item gift tastes which haven't been revealed in the NPC profile.</param>
        /// <remarks>Reverse engineered from <see cref="NPC"/>.</remarks>
        public CharacterSubject(SubjectFactory codex, GameHelper gameHelper, NPC npc, SubjectType type, Metadata metadata, ITranslationHelper translations, IReflectionHelper reflectionHelper, bool progressionMode, bool highlightUnrevealedGiftTastes)
            : base(codex, gameHelper, translations)
        {
            this.Reflection      = reflectionHelper;
            this.ProgressionMode = progressionMode;
            this.HighlightUnrevealedGiftTastes = highlightUnrevealedGiftTastes;

            // initialize
            this.Target     = npc;
            this.TargetType = type;
            CharacterData overrides = metadata.GetCharacter(npc, type);

            this.Initialize(
                name: npc.getName(),
                description: overrides?.DescriptionKey != null ? translations.Get(overrides.DescriptionKey) : null,
                type: CharacterSubject.GetTypeName(npc, type)
                );
            this.IsHauntedSkull = npc is Bat && this.Reflection.GetField <NetBool>(npc, "hauntedSkull").GetValue().Value;
        }
 /// <summary>Get overrides for a game object.</summary>
 /// <param name="character">The character for which to get overrides.</param>
 /// <param name="type">The character type.</param>
 public CharacterData GetCharacter(NPC character, SubjectType type)
 {
     return
         (this.Characters?.FirstOrDefault(p => p.ID == $"{type}::{character.Name}") // override by type + name
          ?? this.Characters?.FirstOrDefault(p => p.ID == type.ToString()));        // override by type
 }
Exemple #57
0
 public static bool RemoveSubjectProduct(SubjectType subjectType, int productId)
 {
     return ProductProvider.Instance().RemoveSubjectProduct(subjectType, productId);
 }
Exemple #58
0
 public static IList<int> GetSubjectProductIds(SubjectType subjectType)
 {
     return ProductProvider.Instance().GetSubjectProductIds(subjectType);
 }
Exemple #59
0
 public LinkedAttributeGridForm(SubjectType SubjectType)
     : this()
 {
     this.SubjectType = SubjectType;
 }
Exemple #60
0
 public static bool AddSubjectProduct(SubjectType subjectType, int productId)
 {
     IList<int> productIds = new List<int>();
     productIds.Add(productId);
     return ProductProvider.Instance().AddSubjectProducts(subjectType, productIds);
 }