コード例 #1
0
 public ActionResult Edit(AgencyPackage agencyPackage, string actionlink = "")
 {
     agencyPackage.UpdatedBy = user.Staff.UserName;
     agencyPackage.UpdatedAt = DateTime.Now;
     if (ModelState.IsValid)
     {
         agencyPackage.AgencyId        = user.Agency.Id;
         db.Entry(agencyPackage).State = EntityState.Modified;
         db.SaveChanges();
         ViewBag.ShipmentId = agencyPackage.ShipmentId;
         if (actionlink != "")
         {
             return(Content(javasctipt_add("/AgencyPackageItem/Index/" + agencyPackage.Id, "Cập nhật dữ liệu thành công")));
         }
         else
         {
             return(Content(javasctipt_add("/Shipment/Package/" + agencyPackage.ShipmentId, "Cập nhật dữ liệu thành công")));
         }
     }
     ViewBag.SendHour     = new SelectList(TimeUtils.TimeHours(), "Value", "Text", agencyPackage.SendHour);
     ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", agencyPackage.ReceivedHour);
     ViewBag.AgencyId     = new SelectList(db.Agencies.Where(n => n.Id == user.Agency.Id), "Id", "Name", agencyPackage.AgencyId);
     ViewBag.DeliveryId   = new SelectList(db.DeliveryComs.Where(n => n.IsActive == true), "Id", "Name", agencyPackage.DeliveryId);
     ViewBag.StatusId     = new SelectList(StatusUtils.GetStatus(1), "Value", "Text", agencyPackage.TrackingStatusId);
     if (actionlink != "")
     {
         return(Content(javasctipt_add("/AgencyPackageItem/Index/" + agencyPackage.Id, "Cập nhật dữ liệu thất bại")));
     }
     else
     {
         return(Content(javasctipt_add("/Shipment/Package/" + agencyPackage.ShipmentId, "Cập nhật dữ liệu thất bại")));
     }
 }
コード例 #2
0
        public ActionResult Edit(Staff model, string ReNewPassword)
        {
            model.IsDeleted = false;
            model.UpdatedAt = DateTime.Now;
            if (ModelState.IsValid)
            {
                try
                {
                    if (model.Email == "" || model.Email == null)
                    {
                        model.Email = model.UserName;
                    }
                    if (ReNewPassword != null && ReNewPassword.Trim().Length > 0)
                    {
                        model.Password = SimpleEncrypt.Encrypt(ReNewPassword, true);
                    }
                    db.Entry(model).State = EntityState.Modified;
                    db.SaveChanges();
                    return(Content(javasctipt_add("/Staff", "Cập nhật dữ liệu thành công")));
                }
                catch (Exception)
                {
                    return(Content(javasctipt_add("/Staff", "Cập nhật dữ liệu thất bại")));
                }
            }
            ViewBag.RoleId = new SelectList(db.Roles.Where(n => n.Name.Contains("Better")), "Id", "Name", model.RoleId);
            var status = StatusUtils.GetSettingStatus();

            ViewBag.IsActive = new SelectList(status, "Value", "Text", model.IsActive);
            ViewBag.Gender   = new SelectList(StatusUtils.GetGender(), "Value", "Text", model.Gender);
            return(Content(javasctipt_add("/Staff", "Cập nhật dữ liệu thất bại")));
        }
コード例 #3
0
    void Update()
    {
        if (initialized)
        {
            enemyHealthBar.updateHealthBar(enemy.data.healthBarData);
            if (enemy.data.healthBarData.currHealth <= 0)
            {
                gameObject.SetActive(false);
                EnemyManagerService.getInstance().onEnemyDefeat(this);
            }

            if (attacking)
            {
                this.attackAnimationAction();
            }

            Card enemyTurn = enemy.data.enemyTurnData.currEnemyTurn;
            if (enemyTurn != null)
            {
                double weakModifier = StatusUtils.getAppliedStatusCount(StatusTypes.StatusEnum.weak, this.statusesObject.activeStatuses) > 0 ? enemy.data.weakMultiplier : 1.0;
                enemyBlockIntent.text  = "Block: " + enemyTurn.data.defend.ToString();
                enemyAttackIntent.text = "Attack: " + ((int)(weakModifier * enemyTurn.data.attack)).ToString();
                if (enemyTurn.data.attackMultiplier > 1)
                {
                    enemyAttackIntent.text += " x " + enemyTurn.data.attackMultiplier.ToString();
                }
                otherIntent.text = "";
                if (enemyTurn.data.cardToAddToPlayersDecks != null && enemyTurn.data.cardToAddToPlayersDecks.Count > 0)
                {
                    otherIntent.text = "Add " + enemyTurn.data.cardToAddToPlayersDecks.Count + " cards to players deck";
                }
            }
        }
    }
コード例 #4
0
        // GET: WareHouseInfo/Create
        public ActionResult Add()
        {
            var status = StatusUtils.GetSettingStatus();

            ViewBag.IsActive = new SelectList(status, "Value", "Text");
            return(View());
        }
コード例 #5
0
        public ActionResult Detail(Guid id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PackageReturn model = db.PackageReturns.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Id       = id;
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(6), "Value", "Text", model.StatusId);
            var ListJP = db.TrackingDetails.Where(n => n.StorageJP.AgencyId == user.Agency.Id && n.TrackingSubCode == "21").OrderByDescending(n => n.CreatedAt);

            ListJP         = ListJP.Where(n => db.ReturnDetails.Where(m => m.PackageReturn.AgencyId == user.Agency.Id).Where(m => m.TrackingDetailId == n.Id).Count() == 0).OrderByDescending(n => n.CreatedAt);
            ViewBag.ListJP = Pager <TrackingDetail> .CreatePagging(ListJP.OrderByDescending(n => n.CreatedAt), 1, 10);

            var ReturnDetail = db.ReturnDetails.Where(n => n.PackageReturnId == id).Where(n => n.PackageReturn.AgencyId == user.Agency.Id).OrderByDescending(n => n.CreatedAt);

            ViewBag.ReturnDetail = Pager <ReturnDetail> .CreatePagging(ReturnDetail.OrderByDescending(n => n.CreatedAt), 1, 10);

            ViewBag.Model = model;
            return(View(model));
        }
コード例 #6
0
        public ActionResult Add()
        {
            ViewBag.FromAirId = new SelectList(db.FromAirs.OrderBy(n => n.CreatedAt), "Id", "Name");
            ViewBag.ToAirId   = new SelectList(db.ToAirs.OrderBy(n => n.CreatedAt), "Id", "Name");
            //var WareHouseInfoId = db.WareHouseInfoes.Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem() { Value = n.Id+"", Text = n.Name + " / " + n.Address });
            //ViewBag.WareHouseInfoId = new SelectList(WareHouseInfoId, "Value", "Text");
            //var mawb = db.MAWBs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem() { Value = n.Id, Text = n.Name + " / " + n.Address });
            //ViewBag.MaWBId = new SelectList(mawb, "Value", "Text");

            var WareHouseInfoId = db.WareHouseInfoes.Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id + "", Text = n.Name + " / " + n.Address
            });

            ViewBag.WareHouseInfoId = new SelectList(WareHouseInfoId, "Value", "Text");
            var mawb = db.MAWBs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id, Text = n.Name + " / " + n.Address
            });

            ViewBag.MaWBId = new SelectList(mawb, "Value", "Text");


            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(5), "Value", "Text");

            return(View(new Shipping()
            {
                DateAir = DateTime.Now, HourAir = DateTime.Now.ToString("HH:mm")
            }));
        }
コード例 #7
0
        public ActionResult ShippingPackage(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Shipping model = db.Shippings.Find(id);

            //lay trang thai cua booking
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(5), "Value", "Text", model.StatusId);
            //lay danh sach kien hang VN
            var listVN = db.ExportGoods.Where(n => n.AgencyId == user.Agency.Id && n.StatusId == 10);

            //check list VN exist in Chuyen bay Hay khong?
            listVN         = listVN.Where(n => db.ShippingHAWBDetails.Where(m => m.AgencyId == user.Agency.Id).Where(m => m.ExportGoodId == n.Id).Count() == 0);
            ViewBag.ListVN = Pager <ExportGood> .CreatePagging(listVN.OrderByDescending(n => n.CreatedAt), 1, 10);

            //lay danh sach kiện Shipping
            var itemListShipping = db.ShippingHAWBDetails.Where(n => n.AgencyId == user.Agency.Id && n.ShippingHAWB.ShippingId == model.Id).OrderByDescending(n => n.CreatedAt);

            ViewBag.Weigh        = itemListShipping.Sum(n => n.ExportGood.Weigh);
            ViewBag.ListShipping = Pager <ShippingHAWBDetail> .CreatePagging(itemListShipping, 1, 10);

            //lay danh sach HAWB
            var listHAWB = db.HAWBs.Where(n => n.AgencyId == user.Agency.Id && n.IsActive == true).OrderBy(n => n.CreatedAt);

            ViewBag.HAWB = new SelectList(listHAWB, "Id", "Name");
            return(View(model));
        }
コード例 #8
0
        //detail
        public ActionResult Detail(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExportGood exportGood = db.ExportGoods.Find(id);
            //LIST KIEN JP
            var listjp = db.StorageJPs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.StatusId == 8).OrderByDescending(n => n.CreatedAt);
            List <TrackingDetail> lstDetail = new List <TrackingDetail>();

            foreach (var item in listjp)
            {
                lstDetail.AddRange(item.TrackingDetails.Where(n => n.TrackingSubCode != "21"));
            }
            lstDetail = lstDetail.Where(n => PageUtils.IsExistExport(n.Id, user.Agency.Id) == false).OrderByDescending(n => n.CreatedAt).ToList();
            var lstReturn = Pager <TrackingDetail> .CreatePagging(lstDetail.AsQueryable(), 1, 10);

            ViewBag.ListJP = lstReturn;
            ViewBag.ListVN = Pager <ExportGoodDetail> .CreatePagging(exportGood.ExportGoodDetails.OrderByDescending(n => n.CreatedAt).AsQueryable(), 1, 10);

            ViewBag.StatusId         = new SelectList(StatusUtils.GetStatus(3), "Value", "Text", exportGood.StatusId);
            ViewBag.ExportGoodStatus = exportGood.StatusId;
            return(View(exportGood));
        }
コード例 #9
0
 public ActionResult Edit(Shipment model, string actionlink = "")
 {
     model.UpdatedBy = user.Staff.UserName;
     model.UpdatedAt = DateTime.Now;
     if (ModelState.IsValid)
     {
         model.AgencyId        = user.Agency.Id;
         db.Entry(model).State = EntityState.Modified;
         db.SaveChanges();
         if (actionlink != "")
         {
             return(Content(javasctipt_add("/Shipment/Package/" + model.Id, "Cập nhật dữ liệu thành công")));
         }
         else
         {
             return(Content(javasctipt_add("/Shipment", "Cập nhật dữ liệu thành công")));
         }
     }
     ViewBag.StatusId     = new SelectList(StatusUtils.GetStatus(0), "Value", "Text", model.StatusId);
     ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", model.ReceivedHour);
     if (actionlink != "")
     {
         return(Content(javasctipt_add("/Shipment/Package/" + model.Id, "Cập nhật dữ liệu thất bại")));
     }
     else
     {
         return(Content(javasctipt_add("/Shipment", "Cập nhật dữ liệu thất bại")));
     }
 }
コード例 #10
0
        // GET: ExportGoods
        public ActionResult Index(int page = 1, string key = "", int sort = 0)
        {
            ViewBag.Title = "Danh sách kiện hàng Việt Nam";
            ViewBag.key   = key;
            ViewBag.Page  = page;
            ViewBag.sort  = sort;
            var status = StatusUtils.GetStatus(3);

            status.Insert(0, new SelectListItem()
            {
                Value = "0", Text = "Tất cả"
            });
            ViewBag.ExportGoodStatus = new SelectList(status, "Value", "Text", sort);

            var item           = db.ExportGoods.Where(n => n.AgencyId == user.Agency.Id).OrderByDescending(n => n.CreatedAt);
            var exportShipping = db.ShippingHAWBDetails.Where(n => n.AgencyId == user.Agency.Id);

            item = item.Where(m => exportShipping.Where(n => n.ExportGoodId == m.Id).Count() == 0)
                   .OrderByDescending(n => n.CreatedAt);


            if (sort != 0)
            {
                item = item.Where(n => n.StatusId == sort).OrderByDescending(n => n.CreatedAt);
            }
            if (key != "")
            {
                item = item.Where(n => n.ShippingMarkVN.Contains(key)).OrderByDescending(n => n.CreatedAt);
            }
            return(View(Pager <ExportGood> .CreatePagging(item, page, 10)));
        }
コード例 #11
0
        // GET: ExportGoods/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ExportGood exportGood = db.ExportGoods.Find(id);

            if (exportGood == null)
            {
                return(HttpNotFound());
            }
            var size = db.SizeTables.OrderBy(n => n.NoOrder).Select(n => new SelectListItem()
            {
                Text = n.Name, Value = n.Id + ""
            }).ToList();

            size.Insert(0, new SelectListItem()
            {
                Value = " ", Text = " "
            });
            ViewBag.SizeTableId = new SelectList(size, "Value", "Text", exportGood.SizeTableId);
            ViewBag.StatusId    = new SelectList(StatusUtils.GetStatus(3), "Value", "Text", exportGood.StatusId);
            //ViewBag.ExportHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", exportGood.ExportHour);

            return(View(exportGood));
        }
コード例 #12
0
        public ActionResult _Clearance(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FlightBooking FlightBooking = db.FlightBookings.Find(id);

            if (FlightBooking == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(4), "Value", "Text", FlightBooking.StatusId);

            ViewBag.MAWB          = new SelectList(db.MAWBs.Where(n => n.AgencyId == user.Agency.Id), "Id", "Id");
            ViewBag.HAWB          = new SelectList(db.HAWBs.Where(n => n.AgencyId == user.Agency.Id), "Id", "Id");
            ViewBag.FlightBooking = FlightBooking;
            Tuple <Invoice, CustomsClearance> model = new Tuple <Invoice, CustomsClearance>(new Invoice(), new CustomsClearance());

            try
            {
                model = new Tuple <Invoice, CustomsClearance>(FlightBooking.Invoices != null && FlightBooking.Invoices.Count > 0 ? FlightBooking.Invoices.First() : new Invoice(), FlightBooking.CustomsClearances != null && FlightBooking.CustomsClearances.Count > 0 ? FlightBooking.CustomsClearances.First() : new CustomsClearance());
                if (model.Item2.ClearanceAirs == null || model.Item2.ClearanceAirs.Count <= 0)
                {
                    model.Item2.ClearanceAirs.Add(new ClearanceAir()
                    {
                    });
                }
                ViewBag.Size = new SelectList(db.SizeTables.OrderBy(n => n.NoOrder), "Id", "Name", model.Item2.Size);
            }
            catch { ViewBag.Size = new SelectList(db.SizeTables.OrderBy(n => n.NoOrder), "Id", "Name"); }
            return(PartialView(model));
        }
コード例 #13
0
        public ActionResult Add(Staff model)
        {
            model.IsDeleted = false;
            model.CreatedAt = model.UpdatedAt = DateTime.Now;
            if (ModelState.IsValid)
            {
                try
                {
                    if (model.Email == "" || model.Email == null)
                    {
                        model.Email = model.UserName;
                    }
                    model.Password = SimpleEncrypt.Encrypt(model.Password, true);
                    db.Staffs.Add(model);
                    db.SaveChanges();
                    return(Content(javasctipt_add("/Staff", "Thêm dữ liệu thành công")));
                }
                catch (Exception)
                {
                    return(Content(javasctipt_add("/Staff", "Thêm dữ liệu thất bại")));
                }
            }
            var status = StatusUtils.GetSettingStatus();

            ViewBag.IsActive = new SelectList(status, "Value", "Text", model.IsActive);
            ViewBag.RoleId   = new SelectList(db.Roles.Where(n => n.Name.Contains("Better")), "Id", "Name", model.RoleId);
            ViewBag.Gender   = new SelectList(StatusUtils.GetGender(), "Value", "Text", model.Gender);
            return(Content(javasctipt_add("/Staff", "Thêm dữ liệu thất bại")));
        }
コード例 #14
0
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Shipping model = db.Shippings.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            ViewBag.FromAirId = new SelectList(db.FromAirs.OrderBy(n => n.CreatedAt), "Id", "Name", model.FromAirId);
            ViewBag.ToAirId   = new SelectList(db.ToAirs.OrderBy(n => n.CreatedAt), "Id", "Name", model.ToAirId);
            var WareHouseInfoId = db.WareHouseInfoes.Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id + "", Text = n.Name + " / " + n.Address
            });

            ViewBag.WareHouseInfoId = new SelectList(WareHouseInfoId, "Value", "Text", model.WareHouseInfoId);
            var mawb = db.MAWBs.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id, Text = n.Name + " / " + n.Address
            });

            ViewBag.MaWBId   = new SelectList(mawb, "Value", "Text", model.MaWBId);
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(5), "Value", "Text", model.StatusId);
            return(View(model));
        }
コード例 #15
0
        // GET: WareHouseInfo/Create
        public ActionResult Add()
        {
            var status = StatusUtils.GetSettingStatus();

            ViewBag.IsActive = new SelectList(status, "Value", "Text");
            ViewBag.AgencyId = new SelectList(db.Agencies, "Id", "Id", user.Agency.Id);
            return(View());
        }
コード例 #16
0
        public ActionResult Add()
        {
            ViewBag.RoleId = new SelectList(db.Roles.Where(n => n.Name.Contains("Better")), "Id", "Name");
            var status = StatusUtils.GetSettingStatus();

            ViewBag.IsActive = new SelectList(status, "Value", "Text");
            ViewBag.Gender   = new SelectList(StatusUtils.GetGender(), "Value", "Text");
            return(View());
        }
コード例 #17
0
        // GET: FlightGoods
        public ActionResult Index(Guid id)
        {
            var FlightBooking = db.FlightBookings.Find(id);

            ViewBag.FlightBooking = FlightBooking;
            var model = db.FlightGoods.Where(n => n.FlightBookingId == id);

            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(4), "Value", "Text", FlightBooking.StatusId);
            return(View(model));
        }
コード例 #18
0
        public ActionResult Clearance(Guid?ShippingId, string PreAD_Note = "", string PreADFile = "", string PreADBase64 = "")
        {
            if (ShippingId == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            //xu ly update
            Shipping model = db.Shippings.Find(ShippingId);
            //add shipping clearnace
            var shippingClearnace = new ShippingHistory()
            {
                Id              = Guid.NewGuid(),
                ShippingId      = model.Id,
                AgencyId        = user.Agency.Id,
                ShippingCode    = model.ShippingCode,
                DateAir         = model.DateAir,
                HourAir         = model.HourAir,
                FromAirId       = model.FromAirId,
                ToAirId         = model.ToAirId,
                WareHouseInfoId = model.WareHouseInfoId,
                Notes           = model.Notes,
                MaWBId          = model.MaWBId,
                CreatedAt       = DateTime.Now,
                CreatedBy       = user.Staff.UserName,
                StatusId        = model.StatusId,
                UpdatedAt       = DateTime.Now,
                UpdatedBy       = user.Staff.UserName
            };

            if (PreAD_Note != "")
            {
                shippingClearnace.PreAD_Note = PreAD_Note;
            }
            //xu ly upload file
            var upImage = Request.Files["upImage"];

            if (upImage.ContentLength > 0 && upImage != null)
            {
                string fileName = upImage.FileName;
                upImage.SaveAs(Server.MapPath("~/Uploads/PreAD/" + fileName));
                shippingClearnace.PreADFile = fileName;
                try
                {
                    shippingClearnace.PreADBase64 = Web.Helpers.Images.ImageUtils.Images(Server.MapPath("~/Uploads/PreAD/" + fileName));
                }
                catch { }
            }
            db.ShippingHistories.Add(shippingClearnace);
            db.SaveChanges();
            TempData["Message"] = "Cập nhật pre-ad thành công";
            //lay trang thai cua booking
            ViewBag.StatusId          = new SelectList(StatusUtils.GetStatus(5), "Value", "Text", model.StatusId);
            ViewBag.ShippingClearance = db.ShippingHistories.Where(n => n.AgencyId == user.Agency.Id && n.ShippingId == model.Id).OrderByDescending(n => n.CreatedAt);
            return(Redirect("/shipping/clearance/" + model.Id));
        }
コード例 #19
0
    public Card getModifiedEnemyTurn(EnemyGameObject enemyGameObject)
    {
        Card modifiedEnemyTurn = stackCardAffects(enemyGameObject.enemy.data.enemyTurnData.enemyModifiers);

        if (StatusUtils.getAppliedStatusCount(StatusTypes.StatusEnum.weak, enemyGameObject.statusesObject.activeStatuses) > 0)
        {
            modifiedEnemyTurn.data.attack = (int)(modifiedEnemyTurn.data.attack * enemyGameObject.enemy.data.weakMultiplier);
        }

        return(modifiedEnemyTurn);
    }
コード例 #20
0
        public string getStatus(string name)
        {
            string status = "2";

            try
            {
                status = StatusUtils.GetStatus(1).Where(n => n.Text.Trim().ToLower() == name.Trim().ToLower()).ToList()[0].Value;
            }
            catch { }
            return(status);
        }
コード例 #21
0
 public bool UpdateTimeLeft(float delta)
 {
     timeLeft -= delta * (1 / StatusUtils.GetDuration(statusType));
     if (timeLeft < 0)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
コード例 #22
0
 // GET: AgencyPackage/Create
 public ActionResult Add(Guid id)
 {
     ViewBag.AgencyId     = new SelectList(db.Agencies.Where(n => n.Id == user.Agency.Id), "Id", "Name");
     ViewBag.SendHour     = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
     ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
     ViewBag.AgencyId     = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
     ViewBag.DeliveryId   = new SelectList(db.DeliveryComs.Where(n => n.IsActive == true), "Id", "Name", "");
     ViewBag.StatusId     = new SelectList(StatusUtils.GetStatus(1), "Value", "Text", "");
     return(View(new AgencyPackage()
     {
         ShipmentId = id, SentDate = DateTime.Now, SendHour = DateTime.Now.ToString("HH:mm"), ReceivedDate = DateTime.Now, ReceivedHour = DateTime.Now.ToString("HH:mm")
     }));
 }
コード例 #23
0
    public void SetStatuses(List <Status> statuses)
    {
        // Loop through all statuses
        List <Status> displayedStatuses = new List <Status>();

        int swarmResistCount = 0;

        foreach (Status s in statuses)
        {
            // Only display a relevant number of SwarmResist icons
            if (s.statusType == StatusType.SwarmResist)
            {
                swarmResistCount++;

                if (swarmResistCount > gameRules.STATswarmResistMaxStacks)
                {
                    continue;
                }
            }

            if (StatusUtils.ShouldDisplay(s.statusType))
            {
                displayedStatuses.Add(s);
            }
        }

        // For each status icon, enable or disable, apply colors, and set inner icon
        for (int i = 0; i < statusBkgs.Length; i++)
        {
            if (i < displayedStatuses.Count)
            {
                statusBkgs[i].gameObject.SetActive(true);

                StatusType type   = displayedStatuses[i].statusType;
                Color[]    colors = StatusUtils.GetDisplayColors(type);
                statusBkgs[i].color = colors[0];

                // TODO:
                //string timeLeft = StatusUtils.ShouldCountDownDuration(type) ? string.Format(" ({0:0.0}s)", displayedStatuses[i].GetTimeLeft()) : "";
                statusBkgs[i].GetComponent <UI_TooltipSource>().SetText(StatusUtils.GetDisplayName(type) + "\n" + StatusUtils.GetDisplayDesc(type));

                Image icon = statusBkgs[i].GetComponentsInChildren <Image>()[1];
                icon.color  = colors[1];
                icon.sprite = StatusUtils.GetDisplayIcon(type);
            }
            else
            {
                statusBkgs[i].gameObject.SetActive(false);
            }
        }
    }
コード例 #24
0
        public IActionResult Update(int id, long dt_log, int new_status, string Comment)
        {
            try
            {
                using (MUPContext db = new MUPContext())
                {
                    using (var transact = db.Database.BeginTransaction(IsolationLevel.RepeatableRead))
                    {
                        //получаем последнюю запись из лога
                        var rl = db.RequestLogs
                                 .Where(r => r.RequestId == id)
                                 .OrderByDescending(a => a.LogTime)
                                 .First();

                        ////проверяем последняя ли запись
                        if (rl.LogTime.Ticks != dt_log)
                        {
                            throw new Exception("Данные устарели, необходимо обновить!");
                        }

                        if (!StatusUtils.CheckNextStatus(rl.Status, new_status))
                        {
                            throw new Exception(string.Format("Недопустимое изменение статуса заявки '{0}'->'{1}'",
                                                              StatusUtils.GetStatusName(rl.Status), StatusUtils.GetStatusName(new_status)));
                        }

                        //добавление записи
                        db.RequestLogs.Add(new RequestLog
                        {
                            RequestId = id,
                            Status    = new_status,
                            Comment   = Comment,
                            LogTime   = DateTime.Now
                        });

                        db.SaveChanges();
                        transact.Commit();
                    }
                }

                return(Redirect((Url.Action("Update", new { id = id }))));
            }
            catch (Exception e)
            {
                return(View("ErrorUpdate", new ErrorUpdate {
                    message = e.Message, id = id
                }));
            }
        }
コード例 #25
0
        public ActionResult Add()
        {
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(6), "Value", "Text", "");
            var hawb = db.HAWBs.Where(n => n.AgencyId == user.Agency.Id && n.IsActive == true).OrderBy(n => n.CreatedAt).Select(n => new SelectListItem()
            {
                Value = n.Id, Text = n.Name + " / " + n.Address
            });

            ViewBag.HAWB = new SelectList(hawb, "Value", "Text");
            //ViewBag.ExportHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
            return(View(new PackageReturn()
            {
                ReturnDate = DateTime.Now, ReturnHour = DateTime.Now.ToString("HH:mm")
            }));
        }
コード例 #26
0
        // GET: Shipment/Edit/5
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var model = db.Shipments.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            ViewBag.StatusId     = new SelectList(StatusUtils.GetStatus(0), "Value", "Text", model.StatusId);
            ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", model.ReceivedHour);
            return(View(model));
        }
コード例 #27
0
        public ActionResult Clearance(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Shipping model = db.Shippings.Find(id);

            //lay trang thai cua booking
            ViewBag.StatusId = new SelectList(StatusUtils.GetStatus(5), "Value", "Text", model.StatusId);
            var items = db.ShippingHistories.Where(n => n.AgencyId == user.Agency.Id && n.ShippingId == model.Id).OrderByDescending(n => n.CreatedAt);

            ViewBag.ShippingClearance = items;
            ViewBag.CountItem         = items.Count();
            return(View(model));
        }
コード例 #28
0
        public ActionResult Add(WareHouseInfo model)
        {
            model.CreatedAt = model.UpdatedAt = DateTime.Now;
            model.IsDeleted = false;

            if (ModelState.IsValid)
            {
                db.WareHouseInfoes.Add(model);
                db.SaveChanges();
                return(Content(javasctipt_add("/WareHouseInfo", "Thêm dữ liệu thành công")));
            }
            var status = StatusUtils.GetSettingStatus();

            ViewBag.IsActive = new SelectList(status, "Value", "Text", model.IsActive);
            return(Content(javasctipt_add("/WareHouseInfo", "Thêm dữ liệu thất bại")));
        }
コード例 #29
0
        public ActionResult Package(Guid id, string key = "", int page = 1, int sort = 0)
        {
            var shipment = db.Shipments.Find(id);

            ViewBag.Shipment = shipment;
            ViewBag.Title    = shipment.ShipmentName;

            ViewBag.KeyPackage  = key;
            ViewBag.SortPackage = sort;
            ViewBag.ShipmentId  = id;
            ViewBag.PagePackage = page;
            var status = StatusUtils.GetStatus(1);

            status.Insert(0, new SelectListItem()
            {
                Value = "0", Text = "Tất cả"
            });
            ViewBag.PackageStatusId = new SelectList(status, "Value", "Text", sort);
            var item = db.AgencyPackages.Where(n => n.AgencyId == user.Agency.Id).Where(n => n.ShipmentId == id).OrderByDescending(n => n.CreatedAt);

            if (sort != 0)
            {
                item = item.Where(n => n.StatusId == sort).OrderByDescending(n => n.CreatedAt);
            }
            if (key != "")
            {
                item = item.Where(n => n.TrackingCode.Contains(key)).OrderByDescending(n => n.CreatedAt);
            }

            ViewBag.DeliveryId   = new SelectList(db.DeliveryComs.Where(n => n.IsActive == true), "Id", "Name", "");
            ViewBag.SendHour     = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
            ViewBag.ReceivedHour = new SelectList(TimeUtils.TimeHours(), "Value", "Text", "");
            ViewBag.CurrentDate  = DateTime.Now.ToString("yyyy-MM-dd");

            ViewBag.TotalCount = item.Count();
            ViewBag.TotalWeigh = item.Where(n => n.Weigh != null).Sum(n => n.Weigh);
            try
            {
                ViewBag.TotalItems = item.Sum(m => m.AgencyPackageItems.Count());
            }catch { ViewBag.TotalItems = 0; }
            try
            {
                ViewBag.TotalItemQuantitys = item.Sum(m => m.AgencyPackageItems.Sum(n => n.ItemQuantity));
            }
            catch { ViewBag.TotalItemQuantitys = 0; }
            return(View(Pager <AgencyPackage> .CreatePagging(item, page, 10)));
        }
コード例 #30
0
        // GET: WareHouseInfo/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WareHouseInfo model = db.WareHouseInfoes.Find(id);

            if (model == null)
            {
                return(HttpNotFound());
            }
            var status = StatusUtils.GetSettingStatus();

            ViewBag.IsActive = new SelectList(status, "Value", "Text", model.IsActive);
            return(View(model));
        }