当前位置: 首页>>代码示例>>C#>>正文


C# DBHelper.ExecuteSQL方法代码示例

本文整理汇总了C#中DBHelper.ExecuteSQL方法的典型用法代码示例。如果您正苦于以下问题:C# DBHelper.ExecuteSQL方法的具体用法?C# DBHelper.ExecuteSQL怎么用?C# DBHelper.ExecuteSQL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBHelper的用法示例。


在下文中一共展示了DBHelper.ExecuteSQL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddCallbackServiceLogTest

        public void AddCallbackServiceLogTest()
        {
            DBHelper db = new DBHelper();
            db.ExecuteSQL("DELETE FROM DealerServiceLog", null);
            // arrange
            DealerServiceLog log = new DealerServiceLog()
            {
                ServiceType = (int)ServiceType.已竣工,
                DealerID = 2,//(int)DateTime.Now.Ticks,
                ApplyID = 0,
                OperatorSoufunID = 20000,
                OperatorRoleID = (int)OperatorRole.监理,
                OperatorRoleName = OperatorRole.监理.ToString(),
                OperatorRealName = "渣与与",
                SendOrderID = null,
                CallbackRemark = null,
                CreateTime = DateTime.Now,
                ApplySourcePageUrl = null,
                SendOrderCompany = null,
                SigningCompany = null,
                IsDel = 0
            };
            int count = 0;
            // act
            count = db.Add<DealerServiceLog>(log);
            // assert
            Assert.AreEqual(1, count);

            // 已开工
            log.ServiceType = (int)ServiceType.已开工;
            log.OperatorRoleID = 0;
            log.OperatorRoleName = null;
            log.OperatorRealName = null;
            log.CreateTime = DateTime.Now;
            db.Add<DealerServiceLog>(log);

            // 已签约
            // “已签约”,就只显示1家签约公司,不显示派单公司的信息了
            log.ServiceType = (int)ServiceType.已签约;
            log.OperatorRoleID = (int)OperatorRole.运营;
            log.OperatorRoleName = OperatorRole.运营.ToString();
            log.OperatorRealName = "渣与与";
            log.SigningCompany = "嘻嘻装饰公司";
            log.CreateTime = DateTime.Now;
            db.Add<DealerServiceLog>(log);

            // 已派单
            // 展示派单公司--顺序先派单后签约,如果有
            log.ServiceType = (int)ServiceType.已派单;
            log.SendOrderCompany = "嘻嘻装饰公司,闫亚白装饰公司,美俄可解装饰公司";
            log.SigningCompany = null;
            log.CreateTime = DateTime.Now;
            db.Add<DealerServiceLog>(log);

            // 待派单
            log.ServiceType = (int)ServiceType.待派单;
            log.OperatorRoleID = (int)OperatorRole.客服;
            log.OperatorRoleName = OperatorRole.客服.ToString();
            log.OperatorRealName = "张亮亮";
            log.SendOrderCompany = null;
            log.SigningCompany = null;
            log.CreateTime = DateTime.Now;
            db.Add<DealerServiceLog>(log);

            // 已回访
            log.ServiceType = (int)ServiceType.已回访;
            log.OperatorRoleID = (int)OperatorRole.客服;
            log.OperatorRoleName = OperatorRole.客服.ToString();
            log.OperatorRealName = "张亮亮";
            log.CallbackRemark = "回访备注回访备注回访备注回访备注回访备注回访备注回访备注回访备注回访备注回访备注回访备注回访备注回访备注";
            log.CreateTime = DateTime.Now;
            db.Add<DealerServiceLog>(log);

            // 已报名
            log.ServiceType = (int)ServiceType.已报名;
            log.OperatorRoleID = 0;
            log.OperatorRoleName = null;
            log.OperatorRealName = null;
            log.CallbackRemark = null;
            log.CreateTime = DateTime.Now;
            db.Add<DealerServiceLog>(log);
        }
开发者ID:AllenSteve,项目名称:Instance,代码行数:82,代码来源:LogServiceTest.cs

示例2: AddDealerServiceLogTest

        public void AddDealerServiceLogTest()
        {
            // arrange
            DBHelper db = new DBHelper();
            DealerServiceLog log = new DealerServiceLog()
            {
                ServiceType = (int)ServiceType.已签约,
                DealerID=1,//(int)DateTime.Now.Ticks,
                ApplyID=0,
                OperatorSoufunID=10000,
                OperatorRoleID=(int)OperatorRole.客服,
                OperatorRoleName=OperatorRole.客服.ToString(),
                OperatorRealName="张亮亮",
                OrderID="6372637284783",
                Description = "积分奖励3多米",
                CreateTime=DateTime.Now,
                IsDel=0
            };
            int count = 0;

            // act
            db.ExecuteSQL("DELETE FROM DealerServiceLog", null);

            count = db.Add<DealerServiceLog>(log);
            // assert
            Assert.AreEqual(1, count);

            log.ServiceType = (int)ServiceType.退单失败;
            log.OperatorRoleID = (int)OperatorRole.运营;
            log.OperatorRoleName = OperatorRole.运营.ToString();
            log.OperatorRealName = "张亮亮";
            log.Description = "退单申请被驳回";
            // act
            count = db.Add<DealerServiceLog>(log);
            // assert
            Assert.AreEqual(1, count);

            log.ServiceType = (int)ServiceType.退单成功;
            log.OperatorRoleID = (int)OperatorRole.运营经理;
            log.OperatorRoleName = OperatorRole.运营经理.ToString();
            log.OperatorRealName = "张亮亮";
            log.Description = "积分返还 3多米,信息费返款 166元";
            // act
            count = db.Add<DealerServiceLog>(log);
            // assert
            Assert.AreEqual(1, count);

            log.ServiceType = (int)ServiceType.申请退单;
            log.OperatorRoleID = (int)OperatorRole.商家;
            log.OperatorRoleName = OperatorRole.商家.ToString();
            log.OperatorRealName = "张媛媛";
            log.Description = null;
            // act
            count = db.Add<DealerServiceLog>(log);
            // assert
            Assert.AreEqual(1, count);

            //DealerServiceLog L = db.Query<DealerServiceLog>("SELECT * FROM DealerServiceLog WHERE ID=78").FirstOrDefault();

            //L.Description = "UPDATE<T>():测试用例";

            //db.Update<DealerServiceLog>(L);
        }
开发者ID:AllenSteve,项目名称:Instance,代码行数:63,代码来源:LogServiceTest.cs


注:本文中的DBHelper.ExecuteSQL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。