Exemplo n.º 1
0
 /// <summary>
 /// Opdater et kald
 /// </summary>
 /// <param name="db">Den delte database PCL</param>
 /// <param name="callEntity">Kaldet</param>
 public static void UpdateMyCallToLocalDatabase(SharedLocalDB db, CallEntity callEntity)
 {
     if (callEntity != null)
     {
         db.UpdateMyCall(callEntity);
     }
 }
Exemplo n.º 2
0
    private void updateCallEntity()
    {
        int layer = 0;
        int num   = 4;
        int max   = this.calls.Count;
        int index = 0;

        for (int i = 0, len = this.calls.Count; i < len; i++)
        {
            CallEntity entity = this.calls[i];
            entity.index = i;
            if (index >= num)
            {
                max   -= num;
                index -= num;
                num   += 2;
                layer++;
            }
            double count = Math.Min(max, num);
            //最外圈要根据最后的数量进行间隔
            double interval = Math2.PI2 / count;
            double start    = count % 2 == 0 ? -interval / 2 : 0;
            entity.layer         = layer;
            entity.offset.length = this.getProperty(ConfigConstant.PROPERTY_RADIUS) + ConfigConstant.CALL_POS_RADIUS + layer * ConfigConstant.CALL_LAYER_RADIUS;
            entity.offset.angle  = start + interval * index;
            index++;
        }
    }
Exemplo n.º 3
0
        public void SendingCallJSONCategory_JSONConverted()
        {
            try
            {
                // Arrange
                var            testString     = "Test";
                CategoryEntity categoryEntity = new CategoryEntity
                {
                    CategoryId = Guid.NewGuid().ToString(),
                    Name       = "TestTestTest"
                };
                CallEntity callEntity = CallWrapper.WrapCall(CPRNUMMER, CallUtil.StatusCode.Active, categoryEntity, null,
                                                             null);

                //Act
                PatientCall call = new PatientCall();

                var callId = call.MakeCall(callEntity);

                Assert.IsTrue(!String.IsNullOrEmpty(callId));
            }
            catch (Exception ex)
            {
                //Assert
                Assert.Fail("Status Code not OK " + ex.Message);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Wrapper en Category, Choice og/eller Detail til et kald sammen med Patients CPR-nr og en Status kode på kaldet(Afventende, Udført, Fortrudt)
        /// </summary>
        /// <param name="cprnr">CPR-nr for Patient</param>
        /// <param name="status">Status kode(Active, Completed, Canceled) på kaldet</param>
        /// <param name="categoryEntity">Kategorien</param>
        /// <param name="choiceEntity">Valget</param>
        /// <param name="detailEntity">Tilebør</param>
        /// <returns>Returner et objekt der anses som et kald, klar til at blive sendt afsted til Web API</returns>
        public static CallEntity WrapCall(String cprnr, CallUtil.StatusCode status, CategoryEntity categoryEntity, ChoiceEntity choiceEntity = null, DetailEntity detailEntity = null)
        {
            var callEntity = new CallEntity();

            /* Non-nullable values */
            //callEntity._id = Guid.NewGuid().ToString();
            callEntity.PatientCPR = cprnr;
            callEntity.Status     = (int)status;
            callEntity.Category   = categoryEntity.Name;

            /* Nullable values*/

            /*
             * if (categoryEntity.Picture != null)
             * {
             *  callEntity.Picture = categoryEntity.Picture;
             * }
             */

            if (choiceEntity != null)
            {
                callEntity.Choice = choiceEntity.Name;
            }

            /* Nullable values*/
            if (detailEntity != null)
            {
                callEntity.Detail = detailEntity.Name;
            }

            return(callEntity);
        }
Exemplo n.º 5
0
        public void SetCallEntities(CallEntity callEntity)
        {
            // Load calls from database
            CallEntities = DataHandler.LoadCallsFromLocalDatabase(new LocalDB()).ToList();

            if (CallEntities == null || CallEntities.Count == 0)
            {
                CallEntities = new List <CallEntity>();
            }

            // If we are making a new call
            if (callEntity != null)
            {
                // And if the call is the same as before
                if (CallEntities.Any(call => call._id == callEntity._id))
                {
                    //CallEntities.Remove(callEntity);
                    callEntity = null;
                }
            }

            // If the call is not the same as before, e.g. if we are just updating the call
            if (callEntity != null)
            {
                CallEntities.Add(callEntity);

                DataHandler.SaveCallsToLocalDatabase(new LocalDB(), CallEntities.ToArray());
            }

            TabBar.ResetBadgeValue(vc);
        }
Exemplo n.º 6
0
        public bool AddActivity(CallEntity call)
        {
            try
            {
                using (var context = new CellularDbContext())
                {
                    context.Calls.Add(call);
                    context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception)
            { /**/ return(false); }
        }

        public bool AddActivity(SMSEntity sms)
        {
            try
            {
                using (var context = new CellularDbContext())
                {
                    context.SMSMessages.Add(sms);
                    context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception)
            { /**/ return(false); }
        }
Exemplo n.º 7
0
        private OnGoingCall MapToOngoingCall(CallEntity dbCall, string sipDomain, bool anonymize)
        {
            var fromDisplayName = CallDisplayNameHelper.GetDisplayName(dbCall.FromSip, dbCall.FromDisplayName, dbCall.FromUsername, sipDomain);
            var toDisplayName   = CallDisplayNameHelper.GetDisplayName(dbCall.ToSip, dbCall.ToDisplayName, dbCall.ToUsername, sipDomain);

            var onGoingCall = new OnGoingCall
            {
                CallId                = GuidHelper.GuidString(dbCall.Id),
                Started               = dbCall.Started,
                FromId                = GuidHelper.GuidString(dbCall.FromId),
                FromSip               = anonymize ? DisplayNameHelper.AnonymizePhonenumber(dbCall.FromUsername) : dbCall.FromUsername,
                FromDisplayName       = anonymize ? DisplayNameHelper.AnonymizeDisplayName(fromDisplayName) : fromDisplayName,
                FromCodecTypeColor    = dbCall.FromSip != null && dbCall.FromSip.User != null && dbCall.FromSip.User.CodecType != null ? dbCall.FromSip.User.CodecType.Color : string.Empty,
                FromCodecTypeName     = dbCall.FromSip != null && dbCall.FromSip.User != null && dbCall.FromSip.User.CodecType != null ? dbCall.FromSip.User.CodecType.Name : string.Empty,
                FromComment           = dbCall.FromSip != null && dbCall.FromSip.User != null ? dbCall.FromSip.User.Comment : string.Empty,
                FromLocationName      = dbCall.FromSip != null && dbCall.FromSip.Location != null ? dbCall.FromSip.Location.Name : string.Empty,
                FromLocationShortName = dbCall.FromSip != null && dbCall.FromSip.Location != null ? dbCall.FromSip.Location.ShortName : string.Empty,
                FromRegionName        = dbCall.FromSip != null && dbCall.FromSip.Location != null && dbCall.FromSip.Location.Region != null ? dbCall.FromSip.Location.Region.Name : string.Empty,
                ToId                = GuidHelper.GuidString(dbCall.ToId),
                ToSip               = anonymize ? DisplayNameHelper.AnonymizePhonenumber(dbCall.ToUsername) : dbCall.ToUsername,
                ToDisplayName       = anonymize ? DisplayNameHelper.AnonymizeDisplayName(toDisplayName) : toDisplayName,
                ToCodecTypeColor    = dbCall.ToSip != null && dbCall.ToSip.User != null && dbCall.ToSip.User.CodecType != null ? dbCall.ToSip.User.CodecType.Color : string.Empty,
                ToCodecTypeName     = dbCall.ToSip != null && dbCall.ToSip.User != null && dbCall.ToSip.User.CodecType != null ? dbCall.ToSip.User.CodecType.Name : string.Empty,
                ToComment           = dbCall.ToSip != null && dbCall.ToSip.User != null ? dbCall.ToSip.User.Comment : string.Empty,
                ToLocationName      = dbCall.ToSip != null && dbCall.ToSip.Location != null ? dbCall.ToSip.Location.Name : string.Empty,
                ToLocationShortName = dbCall.ToSip != null && dbCall.ToSip.Location != null ? dbCall.ToSip.Location.ShortName : string.Empty,
                ToRegionName        = dbCall.ToSip != null && dbCall.ToSip.Location != null && dbCall.ToSip.Location.Region != null ? dbCall.ToSip.Location.Region.Name : string.Empty
            };

            return(onGoingCall);
        }
Exemplo n.º 8
0
        public static void CallNo(string address, string plateNo)
        {
            CallEntity callEntity = null;

            try
            {
                var obj = new
                {
                    cmd        = "Call",
                    CallerAddr = address,
                    CardNo     = plateNo
                };
                string    requestStr = JsonConvert.SerializeObject(obj);
                Hashtable hashtable  = new Hashtable();
                hashtable.Add("data", requestStr);
                Live0xUtils.HttpUtils.HttpRequest httpRequest = new Live0xUtils.HttpUtils.HttpRequest();
                string url    = AppHelper.AppSetting.CallUrl.EndsWith("/") ? AppHelper.AppSetting.CallUrl + "getno" : AppHelper.AppSetting.CallUrl + "/getno";
                string result = httpRequest.HttpGet(url, hashtable);
                LogHelper.Trace($"请求叫号机:{url}-{requestStr}-{result}");
                callEntity = JsonConvert.DeserializeObject <CallEntity>(result);
            }
            catch (Exception ex)
            {
                LogHelper.Error("请求叫号机异常:" + ex.Message);
            }
        }
Exemplo n.º 9
0
        public MyCallsSource(CallEntity callEntity, MyCallsViewController vc)
        {
            if (vc != null)
            {
                this.vc = vc;
            }

            SetCallEntities(callEntity);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Opdater et kald. Dette kan f.eks. være når en Patient fortryder et kald, hvorved status på kaldet ændres fra "Afventende" til "Fortrudt"
        /// </summary>
        /// <param name="call">Kald objekt der indeholder properties for hvad kaldet skal indeholde</param>
        public void UpdateCall(CallEntity call)
        {
            //var json = CreateCall(call);
            //var json = "{\"_id\" : \"5638662c4ca8e92f7cf1fcc7\", \"Status\" : 2}";
            var json = "{\"_id\" : \"" + call._id + "\", \"Status\" : " + call.Status + "}";

            var manager = new CallManager();

            manager.PutCall(json);
        }
Exemplo n.º 11
0
        public async Task <CallEntity> GetCall(int id)
        {
            CallEntity call = await _dataContext.Calls
                              .Include(c => c.Codification)
                              .Include(c => c.User)
                              .ThenInclude(c => c.Monitorings)
                              .FirstOrDefaultAsync(c => c.Id == id);

            return(call);
        }
Exemplo n.º 12
0
        public override View OnCreateView(LayoutInflater inflater,
                                          ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);

            var view = inflater.Inflate(
                Resource.Layout.activity_category, container, false);

            GridView gridView = (GridView)view.FindViewById(Resource.Id.grid_view);
            // Instance of ImageAdapter Class

            var categories = DataHandler.LoadCategoriesFromLocalDatabase(new LocalDB());

            gridView.SetAdapter(new CategoryAdapter(view.Context, categories));

            gridView.ItemClick += delegate(object sender, AdapterView.ItemClickEventArgs args)
            {
                Intent intent = new Intent(Application.Context, typeof(ChoiceActivity));

                List <string> choiceList = new List <string>();
                List <string> detailList = new List <string>();

                var category = categories[args.Position];
                var choices  = categories[args.Position].Choices;

                // Add each choice from selected category to list
                // Add each detail from selected choice to list
                foreach (var choice in choices)
                {
                    choiceList.Add(choice.Name);

                    detailList.AddRange(choice.Details.Select(detail => detail.Name));
                }

                if (choices == null || choices.Count == 0 || String.IsNullOrEmpty(choices[0].Name))
                // Dummy, hvis der er en tom Choice liste uden et navn
                {
                    CallEntity callEntity = CallWrapper.WrapCall(UserData.CPRNR, CallUtil.StatusCode.Active, category);
                    //AppDelegate.MakeCall(callEntity, category.Name, this);
                }
                else
                {
                    Bundle bundle = new Bundle();

                    bundle.PutStringArray("choices", choiceList.ToArray());
                    bundle.PutStringArray("details", detailList.ToArray());
                    bundle.PutString("category", categories[args.Position].Name);
                    intent.PutExtras(bundle);

                    StartActivity(intent);
                }
            };
            return(view);
        }
Exemplo n.º 13
0
        public async Task <bool> AddCall(CallEntity call)
        {
            if (call == null)
            {
                return(false);
            }
            _dataContext.Add(call);
            await _dataContext.SaveChangesAsync();

            return(true);
        }
Exemplo n.º 14
0
    private void createCalls()
    {
        object[] calls = (object[])this._step["calls"];

        for (int i = 0, len = calls.Length; i < len; i++)
        {
            Dictionary <string, object> callData = (Dictionary <string, object>)calls[i];
            CallEntity entity = (CallEntity)this._map.createFightEntity(ConfigConstant.ENTITY_CALL);
            entity.ownerPlayer = this._player.ownerPlayer;
            entity.initConfig(callData);
        }
    }
Exemplo n.º 15
0
 private CallInfo MapToCallInfo(CallEntity dbCall)
 {
     return(dbCall == null ? null : new CallInfo
     {
         Id = dbCall.Id,
         Started = dbCall.Started,
         FromSipAddress = dbCall.FromUsername,
         ToSipAddress = dbCall.ToUsername,
         FromId = dbCall.FromId ?? Guid.Empty,
         ToId = dbCall.ToId ?? Guid.Empty,
         Closed = dbCall.Closed
     });
 }
Exemplo n.º 16
0
        public CallEntity ConvertCall(CallModel originalCall)
        {
            CallEntity convertedCall = new CallEntity
            {
                CallId            = originalCall.Id,
                LineId            = originalCall.LineId,
                DateCreated       = originalCall.DateActivityMade,
                DestinationNumber = originalCall.DestinationNumber,
                Duration          = originalCall.Duration
            };

            return(convertedCall);
        }
Exemplo n.º 17
0
        private static bool CallHasBeenMade(CallEntity[] callEntities, CallEntity callEntity)
        {
            if (callEntities.Where(
                    myCalls => myCalls.Category == callEntity.Category && myCalls.Choice == callEntity.Choice &&
                    myCalls.Detail == callEntity.Detail)
                .Any(myCalls => myCalls.Status == (int)CallUtil.StatusCode.Active))
            {
                loadingOverlay.Hide();
                new UIAlertView(Strings.CallAlreadySent, null, null, "OK", null).Show();

                return(true);
            }
            return(false);
        }
Exemplo n.º 18
0
        /// <summary>
        /// Opret et kald
        /// </summary>
        /// <param name="call">Kald objekt der indeholder properties for hvad kaldet skal indeholde</param>
        public String MakeCall(CallEntity call)
        {
            // Json repræsentation af et kald der sendes afsted
            //var jsonWorking = "{\"PatientCPR\" : \"123456-1234\", \"Category\" : \"TestTestTest\",\"Choice\" : null, \"Detail\" : null ,\"CreatedOn\" : \"onsdag, 28 oktober 15.27.31\",\"ModifiedOn\" : null,\"Status\" : 0}";
            call.CreatedOn = DateTime.Now.ToString("HH:mm:ss");

            var json = CreateJSONCall(call);

            var manager = new CallManager();

            manager.PostCall(json);

            return(HttpHandler.MongoCallId);
        }
Exemplo n.º 19
0
        /// <summary>
        /// Henter alle kald fra Web API som en Patient har foretaget
        /// </summary>
        /// <returns>Returnere en Liste af kald.</returns>
        public String GetStatusCall(CallEntity callEntity)
        {
            var httpHandler = new HttpHandler();

            var callJson = httpHandler.GetData(HttpHandler.API.Call, callEntity._id);

            var json = JsonConvert.DeserializeObject(callJson);

            Dictionary <string, string> jsonDictionary = JsonConvert.DeserializeObject <Dictionary <string, string> >(json as string);

            var callStatus = jsonDictionary["Status"];

            return(callStatus);
        }
Exemplo n.º 20
0
        public void SendingCallJSONCategoryChoiceDetail_JSONConverted()
        {
            // Arrange
            var testString = "Test";

            var detail = new DetailEntity()
            {
                DetailId = Guid.NewGuid().ToString(),
                Name     = "Mælk",
            };

            var choice = new ChoiceEntity()
            {
                ChoiceId = Guid.NewGuid().ToString(),
                Name     = "Kaffe",
                Details  = new List <DetailEntity> {
                    detail
                }
            };

            var category = new CategoryEntity()
            {
                CategoryId = Guid.NewGuid().ToString(),
                Name       = "Dinmor",
                //Picture = "http://multimedia.pol.dk/archive/00537/ITALY_CLONED_CHAMPI_537998a.jpg",
                Choices = new List <ChoiceEntity> {
                    choice
                }
            };

            CallEntity callEntity = CallWrapper.WrapCall(CPRNUMMER, CallUtil.StatusCode.Active, category, choice, detail);

            try
            {
                //Act
                PatientCall call   = new PatientCall();
                var         callId = call.MakeCall(callEntity);

                Assert.IsTrue(!String.IsNullOrEmpty(callId));
            }
            catch (Exception ex)
            {
                Assert.Fail("Status Code not OK " + ex.Message);
            }
        }
Exemplo n.º 21
0
        private void CategoryTapped(CategoryEntity category)
        {
            // The category tapped
            Category = category;

            // Hvis der ikke er nogle typer, så start kaldet her
            if (Category.Choices == null || Category.Choices.Count == 0 || String.IsNullOrEmpty(Category.Choices[0].Name)) // Dummy, hvis der er en tom Choice liste uden et navn
            {
                CallEntity callEntity = CallWrapper.WrapCall(UserData.CPRNR, CallUtil.StatusCode.Active, Category);
                AppDelegate.MakeCall(callEntity, this);
            }

            // Ellers gå videre til næste view.
            else
            {
                PerformSegue("CategorySegue", this);
            }
        }
Exemplo n.º 22
0
        private static void GoToMyCalls(UIViewController vc, CallEntity callEntity)
        {
            // Hide the loading screen
            loadingOverlay.Hide();
            // (Get a confirm message that the patient call was successfull)
            //new UIAlertView(Strings.CallSent, null, null, Strings.OK, null).Show();

            // Take the user back to Categories
            //vc.NavigationController.PopViewController(true);

            // Take the user to My Calls
            var tabbar            = vc.TabBarController;
            var navController     = tabbar.ViewControllers[1];
            var myCallsController = (MyCallsViewController)navController.ChildViewControllers[0];

            myCallsController.callEntity = callEntity;

            tabbar.SelectedViewController = navController;
        }
Exemplo n.º 23
0
        public async Task <List <CallEntity> > ToCallEntity(List <CallsUploadedViewModel> model)
        {
            List <CallEntity> calls = new List <CallEntity>();

            foreach (CallsUploadedViewModel item in model)
            {
                CallEntity call = new CallEntity
                {
                    CustomerId      = item.CustomerId,
                    CustomerProduct = item.CustomerProduct,
                    StartDate       = item.StartDate,
                    EndDate         = item.EndDate,
                    Codification    = await _codificationHelper.GetCodification(item.CodificationId),
                    User            = _userHelper.GetUserByCodeAsync(item.UserCode)
                };
                calls.Add(call);
            }
            return(calls);
        }
Exemplo n.º 24
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            tableView.DeselectRow(indexPath, true);

            var detail = Details[indexPath.Row];
            var choice = detail.Choices[0];

            if (detail.Choices.Count > 1)
            {
                choice = detail.Choices[ChoiceIndexPathRow];
            }

            var category = choice.CategoryEntity;


            CallEntity callEntity = CallWrapper.WrapCall(UserData.CPRNR, CallUtil.StatusCode.Active, category, choice, detail);

            AppDelegate.MakeCall(callEntity, vc);
        }
Exemplo n.º 25
0
        void OnListItemClick(object sender, AdapterView.ItemClickEventArgs e)
        {
            var choice = choiceList[e.Position];
            var intent = new Intent(Application.Context, typeof(DetailChoiceActivity));

            // Hvis der er ikke er nogen detailer, start kaldet her
            if (choice == null || details.Count == 0)
            {
                CallEntity callEntity = CallWrapper.WrapCall(UserData.CPRNR, CallUtil.StatusCode.Active, category, choice);
                AppDelegate.MakeCall(callEntity, choice.Name, vc);
            }


            Bundle bundle = new Bundle();

            bundle.PutStringArray("details", detailList.ToArray());
            bundle.PutString("choice", choice);
            intent.PutExtras(bundle);
            StartActivity(intent);
        }
Exemplo n.º 26
0
 /// <summary>
 /// Method that convert a CallEntity(Database) into Call
 /// </summary>
 /// <param name="cEntity">CallEntity</param>
 /// <returns>Call</returns>
 public Call convertToEntity(CallEntity cEntity)
 {
     try
     {
         Call c = new Call();
         c.CallId            = cEntity.PhoneCall_Id;
         c.Cost              = cEntity.Call_Cost;
         c.Duration          = cEntity.Call_Duration;
         c.State             = cEntity.Call_State;
         c.PhoneNumber       = cEntity.Phone_Number;
         c.Id                = cEntity.Customer_id;
         c.InitialDatetime   = cEntity.Initial_DateTime;
         c.FinalDatetime     = cEntity.Final_DateTime;
         c.DestinationNumber = cEntity.Destination_Number;
         return(c);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 27
0
        public void UpdatingCallJSON_CalledUpdated()
        {
            //Arrange
            // Arrange
            var testString = "Test";

            var choice = new ChoiceEntity()
            {
                ChoiceId = Guid.NewGuid().ToString(),
                Name     = "Morfin"
            };

            var category = new CategoryEntity()
            {
                CategoryId = Guid.NewGuid().ToString(),
                Name       = "Smertestillende",
                //Picture = "http://multimedia.pol.dk/archive/00537/ITALY_CLONED_CHAMPI_537998a.jpg",
                Choices = new List <ChoiceEntity> {
                    choice
                }
            };

            CallEntity callEntity = CallWrapper.WrapCall(CPRNUMMER, CallUtil.StatusCode.Active, category, choice, null);

            //Act
            PatientCall call = new PatientCall();

            try
            {
                callEntity._id    = "5641c5dd02a93d27a8910f9c";
                callEntity.Status = (int)CallUtil.StatusCode.Canceled;
                call.UpdateCall(callEntity);
            }
            catch (Exception e)
            {
                // Assert
                Assert.Fail("No calls has been updated");
            }
        }
Exemplo n.º 28
0
        public void SerializeCallJSON_JSONConverted()
        {
            // Arrange
            var        testString = "Test";
            CallEntity call       = new CallEntity
            {
                _id        = Guid.NewGuid().ToString(),
                Category   = "Mad/Drikke",
                Choice     = "Cola",
                CreatedOn  = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss.fff"),
                Detail     = "Sukker",
                PatientCPR = Guid.NewGuid().ToString(),
                Status     = (int)CallUtil.StatusCode.Active
            };


            //Act
            string json = JsonConvert.SerializeObject(call);

            //Assert
            Assert.IsTrue(ReferenceEquals(json.GetType(), testString.GetType()));
        }
Exemplo n.º 29
0
 private Call MapCall(CallEntity dbCall)
 {
     return(dbCall == null ? null : new Call
     {
         FromId = dbCall.FromId ?? Guid.Empty,
         ToId = dbCall.ToId ?? Guid.Empty,
         Started = dbCall.Started,
         State = dbCall.State ?? SipCallState.NONE,
         Updated = dbCall.Updated,
         Id = dbCall.Id,
         CallId = dbCall.SipCallID,
         Closed = dbCall.Closed,
         From = MapRegisteredSip(dbCall.FromSip),
         To = MapRegisteredSip(dbCall.ToSip),
         FromSip = dbCall.FromUsername,
         ToSip = dbCall.ToUsername,
         FromTag = dbCall.FromTag,
         ToTag = dbCall.ToTag,
         DlgHashId = dbCall.DlgHashId,
         DlgHashEnt = dbCall.DlgHashEnt,
         IsPhoneCall = dbCall.IsPhoneCall
     });
 }
Exemplo n.º 30
0
    public override FightEntity createFightEntity(int type, int netId = -1)
    {
        FightEntity entity = null;

        switch (type)
        {
        case ConfigConstant.ENTITY_LOOP_BEAN:        //
            entity = new LoopBeanEntity(this);
            break;

        case ConfigConstant.ENTITY_PLAYER:
            entity = new PlayerEntity(this);
            break;

        case ConfigConstant.ENTITY_BULLET:
            entity = new BulletEntity(this);
            break;

        case ConfigConstant.ENTITY_PRICE_BEAN:
            entity = new PriceBeanEntity(this);
            break;

        case ConfigConstant.ENTITY_CALL:
            entity = new CallEntity(this);
            break;

        case ConfigConstant.ENTITY_BARRIER:
            entity = new BarrierEntity(this);
            break;

        case ConfigConstant.ENTITY_RADISH:
            entity = new RadishEntity(this);
            break;
        }
        return(entity);
    }