Example #1
0
        public void ReanimarCommand(Client player, String targetString)
        {
            if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_FACTION) != Constants.FACTION_EMERGENCY)
            {
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_EMERGENCY_FACTION);
            }
            else if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_ON_DUTY) == 0)
            {
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_ON_DUTY);
            }
            else if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_KILLED) != 0)
            {
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_IS_DEAD);
            }
            else
            {
                Client target = Int32.TryParse(targetString, out int targetId) ? Globals.GetPlayerById(targetId) : NAPI.Player.GetPlayerFromName(targetString);

                if (target != null)
                {
                    if (NAPI.Data.GetEntityData(target, EntityData.PLAYER_KILLED) != 0)
                    {
                        if (GetRemainingBlood() > 0)
                        {
                            // Eliminamos el timer
                            DestroyDeathTimer(target);

                            // Creamos el modelo
                            BloodModel bloodModel = new BloodModel();
                            bloodModel.doctor  = NAPI.Data.GetEntityData(player, EntityData.PLAYER_SQL_ID);
                            bloodModel.patient = NAPI.Data.GetEntityData(target, EntityData.PLAYER_SQL_ID);
                            bloodModel.type    = String.Empty;
                            bloodModel.used    = true;

                            // Añadimos la sangre a la base de datos
                            bloodModel.id = Database.AddBloodTransaction(bloodModel);
                            bloodList.Add(bloodModel);

                            String playerMessage = String.Format(Messages.INF_PLAYER_REANIMATED, target.Name);
                            String targetMessage = String.Format(Messages.SUC_TARGET_REANIMATED, player.Name);
                            NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ADMIN_INFO + playerMessage);
                            NAPI.Chat.SendChatMessageToPlayer(target, Constants.COLOR_SUCCESS + targetMessage);
                        }
                        else
                        {
                            // No queda sangre en las reservas
                            NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_NO_BLOOD_LEFT);
                        }
                    }
                    else
                    {
                        NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_DEAD);
                    }
                }
                else
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_FOUND);
                }
            }
        }
Example #2
0
        public ActionResult DeleteConfirm(string id)
        {
            BloodModel       model = new BloodModel();
            WebServiceClient ws    = new WebServiceClient();
            int     HospitalId;
            DataSet ds = new DataSet();

            if (!id.Contains("-"))
            {
                id = id + "+";
            }
            model.BloodType = id;
            try
            {
                string strConfigFileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase.ToString()) + "\\Information.xml";
                ds.ReadXml(strConfigFileName);
                HospitalId = Convert.ToInt32(ds.Tables[0].Rows[0]["HospitalId"].ToString());

                ws.NotificationFinished(HospitalId, model.BloodType);
            }
            catch
            {
                ModelState.AddModelError("", "Kan Talebini Silerken Hata ile Karşılaşıldı");
            }

            return(Redirect("~/Home/Index"));
        }
Example #3
0
        public void ExtractCommand(Client player, string targetString)
        {
            if (player.GetSharedData(EntityData.PLAYER_KILLED) != 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_is_dead);
            }
            else if (player.GetData(EntityData.PLAYER_ON_DUTY) == 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_on_duty);
            }
            else if (player.GetData(EntityData.PLAYER_FACTION) != Constants.FACTION_EMERGENCY)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_emergency_faction);
            }
            else
            {
                Client target = int.TryParse(targetString, out int targetId) ? Globals.GetPlayerById(targetId) : NAPI.Player.GetPlayerFromName(targetString);

                if (target == null || player.Position.DistanceTo(target.Position) > 5.0f)
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_too_far);
                    return;
                }

                if (target.Health <= 15)
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.low_blood);
                    return;
                }

                // Substract the blood from the player
                target.Health -= 15;

                // We create the blood model
                BloodModel blood = new BloodModel();
                {
                    blood.doctor  = player.GetData(EntityData.PLAYER_SQL_ID);
                    blood.patient = target.GetData(EntityData.PLAYER_SQL_ID);
                    blood.type    = string.Empty;
                    blood.used    = false;
                }

                Task.Factory.StartNew(() =>
                {
                    NAPI.Task.Run(() =>
                    {
                        // We add the blood unit to the database
                        blood.id = Database.AddBloodTransaction(blood);
                        bloodList.Add(blood);

                        player.SendChatMessage(Constants.COLOR_INFO + string.Format(InfoRes.blood_extracted, target.Name));
                        target.SendChatMessage(Constants.COLOR_INFO + string.Format(InfoRes.blood_given, player.Name));
                    });
                });
            }
        }
Example #4
0
        public ActionResult Delete(string id)
        {
            BloodModel model = new BloodModel();

            if (!id.Contains("-"))
            {
                id = id + "+";
            }
            model.BloodType = id;
            return(View(model));
        }
Example #5
0
        private async void Button_Clicked(object sender, EventArgs e)
        {
            var s = sender as Button;

            BloodModel model = BindingContext as BloodModel;

            //SendMaps?.Invoke(model, e);
            AppConstants.lat  = model.Latitude;
            AppConstants.lang = model.Longitude;
            SendMaps?.Invoke(model, e);
        }
Example #6
0
        public void ExtractCommand(Client player, string targetString)
        {
            if (player.GetData(EntityData.PLAYER_KILLED) != 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_is_dead);
            }
            else if (player.GetData(EntityData.PLAYER_ON_DUTY) == 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_on_duty);
            }
            else
            {
                var target = int.TryParse(targetString, out var targetId)
                    ? Globals.GetPlayerById(targetId)
                    : NAPI.Player.GetPlayerFromName(targetString);

                if (target != null && player.GetData(EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY)
                {
                    if (target.Health > 15)
                    {
                        // We create the blood model
                        var blood = new BloodModel();
                        {
                            blood.doctor  = player.GetData(EntityData.PLAYER_SQL_ID);
                            blood.patient = target.GetData(EntityData.PLAYER_SQL_ID);
                            blood.type    = string.Empty;
                            blood.used    = false;
                        }

                        Task.Factory.StartNew(() => {
                            // We add the blood unit to the database
                            blood.id = Database.AddBloodTransaction(blood);
                            bloodList.Add(blood);

                            target.Health -= 15;

                            var playerMessage = string.Format(InfoRes.blood_extracted, target.Name);
                            var targetMessage = string.Format(InfoRes.blood_extracted, player.Name);
                            player.SendChatMessage(playerMessage);
                            target.SendChatMessage(targetMessage);
                        });
                    }
                    else
                    {
                        player.SendChatMessage(ErrRes.low_blood);
                    }
                }
                else
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_found);
                }
            }
        }
        public void ExtractCommand(Client player, string targetString)
        {
            if (player.GetData(EntityData.PLAYER_KILLED) != 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_IS_DEAD);
            }
            else if (player.GetData(EntityData.PLAYER_ON_DUTY) == 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_ON_DUTY);
            }
            else
            {
                Client target = int.TryParse(targetString, out int targetId) ? Globals.GetPlayerById(targetId) : NAPI.Player.GetPlayerFromName(targetString);

                if (target != null && player.GetData(EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY)
                {
                    if (target.Health > 15)
                    {
                        // We create the blood model
                        BloodModel blood = new BloodModel();
                        blood.doctor  = player.GetData(EntityData.PLAYER_SQL_ID);
                        blood.patient = target.GetData(EntityData.PLAYER_SQL_ID);
                        blood.type    = string.Empty;
                        blood.used    = false;

                        Task.Factory.StartNew(() =>
                        {
                            // We add the blood unit to the database
                            blood.id = Database.AddBloodTransaction(blood);
                            bloodList.Add(blood);

                            target.Health -= 15;

                            string playerMessage = string.Format(Messages.INF_BLOOD_EXTRACTED, target.Name);
                            string targetMessage = string.Format(Messages.INF_BLOOD_EXTRACTED, player.Name);
                            player.SendChatMessage(playerMessage);
                            target.SendChatMessage(targetMessage);
                        });
                    }
                    else
                    {
                        player.SendChatMessage(Messages.ERR_LOW_BLOOD);
                    }
                }
                else
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_FOUND);
                }
            }
        }
        public void ExtractCommand(Client player, String targetString)
        {
            if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_KILLED) != 0)
            {
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_IS_DEAD);
            }
            else if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_ON_DUTY) == 0)
            {
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_ON_DUTY);
            }
            else
            {
                Client target = Int32.TryParse(targetString, out int targetId) ? Globals.GetPlayerById(targetId) : NAPI.Player.GetPlayerFromName(targetString);

                if (target != null && NAPI.Data.GetEntityData(player, EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY)
                {
                    if (NAPI.Player.GetPlayerHealth(target) > 15)
                    {
                        // We create the blood model
                        BloodModel blood = new BloodModel();
                        blood.doctor  = NAPI.Data.GetEntityData(player, EntityData.PLAYER_SQL_ID);
                        blood.patient = NAPI.Data.GetEntityData(target, EntityData.PLAYER_SQL_ID);
                        blood.type    = String.Empty;
                        blood.used    = false;

                        // We add the blood unit to the database
                        blood.id = Database.AddBloodTransaction(blood);
                        bloodList.Add(blood);

                        NAPI.Player.SetPlayerHealth(target, NAPI.Player.GetPlayerHealth(target) - 15);

                        String playerMessage = String.Format(Messages.INF_BLOOD_EXTRACTED, target.Name);
                        String targetMessage = String.Format(Messages.INF_BLOOD_EXTRACTED, player.Name);
                        NAPI.Chat.SendChatMessageToPlayer(player, playerMessage);
                        NAPI.Chat.SendChatMessageToPlayer(target, targetMessage);
                    }
                    else
                    {
                        NAPI.Chat.SendChatMessageToPlayer(player, Messages.ERR_LOW_BLOOD);
                    }
                }
                else
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_FOUND);
                }
            }
        }
        public IHttpActionResult PutBlood(BloodModel bloodModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            try
            {
                var bloodDataExist = db.Bloods.FirstOrDefault(w => w.Id == bloodModel.Id);
                if (bloodDataExist != null)
                {
                    bloodDataExist.WantedFrom  = Common.CreatePoint(bloodModel.Latitude, bloodModel.Longitude);
                    bloodDataExist.Description = bloodModel.Description;
                    bloodDataExist.Name        = bloodModel.Name;
                    db.SaveChanges();
                }
                else
                {
                    var blood = new Blood();
                    blood.Id          = Guid.NewGuid();
                    blood.IsActive    = true;
                    blood.CreatedDate = DateTime.UtcNow;
                    blood.WantedFrom  = Common.CreatePoint(bloodModel.Latitude, bloodModel.Longitude);
                    blood.Description = bloodModel.Description;
                    blood.Name        = bloodModel.Name;
                    blood.OrgUserId   = Guid.Parse("b55f9060-2f96-4ff0-91c7-ecdbdc386056");
                    blood.Contact     = bloodModel.Contact;
                    blood.IsFulfilled = true;
                    blood.BloodGroup  = bloodModel.Name;
                    db.Bloods.Add(blood);
                    db.SaveChanges();
                    Common.Push(bloodModel.Longitude, bloodModel.Latitude, 10000, bloodModel.Name + " blood required urgently ", bloodModel.Id, 0);
                }
                db.SaveChanges();
                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Example #10
0
        public void ExtraerCommand(Client player, String targetString)
        {
            if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_KILLED) != 0)
            {
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_IS_DEAD);
            }
            else if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_ON_DUTY) == 0)
            {
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_ON_DUTY);
            }
            else
            {
                Client target = Int32.TryParse(targetString, out int targetId) ? Globals.GetPlayerById(targetId) : NAPI.Player.GetPlayerFromName(targetString);

                if (target != null && NAPI.Data.GetEntityData(player, "PLAYER_FACTION") == Constants.FACTION_EMERGENCY)
                {
                    if (NAPI.Player.GetPlayerHealth(target) > 15)
                    {
                        // Creamos el modelo
                        BloodModel blood = new BloodModel();
                        blood.doctor  = NAPI.Data.GetEntityData(player, EntityData.PLAYER_SQL_ID);
                        blood.patient = NAPI.Data.GetEntityData(target, EntityData.PLAYER_SQL_ID);
                        blood.type    = String.Empty;
                        blood.used    = false;

                        // Añadimos la sangre a la base de datos
                        blood.id = Database.AddBloodTransaction(blood);
                        bloodList.Add(blood);

                        NAPI.Player.SetPlayerHealth(target, NAPI.Player.GetPlayerHealth(target) - 15);
                        NAPI.Chat.SendChatMessageToPlayer(player, String.Format("Sangre extraida, ahora tiene {0}", NAPI.Player.GetPlayerHealth(target)));
                    }
                    else
                    {
                        NAPI.Chat.SendChatMessageToPlayer(player, String.Format("El jugador {0} tiene muy poca sangre, por lo tanto, no se le puede extraer", targetString));
                    }
                }
                else
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_FOUND);
                }
            }
        }
 public IHttpActionResult Post([FromBody] BloodModel bloodmodel)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var stream   = new MemoryStream(bloodmodel.ImageArray);
             var guid     = Guid.NewGuid().ToString();
             var file     = string.Format("{0}.jpg", guid);
             var folder   = "~\\Content\\Users";
             var fullpath = string.Format("{0}\\{1}", folder, file);
             var response = FilesHelper.UploadPhoto(stream, folder, file);
             //if(response)
             //{
             //    bloodmodel.ImagePath = fullpath;
             //}
             var user = new BloodModel()
             {
                 Username   = bloodmodel.Username,
                 Email      = bloodmodel.Email,
                 Phone      = bloodmodel.Phone,
                 Country    = bloodmodel.Country,
                 Location   = bloodmodel.Location,
                 Date       = bloodmodel.Date,
                 BloodGroup = bloodmodel.BloodGroup,
                 ImagePath  = fullpath,
                 userId     = bloodmodel.userId
             };
             db.bloodmodels.Add(user);
             db.SaveChanges();
             return(Ok());
         }
         else
         {
             return(BadRequest("Incorrect request sent"));
         }
     }
     catch (Exception ex)
     {
         throw ex.InnerException;
     }
 }
Example #12
0
        public void ReanimateCommand(Client player, string targetString)
        {
            if (player.GetData(EntityData.PLAYER_FACTION) != Constants.FACTION_EMERGENCY)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_emergency_faction);
            }
            else if (player.GetData(EntityData.PLAYER_ON_DUTY) == 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_on_duty);
            }
            else if (player.GetSharedData(EntityData.PLAYER_KILLED) != 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_is_dead);
            }
            else
            {
                Client target = int.TryParse(targetString, out int targetId) ? Globals.GetPlayerById(targetId) : NAPI.Player.GetPlayerFromName(targetString);

                if (target != null)
                {
                    if (target.GetSharedData(EntityData.PLAYER_KILLED) != 0)
                    {
                        if (GetRemainingBlood() > 0)
                        {
                            CancelPlayerDeath(target);

                            // We create blood model
                            BloodModel bloodModel = new BloodModel();
                            {
                                bloodModel.doctor  = player.GetData(EntityData.PLAYER_SQL_ID);
                                bloodModel.patient = target.GetData(EntityData.PLAYER_SQL_ID);
                                bloodModel.type    = string.Empty;
                                bloodModel.used    = true;
                            }

                            Task.Factory.StartNew(() =>
                            {
                                // Add the blood consumption to the database
                                bloodModel.id = Database.AddBloodTransaction(bloodModel);
                                bloodList.Add(bloodModel);

                                // Send the confirmation message to both players
                                string playerMessage = string.Format(InfoRes.player_reanimated, target.Name);
                                string targetMessage = string.Format(SuccRes.target_reanimated, player.Name);
                                player.SendChatMessage(Constants.COLOR_ADMIN_INFO + playerMessage);
                                target.SendChatMessage(Constants.COLOR_SUCCESS + targetMessage);
                            });
                        }
                        else
                        {
                            // There's no blood left
                            player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.no_blood_left);
                        }
                    }
                    else
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_dead);
                    }
                }
                else
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_found);
                }
            }
        }
Example #13
0
        // GET: Home
        public ActionResult Index()
        {
            //if (Session["user"] == null)
            //{
            //    return RedirectToAction("Login", "Login");
            //}
            WebServiceClient ws = new WebServiceClient();
            int               HospitalId;
            DataSet           ds        = new DataSet();
            List <BloodModel> modelList = new List <BloodModel>();

            try
            {
                string strConfigFileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase.ToString()) + "\\Information.xml";
                ds.ReadXml(strConfigFileName);
                HospitalId = Convert.ToInt32(ds.Tables[0].Rows[0]["HospitalId"].ToString());

                DataTable dtResult = ws.NotificationAccept(HospitalId);



                //var BloodTypes = dtResult.AsEnumerable().GroupBy(row => row.Field<String>("BloodType")).Select(grp => new { BloodType = grp.Key, Count = grp.Count() });  //


                #region Fill Table
                foreach (DataRow dr in dtResult.Rows)
                {
                    bool control = false;

                    foreach (BloodModel bloodmodel in modelList)
                    {
                        if (bloodmodel.BloodType == dr["BloodType"].ToString())
                        {
                            control = true;
                            if (Convert.ToBoolean(dr["State"].ToString()))
                            {
                                bloodmodel.Counter++;
                            }
                        }
                        else
                        {
                            control = false;
                        }
                    }
                    if (!control)
                    {
                        BloodModel model = new BloodModel();
                        model.BloodType = dr["BloodType"].ToString();
                        if (Convert.ToBoolean(dr["State"].ToString()))
                        {
                            model.Counter = 1;
                        }
                        else
                        {
                            model.Counter = 0;
                        }
                        modelList.Add(model);
                    }
                }
                #endregion

                List <SelectListItem> li = new List <SelectListItem>();
                li.Add(new SelectListItem()
                {
                    Text = "A+", Value = "A+"
                });
                li.Add(new SelectListItem()
                {
                    Text = "A-", Value = "A-"
                });
                li.Add(new SelectListItem()
                {
                    Text = "B+", Value = "B+"
                });
                li.Add(new SelectListItem()
                {
                    Text = "B-", Value = "B-"
                });
                li.Add(new SelectListItem()
                {
                    Text = "AB+", Value = "AB+"
                });
                li.Add(new SelectListItem()
                {
                    Text = "AB-", Value = "AB-"
                });
                li.Add(new SelectListItem()
                {
                    Text = "0+", Value = "0+"
                });
                li.Add(new SelectListItem()
                {
                    Text = "0-", Value = "0-"
                });
                ViewBag.BloodType = li;
            }
            catch
            {
                ModelState.AddModelError("", "Kan Talebi Ekranı Yüklenirken Hata ile Karşılaşıldı.");
            }
            return(View(modelList));
        }
Example #14
0
        public ActionResult Index(string BloodType)
        {
            WebServiceClient ws = new WebServiceClient();
            int HospitalId, UserId;
            List <BloodModel> modelList = new List <BloodModel>();


            DataSet ds = new DataSet();

            try
            {
                string strConfigFileName = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase.ToString()) + "\\Information.xml";
                ds.ReadXml(strConfigFileName);
                HospitalId = Convert.ToInt32(ds.Tables[0].Rows[0]["HospitalId"].ToString());
                UserId     = Convert.ToInt32(ds.Tables[0].Rows[0]["UserId"].ToString());


                bool BloodControl = false, stateControl = false;

                DataTable dtResult = ws.NotificationAccept(HospitalId);

                if (BloodType == "")
                {
                    BloodControl = true;
                    stateControl = true;
                }

                foreach (DataRow dr in dtResult.Rows)
                {
                    if (BloodType.Equals(dr["BloodType"]))
                    {
                        BloodControl = true;
                    }
                }

                if (!BloodControl)
                {
                    ws.SelectUserNotificationAccept(HospitalId, UserId, BloodType);
                }
                else
                {
                    if (stateControl)
                    {
                        ViewBag.JsMessage = "Kan grubu alanı zorunludur!";
                    }
                    else
                    {
                        ViewBag.JsMessage = "Var olan bir kan talebi girdiniz!";
                    }
                }


                List <SelectListItem> li = new List <SelectListItem>();
                li.Add(new SelectListItem()
                {
                    Text = "A+", Value = "A+"
                });
                li.Add(new SelectListItem()
                {
                    Text = "A-", Value = "A-"
                });
                li.Add(new SelectListItem()
                {
                    Text = "B+", Value = "B+"
                });
                li.Add(new SelectListItem()
                {
                    Text = "B-", Value = "B-"
                });
                li.Add(new SelectListItem()
                {
                    Text = "AB+", Value = "AB+"
                });
                li.Add(new SelectListItem()
                {
                    Text = "AB-", Value = "AB-"
                });
                li.Add(new SelectListItem()
                {
                    Text = "0+", Value = "0+"
                });
                li.Add(new SelectListItem()
                {
                    Text = "0-", Value = "0-"
                });
                ViewBag.BloodType = li;

                #region Fill Table

                dtResult = ws.NotificationAccept(HospitalId);

                foreach (DataRow dr in dtResult.Rows)
                {
                    bool control = false;

                    foreach (BloodModel bloodmodel in modelList)
                    {
                        if (bloodmodel.BloodType == dr["BloodType"].ToString())
                        {
                            control = true;
                            if (Convert.ToBoolean(dr["State"].ToString()))
                            {
                                bloodmodel.Counter++;
                            }
                        }
                        else
                        {
                            control = false;
                        }
                    }
                    if (!control)
                    {
                        BloodModel model = new BloodModel();
                        model.BloodType = dr["BloodType"].ToString();
                        if (Convert.ToBoolean(dr["State"].ToString()))
                        {
                            model.Counter = 1;
                        }
                        else
                        {
                            model.Counter = 0;
                        }
                        modelList.Add(model);
                    }
                }
                #endregion
            }
            catch (Exception exc)
            {
                ModelState.AddModelError("", "Kan talebi oluşturulurken bir hata ile karşılaşıldı.");
                throw exc;
            }

            return(View(modelList));
        }
        public void ReanimateCommand(Client player, string targetString)
        {
            if (player.GetData(EntityData.PLAYER_FACTION) != Constants.FACTION_EMERGENCY)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_EMERGENCY_FACTION);
            }
            else if (player.GetData(EntityData.PLAYER_ON_DUTY) == 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_ON_DUTY);
            }
            else if (player.GetData(EntityData.PLAYER_KILLED) != 0)
            {
                player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_IS_DEAD);
            }
            else
            {
                Client target = int.TryParse(targetString, out int targetId) ? Globals.GetPlayerById(targetId) : NAPI.Player.GetPlayerFromName(targetString);

                if (target != null)
                {
                    if (target.GetData(EntityData.PLAYER_KILLED) != 0)
                    {
                        if (GetRemainingBlood() > 0)
                        {
                            CancelPlayerDeath(target);

                            // We create blood model
                            BloodModel bloodModel = new BloodModel();
                            bloodModel.doctor  = player.GetData(EntityData.PLAYER_SQL_ID);
                            bloodModel.patient = target.GetData(EntityData.PLAYER_SQL_ID);
                            bloodModel.type    = string.Empty;
                            bloodModel.used    = true;

                            Task.Factory.StartNew(() =>
                            {
                                // Add the blood consumption to the database
                                bloodModel.id = Database.AddBloodTransaction(bloodModel);
                                bloodList.Add(bloodModel);

                                // Send the confirmation message to both players
                                string playerMessage = string.Format(Messages.INF_PLAYER_REANIMATED, target.Name);
                                string targetMessage = string.Format(Messages.SUC_TARGET_REANIMATED, player.Name);
                                player.SendChatMessage(Constants.COLOR_ADMIN_INFO + playerMessage);
                                target.SendChatMessage(Constants.COLOR_SUCCESS + targetMessage);
                            });
                        }
                        else
                        {
                            // There's no blood left
                            player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_NO_BLOOD_LEFT);
                        }
                    }
                    else
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_DEAD);
                    }
                }
                else
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_FOUND);
                }
            }
        }