예제 #1
0
    public void Update(string type, object item, DateTime time)
    {
        if (type == "" || type == null || time == default(DateTime))
        {
            return;
        }

        switch (type)
        {
        case "admin":
            AdminUser ad1 = (AdminUser)item;
            AdminUser ad2 = null;
            if ((ad2 = (AdminUser)this.Get(type, ad1.AdminUserID)) != null)
            {
                ad2.Update(ref ad1, time);
                ad2.LastUpdate   = time;
                ad2.spLastUpdate = time.ToString();
            }
            break;

        case "article":
            Article ar1 = (Article)item;
            Article ar2 = null;
            if ((ar2 = (Article)this.Get(type, ar1.ArticleID)) != null)
            {
                ar2.Update(ref ar1, time);
                ar2.LastUpdate   = time;
                ar2.spLastUpdate = time.ToString();
            }
            break;

        case "content":
            ContentP co1 = (ContentP)item;
            ContentP co2 = null;
            if ((co2 = (ContentP)this.Get(type, co1.ContentID)) != null)
            {
                co2.Update(ref co1, time);
                co2.LastUpdate   = time;
                co2.spLastUpdate = time.ToString();
            }
            break;

        case "log":
            Log lo1 = (Log)item;
            Log lo2 = null;
            if ((lo2 = (Log)this.Get(type, lo1.LogID.ToString())) != null)
            {
                lo2.Update(ref lo1, time);
            }
            break;

        case "graduate":
            Graduate gr1 = (Graduate)item;
            Graduate gr2 = null;
            if ((gr2 = (Graduate)this.Get(type, gr1.GraduateID)) != null)
            {
                gr2.Update(ref gr1, time);
            }
            break;

        case "session":
            GraduateSession ss1 = (GraduateSession)item;
            GraduateSession ss2 = null;
            if ((ss2 = (GraduateSession)this.Get(type, ss1.GraduateSessionID)) != null)
            {
                ss2.Update(ref ss1, time);
            }
            break;

        case "lead":
            Lead le1 = (Lead)item;
            Lead le2 = null;
            if ((le2 = (Lead)this.Get(type, le1.LeadID.ToString())) != null)
            {
                le2.Update(ref le1, time);
            }
            break;

        case "news":
            New ne1 = (New)item;
            New ne2 = null;
            if ((ne2 = (New)this.Get(type, ne1.NewsID.ToString())) != null)
            {
                ne2.Update(ref ne1, time);
            }
            break;

        default:
            break;
        }
        this.coachingDal.SubmitChanges();
    }