/// <summary> /// 根据任务ID,查询订单类型 /// </summary> private void GetTaskSource() { int intTid = 0; if (TaskID != string.Empty && int.TryParse(TaskID, out intTid)) { Entities.OrderTask model = BLL.OrderTask.Instance.GetOrderTask(intTid); if (model != null) { this.Source = model.Source.ToString(); this.TaskStatus = model.TaskStatus.ToString(); int userID = BLL.Util.GetLoginUserID(); if (model.AssignUserID == userID) { IsBelong = "1"; } else { IsBelong = "0"; } this.UCOrderConsult1.Source = model.Source.ToString(); this.UCOrderConsult1.TID = model.TaskID.ToString(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //查询数据来源属于新车还是置换订单 if (RequestTaskID != "") { int _taskID; if (int.TryParse(RequestTaskID, out _taskID)) { Entities.OrderTask model = BLL.OrderTask.Instance.GetOrderTask(_taskID); if (model != null) { Source = model.Source.ToString(); ContactRecordView1.TaskID = RequestTaskID; ContactRecordView1.Source = Source; divDeal.Style.Add("display", "none"); ulDeal.Style.Add("display", "none"); BindData(); } } else if (Source == string.Empty) { if (HiddenDiv()) { BindData(); } } } } }
private void DeleteTask(out string errorMsg) { errorMsg = string.Empty; Validate(out errorMsg); if (errorMsg != string.Empty) { return; } long taskID = long.Parse(TaskID); Entities.OrderTask model = BLL.OrderTask.Instance.GetOrderTask(taskID); BLL.OrderTask.Instance.Delete(taskID); Entities.OrderTaskOperationLog oLog = new Entities.OrderTaskOperationLog(); oLog.TaskID = taskID; oLog.OperationStatus = (int)Entities.OperationStatus.Delete; oLog.TaskStatus = model.TaskStatus; oLog.Remark = Reason; oLog.CreateTime = DateTime.Now; oLog.CreateUserID = BLL.Util.GetLoginUserID(); BLL.OrderTaskOperationLog.Instance.Insert(oLog); BLL.Util.InsertUserLog("【无主订单】任务ID为【" + TaskID + "】被删除!删除原因:" + Reason); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //判断是否有查看该处理订单的权限 if (BLL.Util.CheckButtonRight("SYS024BUT1201")) { IsEditTask = "1"; } //查询数据来源属于新车还是置换订单 int _userID = BLL.Util.GetLoginUserID(); int _taskID; if (int.TryParse(RequestTaskID, out _taskID)) { Entities.OrderTask model = BLL.OrderTask.Instance.GetOrderTask(_taskID); if (model != null) { if (model.TaskStatus == (int)Entities.TaskStatus.Processed) { IsProcessed = "1"; } if (model.AssignUserID == _userID) { IsBelong = "1"; } Source = model.Source.ToString(); ContactRecordView1.TaskID = RequestTaskID; ContactRecordView1.Source = Source; } } } }
//根据任务状态如果是-提交,则去OrderTask表查找“理由”和“备注”信息 public string[] getNoDealReason(string operStatus, string taskID) { string[] noDealReason = new string[2]; if (int.Parse(operStatus) == (int)Entities.OperationStatus.Submit) { int _taskID; if (int.TryParse(taskID, out _taskID)) { Entities.OrderTask model = BLL.OrderTask.Instance.GetOrderTask(_taskID); if (model != null) { string strReason = BLL.Util.GetEnumOptText(typeof(Entities.NoDealerReason), int.Parse(model.NoDealerReasonID.ToString())); if (strReason != "") { noDealReason[0] = "理由:" + strReason + "<br/>"; noDealReason[1] = "理由:" + strReason + ";"; } if (model.NoDealerReason != null && model.NoDealerReason != "") { string strRemark = model.NoDealerReason; if (strRemark.Length >= 50) { strRemark = strRemark.Substring(0, 50) + "..."; } noDealReason[0] += "备注:" + strRemark + ""; noDealReason[1] += "备注:" + model.NoDealerReason + ""; } } } } return(noDealReason); }
/// <summary> /// 根据新车订单信息,生成任务 /// </summary> /// <param name="tran"></param> /// <param name="model">新车订单信息</param> /// <returns>返回任务ID</returns> public long InsertByOrder(SqlTransaction tran, Entities.OrderNewCarLog model) { Entities.OrderTask otModel = new Entities.OrderTask(); if (model.OrderType == 1) { otModel.Source = 3; } else { otModel.Source = 1;//1新车,2置换,3试驾 } otModel.TaskStatus = (int)TaskStatus.NoAllocation; otModel.RelationID = model.RecID; otModel.BGID = int.Parse(ConfigurationUtil.GetAppSettingValue("GenTaskDefaultGroupID")); otModel.AssignUserID = null; otModel.AssignTime = null; otModel.UserName = model.UserName; otModel.IsSelectDMSMember = null; otModel.Status = 0; otModel.SubmitTime = null; otModel.CreateTime = DateTime.Now; otModel.CreateUserID = null; otModel.NoDealerReasonID = -2; otModel.NoDealerReason = ""; otModel.DealerID = model.DealerID; return(Insert(tran, otModel)); }
/// <summary> /// 增加一条数据 /// </summary> public long Insert(SqlTransaction sqltran, Entities.OrderTask model) { SqlParameter[] parameters = { new SqlParameter("@TaskID", SqlDbType.BigInt, 8), new SqlParameter("@Source", SqlDbType.Int, 4), new SqlParameter("@TaskStatus", SqlDbType.Int, 4), new SqlParameter("@RelationID", SqlDbType.BigInt, 8), new SqlParameter("@BGID", SqlDbType.Int, 4), new SqlParameter("@AssignUserID", SqlDbType.Int, 4), new SqlParameter("@AssignTime", SqlDbType.DateTime), new SqlParameter("@UserName", SqlDbType.NVarChar, 64), new SqlParameter("@IsSelectDMSMember", SqlDbType.Bit, 1), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@SubmitTime", SqlDbType.DateTime), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@CreateUserID", SqlDbType.Int, 4), new SqlParameter("@NoDealerReasonID", SqlDbType.Int, 4), new SqlParameter("@NoDealerReason", SqlDbType.VarChar, 1000), new SqlParameter("@DealerID", SqlDbType.Int, 4) }; parameters[0].Direction = ParameterDirection.Output; parameters[1].Value = model.Source; parameters[2].Value = model.TaskStatus; parameters[3].Value = model.RelationID; parameters[4].Value = model.BGID; parameters[5].Value = model.AssignUserID; parameters[6].Value = model.AssignTime; parameters[7].Value = model.UserName; parameters[8].Value = model.IsSelectDMSMember; parameters[9].Value = model.Status; parameters[10].Value = model.SubmitTime; parameters[11].Value = model.CreateTime; parameters[12].Value = model.CreateUserID; parameters[13].Value = model.NoDealerReasonID; parameters[14].Value = model.NoDealerReason; parameters[15].Value = model.DealerID; SqlHelper.ExecuteNonQuery(sqltran, CommandType.StoredProcedure, P_ORDERTASK_INSERT, parameters); return((long)parameters[0].Value); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(Entities.OrderTask model) { SqlParameter[] parameters = { new SqlParameter("@TaskID", SqlDbType.BigInt, 8), new SqlParameter("@Source", SqlDbType.Int, 4), new SqlParameter("@TaskStatus", SqlDbType.Int, 4), new SqlParameter("@RelationID", SqlDbType.BigInt, 8), new SqlParameter("@BGID", SqlDbType.Int, 4), new SqlParameter("@AssignUserID", SqlDbType.Int, 4), new SqlParameter("@AssignTime", SqlDbType.DateTime), new SqlParameter("@UserName", SqlDbType.NVarChar, 64), new SqlParameter("@IsSelectDMSMember", SqlDbType.Bit, 1), new SqlParameter("@Status", SqlDbType.Int, 4), new SqlParameter("@SubmitTime", SqlDbType.DateTime), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@CreateUserID", SqlDbType.Int, 4), new SqlParameter("@NoDealerReasonID", SqlDbType.Int, 4), new SqlParameter("@NoDealerReason", SqlDbType.VarChar, 1000) }; parameters[0].Value = model.TaskID; parameters[1].Value = model.Source; parameters[2].Value = model.TaskStatus; parameters[3].Value = model.RelationID; parameters[4].Value = model.BGID; parameters[5].Value = model.AssignUserID; parameters[6].Value = model.AssignTime; parameters[7].Value = model.UserName; parameters[8].Value = model.IsSelectDMSMember; parameters[9].Value = model.Status; parameters[10].Value = model.SubmitTime; parameters[11].Value = model.CreateTime; parameters[12].Value = model.CreateUserID; parameters[13].Value = model.NoDealerReasonID; parameters[14].Value = model.NoDealerReason; return(SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_ORDERTASK_UPDATE, parameters)); }
private void Validate(out string errorMsg) { errorMsg = string.Empty; if (Reason.Trim() == string.Empty) { errorMsg = "删除原因不能为空!"; return; } long taskID; if (!long.TryParse(TaskID, out taskID)) { errorMsg = "任务ID有错误!"; return; } Entities.OrderTask model = BLL.OrderTask.Instance.GetOrderTask(taskID); if (model == null) { errorMsg = "该任务不存在!"; return; } if (model.Status == -1) { errorMsg = "该任务已被删除!"; return; } if (model.TaskStatus == (int)Entities.TaskStatus.Processed) { errorMsg = "该任务已提交,不可被删除!"; return; } }
/// <summary> /// 分配任务 /// </summary> /// <param name="msg"></param> internal void AssignTask(out string msg) { msg = string.Empty; string Result = "yes"; string ErrorMsg = ""; //不为空 if (!string.IsNullOrEmpty(TaskIDS) && !string.IsNullOrEmpty(AssignUserID)) { if (TaskIDS.IndexOf(',') > 0) { for (int i = 0; i < TaskIDS.Split(',').Length; i++) { Entities.OrderTask Model = BLL.OrderTask.Instance.GetOrderTask(Convert.ToInt32(TaskIDS.Split(',')[i])); if (Model.TaskStatus == (int)Entities.TaskStatus.NoAllocation) { Model.AssignUserID = Convert.ToInt32(AssignUserID); Model.AssignTime = System.DateTime.Now; Model.TaskStatus = (int)Entities.TaskStatus.NoProcess; BLL.OrderTask.Instance.Update(Model); //插入任务操作日志 Entities.OrderTaskOperationLog logmodel = new Entities.OrderTaskOperationLog(); logmodel.TaskID = Model.TaskID; logmodel.OperationStatus = (int)Entities.OperationStatus.Allocation; logmodel.TaskStatus = (int)Entities.TaskStatus.NoProcess; logmodel.Remark = BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(Convert.ToInt32(AssignUserID)); logmodel.CreateTime = System.DateTime.Now; logmodel.CreateUserID = BLL.Util.GetLoginUserID(); BLL.OrderTaskOperationLog.Instance.Insert(logmodel); } else { Result = "no"; ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态不是待分配。"; } } } else { Entities.OrderTask Model = BLL.OrderTask.Instance.GetOrderTask(Convert.ToInt32(TaskIDS)); if (Model.TaskStatus == (int)Entities.TaskStatus.NoAllocation) { Model.AssignUserID = Convert.ToInt32(AssignUserID); Model.AssignTime = System.DateTime.Now; Model.TaskStatus = (int)Entities.TaskStatus.NoProcess; BLL.OrderTask.Instance.Update(Model); //插入任务操作日志 Entities.OrderTaskOperationLog logmodel = new Entities.OrderTaskOperationLog(); logmodel.TaskID = Model.TaskID; logmodel.OperationStatus = (int)Entities.OperationStatus.Allocation; logmodel.TaskStatus = (int)Entities.TaskStatus.NoProcess; logmodel.Remark = BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(Convert.ToInt32(AssignUserID)); logmodel.CreateTime = System.DateTime.Now; logmodel.CreateUserID = BLL.Util.GetLoginUserID(); BLL.OrderTaskOperationLog.Instance.Insert(logmodel); } else { Result = "no"; ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态不是待分配。"; } } } msg = "{Result:'" + Result + "',CustID:'',ErrorMsg:'" + ErrorMsg + "'}"; }
private void CustBaseInfoBind() { if (!string.IsNullOrEmpty(RequstTaskID)) { //判断数据来源 Entities.OrderTask model = BLL.OrderTask.Instance.GetOrderTask(Convert.ToInt32(RequstTaskID)); if (model != null) { //未购车,试驾 if (model.Source == 1 || model.Source == 3) { Entities.OrderNewCar custBasicInfo = BLL.OrderNewCar.Instance.GetOrderNewCar(Convert.ToInt32(RequstTaskID)); if (custBasicInfo != null) { CustName = custBasicInfo.UserName; if (custBasicInfo.UserGender == 1) { Sex = "先生"; } else if (custBasicInfo.UserGender == 2) { Sex = "女士"; } Address = custBasicInfo.UserAddress; if (custBasicInfo.ProvinceID != Entities.Constants.Constant.INT_INVALID_VALUE) { PlaceStr += BitAuto.YanFa.Crm2009.BLL.AreaInfo.Instance.GetAreaName(custBasicInfo.ProvinceID.ToString()); } if (custBasicInfo.CityID != Entities.Constants.Constant.INT_INVALID_VALUE) { PlaceStr += "," + BitAuto.YanFa.Crm2009.BLL.AreaInfo.Instance.GetAreaName(custBasicInfo.CityID.ToString()); } if (custBasicInfo.CountyID != Entities.Constants.Constant.INT_INVALID_VALUE) { PlaceStr += "," + BitAuto.YanFa.Crm2009.BLL.AreaInfo.Instance.GetAreaName(custBasicInfo.CountyID.ToString()); } AreaStr = BLL.Util.GetEnumOptText(typeof(Entities.EnumArea), (int)custBasicInfo.AreaID); CustCategoryStr = "未购车"; if (!string.IsNullOrEmpty(custBasicInfo.UserMobile) && !string.IsNullOrEmpty(custBasicInfo.UserPhone)) { Tels = custBasicInfo.UserPhone + "," + custBasicInfo.UserMobile; } else if (!string.IsNullOrEmpty(custBasicInfo.UserMobile)) { Tels = custBasicInfo.UserMobile; } else { Tels = custBasicInfo.UserPhone; } Email = custBasicInfo.UserMail; } } //已购车 else { Entities.OrderRelpaceCar custBasicInfo = BLL.OrderRelpaceCar.Instance.GetOrderRelpaceCar(Convert.ToInt32(RequstTaskID)); if (custBasicInfo != null) { CustName = custBasicInfo.UserName; if (custBasicInfo.UserGender == 1) { Sex = "先生"; } else if (custBasicInfo.UserGender == 2) { Sex = "女士"; } Address = custBasicInfo.UserAddress; if (custBasicInfo.ProvinceID != Entities.Constants.Constant.INT_INVALID_VALUE) { PlaceStr += BitAuto.YanFa.Crm2009.BLL.AreaInfo.Instance.GetAreaName(custBasicInfo.ProvinceID.ToString()); } if (custBasicInfo.CityID != Entities.Constants.Constant.INT_INVALID_VALUE) { PlaceStr += "," + BitAuto.YanFa.Crm2009.BLL.AreaInfo.Instance.GetAreaName(custBasicInfo.CityID.ToString()); } if (custBasicInfo.CountyID != Entities.Constants.Constant.INT_INVALID_VALUE) { PlaceStr += "," + BitAuto.YanFa.Crm2009.BLL.AreaInfo.Instance.GetAreaName(custBasicInfo.CountyID.ToString()); } AreaStr = BLL.Util.GetEnumOptText(typeof(Entities.EnumArea), (int)custBasicInfo.AreaID); CustCategoryStr = "已购车"; if (!string.IsNullOrEmpty(custBasicInfo.UserMobile) && !string.IsNullOrEmpty(custBasicInfo.UserPhone)) { Tels = custBasicInfo.UserPhone + "," + custBasicInfo.UserMobile; } else if (!string.IsNullOrEmpty(custBasicInfo.UserMobile)) { Tels = custBasicInfo.UserMobile; } else { Tels = custBasicInfo.UserPhone; } Email = custBasicInfo.UserMail; } } ///更具已购车未购车表确定Type Entities.OrderBuyCarInfo modelOrderbuyCar = null; modelOrderbuyCar = BLL.OrderBuyCarInfo.Instance.GetOrderBuyCarInfo(Convert.ToInt32(RequstTaskID)); if (modelOrderbuyCar != null) { if (modelOrderbuyCar.Type == 2) { CustCategoryStr = "未购车"; } else { CustCategoryStr = "已购车"; } } } } }
private Entities.OrderTask LoadSingleOrderTask(DataRow row) { Entities.OrderTask model = new Entities.OrderTask(); if (row["TaskID"].ToString() != "") { model.TaskID = long.Parse(row["TaskID"].ToString()); } if (row["Source"].ToString() != "") { model.Source = int.Parse(row["Source"].ToString()); } if (row["TaskStatus"].ToString() != "") { model.TaskStatus = int.Parse(row["TaskStatus"].ToString()); } if (row["RelationID"].ToString() != "") { model.RelationID = long.Parse(row["RelationID"].ToString()); } if (row["BGID"].ToString() != "") { model.BGID = int.Parse(row["BGID"].ToString()); } if (row["AssignUserID"].ToString() != "") { model.AssignUserID = int.Parse(row["AssignUserID"].ToString()); } if (row["AssignTime"].ToString() != "") { model.AssignTime = DateTime.Parse(row["AssignTime"].ToString()); } model.UserName = row["UserName"].ToString(); if (row["IsSelectDMSMember"].ToString() != "") { if ((row["IsSelectDMSMember"].ToString() == "1") || (row["IsSelectDMSMember"].ToString().ToLower() == "true")) { model.IsSelectDMSMember = true; } else { model.IsSelectDMSMember = false; } } if (row["Status"].ToString() != "") { model.Status = int.Parse(row["Status"].ToString()); } if (row["SubmitTime"].ToString() != "") { model.SubmitTime = DateTime.Parse(row["SubmitTime"].ToString()); } if (row["CreateTime"].ToString() != "") { model.CreateTime = DateTime.Parse(row["CreateTime"].ToString()); } if (row["CreateUserID"].ToString() != "") { model.CreateUserID = int.Parse(row["CreateUserID"].ToString()); } if (row["NoDealerReasonID"].ToString() != "") { model.NoDealerReasonID = int.Parse(row["NoDealerReasonID"].ToString()); } if (row["NoDealerReason"].ToString() != "") { model.NoDealerReason = row["NoDealerReason"].ToString(); } if (row["DealerID"].ToString() != "") { model.DealerID = int.Parse(row["DealerID"].ToString()); } return(model); }
/// <summary> /// 更新一条数据 /// </summary> public int Update(Entities.OrderTask model) { return(Dal.OrderTask.Instance.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Insert(Entities.OrderTask model) { return(Dal.OrderTask.Instance.Insert(model)); }
private void Submit(out string msg, int userID) { //此方法内的逻辑可参考文档:$/A5信息系统研发/销售业务管理平台/客户关系管理/doc/Call Center/无主订单处理页面保存和提交逻辑.docx ---- Add By Chybin At 2013-07-19 msg = ""; //System.Threading.Thread.Sleep(5000); #region 准备数据 NewCarConsultInfo newInfo = null; //新车订单信息 ReplaceCarConsultInfo replaceInfo = null; //置换订单信息 Entities.OrderTask orderTaskModel = null; //无主订单任务信息 Entities.OrderTaskOperationLog orderLog = null; //任务操作日志 List <StringBuilder> listLogStr = new List <StringBuilder>(); //用户操作日志 StringBuilder sblogstr = new StringBuilder(); string logstr = ""; #region 取得新车/置换无主订单信息更新后Model(此时不保存到数据库) Entities.OrderNewCar newModel = null; //新车订单实体类 Entities.OrderRelpaceCar replaceModel = null; //置换订单实体类 if (Source == "1" || Source == "3") { newInfo = (NewCarConsultInfo)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(NewCarConsultInfoStr, typeof(NewCarConsultInfo)); newModel = OrderNewSave.Save(newInfo, out msg, userID, int.Parse(TaskID)); if (msg != "") { return; } } else if (Source == "2") { replaceInfo = (ReplaceCarConsultInfo)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(ReplaceCarConsultInfoStr, typeof(ReplaceCarConsultInfo)); replaceModel = OrderReplaceSave.Save(replaceInfo, out msg, userID, long.Parse(TaskID)); if (msg != "") { return; } } #endregion #region 取得任务的更新后信息 orderTaskModel = BLL.OrderTask.Instance.GetOrderTask(long.Parse(TaskID)); if (orderTaskModel == null) { msg += "没有找到相关的任务信息"; return; } if (orderTaskModel.TaskStatus != 2 && orderTaskModel.TaskStatus != 3) { msg += "当前任务状态不能保存和提交"; return; } if (orderTaskModel.AssignUserID != userID) { msg += "此订单没有分配给你"; return; } //修改状态 if (Action == "save") { orderTaskModel.TaskStatus = (int)TaskStatus.Processing; } else if (Action == "sub") { orderTaskModel.TaskStatus = (int)TaskStatus.Processed; orderTaskModel.SubmitTime = DateTime.Now; } //是否已选择经销商 只有在提交时,才会改动该属性 -是否已选择经销商 lxw if (Action == "sub") { if (((Source == "1" || Source == "3") && newModel.DMSMemberCode != "") || (Source == "2" && replaceModel.DMSMemberCode != "")) { orderTaskModel.IsSelectDMSMember = true; } else { orderTaskModel.IsSelectDMSMember = false; } } if (Source == "1" || Source == "3") { orderTaskModel.UserName = newModel.UserName; } else if (Source == "2") { orderTaskModel.UserName = replaceModel.UserName; } if (NoDealerReasonID != "") { orderTaskModel.NoDealerReasonID = int.Parse(NoDealerReasonID); } orderTaskModel.NoDealerReason = NoDealerReason; #endregion #region 任务操作日志 orderLog = new OrderTaskOperationLog(); //modify by qizq 2013-1-4首先判断是否是通话中 if (IsCalling == "1") { if (HistoryLogID == "") { //通话中提交把本地录音主键付给实体 long CallRecordReCID = 0; if (CallRecordID != "") { if (long.TryParse(CallRecordID, out CallRecordReCID)) { orderLog.CallRecordID = CallRecordReCID; } } } } // orderLog.TaskID = int.Parse(TaskID); if (Action == "save") { orderLog.OperationStatus = (int)OperationStatus.Save; } else if (Action == "sub") { orderLog.OperationStatus = (int)OperationStatus.Submit; } orderLog.TaskStatus = orderTaskModel.TaskStatus; orderLog.CreateTime = DateTime.Now; orderLog.CreateUserID = userID; #endregion #region 如果是提交操作,更新客户信息、插入咨询类型、添加客户联系记录 Entities.CustBasicInfo custmodel = null; //客户信息实体类 Entities.CustTel telPhoneMode = null; //电话实体类 Entities.CustTel telMobileMode = null; //电话实体类 Entities.CustEmail emailMode = null; //邮件实体类 Entities.ConsultOrderNewCar cNewCar = null; //新车咨询类型 Entities.ConsultOrderRelpaceCar cReplaceCar = null; //置换车咨询类型 Entities.CustHistoryInfo custHistInfo = null; //客户联系记录 Entities.BuyCarInfo buyCarInfo = new Entities.BuyCarInfo(); //已购车或未购车信息 lxw if (Action == "sub") { #region 更新或插入客户信息 //代码失效,功能废弃,需求重新实现 #endregion #region 插入咨询类型 if (Source == "1" || Source == "3") { cNewCar = new ConsultOrderNewCar(); #region 赋值 cNewCar.CarBrandId = newModel.CarMasterID; cNewCar.CarSerialId = newModel.CarSerialID; cNewCar.CarNameID = newModel.CarTypeID; cNewCar.CarColor = newModel.CarColor; cNewCar.DealerCode = newModel.DMSMemberCode; cNewCar.DealerName = newModel.DMSMemberName; cNewCar.OrderRemark = newModel.OrderRemark; cNewCar.CallRecord = newModel.CallRecord; cNewCar.CreateTime = DateTime.Now; cNewCar.CreateUserID = userID; #endregion } else if (Source == "2") { cReplaceCar = new ConsultOrderRelpaceCar(); #region 赋值 cReplaceCar.WantBrandId = replaceModel.RepCarMasterID; cReplaceCar.WantSerialId = replaceModel.RepCarSerialID; cReplaceCar.WantNameID = replaceModel.RepCarTypeId; cReplaceCar.WantCarColor = replaceModel.ReplacementCarColor; cReplaceCar.WantDealerName = replaceModel.DMSMemberName; cReplaceCar.WantDealerCode = replaceModel.DMSMemberCode; cReplaceCar.CallRecord = replaceModel.CallRecord; cReplaceCar.OldBrandId = replaceModel.CarMasterID; cReplaceCar.OldSerialId = replaceModel.CarSerialID; cReplaceCar.OldNameID = replaceModel.CarTypeID; cReplaceCar.OldCarColor = replaceModel.CarColor; cReplaceCar.RegisterDateYear = replaceModel.ReplacementCarBuyYear.ToString(); cReplaceCar.RegisterDateMonth = replaceModel.ReplacementCarBuyMonth.ToString(); cReplaceCar.RegisterProvinceID = replaceModel.RepCarProvinceID; cReplaceCar.RegisterCityID = replaceModel.RepCarCityID; cReplaceCar.RegisterCountyID = replaceModel.RepCarCountyID; cReplaceCar.Mileage = (decimal)replaceModel.ReplacementCarUsedMiles; cReplaceCar.PresellPrice = replaceModel.SalePrice; cReplaceCar.OrderRemark = replaceModel.OrderRemark; cReplaceCar.CreateTime = DateTime.Now; cReplaceCar.CreateUserID = userID; #endregion } #endregion #region 插入客户历史记录 custHistInfo = new CustHistoryInfo(); #region 赋值 custHistInfo.TaskID = TaskID; if (Source == "1" || Source == "3") { custHistInfo.ConsultID = 60010;//新车咨询类型 } else { custHistInfo.ConsultID = 60011;//置换咨询类型 } custHistInfo.RecordType = 2; custHistInfo.QuestionQuality = (int)QuestionNature.NatureCommon; custHistInfo.ProcessStatus = (int)EnumTaskStatus.TaskStatusOver; custHistInfo.CreateTime = DateTime.Now; custHistInfo.CreateUserID = userID; custHistInfo.LastTreatmentTime = DateTime.Now; #endregion #endregion } #endregion #endregion #region 事务提交 string connectionstrings = ConfigurationUtil.GetAppSettingValue("ConnectionStrings_CC"); SqlConnection connection = new SqlConnection(connectionstrings); connection.Open(); SqlTransaction tran = connection.BeginTransaction(IsolationLevel.ReadUncommitted, "SampleTransaction"); try { #region 保存新车/置换无主订单信息 if (Source == "1" || Source == "3") { BLL.OrderNewCar.Instance.Update(tran, newModel); } else if (Source == "2") { BLL.OrderRelpaceCar.Instance.Update(tran, replaceModel); } #endregion #region 修改任务信息 BLL.OrderTask.Instance.Update(tran, orderTaskModel); #endregion #region 任务操作日志 //modify by qizq 2013-1-4不是在通话中,处理记录已存在更新处理记录 if (IsCalling != "1" && HistoryLogID != "") { //通话中提交把本地录音主键付给实体 long CallRecordReCID = 0; if (CallRecordID != "") { if (long.TryParse(CallRecordID, out CallRecordReCID)) { orderLog.CallRecordID = CallRecordReCID; } } long HistoryLogIDLog = 0; if (long.TryParse(HistoryLogID, out HistoryLogIDLog)) { orderLog.RecID = HistoryLogIDLog; } BLL.OrderTaskOperationLog.Instance.Update(tran, orderLog); } else { BLL.OrderTaskOperationLog.Instance.Insert(tran, orderLog); } // #endregion if (Action == "sub") { string retCustID = ""; #region 更新或插入客户信息 if (custmodel.RecID == -2) { //新加的客户 retCustID = BLL.CustBasicInfo.Instance.Insert(tran, custmodel); #region 记日志 sblogstr = new StringBuilder(); logstr = ""; logstr += "新加了客户‘" + custmodel.CustName + "’的信息【ID:" + retCustID + "】"; if (logstr != "") { sblogstr.Append(logstr); listLogStr.Add(sblogstr); } #endregion } else { //编辑客户信息 BLL.CustBasicInfo.Instance.Update(tran, custmodel); retCustID = custmodel.CustID; } #endregion #region 插入电话 if (telPhoneMode != null) { telPhoneMode.CustID = retCustID; BLL.CustTel.Instance.Insert(tran, telPhoneMode); } if (telMobileMode != null) { telMobileMode.CustID = retCustID; BLL.CustTel.Instance.Insert(tran, telMobileMode); } #endregion #region 插入邮箱 if (emailMode != null) { emailMode.CustID = retCustID; BLL.CustEmail.Instance.Insert(tran, emailMode); } #endregion #region 插入咨询类型 int retDataID = 0; if (cNewCar != null) { cNewCar.CustID = retCustID; retDataID = BLL.ConsultOrderNewCar.Instance.Insert(tran, cNewCar); #region 记日志 sblogstr = new StringBuilder(); logstr = ""; logstr += "新加了无主订单新车联系咨询记录【ID:" + retDataID + "】"; if (logstr != "") { sblogstr.Append(logstr); listLogStr.Add(sblogstr); } #endregion } if (cReplaceCar != null) { cReplaceCar.CustID = retCustID; retDataID = BLL.ConsultOrderRelpaceCar.Instance.Insert(tran, cReplaceCar); #region 记日志 sblogstr = new StringBuilder(); logstr = ""; logstr += "新加了无主订单置换联系咨询记录【ID:" + retDataID + "】"; if (logstr != "") { sblogstr.Append(logstr); listLogStr.Add(sblogstr); } #endregion } #endregion #region 插入未购车或已购车记录 BuyCarInfo lxw if (buyCarInfo != null && buyCarInfo.RecID == -2) { buyCarInfo.CustID = retCustID; int recID = BLL.BuyCarInfo.Instance.Insert(tran, buyCarInfo); #region 记日志 sblogstr = new StringBuilder(); logstr = ""; logstr += "新加了未购车已购车BuyCarInfo表的记录【ID:" + recID + "】"; if (logstr != "") { sblogstr.Append(logstr); listLogStr.Add(sblogstr); } #endregion } if (buyCarInfo != null && buyCarInfo.RecID != -2) { BLL.BuyCarInfo.Instance.Update(tran, buyCarInfo); #region 记日志 sblogstr = new StringBuilder(); logstr = ""; logstr += "修改了未购车已购车BuyCarInfo表的记录【ID:" + buyCarInfo.RecID + "】"; if (logstr != "") { sblogstr.Append(logstr); listLogStr.Add(sblogstr); } #endregion } #endregion #region 插入客户联系记录 if (custHistInfo != null) { custHistInfo.CustID = retCustID; custHistInfo.ConsultDataID = retDataID; BLL.CustHistoryInfo.Instance.Insert(tran, custHistInfo); } #endregion #region 插入已购车或未购车信息 #endregion #region 保存用户操作日志 foreach (StringBuilder sbStr in listLogStr) { BLL.Util.InsertUserLog(tran, sbStr.ToString()); } #endregion } if (msg == "") { tran.Commit(); if (Action == "sub") { #region 调用易湃接口,传回数据 string errorMsg = ""; int retService = 0; short isSelectDMS = 0; #region 调用接口 BitAuto.ISDC.CC2012.WebService.NoDealerOrderHelper OrderHelper = new BitAuto.ISDC.CC2012.WebService.NoDealerOrderHelper(); if (Source == "1") //新车 { isSelectDMS = newModel.DMSMemberCode == "" ? (short)2 : (short)1; //1 选择了经销商 2 未选择经销商 retService = OrderHelper.SetNewCarOrder(newModel, isSelectDMS, NoDealerReason, ref errorMsg); } else if (Source == "2") //置换 { isSelectDMS = replaceModel.DMSMemberCode == "" ? (short)2 : (short)1; //1 选择了经销商 2 未选择经销商 retService = OrderHelper.SetReplacementOrder(replaceModel, isSelectDMS, NoDealerReason, ref errorMsg); } else if (Source == "3") { isSelectDMS = newModel.DMSMemberCode == "" ? (short)2 : (short)1; //1 选择了经销商 2 未选择经销商 retService = OrderHelper.SetTestDriveOrder(newModel, isSelectDMS, NoDealerReason, ref errorMsg); } #endregion #region 插入更新无主订单数据日志表 Entities.UpdateOrderData updateDateMode = new UpdateOrderData(); updateDateMode.TaskID = TaskID; if (Source == "1" || Source == "3") { updateDateMode.YPOrderID = newModel.YPOrderID; } else if (Source == "2") { updateDateMode.YPOrderID = replaceModel.YPOrderID; } updateDateMode.UpdateType = retService; updateDateMode.IsUpdate = retService; // 1 成功了,不用处理,-1 需要重新处理 if (retService == 1) { updateDateMode.UpdateDateTime = DateTime.Now; } updateDateMode.UpdateErrorMsg = errorMsg; updateDateMode.CreateTime = DateTime.Now; updateDateMode.CreateUserID = userID; updateDateMode.APIType = 1; BLL.UpdateOrderData.Instance.Insert(updateDateMode); #endregion if (retService == -1) { msg = "InterfaceErr|" + errorMsg; } #endregion } } else { tran.Rollback(); } } catch (Exception ex) { if (tran.Connection != null) { tran.Rollback(); } msg = ex.Message.ToString(); } finally { connection.Close(); } #endregion }
/// <summary> /// 更新一条数据 /// </summary> public int Update(SqlTransaction sqltran, Entities.OrderTask model) { return(Dal.OrderTask.Instance.Update(sqltran, model)); }
/// <summary> /// 收回任务 /// </summary> /// <param name="msg"></param> internal void RevokeTask(out string msg) { msg = string.Empty; string Result = "yes"; string ErrorMsg = ""; //不为空 if (!string.IsNullOrEmpty(TaskIDS)) { if (TaskIDS.IndexOf(',') > 0) { for (int i = 0; i < TaskIDS.Split(',').Length; i++) { int userid = 0; Entities.OrderTask Model = BLL.OrderTask.Instance.GetOrderTask(Convert.ToInt32(TaskIDS.Split(',')[i])); //判断任务状态,是否为已处理 if (Model.TaskStatus != (int)Entities.TaskStatus.Processed) { //取要被收回任务的处理人 if (Model.AssignUserID != null && Model.AssignUserID != -2) { userid = Convert.ToInt32(Model.AssignUserID); } Model.AssignUserID = null; Model.TaskStatus = (int)Entities.TaskStatus.NoAllocation; BLL.OrderTask.Instance.Update(Model); Entities.OrderTaskOperationLog logmodel = new Entities.OrderTaskOperationLog(); logmodel.TaskID = Model.TaskID; logmodel.OperationStatus = (int)Entities.OperationStatus.Recover; logmodel.TaskStatus = (int)Entities.TaskStatus.NoAllocation; if (userid != 0) { logmodel.Remark = BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(userid); } logmodel.CreateTime = System.DateTime.Now; logmodel.CreateUserID = BLL.Util.GetLoginUserID(); BLL.OrderTaskOperationLog.Instance.Insert(logmodel); } else { Result = "no"; ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态为已处理,不能回收。"; } } } else { int userid = 0; Entities.OrderTask Model = BLL.OrderTask.Instance.GetOrderTask(Convert.ToInt32(TaskIDS)); //判断任务状态,是否为已处理 if (Model.TaskStatus != (int)Entities.TaskStatus.Processed) { //取要被收回任务的处理人 if (Model.AssignUserID != null && Model.AssignUserID != -2) { userid = Convert.ToInt32(Model.AssignUserID); } Model.AssignUserID = null; Model.TaskStatus = (int)Entities.TaskStatus.NoAllocation; BLL.OrderTask.Instance.Update(Model); Entities.OrderTaskOperationLog logmodel = new Entities.OrderTaskOperationLog(); logmodel.TaskID = Model.TaskID; logmodel.OperationStatus = (int)Entities.OperationStatus.Recover; logmodel.TaskStatus = (int)Entities.TaskStatus.NoAllocation; logmodel.Remark = BitAuto.YanFa.SysRightManager.Common.UserInfo.GerTrueName(userid); logmodel.CreateTime = System.DateTime.Now; logmodel.CreateUserID = BLL.Util.GetLoginUserID(); BLL.OrderTaskOperationLog.Instance.Insert(logmodel); } else { Result = "no"; ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态为已处理,不能回收。"; } } } msg = "{Result:'" + Result + "',CustID:'',ErrorMsg:'" + ErrorMsg + "'}"; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlAreaBind(); //ddlDataSourceBind(); if (!string.IsNullOrEmpty(RequstTaskID)) { //判断数据来源 Entities.OrderTask model = BLL.OrderTask.Instance.GetOrderTask(Convert.ToInt32(RequstTaskID)); if (model != null) { //未购车,试驾 if (model.Source == 1 || model.Source == 3) { this.rdoNoCar.Checked = true; Entities.OrderNewCar custBasicInfo = BLL.OrderNewCar.Instance.GetOrderNewCar(Convert.ToInt32(RequstTaskID)); if (custBasicInfo != null) { this.txtCustName.Value = custBasicInfo.UserName; this.txtAddress.Value = custBasicInfo.UserAddress; ProvinceID = custBasicInfo.ProvinceID.ToString(); CityID = custBasicInfo.CityID.ToString(); CountyID = custBasicInfo.CountyID.ToString(); //ddlDataSource.Value = "易湃"; if (custBasicInfo.UserGender == 1) { rdoMan.Checked = true; } else { rdoWomen.Checked = true; } ddlArea.Value = custBasicInfo.AreaID.ToString(); txtTel1.Value = custBasicInfo.UserPhone; txtTel2.Value = custBasicInfo.UserMobile; txtEmail.Value = custBasicInfo.UserMail; } } //已购车 else { this.rdoHavCar.Checked = true; Entities.OrderRelpaceCar custBasicInfo = BLL.OrderRelpaceCar.Instance.GetOrderRelpaceCar(Convert.ToInt32(RequstTaskID)); if (custBasicInfo != null) { this.txtCustName.Value = custBasicInfo.UserName; this.txtAddress.Value = custBasicInfo.UserAddress; ProvinceID = custBasicInfo.ProvinceID.ToString(); CityID = custBasicInfo.CityID.ToString(); CountyID = custBasicInfo.CountyID.ToString(); //ddlDataSource.Value = "易湃"; if (custBasicInfo.UserGender == 1) { rdoMan.Checked = true; } else { rdoWomen.Checked = true; } ddlArea.Value = custBasicInfo.AreaID.ToString(); txtTel1.Value = custBasicInfo.UserPhone; txtTel2.Value = custBasicInfo.UserMobile; txtEmail.Value = custBasicInfo.UserMail; } } ///更具已购车未购车表确定Type Entities.OrderBuyCarInfo modelOrderbuyCar = null; modelOrderbuyCar = BLL.OrderBuyCarInfo.Instance.GetOrderBuyCarInfo(Convert.ToInt32(RequstTaskID)); if (modelOrderbuyCar != null) { if (modelOrderbuyCar.Type == 2) { this.rdoNoCar.Checked = true; this.rdoHavCar.Checked = false; } else { this.rdoHavCar.Checked = true; this.rdoNoCar.Checked = false; } } } } } }
private void GetBuyCarModel(string TaskID) { if (!string.IsNullOrEmpty(TaskID)) { long _taskID = Convert.ToInt32(TaskID); //数据来源 Entities.OrderTask model = BLL.OrderTask.Instance.GetOrderTask(_taskID); if (model != null) { Type = model.Source.ToString(); } BuyCarInfoModel = BLL.OrderBuyCarInfo.Instance.GetOrderBuyCarInfo(_taskID); if (BuyCarInfoModel != null) { //汽车品牌 CarBrandID = Convert.ToInt32(BuyCarInfoModel.CarBrandId); //汽车系列 CarSerialID = Convert.ToInt32(BuyCarInfoModel.CarSerialId); CarTypeID = Convert.ToInt32(BuyCarInfoModel.CarTypeID); } if (BuyCarInfoModel == null) { BuyCarInfoModel = new Entities.OrderBuyCarInfo(); } //1,3都从新车里取数据,modify by qizq 2013-7-19 switch (model.Source) { case 1: Entities.OrderNewCar model_newCar = new Entities.OrderNewCar(); model_newCar = BLL.OrderNewCar.Instance.GetOrderNewCar(_taskID); if (model_newCar != null) { //易湃订单ID YPOrderID = model_newCar.YPOrderID.ToString(); } break; case 3: Entities.OrderNewCar model_newCar1 = new Entities.OrderNewCar(); model_newCar1 = BLL.OrderNewCar.Instance.GetOrderNewCar(_taskID); if (model_newCar1 != null) { //易湃订单ID YPOrderID = model_newCar1.YPOrderID.ToString(); } break; case 2: Entities.OrderRelpaceCar model_relpaceCar = new Entities.OrderRelpaceCar(); model_relpaceCar = BLL.OrderRelpaceCar.Instance.GetOrderRelpaceCar(_taskID); if (model_relpaceCar != null) { //易湃订单ID YPOrderID = model_relpaceCar.YPOrderID.ToString(); } break; } } }
/// <summary> /// 增加一条数据 /// </summary> public long Insert(SqlTransaction sqltran, Entities.OrderTask model) { return(Dal.OrderTask.Instance.Insert(sqltran, model)); }