FetchOrCreateMemberStatus() public static method

public static FetchOrCreateMemberStatus ( CmsData.CMSDataContext db, string type ) : int
db CmsData.CMSDataContext
type string
return int
コード例 #1
0
        public void UpdateMemberStatus(object savedQuery, string status)
        {
            var id = Person.FetchOrCreateMemberStatus(db, status);
            var q  = db.PeopleQuery2(savedQuery);

            foreach (var p in q)
            {
                p.UpdateValue("MemberStatusId", id);
                p.LogChanges(db);
                db.SubmitChanges();
            }
        }
コード例 #2
0
        public void UpdateMemberStatus(object query, object status)
        {
            var str = status as string;

            using (var db2 = NewDataContext())
            {
                var id = status is int || str.AllDigits()
                    ? status.ToInt()
                    : Person.FetchOrCreateMemberStatus(db2, str);
                if (id == 0)
                {
                    return;
                }
                var q = db2.PeopleQuery2(query);
                foreach (var p in q)
                {
                    p.UpdateValue("MemberStatusId", id);
                    p.LogChanges(db2);
                    db2.SubmitChanges();
                }
            }
        }