zoukankan      html  css  js  c++  java
  • Linq-C#左连接

      var list = (from dr in dt_project.AsEnumerable()
                            join d1 in list_businessclass on dr.Field<Guid?>("BusinessClass") equals d1.ID into temp0
                            from tp0 in temp0.DefaultIfEmpty()
                            join d2 in list_dic_ppmodle on dr.Field<Guid?>("SanctionPPMode") equals d2.ID into temp1
                            from tp1 in temp1.DefaultIfEmpty()
                            join d3 in list_dic_ppmodle on dr.Field<Guid?>("RealPPMode") equals d3.ID into temp2
                            from tp2 in temp2.DefaultIfEmpty()
                            select new
                            {
                                ProjectID = dr.Field<Guid?>("ProjectID"),
                                ResponsibleUnit = dr.Field<Guid?>("ResponsibleUnit"),
                                OwnerUnitName = dr.Field<string>("OwnerUnitName"),//,
                                ProjectName = dr.Field<string>("ProjectName"),
                                BusinessClass = dr.Field<Guid?>("BusinessClass"),
                                BusinessClassText = (tp0 == null ? "" : tp0.Title),
                                //设立
                                EstablishedTime = dr.Field<DateTime?>("EstablishedTime") == null ? "" : Convert.ToDateTime(dr.Field<DateTime?>("EstablishedTime")).ToString("yyyy-MM-dd"),//立项时间
                                EstablishReplyCode = dr.Field<string>("EstablishReplyCode"),//立项批复文号
                                EstablishReplyCodeAttach = dr.Field<string>("EstablishReplyCodeAttach"),//立项批复文号附件
                                //可研
                                FeasibilityStudyReplyTime = dr.Field<DateTime?>("FeasibilityStudyReplyTime") == null ? "" : Convert.ToDateTime(dr.Field<DateTime?>("FeasibilityStudyReplyTime")).ToString("yyyy-MM-dd"),//可研批复时间
                                FeasibilityStudyReplyCode = dr.Field<string>("FeasibilityStudyReplyCode"),//可研批复文号
                                FeasibilityStudyReplyCodeAttach = dr.Field<string>("FeasibilityStudyReplyCodeAttach"),//可研批复文号附件
                                //概算
                                ApproximateReplyTime = dr.Field<DateTime?>("ApproximateReplyTime") == null ? "" : Convert.ToDateTime(dr.Field<DateTime?>("ApproximateReplyTime")).ToString("yyyy-MM-dd"),//概算批复时间
                                ApproximateReplyCode = dr.Field<string>("ApproximateReplyCode"),//概算批准文号
                                ApproximateReplyCodeAttach = dr.Field<string>("ApproximateReplyCodeAttach"),//概算批准文号附件
                                ApproximateExamApprovalMoney = dr.Field<decimal?>("ApproximateExamApprovalMoney") ?? 0,//概算审批金额
                                //招投标项目信息核准招标方式表
                                ApprovedInviteBidModeTime = dr.Field<DateTime?>("ApprovedInviteBidModeTime") == null ? "" : Convert.ToDateTime(dr.Field<DateTime?>("ApprovedInviteBidModeTime")).ToString("yyyy-MM-dd"),//核准招标方式时间
                                ApprovedInviteBidModeCode = dr.Field<string>("ApprovedInviteBidModeCode"),//核准招标方式文号
                                ApprovedInviteBidModeMoney = dr.Field<decimal?>("ApprovedInviteBidModeMoney") ?? 0,//招标方式核准金额
                                ApprovedInviteBidModeBasisAttach = dr.Field<string>("ApprovedInviteBidModeBasisAttach"),//上传核准招标方式依据文件
                                IsEvaluate = dr.Field<bool?>("IsEvaluate") ?? false,//项目投资是否评审
                                ApprovedInviteBidModeBasis = dr.Field<string>("ApprovedInviteBidModeBasis"),//上传核准招标方式依据
                                //招投标项目信息结算表
                                FinalAccountMoney = dr.Field<decimal?>("FinalAccountMoney") ?? 0,//决算金额
                                ApproximateExecMoney = dr.Field<decimal?>("ApproximateExecMoney") ?? 0,//执行金额
                                IsExceedApproximate = dr.Field<bool?>("IsExceedApproximate") ?? false,//是否超出概算
                                ExceedApproximateMoney = dr.Field<decimal?>("ExceedApproximateMoney") ?? 0,//超出概算金额
                                //
                                PackageID = dr.Field<Guid?>("PackageID"),//包类型
                                PackageClassID = dr.Field<Guid?>("PackageClassID"),//包类型
                                EngineeringName = dr.Field<string>("EngineeringName"),
                                AgencyName = dr.Field<string>("AgencyName"),
                                InviteSchemeSancDept = dr.Field<string>("InviteSchemeSancDept"),
                                SanctionPPMode = dr.Field<Guid?>("SanctionPPMode"),
                                SanctionPPModeText = (tp1 == null ? "" : tp1.Title),
                                RealPPMode = dr.Field<Guid?>("RealPPMode"),
                                RealPPModeText = (tp2 == null ? "" : tp2.Title),
                                PPChangeSancDept = dr.Field<string>("PPChangeSancDept"),
                                PPChangeReason = dr.Field<string>("PPChangeReason"),
                                PPChangeBasis = dr.Field<string>("PPChangeBasis"),
                                PPChangeBasisAttach = dr.Field<string>("PPChangeBasisAttach"),
                                Media = b_common.TranslateMedia(list_media, dr.Field<string>("Media")),
                                //3
                                SignedContractTime = dr.Field<DateTime?>("SignedContractTime") == null ? "" : Convert.ToDateTime(dr.Field<DateTime?>("SignedContractTime")).ToString("yyyy-MM-dd"),
                                SignedContractMoney = dr.Field<decimal?>("SignedContractMoney") ?? 0,
                                ExecuteUnit = dr.Field<string>("ExecuteUnit"),
                                //3
                                SettlementMoney = dr.Field<decimal?>("SettlementMoney") ?? 0,
                                IsExceedApproximateForPackage = dr.Field<bool?>("IsExceedApproximateForPackage") ?? false,
                                ExceedApproximateBasis = dr.Field<string>("ExceedApproximateBasis"),
                                ExceedApproximateBasisAttach = dr.Field<string>("ExceedApproximateBasisAttach"),
                                Note = dr.Field<string>("Note")
                            }
                  ).ToList();
  • 相关阅读:
    转:细说一个汉字等于几个字符,以及汉字,字符,字节,位之间的关系
    iOS8 无缝切换WKWebView,借鉴IMYWebview,解决进度条,cookie,本地页面等问题
    ios加载本地html
    如何做一个细心的人
    学习h5(开始)
    JLRoute 使用
    大二下学期学习进度(四)
    求首尾相接的数组的最大子数组和
    大二下学期学习进度(三)
    构建之法阅读笔记01
  • 原文地址:https://www.cnblogs.com/yongtaiyu/p/4647834.html
Copyright © 2011-2022 走看看