Exemple #1
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public int Update(SqlTransaction sqltran, Entities.GroupOrderTask model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@TaskID",           SqlDbType.BigInt,    8),
                new SqlParameter("@TaskStatus",       SqlDbType.Int,       4),
                new SqlParameter("@OrderID",          SqlDbType.Int,       4),
                new SqlParameter("@BGID",             SqlDbType.Int,       4),
                new SqlParameter("@SCID",             SqlDbType.Int,       4),
                new SqlParameter("@AssignUserID",     SqlDbType.Int,       4),
                new SqlParameter("@AssignTime",       SqlDbType.DateTime),
                new SqlParameter("@SubmitTime",       SqlDbType.DateTime),
                new SqlParameter("@CreateTime",       SqlDbType.DateTime),
                new SqlParameter("@CreateUserID",     SqlDbType.Int,       4),
                new SqlParameter("@LastUpdateTime",   SqlDbType.DateTime),
                new SqlParameter("@LastUpdateUserID", SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.TaskID;
            parameters[1].Value  = model.TaskStatus;
            parameters[2].Value  = model.OrderID;
            parameters[3].Value  = model.BGID;
            parameters[4].Value  = model.SCID;
            parameters[5].Value  = model.AssignUserID;
            parameters[6].Value  = model.AssignTime;
            parameters[7].Value  = model.SubmitTime;
            parameters[8].Value  = model.CreateTime;
            parameters[9].Value  = model.CreateUserID;
            parameters[10].Value = model.LastUpdateTime;
            parameters[11].Value = model.LastUpdateUserID;

            return(SqlHelper.ExecuteNonQuery(sqltran, CommandType.StoredProcedure, P_GROUPORDERTASK_UPDATE, parameters));
        }
Exemple #2
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Insert(Entities.GroupOrderTask model)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@TaskID",           SqlDbType.BigInt,    8),
                new SqlParameter("@TaskStatus",       SqlDbType.Int,       4),
                new SqlParameter("@OrderID",          SqlDbType.Int,       4),
                new SqlParameter("@BGID",             SqlDbType.Int,       4),
                new SqlParameter("@SCID",             SqlDbType.Int,       4),
                new SqlParameter("@AssignUserID",     SqlDbType.Int,       4),
                new SqlParameter("@AssignTime",       SqlDbType.DateTime),
                new SqlParameter("@SubmitTime",       SqlDbType.DateTime),
                new SqlParameter("@CreateTime",       SqlDbType.DateTime),
                new SqlParameter("@CreateUserID",     SqlDbType.Int,       4),
                new SqlParameter("@LastUpdateTime",   SqlDbType.DateTime),
                new SqlParameter("@LastUpdateUserID", SqlDbType.Int, 4)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.TaskStatus;
            parameters[2].Value     = model.OrderID;
            parameters[3].Value     = model.BGID;
            parameters[4].Value     = model.SCID;
            parameters[5].Value     = model.AssignUserID;
            parameters[6].Value     = model.AssignTime;
            parameters[7].Value     = model.SubmitTime;
            parameters[8].Value     = model.CreateTime;
            parameters[9].Value     = model.CreateUserID;
            parameters[10].Value    = model.LastUpdateTime;
            parameters[11].Value    = model.LastUpdateUserID;

            SqlHelper.ExecuteNonQuery(CONNECTIONSTRINGS, CommandType.StoredProcedure, P_GROUPORDERTASK_INSERT, parameters);
            return((int)parameters[0].Value);
        }
Exemple #3
0
        private Entities.GroupOrderTask LoadSingleGroupOrderTask(DataRow row)
        {
            Entities.GroupOrderTask model = new Entities.GroupOrderTask();

            if (row["TaskID"].ToString() != "")
            {
                model.TaskID = long.Parse(row["TaskID"].ToString());
            }
            if (row["TaskStatus"].ToString() != "")
            {
                model.TaskStatus = int.Parse(row["TaskStatus"].ToString());
            }
            if (row["OrderID"].ToString() != "")
            {
                model.OrderID = int.Parse(row["OrderID"].ToString());
            }
            if (row["BGID"].ToString() != "")
            {
                model.BGID = int.Parse(row["BGID"].ToString());
            }
            if (row["SCID"].ToString() != "")
            {
                model.SCID = int.Parse(row["SCID"].ToString());
            }
            if (row["AssignUserID"].ToString() != "")
            {
                model.AssignUserID = int.Parse(row["AssignUserID"].ToString());
            }
            if (row["AssignTime"].ToString() != "")
            {
                model.AssignTime = DateTime.Parse(row["AssignTime"].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["LastUpdateTime"].ToString() != "")
            {
                model.LastUpdateTime = DateTime.Parse(row["LastUpdateTime"].ToString());
            }
            if (row["LastUpdateUserID"].ToString() != "")
            {
                model.LastUpdateUserID = int.Parse(row["LastUpdateUserID"].ToString());
            }
            return(model);
        }
Exemple #4
0
        /// <summary>
        /// 根据团购订单信息,生成任务
        /// </summary>
        /// <param name="tran"></param>
        /// <param name="model">团购订单信息</param>
        /// <returns>返回任务ID</returns>
        public long InsertByOrder(SqlTransaction tran, Entities.GroupOrderOrg model)
        {
            Entities.GroupOrderTask otModel = new Entities.GroupOrderTask();
            otModel.TaskStatus       = (int)Entities.GroupTaskStatus.NoAllocation;
            otModel.OrderID          = model.OrderID;
            otModel.BGID             = int.Parse(ConfigurationUtil.GetAppSettingValue("GenTaskDefaultGroupID"));
            otModel.SCID             = int.Parse(ConfigurationUtil.GetAppSettingValue("GenTaskDefaultCategoryID"));
            otModel.AssignUserID     = null;
            otModel.AssignTime       = null;
            otModel.SubmitTime       = null;
            otModel.CreateTime       = DateTime.Now;
            otModel.CreateUserID     = null;
            otModel.LastUpdateTime   = null;
            otModel.LastUpdateUserID = null;

            return(Insert(tran, otModel));
        }
Exemple #5
0
        /// <summary>
        /// ordertype 1是保存,2是提交
        /// </summary>
        /// <param name="ordertype"></param>
        protected void DealOrder(int ordertype, out string msg)
        {
            msg = "";
            long taskid = 0;

            if (long.TryParse(RequestTaskID, out taskid))
            {
                Entities.GroupOrderTask model = BLL.GroupOrderTask.Instance.GetGroupOrderTask(taskid);
                if (model != null)
                {
                    if (model.TaskStatus != (int)Entities.GroupTaskStatus.Processing && model.TaskStatus != (int)Entities.GroupTaskStatus.NoProcess)
                    {
                        msg = "{\"Result\":false,\"Msg\":\"任务不处于处理状态!\"}";
                    }
                    else
                    {
                        //本地保存订单信息,修改订单状态
                        Entities.GroupOrder groupordermodel = BLL.GroupOrder.Instance.GetGroupOrder(taskid);
                        if (groupordermodel != null)
                        {
                            #region 保存或提交订单信息,修改任务状态,插入任务操作状态
                            //保存
                            if (ordertype == 1)
                            {
                                model.LastUpdateTime   = System.DateTime.Now;
                                model.LastUpdateUserID = userId;
                                model.TaskStatus       = (int)Entities.GroupTaskStatus.Processing;
                            }
                            //提交
                            else if (ordertype == 2)
                            {
                                model.LastUpdateTime   = System.DateTime.Now;
                                model.LastUpdateUserID = userId;
                                model.TaskStatus       = (int)Entities.GroupTaskStatus.Processed;
                                model.SubmitTime       = System.DateTime.Now;
                            }
                            int IsReturnVisit = 0;
                            if (int.TryParse(RequestIsReturnVisit, out IsReturnVisit))
                            {
                                groupordermodel.IsReturnVisit = IsReturnVisit;
                            }
                            int FailReson = 0;
                            if (int.TryParse(RequestFailReson, out FailReson))
                            {
                                groupordermodel.FailReasonID = FailReson;
                            }
                            int sex = 0;
                            if (int.TryParse(RequestSex, out sex))
                            {
                                groupordermodel.UserGender = sex;
                            }
                            groupordermodel.CallRecord       = RequestRemark;
                            groupordermodel.UserName         = RequestQCTUserName;
                            groupordermodel.LastUpdateTime   = System.DateTime.Now;
                            groupordermodel.LastUpdateUserID = userId;

                            //意向车型,预计购车时间
                            int _WantCarMasterID = -2;
                            if (int.TryParse(WantCarMasterID, out _WantCarMasterID))
                            {
                                groupordermodel.WantCarMasterID = _WantCarMasterID;
                            }
                            int _WantCarSerialID = -2;
                            if (int.TryParse(WantCarSerialID, out _WantCarSerialID))
                            {
                                groupordermodel.WantCarSerialID = _WantCarSerialID;
                            }
                            int _WantCarID = -2;
                            if (int.TryParse(WantCarID, out _WantCarID))
                            {
                                groupordermodel.WantCarID = _WantCarID;
                            }
                            int _PlanBuyCarTime = -2;
                            if (int.TryParse(PlanBuyCarTime, out _PlanBuyCarTime))
                            {
                                groupordermodel.PlanBuyCarTime = _PlanBuyCarTime;
                            }
                            groupordermodel.WantCarMasterName = WantCarMasterName;
                            groupordermodel.WantCarSerialName = WantCarSerialName;
                            groupordermodel.WantCarName       = WantCarName;

                            //更新任务状态
                            BLL.GroupOrderTask.Instance.Update(model);
                            //对于保存不用匹配客户池客户所以在此处更新订单信息,提交要在匹配客户池客户后拿到custid后更新
                            if (ordertype == 1)
                            {
                                BLL.GroupOrder.Instance.Update(groupordermodel);
                            }
                            //插入或合并任务操作日志
                            DealLog(ordertype);
                            #endregion

                            #region 提交处理
                            if (ordertype == 2)
                            {
                                if (!string.IsNullOrEmpty(groupordermodel.CustomerTel))
                                {
                                    #region 根据电话号码判断 客户池是否存在,存在不更新客户,不存在插入

                                    string CustID = string.Empty;
                                    //根据电话找客户,如果有多个去匹配那个名称一致的
                                    DataTable dtcust = BLL.CustBasicInfo.Instance.GetCustBasicInfosByTel(groupordermodel.CustomerTel);
                                    if (dtcust != null && dtcust.Rows.Count > 0)
                                    {
                                        if (dtcust.Rows.Count == 1)
                                        {
                                            //如果找到一个,就取CustID
                                            CustID = dtcust.Rows[0]["CustID"].ToString();
                                        }
                                        else if (dtcust.Rows.Count > 1)
                                        {
                                            //多个客户,查找有团购订单类型的客户
                                            DataRow[] rows = dtcust.Select("CustName='" + groupordermodel.CustomerName.Trim() + "'");
                                            if (rows.Length > 0)
                                            {
                                                CustID = rows[0]["CustID"].ToString();
                                            }
                                        }
                                    }
                                    else
                                    {
                                        //根据电话没有找到客户,要插入个人客户信息表
                                        CustID = AddNewCustBaseInfo(groupordermodel);
                                    }

                                    #endregion

                                    #region 提交要匹配客户池客户所以在匹配客户池客户后拿到custid后更新订单
                                    groupordermodel.CustID = CustID;
                                    BLL.GroupOrder.Instance.Update(groupordermodel);
                                    #endregion

                                    #region 在客户历史记录里加入团购订单联系记录
                                    Entities.CustHistoryInfo custhistroyinfomodel = new Entities.CustHistoryInfo();
                                    custhistroyinfomodel.TaskID = RequestTaskID;
                                    //业务类型,2为团购订单
                                    custhistroyinfomodel.BusinessType = 2;
                                    //录音
                                    if (!string.IsNullOrEmpty(RequestCallRecordID))
                                    {
                                        long callrecordid = 0;
                                        if (long.TryParse(RequestCallRecordID, out callrecordid))
                                        {
                                            custhistroyinfomodel.CallRecordID = callrecordid;
                                        }
                                    }
                                    //呼出
                                    custhistroyinfomodel.RecordType   = 2;
                                    custhistroyinfomodel.CustID       = CustID;
                                    custhistroyinfomodel.CreateTime   = System.DateTime.Now;
                                    custhistroyinfomodel.CreateUserID = userId;
                                    //功能废弃
                                    BLL.CustHistoryInfo.Instance.Insert(custhistroyinfomodel);
                                    #endregion

                                    #region 回写易湃
                                    string errMsg = "";
                                    ReWriteOrderData(taskid, out errMsg);
                                    #endregion

                                    if (errMsg != "")
                                    {
                                        msg = "{\"Result\":false,\"Msg\":\"调用易湃接口失败!" + errMsg + "\"}";
                                    }
                                }
                            }
                            #endregion
                        }
                        else
                        {
                            msg = "{\"Result\":false,\"Msg\":\"任务对应订单不存在!\"}";
                        }
                    }
                }
                else
                {
                    msg = "{\"Result\":false,\"Msg\":\"任务不存在!\"}";
                }
            }
        }
Exemple #6
0
        /// <summary>
        /// ordertype 1是保存,2是提交
        /// </summary>
        /// <param name="ordertype"></param>
        public void DealOrder(int ordertype, out string msg)
        {
            msg = "";
            long taskid = 0;

            if (long.TryParse(RequestTaskID, out taskid))
            {
                Entities.GroupOrderTask model = BLL.GroupOrderTask.Instance.GetGroupOrderTask(taskid);
                if (model != null)
                {
                    if (model.TaskStatus != (int)Entities.GroupTaskStatus.NoAllocation && model.TaskStatus != (int)Entities.GroupTaskStatus.Processing && model.TaskStatus != (int)Entities.GroupTaskStatus.NoProcess)
                    {
                        //msg = "{\"Result\":false,\"Msg\":\"任务ID"+ taskid +"不处于处理状态\"}";
                        string s = "";
                        s   = BitAuto.ISDC.CC2012.BLL.Util.GetEnumOptText(typeof(BitAuto.ISDC.CC2012.Entities.GroupTaskStatus), Convert.ToInt32(model.TaskStatus));
                        msg = "任务状态为:" + s + ",不处于处理状态";
                    }
                    else
                    {
                        //本地保存订单信息,修改订单状态
                        Entities.GroupOrder groupordermodel = BLL.GroupOrder.Instance.GetGroupOrder(taskid);
                        if (groupordermodel != null)
                        {
                            #region 保存或提交订单信息,修改任务状态,插入任务操作状态
                            //保存
                            if (ordertype == 1)
                            {
                                model.LastUpdateTime   = System.DateTime.Now;
                                model.LastUpdateUserID = userId;
                                model.TaskStatus       = (int)Entities.GroupTaskStatus.Processing;
                            }
                            //提交
                            else if (ordertype == 2)
                            {
                                model.LastUpdateTime   = System.DateTime.Now;
                                model.LastUpdateUserID = userId;

                                //如果 是否为回访值为:是,则更新任务状态,调回写接口
                                //否则 不更新,也不调回写接口
                                if (this.RequestIsReturnVisit == ((int)Entities.IsReturnVisit.Yes).ToString())
                                {
                                    model.TaskStatus = (int)Entities.GroupTaskStatus.Processed;
                                }

                                model.SubmitTime = System.DateTime.Now;
                            }
                            int IsReturnVisit = 0;
                            if (int.TryParse(RequestIsReturnVisit, out IsReturnVisit))
                            {
                                groupordermodel.IsReturnVisit = IsReturnVisit;
                            }

                            groupordermodel.LastUpdateTime   = System.DateTime.Now;
                            groupordermodel.LastUpdateUserID = userId;

                            //更新任务状态
                            BLL.GroupOrderTask.Instance.Update(model);
                            //对于保存不用匹配客户池客户所以在此处更新订单信息,提交要在匹配客户池客户后拿到custid后更新
                            //处理结果为:否的,不提交,所以在些更新订单
                            //if (ordertype == 1)
                            if (this.RequestIsReturnVisit == ((int)Entities.IsReturnVisit.No).ToString())
                            {
                                BLL.GroupOrder.Instance.Update(groupordermodel);
                            }
                            //插入或合并任务操作日志
                            //如果 是否为回访值为:是,则更新任务状态,调回写接口
                            //否则 不更新,也不调回写接口
                            if (this.RequestIsReturnVisit == ((int)Entities.IsReturnVisit.Yes).ToString())
                            {
                                DealLog(ordertype);
                            }
                            #endregion

                            //如果 是否为回访值为:是,则更新任务状态,调回写接口
                            //否则 不更新,也不调回写接口
                            #region 提交处理
                            if (ordertype == 2 && this.RequestIsReturnVisit == ((int)Entities.IsReturnVisit.Yes).ToString())
                            {
                                if (!string.IsNullOrEmpty(groupordermodel.CustomerTel))
                                {
                                    #region 根据电话号码判断 客户池是否存在,存在不更新客户,不存在插入
                                    string CustID = string.Empty;
                                    //根据电话找客户,如果有多个去匹配那个名称一致的
                                    DataTable dtcust = BLL.CustBasicInfo.Instance.GetCustBasicInfosByTel(groupordermodel.CustomerTel);
                                    if (dtcust != null && dtcust.Rows.Count > 0)
                                    {
                                        for (int i = 0; i < dtcust.Rows.Count; i++)
                                        {
                                            if (dtcust.Rows[i]["CustName"].ToString() == groupordermodel.CustomerName)
                                            {
                                                CustID = dtcust.Rows[i]["CustID"].ToString();
                                                break;
                                            }
                                        }
                                    }
                                    //如果CustID不为空说明找到了,否则没找到
                                    if (!string.IsNullOrEmpty(CustID))
                                    {
                                    }
                                    else
                                    {
                                        #region 插入客户池
                                        Entities.CustBasicInfo newcustmodel = new Entities.CustBasicInfo();
                                        newcustmodel.Status         = 0;
                                        newcustmodel.Sex            = groupordermodel.UserGender;
                                        newcustmodel.CustName       = groupordermodel.CustomerName;
                                        newcustmodel.CustCategoryID = 4;
                                        newcustmodel.ProvinceID     = groupordermodel.ProvinceID;
                                        newcustmodel.CityID         = groupordermodel.CityID;
                                        newcustmodel.AreaID         = groupordermodel.AreaID;
                                        newcustmodel.CreateTime     = System.DateTime.Now;
                                        newcustmodel.CreateUserID   = userId;
                                        //功能废弃 插入客户基本信息
                                        CustID = null;// BLL.CustBasicInfo.Instance.Insert(newcustmodel);
                                        Entities.CustTel custtelmodel = new Entities.CustTel();
                                        custtelmodel.CreateTime   = System.DateTime.Now;
                                        custtelmodel.CreateUserID = userId;
                                        custtelmodel.CustID       = CustID;
                                        custtelmodel.Tel          = groupordermodel.CustomerTel;
                                        //插入电话
                                        BLL.CustTel.Instance.Insert(custtelmodel);
                                        //插入bugcarinfo
                                        Entities.BuyCarInfo bugcarmodel = new Entities.BuyCarInfo();
                                        bugcarmodel.CustID       = CustID;
                                        bugcarmodel.Type         = 4;
                                        bugcarmodel.CarBrandId   = 0;
                                        bugcarmodel.CarSerialId  = 0;
                                        bugcarmodel.CarTypeID    = 0;
                                        bugcarmodel.Status       = 0;
                                        bugcarmodel.CreateTime   = System.DateTime.Now;
                                        bugcarmodel.CreateUserID = userId;
                                        //bugcarmodel.UserName = RequestQCTUserName;
                                        BLL.BuyCarInfo.Instance.Insert(bugcarmodel);
                                        #endregion
                                    }
                                    #endregion

                                    #region 提交要匹配客户池客户所以在匹配客户池客户后拿到custid后更新订单
                                    groupordermodel.CustID = CustID;
                                    BLL.GroupOrder.Instance.Update(groupordermodel);
                                    #endregion

                                    #region 在客户历史记录里加入团购订单联系记录
                                    Entities.CustHistoryInfo custhistroyinfomodel = new Entities.CustHistoryInfo();
                                    custhistroyinfomodel.TaskID = RequestTaskID;
                                    //业务类型,2为团购订单
                                    custhistroyinfomodel.BusinessType = 2;
                                    //录音
                                    //if (!string.IsNullOrEmpty(RequestCallRecordID))
                                    //{
                                    //    long callrecordid = 0;
                                    //    if (long.TryParse(RequestCallRecordID, out callrecordid))
                                    //    {
                                    //        custhistroyinfomodel.CallRecordID = callrecordid;

                                    //    }
                                    //}
                                    //呼出
                                    custhistroyinfomodel.RecordType   = 2;
                                    custhistroyinfomodel.CustID       = CustID;
                                    custhistroyinfomodel.CreateTime   = System.DateTime.Now;
                                    custhistroyinfomodel.CreateUserID = userId;
                                    //功能废弃
                                    BLL.CustHistoryInfo.Instance.Insert(custhistroyinfomodel);
                                    #endregion

                                    #region 回写易湃
                                    ReWriteOrderData(taskid);
                                    #endregion
                                }
                            }
                            #endregion
                        }
                        else
                        {
                            //msg = "{\"Result\":false,\"Msg\":\"任务ID" + taskid + "对应订单不存在!\"}";
                            msg = "对应订单不存在!";
                        }
                    }
                }
                else
                {
                    //msg = "{\"Result\":false,\"Msg\":\"任务ID" + taskid + "不存在!\"}";
                    msg = "任务ID不存在";
                }
            }
        }
        /// <summary>
        /// 分配任务
        /// </summary>
        /// <param name="msg"></param>
        private void AssignTask(out string msg)
        {
            msg = string.Empty;

            string Result   = "yes";
            string ErrorMsg = "";

            //不为空
            if (!string.IsNullOrEmpty(TaskIDS) && !string.IsNullOrEmpty(AssignUserID))
            {
                if (TaskIDS.IndexOf(',') > 0)
                {
                    string[] arrayTaskIDS = TaskIDS.Split(',');
                    foreach (string taskid in arrayTaskIDS)
                    {
                        Entities.GroupOrderTask Model = BLL.GroupOrderTask.Instance.GetGroupOrderTask(Convert.ToInt32(taskid));

                        if (Model.TaskStatus == (int)Entities.GroupTaskStatus.NoAllocation)
                        {
                            Model.AssignUserID = Convert.ToInt32(AssignUserID);
                            Model.AssignTime   = System.DateTime.Now;
                            Model.TaskStatus   = (int)Entities.GroupTaskStatus.NoProcess;
                            BLL.GroupOrderTask.Instance.Update(Model);

                            //插入任务操作日志
                            Entities.GroupOrderTaskOperationLog logmodel = new Entities.GroupOrderTaskOperationLog();
                            logmodel.TaskID          = Model.TaskID;
                            logmodel.OperationStatus = (int)Entities.GO_OperationStatus.Allocation;
                            logmodel.TaskStatus      = (int)Entities.GroupTaskStatus.NoProcess;
                            logmodel.CreateTime      = System.DateTime.Now;
                            logmodel.CreateUserID    = BLL.Util.GetLoginUserID();
                            BLL.GroupOrderTaskOperationLog.Instance.Insert(logmodel);
                        }
                        else
                        {
                            Result    = "no";
                            ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态不是待分配。";
                        }
                    }
                }
                else
                {
                    Entities.GroupOrderTask Model = BLL.GroupOrderTask.Instance.GetGroupOrderTask(Convert.ToInt32(TaskIDS));

                    if (Model.TaskStatus == (int)Entities.GroupTaskStatus.NoAllocation)
                    {
                        Model.AssignUserID = Convert.ToInt32(AssignUserID);
                        Model.AssignTime   = System.DateTime.Now;
                        Model.TaskStatus   = (int)Entities.GroupTaskStatus.NoProcess;
                        BLL.GroupOrderTask.Instance.Update(Model);


                        //插入任务操作日志
                        Entities.GroupOrderTaskOperationLog logmodel = new Entities.GroupOrderTaskOperationLog();
                        logmodel.TaskID          = Model.TaskID;
                        logmodel.OperationStatus = (int)Entities.GO_OperationStatus.Allocation;
                        logmodel.TaskStatus      = (int)Entities.GroupTaskStatus.NoProcess;
                        logmodel.CreateTime      = System.DateTime.Now;
                        logmodel.CreateUserID    = BLL.Util.GetLoginUserID();
                        BLL.GroupOrderTaskOperationLog.Instance.Insert(logmodel);
                    }
                    else
                    {
                        Result    = "no";
                        ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态不是待分配。";
                    }
                }
            }
            msg = "{Result:'" + Result + "',CustID:'',ErrorMsg:'" + ErrorMsg + "'}";
        }
        /// <summary>
        /// 收回任务
        /// </summary>
        /// <param name="msg"></param>
        public 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.GroupOrderTask Model = BLL.GroupOrderTask.Instance.GetGroupOrderTask(Convert.ToInt32(TaskIDS.Split(',')[i]));

                        //判断任务状态,是否为已处理
                        if (Model.TaskStatus != (int)Entities.GroupTaskStatus.Processed)
                        {
                            //取要被收回任务的处理人
                            if (Model.AssignUserID != null && Model.AssignUserID != -2)
                            {
                                userid = Convert.ToInt32(Model.AssignUserID);
                            }
                            Model.AssignUserID = null;
                            Model.TaskStatus   = (int)Entities.GroupTaskStatus.NoAllocation;
                            BLL.GroupOrderTask.Instance.Update(Model);
                            Entities.GroupOrderTaskOperationLog logmodel = new Entities.GroupOrderTaskOperationLog();
                            logmodel.TaskID          = Model.TaskID;
                            logmodel.OperationStatus = (int)Entities.GO_OperationStatus.Recover;
                            logmodel.TaskStatus      = (int)Entities.GroupTaskStatus.NoAllocation;
                            logmodel.CreateTime      = System.DateTime.Now;
                            logmodel.CreateUserID    = BLL.Util.GetLoginUserID();
                            BLL.GroupOrderTaskOperationLog.Instance.Insert(logmodel);
                        }
                        else
                        {
                            Result    = "no";
                            ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态为已处理,不能回收。";
                        }
                    }
                }
                else
                {
                    int userid = 0;

                    Entities.GroupOrderTask Model = BLL.GroupOrderTask.Instance.GetGroupOrderTask(Convert.ToInt32(TaskIDS));

                    //判断任务状态,是否为已处理
                    if (Model.TaskStatus != (int)Entities.GroupTaskStatus.Processed)
                    {
                        //取要被收回任务的处理人
                        if (Model.AssignUserID != null && Model.AssignUserID != -2)
                        {
                            userid = Convert.ToInt32(Model.AssignUserID);
                        }
                        Model.AssignUserID = null;
                        Model.TaskStatus   = (int)Entities.GroupTaskStatus.NoAllocation;
                        BLL.GroupOrderTask.Instance.Update(Model);

                        Entities.GroupOrderTaskOperationLog logmodel = new Entities.GroupOrderTaskOperationLog();
                        logmodel.TaskID          = Model.TaskID;
                        logmodel.OperationStatus = (int)Entities.GO_OperationStatus.Recover;
                        logmodel.TaskStatus      = (int)Entities.GroupTaskStatus.NoAllocation;
                        logmodel.CreateTime      = System.DateTime.Now;
                        logmodel.CreateUserID    = BLL.Util.GetLoginUserID();
                        BLL.GroupOrderTaskOperationLog.Instance.Insert(logmodel);
                    }
                    else
                    {
                        Result    = "no";
                        ErrorMsg += "任务ID为" + Model.TaskID + "的任务状态为已处理,不能回收。";
                    }
                }
            }
            msg = "{Result:'" + Result + "',CustID:'',ErrorMsg:'" + ErrorMsg + "'}";
        }
Exemple #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region 页面初次加载
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(TaskID))
                {
                    #region 绑定失败理由
                    BindFailReson();
                    #endregion

                    #region 绑定预计购车时间
                    BindPlanBuyCarTime();
                    #endregion

                    #region 任务不为空

                    int TaskIDInt = 0;
                    if (int.TryParse(TaskID, out TaskIDInt))
                    {
                        #region 任务数据格式正确
                        Entities.GroupOrderTask model = GroupOrderTask.Instance.GetGroupOrderTask(TaskIDInt);
                        if (model != null)
                        {
                            #region 任务存在
                            if (model.TaskStatus == (int)Entities.GroupTaskStatus.NoAllocation || model.TaskStatus == (int)Entities.GroupTaskStatus.Processed)
                            {
                                #region 任务不处于处理状态
                                Response.Write(@"<script language='javascript'>alert('当前任务不处于处理状态,页面将被关闭。');try {
                                                           window.external.MethodScript('/browsercontrol/closepagereloadppage');
                                                       }
                                                       catch (e) {
                                                           window.opener = null; window.open('', '_self'); window.close();
                                                       }</script>");
                                #endregion
                            }
                            else
                            {
                                #region 任务处于处理状态
                                if (model.AssignUserID != BLL.Util.GetLoginUserID())
                                {
                                    #region 当前人不是处理人
                                    Response.Write(@"<script language='javascript'>alert('您不是该任务的当前处理人,页面将被关闭。');try {
                                                           window.external.MethodScript('/browsercontrol/closepagereloadppage');
                                                       }
                                                       catch (e) {
                                                           window.opener = null; window.open('', '_self'); window.close();
                                                       }</script>");
                                    #endregion
                                }
                                else
                                {
                                    #region 加载页面
                                    Entities.GroupOrder grouporder = BLL.GroupOrder.Instance.GetGroupOrder(TaskIDInt);
                                    if (grouporder != null)
                                    {
                                        #region 订单存在
                                        //客户名称
                                        CustName = grouporder.CustomerName;
                                        //客户性别
                                        if (grouporder.UserGender == 1)
                                        {
                                            rdoMan.Checked = true;
                                        }
                                        else if (grouporder.UserGender == 2)
                                        {
                                            rdoWomen.Checked = true;
                                        }
                                        //客户电话
                                        CustTel = grouporder.CustomerTel;
                                        //客户城市id
                                        CityID = grouporder.CityID.ToString();

                                        //客户省份ID
                                        ProvinceID = grouporder.ProvinceID.ToString();

                                        //客户省份城市
                                        if (!string.IsNullOrEmpty(grouporder.ProvinceName))
                                        {
                                            LocationName += grouporder.ProvinceName + " ";
                                        }
                                        if (!string.IsNullOrEmpty(grouporder.CityName))
                                        {
                                            LocationName += grouporder.CityName;
                                        }
                                        //大区id
                                        AreaID   = grouporder.AreaID.ToString();
                                        UserName = grouporder.UserName;
                                        //大区名称
                                        //强斐 2014-12-17
                                        BitAuto.YanFa.Crm2009.Entities.AreaInfo info = BLL.Util.GetAreaInfoByPCC(
                                            BitAuto.ISDC.CC2012.Entities.CommonFunction.ObjectToString(grouporder.ProvinceID),
                                            BitAuto.ISDC.CC2012.Entities.CommonFunction.ObjectToString(grouporder.CityID), null);
                                        AreaName = info == null ? "" : info.DistinctName;
                                        //订单ID
                                        OrderID = grouporder.OrderID.ToString();
                                        //订单编号
                                        OrderCode = grouporder.OrderCode.ToString();
                                        //经销商id
                                        DealerID = grouporder.DealerID.ToString();

                                        //根据经销商id,取名称
                                        if (!string.IsNullOrEmpty(DealerID) && DealerID != "0" && DealerID != "-2")
                                        {
                                            BitAuto.YanFa.Crm2009.Entities.DMSMember DMSModel = BitAuto.YanFa.Crm2009.BLL.DMSMember.Instance.GetDMSMemberByMemberCode(DealerID);
                                            if (DMSModel != null)
                                            {
                                                MemberID = DMSModel.ID.ToString();
                                                CustID   = DMSModel.CustID;
                                            }
                                        }
                                        //经销商名称
                                        DealerName = grouporder.DealerName;
                                        //车款名称
                                        if (!string.IsNullOrEmpty(grouporder.CarMasterName))
                                        {
                                            CarName += grouporder.CarMasterName;
                                        }
                                        if (!string.IsNullOrEmpty(grouporder.CarSerialName))
                                        {
                                            CarName += "-" + grouporder.CarSerialName;
                                        }
                                        if (!string.IsNullOrEmpty(grouporder.CarName))
                                        {
                                            CarName += "-" + grouporder.CarName;
                                        }
                                        //下单时间
                                        DateTime ordertime = System.DateTime.Now;
                                        if (DateTime.TryParse(grouporder.OrderCreateTime.ToString(), out ordertime))
                                        {
                                            OrderTime = ordertime.ToString("yyyy-MM-dd HH:mm:ss");
                                        }
                                        else
                                        {
                                            OrderTime = "";
                                        }
                                        //价格
                                        OrderPrice = grouporder.OrderPrice + "万元";
                                        //是否回访
                                        selReturnVisit.SelectedIndex = selReturnVisit.Items.IndexOf(selReturnVisit.Items.FindByValue(grouporder.IsReturnVisit.ToString()));
                                        Remark = grouporder.CallRecord;
                                        //失败原因
                                        selFailReson.SelectedIndex = selFailReson.Items.IndexOf(selFailReson.Items.FindByValue(grouporder.FailReasonID.ToString()));

                                        //加载意向车型
                                        WantCarBrandID  = grouporder.WantCarMasterID.ToString();
                                        WantCarSerialID = grouporder.WantCarSerialID.ToString();
                                        WantCarID       = grouporder.WantCarID.ToString();
                                        //预计购车时间
                                        if (grouporder.PlanBuyCarTime != -2)
                                        {
                                            dllPlanBuyCarTime.SelectedIndex = dllPlanBuyCarTime.Items.IndexOf(dllPlanBuyCarTime.Items.FindByValue(grouporder.PlanBuyCarTime.ToString()));
                                        }
                                        #endregion
                                    }
                                    else
                                    {
                                        #region 订单不存在
                                        Response.Write(@"<script language='javascript'>alert('该任务对应订单不存在,页面将被关闭。');try {
                                                           window.external.MethodScript('/browsercontrol/closepagereloadppage');
                                                       }
                                                       catch (e) {
                                                           window.opener = null; window.open('', '_self'); window.close();
                                                       }</script>");
                                        #endregion
                                    }
                                    #endregion
                                }
                                #endregion
                            }
                            #endregion
                        }
                        else
                        {
                            #region 任务不存在
                            Response.Write(@"<script language='javascript'>alert('任务不存在,页面将被关闭。');try {
                                                           window.external.MethodScript('/browsercontrol/closepagereloadppage');
                                                       }
                                                       catch (e) {
                                                           window.opener = null; window.open('', '_self'); window.close();
                                                       }</script>");
                            #endregion
                        }
                        #endregion
                    }
                    else
                    {
                        #region 格式不正确
                        Response.Write(@"<script language='javascript'>alert('任务的数据格式不正确,页面将被关闭。');try {
                                                           window.external.MethodScript('/browsercontrol/closepagereloadppage');
                                                       }
                                                       catch (e) {
                                                           window.opener = null; window.open('', '_self'); window.close();
                                                       }</script>");
                        #endregion
                    }
                    #endregion
                }
                else
                {
                    #region 任务为空
                    Response.Write(@"<script language='javascript'>alert('任务不能为空,页面将被关闭。');try {
                                                           window.external.MethodScript('/browsercontrol/closepagereloadppage');
                                                       }
                                                       catch (e) {
                                                           window.opener = null; window.open('', '_self'); window.close();
                                                       }</script>");
                    #endregion
                }
            }
            #endregion
        }
Exemple #10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(SqlTransaction sqltran, Entities.GroupOrderTask model)
 {
     return(Dal.GroupOrderTask.Instance.Update(sqltran, model));
 }
Exemple #11
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(Entities.GroupOrderTask model)
 {
     return(Dal.GroupOrderTask.Instance.Update(model));
 }
Exemple #12
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Insert(SqlTransaction sqltran, Entities.GroupOrderTask model)
 {
     return(Dal.GroupOrderTask.Instance.Insert(sqltran, model));
 }
Exemple #13
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Insert(Entities.GroupOrderTask model)
 {
     return(Dal.GroupOrderTask.Instance.Insert(model));
 }