Beispiel #1
0
        public static WorkFlowRuleApplied Map(this WorkFlowRulesPOCO wfRulePoco)
        {
            var ret = new WorkFlowRuleApplied
            {
            };

            return(ret);
        }
        internal static List <WorkFlowRulesPOCO> GetWorkFlowRules(int toTake)
        {
            string sqlGetRuleValidationsForConversion =
                string.Format("SELECT * FROM zch.workcenter.workflowRule WITH(NOLOCK) where ruleid > {0} ORDER BY RuleID", lastWFIdRead);

            List <WorkFlowRulesPOCO> ret = new List <WorkFlowRulesPOCO>();

            using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["DSN"]))
                using (SqlCommand cmd = new SqlCommand(sqlGetRuleValidationsForConversion, conn))
                {
                    conn.Open();
                    var reader = cmd.ExecuteReader();

                    int i = 0;
                    while (reader.Read() && i++ < toTake)
                    {
                        WorkFlowRulesPOCO r = new WorkFlowRulesPOCO
                        {
                            RuleId           = int.Parse(reader["ruleid"].ToString()),
                            UserId           = int.Parse(reader["usrid"].ToString()),
                            AccountId        = int.Parse(reader["AccountId"].ToString()),
                            DTCreated        = DateTime.Parse(reader["DTCreated"].ToString()),
                            WorkGroupID      = int.Parse(reader["WorkGroupID"].ToString()),
                            RuleXPath        = reader["RuleXPath"].ToString(),
                            SerializedObject = reader["SerializedObject"].ToString(),
                            RuleOrder        = int.Parse(reader["RuleOrder"].ToString()),
                            Broken           = reader["Broken"].ToString() == "0",
                        };

                        if (r.RuleXPath.StartsWith("/*[("))
                        {
                            r.RuleXPath = r.RuleXPath.Substring(4, r.RuleXPath.Length - 4 - 4);
                        }

                        ret.Add(r);
                    }
                }

            lastValIdRead = ret.Max(c => c.RuleId);
            return(ret);
        }