//绑定个人用户库信息表信息 add lxw 13.11.25
        private Web.AjaxServers.CustBaseInfo.CustBasicInfo bindCustBasicInfo(out string msg)
        {
            msg = string.Empty;

            Web.AjaxServers.CustBaseInfo.CustBasicInfo model = new Web.AjaxServers.CustBaseInfo.CustBasicInfo();

            string errMsg = string.Empty;

            BLL.ConverToEntitie <Web.AjaxServers.CustBaseInfo.CustBasicInfo> conver = new BLL.ConverToEntitie <Web.AjaxServers.CustBaseInfo.CustBasicInfo>(model);
            errMsg = conver.Conver(CustBasicInfo);

            if (errMsg != "")
            {
                msg = "{'result':'false','msg':'给对应实体赋值时出错,操作失败!'}";
                return(model);
            }

            model.OperID   = operUserID;
            model.OperTime = operTime;

            return(model);
        }
        private void DealerSubmit(out string msg)
        {
            msg = string.Empty;
            try
            {
                BLL.Loger.Log4Net.Info("【经销商工单提交Step1——参数验证】CallID IS:" + CallID);

                #region 验证
                validate(out msg);
                if (LastProcessDate != string.Empty)
                {
                    DateTime dtLastProcessDate;
                    if (DateTime.TryParse(LastProcessDate, out dtLastProcessDate))
                    {
                        if (dtLastProcessDate < DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")))
                        {
                            msg += "最晚处理日期不能小于当前时间!<br/>";
                        }
                    }
                }

                if (msg != string.Empty)
                {
                    msg = "{'result':'false','msg':'" + msg + "'}";

                    return;
                }
                #endregion

                #region 插入工单表
                BLL.Loger.Log4Net.Info("【经销商工单提交Step2——绑定工单信息】");
                Entities.WorkOrderInfo model_WorkOrderInfo = bindWorkOrderInfo(out msg);

                if (msg != string.Empty)
                {
                    return;
                }

                string orderCustID = string.Empty;
                //根据CRMCustName查询获取CustID
                BLL.Loger.Log4Net.Info("【经销商工单提交Step3——根据CRMCustName查询获取CustID开始】");
                DataSet ds_CustID = BitAuto.YanFa.Crm2009.BLL.CustInfo.Instance.GetCustIDByNameToCC(model_WorkOrderInfo.CustName);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step3——根据CRMCustName查询获取CustID结束】");
                if (ds_CustID != null && ds_CustID.Tables.Count > 0 && ds_CustID.Tables[0].Rows.Count > 0)
                {
                    model_WorkOrderInfo.CRMCustID = orderCustID = ds_CustID.Tables[0].Rows[0]["CustID"].ToString();
                }

                //OperType=1:添加(状态:已完成);OperType=2:转出(状态:待审核)
                model_WorkOrderInfo.WorkOrderStatus = OperType == "1" ? (int)Entities.WorkOrderStatus.Completed : (int)Entities.WorkOrderStatus.Pending;

                model_WorkOrderInfo.WorkCategory = 2;//工单类型-经销商;add lxw 13.9.11

                model_WorkOrderInfo.DemandID = DemandID;
                BLL.Loger.Log4Net.Info("【经销商工单提交Step4——WorkOrderInfo入库开始】");
                model_WorkOrderInfo.OrderID = BLL.WorkOrderInfo.Instance.Insert(model_WorkOrderInfo);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step4——WorkOrderInfo入库结束】OrderID=:" + OrderID);


                //回写IM库
                BLL.Loger.Log4Net.Info("【经销商工单提交Step5——工单信息回写IM库开始】");
                UpdateCCWorkOrder2IM(model_WorkOrderInfo);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step5——工单信息回写IM库结束】");
                #endregion

                #region 插入工单回复表
                BLL.Loger.Log4Net.Info("【经销商工单提交Step6——绑定工单回复信息】OrderID=" + model_WorkOrderInfo.OrderID + ",CallID=" + CallID);
                Entities.WorkOrderRevert model_Revert = bindWorkOrderRevert(out msg);

                model_Revert.OrderID = model_WorkOrderInfo.OrderID;
                if (CallID != string.Empty)
                {
                    model_Revert.CallID = Int64.Parse(CallID);
                }

                if (msg != string.Empty)
                {
                    return;
                }

                model_Revert.WorkOrderStatus = OperType == "1" ? "已完成" : "待审核";
                BLL.Loger.Log4Net.Info("【经销商工单提交Step7——根据部门获取部门名称开始】");
                model_Revert.ReceiverDepartName = BitAuto.YanFa.SysRightManager.Common.UserInfo.Instance.GetDistrictNameByUserID(operUserID);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step7——根据部门获取部门名称结束】");

                BLL.Loger.Log4Net.Info("【经销商工单提交Step8——工单回复信息入库开始】");
                BLL.WorkOrderRevert.Instance.Insert(model_Revert);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step8——工单回复信息入库结束】");
                #endregion

                #region 插入标签
                if (TagIDs != string.Empty)
                {
                    string[] array_TagIDs = TagIDs.Split(',');
                    for (int k = 0; k < array_TagIDs.Length; k++)
                    {
                        Entities.WorkOrderTagMapping model_Mapping = new Entities.WorkOrderTagMapping();
                        model_Mapping.OrderID      = model_WorkOrderInfo.OrderID;
                        model_Mapping.TagID        = int.Parse(array_TagIDs[k]);
                        model_Mapping.Status       = 0;
                        model_Mapping.CreateTime   = model_Mapping.ModifyTime = operTime;
                        model_Mapping.CreateUserID = model_Mapping.ModifyUserID = operUserID;
                        BLL.Loger.Log4Net.Info("【经销商工单提交Step9——插入标签开始】");
                        BLL.WorkOrderTagMapping.Instance.Insert(model_Mapping);
                        BLL.Loger.Log4Net.Info("【经销商工单提交Step9——插入标签结束】");
                    }
                }

                #endregion

                #region 把工单联系人插入个人用户
                Web.AjaxServers.CustBaseInfo.CustBasicInfo model_cbInfo = bindCustBasicInfo(out msg);
                if (msg != string.Empty)
                {
                    return;
                }
                Web.AjaxServers.CustBaseInfo.OperPopCustBasicInfo cbi = new Web.AjaxServers.CustBaseInfo.OperPopCustBasicInfo();
                BLL.Loger.Log4Net.Info("【经销商工单提交Step10——插入个人用户库信息开始】");
                cbi.InsertCustInfo(model_cbInfo, out msg);
                BLL.Loger.Log4Net.Info("【经销商工单提交Step10——插入个人用户库信息结束】");
                string   ccCustID = string.Empty;
                string[] aMsg     = msg.Split(',');
                //如果不存在会新增个人用户 返回ccCustID
                //如果存在会直接返回该联系人ccCustID
                if (aMsg.Length == 2 && aMsg[0].Split(':')[1] == "'true'")
                {
                    ccCustID = aMsg[1].Split(':')[1].Replace("'", "");
                }
                #endregion

                #region 插入访问记录
                if (ccCustID != string.Empty)
                {
                    BLL.Loger.Log4Net.Info("【经销商工单提交Step11——插入联系记录开始】");
                    long callid = CommonFunction.ObjectToLong(CallID, -2);
                    int  userid = BLL.Util.GetLoginUserID();

                    BitAuto.ISDC.CC2012.Web.AjaxServers.CustBaseInfo.OperPopCustBasicInfo.OperCustVisitBusiness(ccCustID, model_WorkOrderInfo.OrderID, callid, (int)VisitBusinessTypeEnum.S1_工单, TaskSource, userid, model_WorkOrderInfo.ContactTel);
                    BLL.Loger.Log4Net.Info("【经销商工单提交Step11——插入联系记录结束】");
                }
                #endregion

                msg = "{'result':'true','OrderID':'" + model_WorkOrderInfo.OrderID + "','orderCustID':'" + orderCustID + "'}";
            }
            catch (Exception ex)
            {
                BLL.Loger.Log4Net.Error("【经销商工单提交】出现方法出现问题:" + ex.Message);
            }
        }