• c#执行sql语句的问题


    var sql = "UPDATE dbo.Purchase_Order SET StatusID = 14,StatusText='已合并', Remark=isnull(Remark, '') + '" + _orderInfo.OrderCode + "' WHERE Order_Id in (" + Order_Ids + ")";
    Purchase_OrderRepository.Instance.DataContext.ExecuteNonQuery(CommandType.Text, sql);

    --------------

    sql = "select count(*) from Purchase_Order where Order_Id = " + info.idValue + " and StatusText = '终止'";
    int reVal = base.Repository.DataContext.ExecuteScalar(CommandType.Text, sql).GetInt();
    if (reVal < 0)
    {
    rinfo.Data = reVal;
    rinfo.Result = false;
    rinfo.Msg = "状态没有为终止,开启失败!";
    }

    ------------

    SqlParameter[] paramList = new SqlParameter[2];
    where = "UserProductCode=@UserProductCode and OrderCode=@OrderCode OR TrackingNumber=@OrderCode";
    paramList[0] = new SqlParameter("@OrderCode", OrderCode.SqlSecurity()) { DbType = DbType.String };
    paramList[1] = new SqlParameter("@UserProductCode", UserProductCode.SqlSecurity()) { DbType = DbType.String };
    Purchase_Order orderInfo = Purchase_OrderRepository.Instance.Get(where, paramList);
    if (orderInfo == null)
    {
    info.Result = false;
    info.Msg = "采购单数据不存在!";
    return info;
    }
    if (orderInfo.StatusText == "完全交货")
    {
    info.Result = false;
    info.Msg = "该订单已经完成交货!";
    return info;
    }

    ----------------------------------------------------------------------

    sql = "select count(*) from TMS_Voyage where VoyageCode ='" + reqInfo.Code+"'" ;
    DataTable table = TMS_VoyageRepository.Instance.DataContext.ExecuteDataSet(CommandType.Text, sql).Tables[0];
    if (table != null && table.Rows.Count > 0)
    {
    sql = "Update TMS_Voyage set ActualTakeOffTime =" + reqInfo.ActualTakeOffTime + " where VoyageCode =" + reqInfo.Code;
    TMS_VoyageRepository.Instance.DataContext.ExecuteNonQuery(CommandType.Text, sql);
    info.Result = true;
    }

    -------------------------------------------

    Where = "UserProduct_Id=@UserProduct_Id AND Enable =1";
    var parmentlist = new List<SqlParameter>();
    parmentlist.Add(new SqlParameter("@UserProduct_Id", UserHelper.UserInfo.UserProduct_Id));
    var Consignlist = Base_ConsignorRepository.Instance.GetMany(Where, parmentlist.ToArray()).ToList();
    if (Consignlist != null)
    {
    info.Result = true;
    info.Data = Consignlist;
    }

  • 相关阅读:
    如何自动生成参考文献格式
    VS2010+OpenCV 项目生成EXE文件如何在其他电脑上直接运行
    从多核CPU Cache一致性的应用到分布式系统一致性的概念迁移
    【译】为什么永远都不要使用MongoDB Why You Should Never Use MongoDB
    团队技能提升的二三事儿
    从微信朋友圈的评论可见性,谈因果一致性在分布式系统中的应用
    我所认为的软件可靠性的三重境界
    Redis核心原理与实践--事务实践与源码分析
    Redis核心原理与实践--Redis启动过程源码分析
    选择SaaS平台的那些事
  • 原文地址:https://www.cnblogs.com/lvqianqian/p/9989492.html
Copyright © 2020-2023  润新知