コード例 #1
0
 public static Order Find(int id)
 {
     return((Order)(ActiveRecordBase.FindByPrimaryKey(typeof(Order), id)));
 }
コード例 #2
0
 public static QuestionContainer Find(int id)
 {
     return((QuestionContainer)ActiveRecordBase.FindByPrimaryKey(typeof(QuestionContainer), id));
 }
コード例 #3
0
ファイル: base.cs プロジェクト: quantum-fulltilt/chai-hiv
        /// <summary> </summary>
        virtual public Boolean this_gets_metadata()
        {
            posting post_obj = ActiveRecordBase <posting> .Find(this.baseid);

            return((!post_obj.post_type.is_overwriteable(post_obj)) ? post_obj.post_type.gets_metadata : post_obj.gets_metadata);
        }
コード例 #4
0
ファイル: Person.cs プロジェクト: qinfengzhu/StudyCastle
 public static Person[] FindAll()
 {
     return((Person[])ActiveRecordBase.FindAll(typeof(Person)));
 }
コード例 #5
0
        public string getShapeLatLng_json_str(int id, bool showOnlyEncoded)
        {
            if (showOnlyEncoded == null)
            {
                showOnlyEncoded = true;
            }
            string     gem       = "";
            geometrics geometric = ActiveRecordBase <geometrics> .Find(id);

            if (geometric.boundary != null)
            {
                SqlGeography spatial = geometrics.AsGeography(geometric.boundary);
                string       sp_type = spatial.STGeometryType().ToString().ToUpper();
                switch (sp_type)
                {
                case "POINT":
                    gem = outputRawPoint(spatial);
                    break;

                case "LINESTRING":
                    gem = outputRawLineString(spatial);
                    break;

                case "POLYGON":
                    gem = outputRawPolygon(spatial);
                    break;

                case "MULTIPOINT":
                    break;

                case "MULTILINESTRING":
                    break;

                case "MULTIPOLYGON":
                    break;
                }
            }
            String shape = "";

            shape += @"
                {";
            String shapeOptions = "";

            shapeOptions += @"       ""name"":""" + geometric.name + @""",";
            //shapeOptions += (showOnlyEncoded ? @"      ""latlng_str"":""" + gem + @"""," : "");
            // shapeOptions += @"       ""encoded"":""" + (geometric.encoded!=null? HelperService.EscapeForJson(geometric.encoded) : "") + @""",";
            if (geometric.children.Count > 0)
            {
                String obj = "";
                foreach (geometrics child in geometric.children)
                {
                    obj += (child.encoded != null ? (obj == "" ? "" : ",") + @"""" + HelperService.EscapeForJson(child.encoded) + @"""" : "");
                }

                shapeOptions += @"       ""encoded"":[" + obj + @"],";
            }
            else
            {
                shapeOptions += @"       ""encoded"":""" + (geometric.encoded != null ? HelperService.EscapeForJson(geometric.encoded) : "") + @""",";
            }



            shapeOptions += (geometric.style.Count > 0 ? @"      ""style"":" + geometric.style[0].style_obj + @"," : "");
            shapeOptions += @"      ""type"":""" + (geometric.default_type != null?geometric.default_type.name:"polygon") + @"""";

            shape += shapeOptions;
            shape += @"
                }";
            return(shape);
        }
コード例 #6
0
 public static void DeleteAll()
 {
     ActiveRecordBase.DeleteAll(typeof(ReferenceEstrato));
 }
コード例 #7
0
 public static ReferenceEstrato[] FindAll()
 {
     return((ReferenceEstrato[])ActiveRecordBase.FindAll(typeof(ReferenceEstrato)));
 }
コード例 #8
0
        public static dynamic _copy_slow <t>(int id, String name) where t : new()
        {
            dynamic org = ActiveRecordBase <t> .Find(id);

            if (String.IsNullOrWhiteSpace(name))
            {
                name = org.name + "_copy";
            }

            /*
             * dynamic copy = new t().InjectFrom<CloneInjection>(org);
             *
             * IValueInjecter injecter = new ValueInjecter();
             * injecter.Inject(copy, org);
             */
            /*Mapper.Reset();
             *
             * Mapper.CreateMap<dynamic, dynamic>().ForMember(x => x.id, o => o.Ignore());
             * Mapper.AssertConfigurationIsValid();
             *
             * var copy = Mapper.Map<t,t>(org);
             *
             * ActiveRecordMediator<dynamic>.Save(copy);*/
            //Mapper.Reset();

            //Mapper.CreateMap<dynamic, dynamic>();//.ForMember(x => x.id, o => o.Ignore());

            dynamic copy = new t();

            copy.name = name;
            ActiveRecordMediator <dynamic> .Save(copy);

            copy = (t)copy;
            int            copy_id  = copy.id;
            IValueInjecter injecter = new ValueInjecter();

            injecter.Inject <CloneInjection>(copy, org);


            //copy = copy.InjectFrom<CloneInjection>(org);
            copy.name = name;
            copy.id   = copy_id;
            try {
                UserService userService = new Services.UserService();
                copy.owner.id = userService.getUserFull().id;
            } catch (Exception ex) {
                // caught it, it is not there..
            }

            copy.status.id = 1;
            copy           = (dynamic)copy;
            //ActiveRecordMediator<dynamic>.Save(copy);

            /*
             * ActiveRecordMediator<dynamic>.Update(copy);
             * try{}
             * catch{
             *  //ActiveRecordMediator<dynamic>.Delete(copy);
             * }
             */
            return(copy);
        }
コード例 #9
0
ファイル: GuildSkill.cs プロジェクト: uvbs/Asda2-Server
 public static GuildSkill[] FindAll(Guild guild)
 {
     return(ActiveRecordBase <GuildSkill> .FindAllByProperty("GuildId", (object)guild.Id));
 }
コード例 #10
0
ファイル: modeDataShare_135.cs プロジェクト: aa5624223/scdw
 public static modeDataShare_135[] FindAll()
 {
     return((modeDataShare_135[])(ActiveRecordBase.FindAll(typeof(modeDataShare_135))));
 }
コード例 #11
0
ファイル: modeDataShare_135.cs プロジェクト: aa5624223/scdw
 public static modeDataShare_135 Find(int id)
 {
     return((modeDataShare_135)(ActiveRecordBase.FindByPrimaryKey(typeof(modeDataShare_135), id)));
 }
コード例 #12
0
ファイル: modeDataShare_135.cs プロジェクト: aa5624223/scdw
 public static void DeleteAll()
 {
     ActiveRecordBase.DeleteAll(typeof(HrmResource));
 }
コード例 #13
0
        /// <summary> </summary>
        public static dynamic make_revision <t>(int id, int version, int revision) where t : new()
        {
            dynamic org;

            org = ActiveRecordBase <t> .TryFind(id);

            if (org == null)
            {
                return(org);
            }
            int     oldrevision = get_last_revision(org);
            dynamic copy        = new t();

            ActiveRecordMediator <dynamic> .Save(copy);

            copy = (t)copy;
            int            copy_id  = copy.baseid;
            IValueInjecter injecter = new ValueInjecter();

            injecter.Inject <CloneInjection>(copy, org);
            if (revision > 0)
            {
                copy.revision = revision + 1;
            }
            else
            {
                copy.revision = oldrevision + 1;
            }
            if (version > 0)
            {
                copy.version = version;
            }
            copy.parent = org;
            copy.baseid = copy_id;

            String dest = "";

            if (copy.loads_file)
            {
                //use the file ext to split.. fix it
                String[] fileparts = copy.static_file.Split('.');
                if (
                    helperService.CalculateMD5Hash(file_handler.read_from_file(copy.static_file))
                    != helperService.CalculateMD5Hash(file_handler.read_from_file(fileparts[0] + "." + copy.version + "." + revision + "." + fileparts[1]))
                    )
                {
                    dest = fileparts[0] + "." + copy.version + "." + copy.revision + "." + fileparts[1];
                    file_handler.copyfile(copy.static_file, dest);
                }
            }

            //copy.status.id = 1;
            //copy = (dynamic)copy;
            try {
                ActiveRecordMediator <dynamic> .Save(copy);

                return(copy);
            } catch {
                ActiveRecordMediator <dynamic> .Delete(copy);

                if (!String.IsNullOrWhiteSpace(dest))
                {
                    file_handler.deletefile(dest);
                }
                return(false);
            }
        }
コード例 #14
0
ファイル: formtable_main.cs プロジェクト: aa5624223/scdw
 public static formtable_main Find(int id)
 {
     return((formtable_main)(ActiveRecordBase.FindByPrimaryKey(typeof(formtable_main), id)));
 }
コード例 #15
0
        /// <summary>
        /// Sets the value.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="value">The value.</param>
        public override void SetValue(ActiveRecordBase item, object value)
        {
            if (CurrentPropertyInfo == null)
                return;

            try
            {
                CurrentPropertyInfo.SetValue(item, Convert.ChangeType(value.ToString(), CurrentPropertyInfo.PropertyType), null);
            }
            catch
            {
            }
        }
コード例 #16
0
ファイル: Survey.cs プロジェクト: qinfengzhu/StudyCastle
 public new static void DeleteAll()
 {
     ActiveRecordBase.DeleteAll(typeof(Survey));
 }
コード例 #17
0
        public static RecipeVO FindById(int id)
        {
            return(ActiveRecordBase <RecipeVO> .Find(id));

            //return all.Where(rec => rec.Id == id).ToArray()[0];
        }
コード例 #18
0
ファイル: Survey.cs プロジェクト: qinfengzhu/StudyCastle
 public static Survey[] FindAll()
 {
     return((Survey[])ActiveRecordBase.FindAll(typeof(Survey)));
 }
コード例 #19
0
 public static ReferenceEstrato Find(int id)
 {
     return((ReferenceEstrato)ActiveRecordBase.FindByPrimaryKey(typeof(ReferenceEstrato), id));
 }
コード例 #20
0
ファイル: Survey.cs プロジェクト: qinfengzhu/StudyCastle
 public new static Survey Find(int id)
 {
     return((Survey)ActiveRecordBase.FindByPrimaryKey(typeof(Survey), id));
 }
コード例 #21
0
ファイル: Person.cs プロジェクト: qinfengzhu/StudyCastle
 public static void DeleteAll()
 {
     ActiveRecordBase.DeleteAll(typeof(Person));
 }
コード例 #22
0
        /// <summary> </summary>
        public static appuser getUserFull(int id)
        {
            appuser user = ActiveRecordBase <appuser> .Find(id);

            return(user);
        }
コード例 #23
0
ファイル: Person.cs プロジェクト: qinfengzhu/StudyCastle
 public static Person Find(int id)
 {
     return((Person)ActiveRecordBase.FindByPrimaryKey(typeof(Person), id));
 }
コード例 #24
0
        /// <summary> </summary>
        public static appuser[] getLogedIn()
        {
            appuser[] users = ActiveRecordBase <appuser> .FindAllByProperty("logedin", true);

            return(users);
        }
コード例 #25
0
 public static void DeleteAll()
 {
     ActiveRecordBase.DeleteAll(typeof(QuestionContainer));
 }
コード例 #26
0
ファイル: Repository.cs プロジェクト: zahirsolak/ActiveRecord
 public new static void DeleteAll()
 {
     ActiveRecordBase.DeleteAll(typeof(Repository));
 }
コード例 #27
0
        /// <summary> </summary>
        public void posting(int iid, string[] cat, int activeitem, Boolean eb, Boolean hasUrl, string sm_url, Boolean dev) {
            //posting post = ActiveRecordBase<posting>.Find(iid);
            List<AbstractCriterion> filtering = new List<AbstractCriterion>();
            editing = false;
            PropertyBag["dev"] = dev;
            //if (!usedev) filtering.Add(Expression.Eq("revision", 0));
            posting post = null;
            if (iid > 0) {
                post = ActiveRecordBase<posting>.Find(iid).get_published();
            } else {
                filtering.Add(Expression.Eq("is_default", true));
                filtering.Add(Expression.Eq("deleted", false));
                filtering.Add(Expression.IsNull("parent")); // the  parent null makes it the working copy to first look too
                filtering.Add(Expression.Eq("post_type", ActiveRecordBase<posting_type>.FindFirst(
                            new List<AbstractCriterion>() { 
                                Expression.Eq("alias", "page")
                            }.ToArray())
                        ));
                post = ActiveRecordBase<posting>.FindFirst(new Order[] { Order.Desc("revision"), Order.Desc("version") }, filtering.ToArray());
                if (post != null) post = post.get_published();
            }

            if(post == null){
                post = postingService.get_posting_by_url("/404.html", usedev).get_published();
                Response.StatusCode = 404;
            }




            /* Items that should be globaly accessed */
            PropertyBag["url"] = sm_url;
            //PropertyBag["campus"] = ActiveRecordBase<campus>.FindAllByProperty("name", "Pullman")[0];

            PropertyBag["selected_taxanony"] = cat;
            PropertyBag["activeitem"] = activeitem;

            PropertyBag["embeded"] = eb;

            site site = siteService.getCurrentSite();
            PropertyBag["site"] = site;

            PropertyBag["baseurl"] = "public/posting.castle";
            PropertyBag["htmlService"] = HtmlService;

            /* add site options */
            if (site.options != null && site.options.Count > 0) {
                foreach (options item in site.options) {
                    PropertyBag[item.option_key.ToUpper()] = item.value.ToString();//ie: post.get_meta("title");
                }
            }

            /* add meta */
            if (post.meta_data != null && post.meta_data.Count > 0) {
                foreach (meta_data item in post.meta_data) {
                    PropertyBag[item.meta_key.ToUpper()] = item.value;//ie: post.get_meta("title");
                }
            }

            String urlQueries = "";
            PropertyBag["urlQueries"] = String.IsNullOrWhiteSpace(urlQueries) ? "" : "iid[]=" + urlQueries.TrimStart(',');
            if (iid > 0) {
                PropertyBag["urlQueries"] += (String.IsNullOrWhiteSpace(urlQueries) ? "" : "&") + "iid=" + iid.ToString();
            }

            PropertyBag["siteroot"] = httpService.getRootUrl().TrimEnd('/');
            PropertyBag["Controller"] = base.MemberwiseClone();
            PropertyBag["mode"] = "published";

            posting pub_post = post.get_published();
            PropertyBag["post"] = pub_post;

            Hashtable content_params = objectService.marge_params(PropertyBag, new Hashtable());


            String output = new renderService().render(post, content_params);



            // bool ActiveRecordBase<site_base>.FindFirst(new List<AbstractCriterion>() { Expression.Eq("name", "minhtml") }.ToArray())
            Boolean tmpB = false;
            if (tmpB) output = htmlService.stripNonSenseContent(output, false);

            RenderText(output);
        }
コード例 #28
0
ファイル: Repository.cs プロジェクト: zahirsolak/ActiveRecord
 public static Repository[] FindAll()
 {
     return((Repository[])ActiveRecordBase.FindAll(typeof(Repository)));
 }
コード例 #29
0
ファイル: base.cs プロジェクト: quantum-fulltilt/chai-hiv
        /// <summary> </summary>
        virtual public Boolean this_is_templatable()
        {
            posting post_obj = ActiveRecordBase <posting> .Find(this.baseid);

            return((!post_obj.post_type.is_overwriteable(post_obj)) ? post_obj.post_type.is_templatable : post_obj.is_templatable);
        }
コード例 #30
0
ファイル: Repository.cs プロジェクト: zahirsolak/ActiveRecord
 public new static Repository Find(int id)
 {
     return((Repository)ActiveRecordBase.FindByPrimaryKey(typeof(Repository), id));
 }
コード例 #31
0
 public static void DeleteAll()
 {
     ActiveRecordBase.DeleteAll(typeof(Order));
 }
コード例 #32
0
        /// <summary>
        /// Gets the value.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <returns></returns>
        public override object GetValue(ActiveRecordBase item)
        {
            if (CurrentPropertyInfo == null)
                return null;

            try
            {
                return CurrentPropertyInfo.GetValue(item, null);
            }
            catch
            {
                return null;
            }
        }