当前位置: 代码迷 >> .NET分析设计 >> 评论一下内容优点和缺点,怎么做更好
  详细解决方案

评论一下内容优点和缺点,怎么做更好

热度:165   发布时间:2016-05-01 22:43:18.0
评论一下内容优点和缺点,如何做更好~

    public interface ITrade
    {
        void UpdateTradeByTid(string Tid);
        bool CheckTrade(string Tid);
        void InsertTrade(TB_Trade trade);
        TB_Trade GetTrade(string Tid);
    }
    public class Trade : ITrade
    {
        public void UpdateTradeByTid(string Tid)
        {
            TB_Trade trade = GetTrade(Tid);
            if (trade == null)
            {
                trade = new TB_Trade();
                InsertTrade(trade);
            }
            else
            {
                using (GuoTBManageEntities context = new GuoTBManageEntities())
                {
                    context.Entry(trade).State = EntityState.Modified;
                    context.SaveChanges();
                }
            }
        }
        public bool CheckTrade(string Tid)
        {
            TB_Trade trade=GetTrade(Tid);
            return trade == null ? false : true;
        }
        public void InsertTrade(TB_Trade trade)
        {
            try
            {
                using (GuoTBManageEntities context = new GuoTBManageEntities())
                {
                    context.TB_Trades.Add(trade);
                    context.SaveChanges();
                }
            }
  相关解决方案
本站暂不开放注册!
内测阶段只得通过邀请码进行注册!
 
  • 最近登录:Thu Mar 30 18:52:27 CST 2017
  • 最近登录:Thu Mar 30 18:52:27 CST 2017
  • 最近登录:Thu Mar 30 18:52:27 CST 2017
  • 最近登录:Thu Mar 30 18:52:27 CST 2017
  • 最近登录:Thu Mar 30 18:52:27 CST 2017