Beispiel #1
0
        public void EditCDP(CallDayPlanningEntity entity, string poplist)
        {
            CallDayPlanningViewEntity_POP searchEntity = new CallDayPlanningViewEntity_POP();

            searchEntity.ClientUserID = entity.ClientUserID;
            searchEntity.CallDate     = entity.CallDate;
            CallDayPlanningEntity[] oldEntity = this._currentDAO.GetCallDayPlanning(searchEntity);

            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    foreach (string popid in poplist.Split(','))
                    {
                        if (!string.IsNullOrEmpty(popid) &&
                            oldEntity.Where(m => m.POPID == popid).ToArray().Length == 0)
                        {
                            entity.PlanningID = null;
                            entity.POPID      = popid;
                            this._currentDAO.Create(entity, tran);
                        }
                    }

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }
        }
        public string EditCDP(NameValueCollection rParams)
        {
            string res = "{success:false,msg:'保存失败'}";

            CallDayPlanningEntity entity = new CallDayPlanningEntity();

            entity.ClientUserID = rParams["ClientUserID"].ToInt();
            entity.CallDate     = rParams["CallDate"].ToDateTime();
            entity.POPType      = rParams["POPType"].ToInt();
            string poplist = "";

            if (entity.POPType == 1)
            {
                poplist = rParams["StoreList"];
            }
            else if (entity.POPType == 2)
            {
                poplist = rParams["DistributorList"];
            }
            entity.Remark       = rParams["Remark"];
            entity.PlanningType = 2;

            entity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
            entity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);

            new CallDayPlanningBLL(CurrentUserInfo).EditCDP(entity, poplist);
            res = "{success:true,msg:'保存成功'}";
            return(res);
        }
        /// <summary>
        /// 路线地图选择终端
        /// </summary>
        /// <param name="routeid"></param>
        /// <param name="mappingEntity"></param>
        /// <param name="deletelist">删除的ID集合(不要含用户后来又选择的)</param>
        public void EditUserCDPPOPMap_Store(CallDayPlanningViewEntity_POP infoEntity, List <DefindControlEntity> pSearch, CallDayPlanningViewEntity_POP[] mappingEntity, string deletelist)
        {
            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    List <CallDayPlanningEntity> oldList = this._currentDAO.GetCallDayPlanning(infoEntity).ToList();

                    for (int i = 0; i < mappingEntity.Length; i++)
                    {
                        CallDayPlanningViewEntity_POP entity = mappingEntity[i];

                        if (entity.MappingID != null && !string.IsNullOrEmpty(entity.MappingID.ToString()))
                        {
                            //修改
                            CallDayPlanningEntity uEntity = oldList.Where(m => m.PlanningID == entity.MappingID).ToArray()[0];
                            uEntity.Sequence = (i + 1);
                            this._currentDAO.Update(uEntity, tran);
                        }
                        else
                        {
                            //新增
                            CallDayPlanningEntity uEntity = new CallDayPlanningEntity();

                            uEntity.CallDate     = infoEntity.CallDate;
                            uEntity.POPID        = entity.StoreID.ToString().ToLower();
                            uEntity.POPType      = 1;
                            uEntity.ClientUserID = infoEntity.ClientUserID;
                            uEntity.Sequence     = (i + 1);
                            uEntity.PlanningType = 2;

                            uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                            uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                            this._currentDAO.Create(uEntity, tran);
                        }
                    }
                    //删除
                    if (deletelist != null && !string.IsNullOrEmpty(deletelist))
                    {
                        foreach (string mapid in deletelist.Split(','))
                        {
                            if (!string.IsNullOrEmpty(mapid))
                            {
                                this._currentDAO.Delete(Guid.Parse(mapid), tran);
                            }
                        }
                    }

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }
        }
        public string GetUserCDPPOPType(NameValueCollection rParams)
        {
            CallDayPlanningEntity entity = new CallDayPlanningEntity();

            entity.ClientUserID = rParams["ClientUserID"].ToInt();
            entity.CallDate     = rParams["CallDate"].ToDateTime();
            return(new CallDayPlanningBLL(CurrentUserInfo).GetUserCDPPOPType(entity).Tables[0].ToJSON());
        }
        /// <summary>
        /// 拜访计划终端选择
        /// </summary>
        /// <param name="infoEntity">clientuserid,calldate 必传</param>
        /// <param name="pSearch"></param>
        /// <param name="mappingEntity"></param>
        public void EditUserCDPPOPList_Store(
            CallDayPlanningViewEntity_POP infoEntity,
            List <DefindControlEntity> pSearch,
            CallDayPlanningViewEntity_POP[] mappingEntity)
        {
            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    List <CallDayPlanningEntity> oldList = this._currentDAO.GetCallDayPlanning(infoEntity).ToList();

                    foreach (CallDayPlanningViewEntity_POP entity in mappingEntity)
                    {
                        if (entity.MappingID != null && !string.IsNullOrEmpty(entity.MappingID.ToString()))
                        {
                            if (entity.IsDelete == 1)
                            {
                                //删除
                                this._currentDAO.Delete(entity.MappingID, tran);
                            }
                            else
                            {
                                //修改
                                CallDayPlanningEntity uEntity = oldList.Where(m => m.PlanningID == entity.MappingID).ToArray()[0];
                                uEntity.Sequence = entity.Sequence;
                                this._currentDAO.Update(uEntity, tran);
                            }
                        }
                        else
                        {
                            //新增
                            CallDayPlanningEntity uEntity = new CallDayPlanningEntity();

                            uEntity.CallDate     = infoEntity.CallDate;
                            uEntity.POPID        = entity.StoreID.ToString().ToLower();
                            uEntity.POPType      = 1;
                            uEntity.ClientUserID = infoEntity.ClientUserID;
                            uEntity.Sequence     = entity.Sequence;
                            uEntity.PlanningType = 2;

                            uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                            uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                            this._currentDAO.Create(uEntity, tran);
                        }
                    }

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }
        }
Beispiel #6
0
 /// <summary>
 /// 获取用户拜访计划终端类型,其中 ClientUserID  calldate 必传
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public DataSet GetUserCDPPOPType(CallDayPlanningEntity entity)
 {
     return(this._currentDAO.GetUserCDPPOPType(entity));
 }