public SWItem GetStorageByID(int agencyId, int id) { var date = ConvertDate.TotalSeconds(DateTime.Now.AddHours(12)); var query = from o in FDIDB.StorageWarehousings where o.AgencyId == agencyId && (!o.IsDelete.HasValue || !o.IsDelete.Value) && o.ID == id select new SWItem { id = o.ID, n = o.Name, c = o.Code, d = o.DateRecive ?? 0, LstItem = o.DN_RequestWare.Select(m => new DNRWHItem { n = m.Category.Name, h = m.Hour ?? 0, c = m.CateID, q = m.Quantity ?? 0, s = date < m.DateEnd, t = m.Type ?? 0 }) }; var obj = query.FirstOrDefault() ?? new SWItem { d = ConvertDate.TotalSeconds(DateTime.Today.AddDays(1)) }; obj.LstTimes = TypeTime.Hours(obj.d, date); return(obj); }
public ActionResult ChangeListTimebyDate(string date) { var dt = ConvertUtil.ToDateTime(date); var datet = TypeTime.Hours(dt.TotalSeconds(), DateTime.Now.AddHours(12).TotalSeconds()); return(Json(datet, JsonRequestBehavior.AllowGet)); }
public SWItem GetStorageByUser(int agencyId) { var date = ConvertDate.TotalSeconds(DateTime.Now.AddHours(12));// .TotalSeconds(); var query = from o in FDIDB.StorageWarehousings where o.AgencyId == agencyId && (!o.IsDelete.HasValue || o.IsDelete == false) orderby o.ID descending select new SWItem { id = o.ID, n = o.Name, d = o.DateRecive ?? 0, LstItem = o.DN_RequestWare.Select(m => new DNRWHItem { //id = m.GID, h = m.Hour ?? 0, //d = m.Day ?? 0, q = m.Quantity ?? 0, s = date < (m.Today + m.Day * 86400 + m.Hour * 3600), }) }; var obj = query.FirstOrDefault() ?? new SWItem { d = ConvertDate.TotalSeconds(DateTime.Today.AddDays(1)) }; obj.LstTimes = TypeTime.Hours(obj.d, date); return(obj); }
public ActionResult AjaxForm() { var model = new StorageWarehousingItem(); if (DoAction == ActionType.Edit) { model = _api.GetStorageWarehousingItem(ArrId.FirstOrDefault()); } ViewBag.UserID = UserItem.UserId; ViewBag.User = UserItem.UserName; var agent = _dnAgencyApi.GetItemById(UserItem.AgencyID); ViewBag.Wallet = agent.WalletValue; ViewBag.Deposit = UserItem.AgencyDeposit ?? 0; ViewBag.marketId = UserItem.MarketID; ViewBag.areaId = UserItem.AreaID; ViewBag.listtime = TypeTime.Hours(DateTime.Today.AddDays(1).TotalSeconds(), DateTime.Now.AddHours(12).TotalSeconds()); ViewBag.Action = DoAction; SupplierDA _supplierDa = new SupplierDA(); return(View(model)); }