Exemplo n.º 1
0
        public bool ChangeWorkerStatus(PartnerInfoEntity entity)
        {
            IDbContextTransaction tran = _context.Database.BeginTransaction();

            try
            {
                if (!Utility.CheckUserExists(_context, entity.userId))
                {
                    return(false);
                }

                var query = from d in _context.M_PARTNER_INFOS
                            where d.USER_ID == entity.userId
                            select d;

                M_PARTNER_INFO user = query.Single();
                user.STATUS = entity.status;

                _context.SaveChanges();

                // Commit transaction.
                tran.Commit();

                return(true);
            }
            catch
            {
                // Rollback transaction.
                tran.Rollback();
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get worker/ company info.
        /// </summary>
        /// <param name="workerId">Worker Id.</param>
        /// <returns>Worker Info Entity</returns>
        public static PartnerInfoEntity GetWorkerInfo(AloaiDataContext db, decimal workerId)
        {
            PartnerInfoEntity workerEntity = new PartnerInfoEntity();

            // User info.
            var user = from d in db.M_USERS
                       where d.USER_ID == workerId
                       select d;

            if (user.Any())
            {
                // Worker info.
                var workerInfo = from d in db.M_PARTNER_INFOS
                                 where d.USER_ID == workerId
                                 select d;

                if (workerInfo.Any())
                {
                    M_PARTNER_INFO info = workerInfo.Single();

                    workerEntity.userId         = info.USER_ID;
                    workerEntity.score          = info.SCORE.Value;
                    workerEntity.introduce      = info.INTRODUCE;
                    workerEntity.fitLocationFlg = info.FIX_LOCATION_FLG;

                    Location loc = new Location();
                    loc.longitude = info.LONGITUDE;
                    loc.latitude  = info.LATITUDE;
                    loc.address   = info.ADDRESS;

                    workerEntity.location       = loc;
                    workerEntity.verifyFlg      = info.VERIFY_FLG;
                    workerEntity.verifyDate     = info.VERIFY_DATE;
                    workerEntity.verifyDateFrom = info.VERIFY_DATE_FROM;
                    workerEntity.verifyDateTo   = info.VERIFY_DATE_TO;
                    workerEntity.likeNum        = info.LIKE_NUM;
                    workerEntity.status         = info.STATUS;
                    workerEntity.regDatetime    = info.REG_DATETIME;
                    workerEntity.updDatetime    = info.UPD_DATETIME;
                }
            }

            return(workerEntity);
        }