| using System; | 
| using System.Collections.Generic; | 
| using System.Text; | 
| using System.Data; | 
|   | 
| namespace DAL | 
| { | 
|     public  class ClsCrm_CustomerFile:DBUtility.ClsXt_BaseBill | 
|     { | 
|         public Model.ClsCrm_CustomerFileMain omodel = new Model.ClsCrm_CustomerFileMain(); | 
|         public List<Model.ClsCrm_CustomerFileSub> DetailColl = new List<Model.ClsCrm_CustomerFileSub>(); | 
|   | 
|         public ClsCrm_CustomerFile() | 
|         { | 
|             base.MvarItemKeySub = "Crm_CustomerFileSub"; | 
|             base.MvarItemKeySub2 = ""; | 
|             base.MvarItemKeySub3 = ""; | 
|             base.MvarItemKeySub4 = ""; | 
|             base.MvarItemKey="Crm_CustomerFileMain"; | 
|             base.MvarReportTitle="客户档案"; | 
|             base.BillType="4021"; | 
|             base.HBillSubType = "4021"; | 
|   | 
|         } | 
|   | 
|         #region 固定代码 | 
|   | 
|         ~ClsCrm_CustomerFile() | 
|         { | 
|             DetailColl = null; | 
|         } | 
|         | 
|         #endregion   自定义方法 | 
|   | 
|   | 
|         public bool UPDateEmpHolder(Int64 lngBillKey, string sEmpHolder, ref string sReturn) | 
|         { | 
|             try | 
|             { | 
|                 oCn.RunProc(" Update " + MvarItemKey + " set HEmpHolder='" + sEmpHolder + "'  Where HInterID=" + lngBillKey.ToString()); | 
|                 sReturn = ""; | 
|                 return true; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 sReturn = e.Message; | 
|                 throw (e); | 
|             } | 
|         } | 
|   | 
|   | 
|         //删除关联 | 
|         public override void DeleteRelation(ref string sReturn, Int64 lngBillKey) | 
|         { | 
|             //增加销售订单关联数量 | 
|             try | 
|             {  | 
|                 oCn.RunProc("exec h_p_Xs_UpDateSeOrderRelation_Del " + lngBillKey.ToString());  | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 throw (e); | 
|             } | 
|         } | 
|   | 
|         //新增关联 | 
|         public override void AddNewRelation(ref string sReturn, Int64 lngBillKey) | 
|         { | 
|             //增加销售订单 关联数量 | 
|             try | 
|             {  | 
|                 oCn.RunProc("exec h_p_Xs_UpDateSeOrderRelation_Add " + lngBillKey.ToString());  | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 throw (e); | 
|             } | 
|         } | 
|   | 
|   | 
|         //修改单据 | 
|         public override bool ModifyBill(Int64 lngBillKey, ref string sReturn) | 
|         { | 
|             try | 
|             { | 
|                 // | 
|                 oCn.BeginTran(); | 
|                 //更新主表 | 
|                 oCn.RunProc("UpDate Crm_CustomerFileMain set  " + | 
|                 " HBillNo='" + omodel.HBillNo + "'" +  //固定赋值=============== | 
|                 ",HDate='" + omodel.HDate + "'" + | 
|                 ",HYear='" + omodel.HYear.ToString() + "'" + | 
|                 ",HPeriod='" + omodel.HPeriod.ToString() + "'" + | 
|                 ",HRemark='" + omodel.HRemark + "'" + | 
|                 ",HUpDater='" + DBUtility.ClsPub.CurUserName + "'" + | 
|                 ",HUpDateDate=getdate()" + | 
|                     //======================================== | 
|                 ",HCusID=" + omodel.HCusID.ToString() + | 
|                 ",HCusNumber='" + omodel.HCusNumber + "'" + | 
|                 ",HNumber='" + omodel.HNumber + "'" + | 
|                 ",HName='" + omodel.HName + "'" + | 
|                 ",HHelpCode='" + omodel.HHelpCode + "'" + | 
|                 ",HShortName='" + omodel.HShortName + "'" + | 
|                 ",HComSortID='" + omodel.HComSortID + "'" + | 
|                 ",HFoundDate='" + omodel.HFoundDate + "'" + | 
|                 ",HCusTypeID=" + omodel.HCusTypeID.ToString() + | 
|                 ",HCusFrom='" + omodel.HCusFrom + "'" + | 
|                 ",HComNote='" + omodel.HComNote + "'" + | 
|                 ",HEvaluate='" + omodel.HEvaluate + "'" + | 
|                 ",HCreditLevel='" + omodel.HCreditLevel + "'" + | 
|                 ",HComTradeID=" + omodel.HComTradeID.ToString() + | 
|                 ",HComKindID='" + omodel.HComKindID + "'" + | 
|                 ",HComScopeID='" + omodel.HComScopeID + "'" + | 
|                 ",HEmpCount=" + omodel.HEmpCount.ToString() + | 
|                 ",HStatus='" + omodel.HStatus + "'" + | 
|                 ",HAreaID=" + omodel.HAreaID.ToString() + | 
|                 ",HPostNo='" + omodel.HPostNo + "'" + | 
|                 ",HCountry='" + omodel.HCountry + "'" + | 
|                 ",HProvince='" + omodel.HProvince + "'" + | 
|                 ",HCity='" + omodel.HCity + "'" + | 
|                 ",HComAddress='" + omodel.HComAddress + "'" + | 
|                 ",HLawMan='" + omodel.HLawMan + "'" + | 
|                 ",HLinkMan='" + omodel.HLinkMan + "'" + | 
|                 ",HLinkPhone='" + omodel.HLinkPhone + "'" + | 
|                 ",HMobPhone='" + omodel.HMobPhone + "'" + | 
|                 ",HLinkMan2='" + omodel.HLinkMan2 + "'" + | 
|                 ",HLinkPhone2='" + omodel.HLinkPhone2 + "'" + | 
|                 ",HMobPhone2='" + omodel.HMobPhone2 + "'" + | 
|                 ",HLinkMan3='" + omodel.HLinkMan3 + "'" + | 
|                 ",HLinkPhone3='" + omodel.HLinkPhone3 + "'" + | 
|                 ",HMobPhone3='" + omodel.HMobPhone3 + "'" + | 
|                 ",HFax='" + omodel.HFax + "'" + | 
|                 ",HBankroll='" + omodel.HBankroll + "'" + | 
|                 ",HDeptID=" + omodel.HDeptID.ToString() + | 
|                 ",HManagerID=" + omodel.HManagerID.ToString() + | 
|                 ",HSellProduct='" + omodel.HSellProduct + "'" + | 
|                 ",HTurnover='" + omodel.HTurnover + "'" + | 
|                 ",HComTradeNo='" + omodel.HComTradeNo + "'" + | 
|                 ",HComERPStatus='" + omodel.HComERPStatus + "'" + | 
|                 ",HComTarget='" + omodel.HComTarget + "'" + | 
|                 ",HEmpHolder='" + omodel.HEmpHolder + "'" + | 
|                 ",HLinkQty=" + omodel.HLinkQty.ToString() + | 
|                 ",HLinkDate='" + omodel.HLinkDate + "'" + | 
|                 ",HUnCloseChanceQty=" + omodel.HUnCloseChanceQty.ToString() + | 
|                 ",HUnSendProdQty=" + omodel.HUnSendProdQty.ToString() + | 
|                 ",HUnReceiveMoney=" + omodel.HUnReceiveMoney.ToString() + | 
|                 ",HCusStatus='" + omodel.HCusStatus + "'" + | 
|                 ",HLastBusDate='" + omodel.HLastBusDate + "'" + | 
|                 ",HLastLinkDate='" + omodel.HLastLinkDate + "'" + | 
|                 ",HLinkDays=" + omodel.HLinkDays.ToString() + | 
|                 ",HOldEmpHolder='" + omodel.HOldEmpHolder + "'" + | 
|                 ",HOutPubDate='" + omodel.HOutPubDate + "'" + | 
|   | 
|                 " where HInterID=" + lngBillKey.ToString()); | 
|                 //删除关联 | 
|                 DeleteRelation(ref sReturn, lngBillKey); | 
|                 //删除子表 | 
|                 DeleteBillSub(lngBillKey); | 
|                 //插入子表 | 
|                 omodel.HInterID = lngBillKey; | 
|                 foreach (Model.ClsCrm_CustomerFileSub oSub in DetailColl) | 
|                 { | 
|                     oCn.RunProc("Insert into Crm_CustomerFileSub " + | 
|                       " (HInterID,HEntryID,HCloseType,HRemark" + | 
|                       ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + | 
|                       ") values(" | 
|                       + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + | 
|                       "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + | 
|                       ") "); | 
|                 } | 
|                 // | 
|                 //更新订单关联数量 | 
|                 AddNewRelation(ref sReturn, omodel.HInterID); | 
|                 // | 
|                 sReturn = "修改单据成功!"; | 
|                 oCn.Commit(); | 
|                 return true; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 sReturn = e.Message; | 
|                 oCn.RollBack(); | 
|                 throw (e); | 
|             } | 
|         } | 
|         //新增单据 | 
|         public override bool AddBill(ref string sReturn) | 
|         { | 
|             try | 
|             { | 
|                 //得到mainid | 
|                 omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); | 
|                 omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); | 
|                 //若MAINDI重复则重新获取 | 
|                 if (IsExistBillNo(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HBillNo, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew, omodel.HInterID)) | 
|                 { | 
|                     omodel.HBillNo = DBUtility.ClsPub.CreateBillCode(BillType, ref DBUtility.ClsPub.sExeReturnInfo, true); | 
|                 } | 
|                 if (IsExistMainID(ref DBUtility.ClsPub.sExeReturnInfo, omodel.HInterID, Pub_Class.ClsPub.Enum_BillStatus.BillStatus_AddNew)) | 
|                 { | 
|                     omodel.HInterID = DBUtility.ClsPub.CreateBillID(BillType, ref DBUtility.ClsPub.sExeReturnInfo); | 
|                 } | 
|                 // | 
|                 oCn.BeginTran(); | 
|                 //主表 | 
|                 oCn.RunProc("Insert Into Crm_CustomerFileMain   " + | 
|                 "(HBillType,HBillSubType,HInterID,HBillNo,HDate" + | 
|                 ",HYear,HPeriod,HRemark,HMaker,HMakeDate" + | 
|   | 
|                 ",HCusID,HCusNumber,HNumber,HName,HHelpCode" + | 
|                 ",HShortName,HComSortID,HFoundDate,HCusTypeID" + | 
|                 ",HCusFrom,HComNote,HEvaluate,HCreditLevel" + | 
|                 ",HComTradeID,HComKindID,HComScopeID,HEmpCount" + | 
|                 ",HStatus,HAreaID,HPostNo,HCountry,HProvince" + | 
|                 ",HCity,HComAddress,HLawMan,HLinkMan" + | 
|                 ",HLinkPhone,HMobPhone,HLinkMan2,HLinkPhone2" + | 
|                 ",HMobPhone2,HLinkMan3,HLinkPhone3,HMobPhone3" + | 
|                 ",HFax,HBankroll,HDeptID,HManagerID,HSellProduct" + | 
|                 ",HTurnover,HComTradeNo,HComERPStatus,HComTarget" + | 
|                 ",HEmpHolder,HLinkQty,HLinkDate,HUnCloseChanceQty" + | 
|                 ",HUnSendProdQty,HUnReceiveMoney,HCusStatus,HLastBusDate" + | 
|                 ",HLastLinkDate,HLinkDays,HOldEmpHolder,HOutPubDate" + | 
|                 ") " + | 
|                 " values('" + this.BillType + "','"  + this.HBillSubType + "'," +omodel.HInterID.ToString() + ",'" + omodel.HBillNo + "','" + omodel.HDate + "'" + | 
|                 ", " + omodel.HYear.ToString() + "," + omodel.HPeriod.ToString() + ",'" + omodel.HRemark + "','" + DBUtility.ClsPub.CurUserName + "',getdate()" + | 
|   | 
|                 "," + omodel.HCusID.ToString() + ",'" + omodel.HCusNumber + "','" + omodel.HNumber + "','" + omodel.HName + "','" + omodel.HHelpCode + "'" + | 
|                 ",'" + omodel.HShortName + "','" + omodel.HComSortID + "','" + omodel.HFoundDate + "'," + omodel.HCusTypeID.ToString() + | 
|                 ",'" + omodel.HCusFrom + "','" + omodel.HComNote + "','" + omodel.HEvaluate + "','" + omodel.HCreditLevel + "'" + | 
|                 "," + omodel.HComTradeID.ToString() + ",'" + omodel.HComKindID + "','" + omodel.HComScopeID + "'," + omodel.HEmpCount.ToString() + | 
|                 ",'" + omodel.HStatus + "'," + omodel.HAreaID.ToString() + ",'" + omodel.HPostNo + "','" + omodel.HCountry + "','" + omodel.HProvince + "'" + | 
|                 ",'" + omodel.HCity + "','" + omodel.HComAddress + "','" + omodel.HLawMan + "','" + omodel.HLinkMan + "'" + | 
|                 ",'" + omodel.HLinkPhone + "','" + omodel.HMobPhone + "','" + omodel.HLinkMan2 + "','" + omodel.HLinkPhone2 + "'" + | 
|                 ",'" + omodel.HMobPhone2 + "','" + omodel.HLinkMan3 + "','" + omodel.HLinkPhone3 + "','" + omodel.HMobPhone3 + "'" + | 
|                 ",'" + omodel.HFax + "','" + omodel.HBankroll + "'," + omodel.HDeptID.ToString() + "," + omodel.HManagerID.ToString() + ",'" + omodel.HSellProduct + "'" + | 
|                 ",'" + omodel.HTurnover + "','" + omodel.HComTradeNo + "','" + omodel.HComERPStatus + "','" + omodel.HComTarget + "'" + | 
|                 ",'" + omodel.HEmpHolder + "'," + omodel.HLinkQty.ToString() + ",'" + omodel.HLinkDate + "'," + omodel.HUnCloseChanceQty.ToString() + | 
|                 "," + omodel.HUnSendProdQty.ToString() + "," + omodel.HUnReceiveMoney.ToString() + ",'" + omodel.HCusStatus + "','" + omodel.HLastBusDate + "'" + | 
|                 ",'" + omodel.HLastLinkDate + "'," + omodel.HLinkDays.ToString() + ",'" + omodel.HOldEmpHolder + "','" + omodel.HOutPubDate + "'" + | 
|                 ") "); | 
|                 //插入子表 | 
|                 foreach (Model.ClsCrm_CustomerFileSub oSub in DetailColl) | 
|                 { | 
|                     oCn.RunProc("Insert into Crm_CustomerFileSub " + | 
|                        " (HInterID,HEntryID,HCloseType,HRemark" + | 
|                        ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HRelationQty,HRelationMoney" + | 
|                        ") values(" | 
|                        + omodel.HInterID.ToString() + "," + oSub.HEntryID.ToString() + "," + Convert.ToString(oSub.HCloseType ? 1 : 0) + ",'" + oSub.HRemark + "'" + | 
|                        "," + oSub.HSourceInterID.ToString() + "," + oSub.HSourceEntryID.ToString() + ",'" + oSub.HSourceBillNo + "','" + oSub.HSourceBillType + "'," + oSub.HRelationQty.ToString() + "," + oSub.HRelationMoney.ToString() + | 
|                        ") "); | 
|                 } | 
|                 //更新订单关联数量 | 
|                 AddNewRelation(ref sReturn, omodel.HInterID); | 
|                 // | 
|                 sReturn = "新增单据成功!"; | 
|                 oCn.Commit(); | 
|                 return true; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 sReturn = e.Message; | 
|                 oCn.RollBack(); | 
|                 throw (e); | 
|             } | 
|         } | 
|   | 
|   | 
|   | 
|         //显示单据 | 
|         public override bool ShowBill(Int64 lngBillKey, ref string sReturn) | 
|         { | 
|             try | 
|             { | 
|                 //查询主表 | 
|                 DataSet Ds ; | 
|                 Ds = oCn.RunProcReturn("Select * from Crm_CustomerFileMain Where HInterID=" + lngBillKey.ToString(), "Crm_CustomerFileMain"); | 
|                 if(Ds.Tables[0].Rows.Count==0) | 
|                 { | 
|                     sReturn = "单据未找到!"; | 
|                     return false; | 
|                 } | 
|                 //固定赋值=========================================== | 
|                 omodel.HYear = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HYear"]); | 
|                 omodel.HPeriod = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HPeriod"]); | 
|                 omodel.HBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillType"]); | 
|                 omodel.HBillSubType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBillSubType"]); | 
|                 omodel.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"]); | 
|                 omodel.HDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HDate"]); | 
|                 omodel.HBillNo = Ds.Tables[0].Rows[0]["HBillNo"].ToString().Trim(); | 
|                 omodel.HBillStatus = DBUtility.ClsPub.isInt(Ds.Tables[0].Rows[0]["HBillStatus"]); | 
|                 omodel.HCheckItemNowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNowID"]); | 
|                 omodel.HCheckItemNextID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckItemNextID"]); | 
|                 omodel.HCheckFlowID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCheckFlowID"]); | 
|                 omodel.HRemark = Ds.Tables[0].Rows[0]["HRemark"].ToString().Trim(); | 
|                 omodel.HBackDate = Ds.Tables[0].Rows[0]["HBackDate"].ToString().Trim(); | 
|                 omodel.HBacker = Ds.Tables[0].Rows[0]["HBacker"].ToString().Trim(); | 
|                 omodel.HCheckDate = Ds.Tables[0].Rows[0]["HCheckDate"].ToString().Trim(); | 
|                 omodel.HChecker = Ds.Tables[0].Rows[0]["HChecker"].ToString().Trim(); | 
|                 omodel.HMaker = Ds.Tables[0].Rows[0]["HMaker"].ToString().Trim(); | 
|                 omodel.HMakeDate = Ds.Tables[0].Rows[0]["HMakeDate"].ToString().Trim(); | 
|                 omodel.HUpDateDate = Ds.Tables[0].Rows[0]["HUpDateDate"].ToString().Trim(); | 
|                 omodel.HUpDater = Ds.Tables[0].Rows[0]["HUpDater"].ToString().Trim(); | 
|                 omodel.HCloseDate = Ds.Tables[0].Rows[0]["HCloseDate"].ToString().Trim(); | 
|                 omodel.HCloseMan = Ds.Tables[0].Rows[0]["HCloseMan"].ToString().Trim(); | 
|                 omodel.HCloseType = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HCloseType"]); | 
|                 omodel.HDeleteDate = Ds.Tables[0].Rows[0]["HDeleteDate"].ToString().Trim(); | 
|                 omodel.HDeleteMan = Ds.Tables[0].Rows[0]["HDeleteMan"].ToString().Trim(); | 
|                 //======================================================== | 
|                 omodel.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusID"]); | 
|                 omodel.HCusNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCusNumber"]); | 
|                 omodel.HNumber = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HNumber"]); | 
|                 omodel.HName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HName"]); | 
|                 omodel.HHelpCode = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HHelpCode"]); | 
|                 omodel.HShortName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HShortName"]); | 
|                 omodel.HComSortID = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HComSortID"]); | 
|                 omodel.HFoundDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HFoundDate"]); | 
|                 omodel.HCusTypeID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusTypeID"]); | 
|                 omodel.HCusFrom = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCusFrom"]); | 
|                 omodel.HComNote = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HComNote"]); | 
|                 omodel.HEvaluate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEvaluate"]); | 
|                 omodel.HCreditLevel = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCreditLevel"]); | 
|                 omodel.HComTradeID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HComTradeID"]); | 
|                 omodel.HComKindID = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HComKindID"]); | 
|                 omodel.HComScopeID = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HComScopeID"]); | 
|                 omodel.HEmpCount = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpCount"]); | 
|                 omodel.HStatus = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HStatus"]); | 
|                 omodel.HAreaID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HAreaID"]); | 
|                 omodel.HPostNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HPostNo"]); | 
|                 omodel.HCountry = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCountry"]); | 
|                 omodel.HProvince = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HProvince"]); | 
|                 omodel.HCity = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCity"]); | 
|                 omodel.HComAddress = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HComAddress"]); | 
|                 omodel.HLawMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLawMan"]); | 
|                 omodel.HLinkMan = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLinkMan"]); | 
|                 omodel.HLinkPhone = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLinkPhone"]); | 
|                 omodel.HMobPhone = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMobPhone"]); | 
|                 omodel.HLinkMan2 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLinkMan2"]); | 
|                 omodel.HLinkPhone2 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLinkPhone2"]); | 
|                 omodel.HMobPhone2 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMobPhone2"]); | 
|                 omodel.HLinkMan3 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLinkMan3"]); | 
|                 omodel.HLinkPhone3 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLinkPhone3"]); | 
|                 omodel.HMobPhone3 = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HMobPhone3"]); | 
|                 omodel.HFax = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HFax"]); | 
|                 omodel.HBankroll = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBankroll"]); | 
|                 omodel.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"]); | 
|                 omodel.HManagerID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HManagerID"]); | 
|                 omodel.HSellProduct = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSellProduct"]); | 
|                 omodel.HTurnover = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HTurnover"]); | 
|                 omodel.HComTradeNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HComTradeNo"]); | 
|                 omodel.HComERPStatus = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HComERPStatus"]); | 
|                 omodel.HComTarget = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HComTarget"]); | 
|                 omodel.HEmpHolder = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HEmpHolder"]); | 
|                 omodel.HLinkQty = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HLinkQty"]); | 
|                 omodel.HLinkDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLinkDate"]); | 
|                 omodel.HUnCloseChanceQty = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HUnCloseChanceQty"]); | 
|                 omodel.HUnSendProdQty = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HUnSendProdQty"]); | 
|                 omodel.HUnReceiveMoney = DBUtility.ClsPub.isSingle(Ds.Tables[0].Rows[0]["HUnReceiveMoney"]); | 
|                 omodel.HCusStatus = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HCusStatus"]); | 
|                 omodel.HLastBusDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLastBusDate"]); | 
|                 omodel.HLastLinkDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HLastLinkDate"]); | 
|                 omodel.HLinkDays = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HLinkDays"]); | 
|                 omodel.HOldEmpHolder = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HOldEmpHolder"]); | 
|                 omodel.HOutPubDate = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HOutPubDate"]); | 
|                  | 
|                 //循环 | 
|                 DataSet DsSub ; | 
|                 DsSub = oCn.RunProcReturn("Select * from Crm_CustomerFileSub Where HInterID=" + lngBillKey.ToString() + " order by HEntryID ", "Crm_CustomerFileSub"); | 
|                 DetailColl.Clear();//清空 | 
|                 for (int i = 0; i < DsSub.Tables[0].Rows.Count; i++) | 
|                 { | 
|                     Model.ClsCrm_CustomerFileSub oSub = new Model.ClsCrm_CustomerFileSub(); | 
|                     // 固定赋值=============================================== | 
|                     oSub.HInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HInterID"]); | 
|                     oSub.HEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HEntryID"]); | 
|                     oSub.HSourceInterID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceInterID"]); | 
|                     oSub.HSourceEntryID = DBUtility.ClsPub.isLong(DsSub.Tables[0].Rows[i]["HSourceEntryID"]); | 
|                     oSub.HSourceBillType = DsSub.Tables[0].Rows[i]["HSourceBillType"].ToString().Trim(); | 
|                     oSub.HSourceBillNo = DsSub.Tables[0].Rows[i]["HSourceBillNo"].ToString().Trim(); | 
|                     oSub.HRelationQty = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationQty"]); | 
|                     oSub.HRelationMoney = DBUtility.ClsPub.isDoule(DsSub.Tables[0].Rows[i]["HRelationMoney"]);  | 
|                     //oSub.HCloseMan =  DBUtility.ClsPub.isStrNull(DsSub.Tables[0].Rows[i]["HCloseMan"]); | 
|                     oSub.HCloseType = DBUtility.ClsPub.isBool(DsSub.Tables[0].Rows[i]["HCloseType"]); | 
|                     //oSub.HEntryCloseDate = DBUtility.ClsPub.isDate(DsSub.Tables[0].Rows[i]["HEntryCloseDate"]); | 
|                     oSub.HRemark = DsSub.Tables[0].Rows[i]["HRemark"].ToString().Trim(); | 
|                     //=================================================== | 
|                     | 
|                      | 
|                     DetailColl.Add(oSub); | 
|                 } | 
|                 sReturn = "显示单据成功!"; | 
|                 return true; | 
|             } | 
|             catch (Exception e) | 
|             { | 
|                 sReturn = e.Message; | 
|                 throw (e); | 
|             } | 
|         } | 
|   | 
|   | 
|          | 
|     } | 
|   | 
| } |