/// <summary>
        /// 路线地图选择终端
        /// </summary>
        /// <param name="routeid"></param>
        /// <param name="mappingEntity"></param>
        /// <param name="deletelist">删除的ID集合(不要含用户后来又选择的)</param>
        public void EditRoutePOPMap_Distributor(Guid routeid, RoutePOPMappingViewEntity[] mappingEntity, string deletelist)
        {
            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    for (int i = 0; i < mappingEntity.Length; i++)
                    {
                        RoutePOPMappingViewEntity entity = mappingEntity[i];

                        if (entity.MappingID != null && !string.IsNullOrEmpty(entity.MappingID.ToString()))
                        {
                            //修改
                            RoutePOPMappingEntity uEntity = new RoutePOPMappingEntity();
                            uEntity.MappingID           = entity.MappingID;
                            uEntity.RouteID             = routeid;
                            uEntity.POPID               = entity.DistributorID.ToString();
                            uEntity.Sequence            = (i + 1);
                            uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                            uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                            this._currentDAO.Update(uEntity, tran);
                        }
                        else
                        {
                            //新增
                            RoutePOPMappingEntity uEntity = new RoutePOPMappingEntity();
                            uEntity.RouteID             = routeid;
                            uEntity.POPID               = entity.DistributorID.ToString();
                            uEntity.Sequence            = (i + 1);
                            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;
                }
            }

            new RouteBLL(CurrentUserInfo).GenerateCallDayPlanning(routeid);
        }
        /// <summary>
        /// 路线列表选择终端
        /// </summary>
        /// <param name="routeid"></param>
        /// <param name="mappingEntity"></param>
        public void EditRoutePOPList_Distributor(Guid routeid, RoutePOPMappingViewEntity[] mappingEntity)
        {
            IDbTransaction tran = new TransactionHelper(this.CurrentUserInfo).CreateTransaction();

            using (tran.Connection)
            {
                try
                {
                    foreach (RoutePOPMappingViewEntity entity in mappingEntity)
                    {
                        if (entity.MappingID != null && !string.IsNullOrEmpty(entity.MappingID.ToString()))
                        {
                            if (entity.IsDelete == 1)
                            {
                                //删除
                                this._currentDAO.Delete(entity, tran);
                            }
                            else
                            {
                                //修改
                                RoutePOPMappingEntity uEntity = new RoutePOPMappingEntity();
                                uEntity.MappingID           = entity.MappingID;
                                uEntity.RouteID             = routeid;
                                uEntity.POPID               = entity.DistributorID.ToString();
                                uEntity.Sequence            = entity.Sequence;
                                uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                                uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                                this._currentDAO.Update(uEntity, tran);
                            }
                        }
                        else
                        {
                            //新增
                            RoutePOPMappingEntity uEntity = new RoutePOPMappingEntity();
                            uEntity.RouteID             = routeid;
                            uEntity.POPID               = entity.DistributorID.ToString();
                            uEntity.Sequence            = entity.Sequence;
                            uEntity.ClientID            = Convert.ToInt32(CurrentUserInfo.ClientID);
                            uEntity.ClientDistributorID = Convert.ToInt32(CurrentUserInfo.ClientDistributorID);
                            this._currentDAO.Create(uEntity, tran);
                        }
                    }

                    tran.Commit();
                }
                catch
                {
                    tran.Rollback();
                    throw;
                }
            }

            new RouteBLL(CurrentUserInfo).GenerateCallDayPlanning(routeid);
        }
예제 #3
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param>
 public void Update(RoutePOPMappingEntity pEntity, IDbTransaction pTran)
 {
     _currentDAO.Update(pEntity, pTran);
 }
예제 #4
0
 /// <summary>
 /// 创建一个新实例
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Create(RoutePOPMappingEntity pEntity)
 {
     _currentDAO.Create(pEntity);
 }
예제 #5
0
 /// <summary>
 /// 分页根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public PagedQueryResult <RoutePOPMappingEntity> PagedQueryByEntity(RoutePOPMappingEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex)
 {
     return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex));
 }
예제 #6
0
 /// <summary>
 /// 根据实体条件查询实体
 /// </summary>
 /// <param name="pQueryEntity">以实体形式传入的参数</param>
 /// <param name="pOrderBys">排序组合</param>
 /// <returns>符合条件的实体集</returns>
 public RoutePOPMappingEntity[] QueryByEntity(RoutePOPMappingEntity pQueryEntity, OrderBy[] pOrderBys)
 {
     return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys));
 }
예제 #7
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="pEntity"></param>
 public void Delete(RoutePOPMappingEntity pEntity)
 {
     _currentDAO.Delete(pEntity);
 }
예제 #8
0
 /// <summary>
 /// 更新
 /// </summary>
 /// <param name="pEntity">实体实例</param>
 public void Update(RoutePOPMappingEntity pEntity)
 {
     _currentDAO.Update(pEntity);
 }