Exemplo n.º 1
0
        /// <summary>
        /// KPTリストを取得(ユーザーで絞込)
        /// </summary>
        /// <returns></returns>
        public IList <Kpt> GetUserKptList(int boardId, Kpt.KptType type, string username)
        {
            var model    = this.GetModel(boardId, type);
            var userList = model.KptList.Where(x => x.UserName == username);

            return(userList.ToList());
        }
Exemplo n.º 2
0
        public ActionResult UpsertItem(Kpt.KptType type, Kpt info = null)
        {
            //(int id = 1, string typeid = null, Kpt info = null)
            var hasError = false;

            /*
             * if (!ViewData.ModelState.IsValid)
             * {
             *  hasError = true;
             * }
             *
             * if (hasError)
             * {
             *  var validatedModel = _basePriceLogic.GetModel(id, typeid, info);
             *  ViewBag.ErrorTypeId = typeid;
             *  ViewBag.ErrorPricingType = info.PricingType;
             *  return View("Index", validatedModel);
             * }
             */
            /*
             * if (info.ID == 0)
             * {
             *  _kptListLogic.AddPricing(typeid, info);
             * }
             * else
             * {
             *  _kptListLogic.UpdatePricing(typeid, info);
             * }
             */
            kptListLogic.AddItem(type, info);
            //var model = _kptListLogic.GetModel(type);
            return(View("Index"));
        }
Exemplo n.º 3
0
        /// <summary>
        /// モデルを取得
        /// </summary>
        /// <returns></returns>
        public KptListModel GetModel(int boardId, Kpt.KptType type)
        {
            var _kptListModel = new KptListModel();
            var list          = tableUtils.GetKptList(boardId, type);

            switch (type)
            {
            case Kpt.KptType.Keep:
                _kptListModel.InputTitle    = "Keep";
                _kptListModel.InputNextType = Kpt.KptType.Problem;
                break;

            case Kpt.KptType.Problem:
                _kptListModel.InputTitle    = "Problem";
                _kptListModel.InputNextType = Kpt.KptType.Try;
                break;

            case Kpt.KptType.Try:
                _kptListModel.InputTitle    = "Try";
                _kptListModel.InputNextType = Kpt.KptType.Try;
                break;

            default:
                break;
            }

            // ViewModel作成
            _kptListModel.KptList   = list;
            _kptListModel.InputType = type;
            return(_kptListModel);
        }
Exemplo n.º 4
0
 /// <summary>
 /// KPT変更
 /// </summary>
 /// <param name="typeid"></param>
 /// <param name="info"></param>
 public void DeleteItem(Kpt.KptType type, Kpt info)
 {
     /*
      * var delPricing = _optimDbContext.ThreadSafe(context => context.Pricing.Include(x => x.DeploymentType)
      *  .FirstOrDefaultAsync(x => x.DeploymentType.ID == typeid && x.ID == info.ID));
      * if (delPricing != null)
      * {
      *  // 基本単価の場合は自動で終了日を設定
      *  if (delPricing.PricingType == Common.DatabaseConnector.Models.PricingTypeEnum.Base)
      *  {
      *      var pricing = _optimDbContext.ThreadSafe(context => context.Pricing.Include(x => x.DeploymentType)
      *          .Where(x => x.DeploymentType.ID == typeid && x.PricingType == delPricing.PricingType)
      *          .OrderByDescending(x => x.EndDate)
      *          .FirstOrDefaultAsync(x => x.EndDate.HasValue));
      *      if (pricing != null)
      *      {
      *          pricing.EndDate = null;
      *          _optimDbContext.Update(pricing);
      *      }
      *  }
      *  _optimDbContext.Remove(delPricing);
      *  _optimDbContext.ThreadSafe(context => context.SaveChangesAsync());
      * }
      */
 }
Exemplo n.º 5
0
        /// <summary>
        /// モデルを取得(ユーザーで絞込)
        /// </summary>
        /// <returns></returns>
        public KptListModel GetUserModel(int boardId, Kpt.KptType type, string username)
        {
            var model    = this.GetModel(boardId, type);
            var userList = model.KptList.Where(x => x.UserName == username);

            model.KptList = userList.ToList();

            return(model);
        }
Exemplo n.º 6
0
        /// <summary>
        /// KPT入力
        /// </summary>
        /// <returns></returns>
        public ActionResult KptInput(int boardId, Kpt.KptType type)
        {
            var model = new KptListModel();

            //セッションから取得する。
            var username = HttpContext.Request.Cookies[cUserName];

            model         = kptListLogic.GetUserModel(boardId, type, username);
            model.BoardId = boardId;

            return(View(model));
        }
Exemplo n.º 7
0
        /*
         * public IActionResult Index()
         * {
         *  return View();
         * }
         */
        /// <summary>
        /// 表示
        /// </summary>
        /// <returns></returns>
        public ActionResult Index(int boardId, Kpt.KptType type)
        {
            Console.WriteLine(HttpContext.Request.Cookies[cBoardName] + ":" + HttpContext.Request.Cookies[cUserName]);

            //セッションから取得する。
            var username = HttpContext.Request.Cookies[cUserName];

            var model = kptListLogic.GetModel(boardId, type);

            model.BoardId = boardId;

            return(View(model));
        }
Exemplo n.º 8
0
 /// <summary>
 /// KPT追加
 /// </summary>
 /// <param name="typeid"></param>
 /// <param name="info"></param>
 public void AddItem(Kpt.KptType type, Kpt info)
 {
     /*
      * var deploymentType = _optimDbContext.ThreadSafe(context => context.DeploymentTypes.FirstAsync(x => x.ID == typeid));
      *
      * var addInfo = Mapper.Map<Common.DatabaseConnector.Models.Pricing>(info);
      * addInfo.DeploymentType = deploymentType;
      * _optimDbContext.DeploymentTypes.Attach(deploymentType);
      *
      * _optimDbContext.Add(addInfo);
      * _optimDbContext.ThreadSafe(context => context.SaveChangesAsync());
      */
 }
Exemplo n.º 9
0
 /// <summary>
 /// KPT変更
 /// </summary>
 /// <param name="typeid"></param>
 /// <param name="info"></param>
 public void UpdateItem(Kpt.KptType type, Kpt info)
 {
     /*
      * var updPricing = _optimDbContext.ThreadSafe(context => context.Pricing.Include(x => x.DeploymentType)
      *  .FirstOrDefaultAsync(x => x.DeploymentType.ID == typeid && x.ID == info.ID));
      * if (updPricing != null)
      * {
      *  var updateInfo = Mapper.Map<Common.DatabaseConnector.Models.Pricing>(info);
      *  updPricing.StartDate = updateInfo.StartDate;
      *  updPricing.EndDate = updateInfo.EndDate;
      *  updPricing.MonthlyPrice = updateInfo.MonthlyPrice;
      *  _optimDbContext.Update(updPricing);
      *  _optimDbContext.ThreadSafe(context => context.SaveChangesAsync());
      * }
      */
 }
Exemplo n.º 10
0
 public ActionResult DeleteItem(Kpt.KptType type, Kpt info = null)
 {
     /*
      *  var hasError = false;
      *
      *  if (!_basePriceLogic.CheckValidPeriod(typeid, info, false))
      *  {
      *      hasError = true;
      *      ViewData.ModelState.AddModelError(nameof(info.StartDate), string.Format(Constants.Messages.ERROR_CHECK_VALID_PERIOD, "削除"));
      *  }
      *
      *  if (hasError)
      *  {
      *      var validatedModel = _basePriceLogic.GetModel(id, typeid, info);
      *      ViewBag.ErrorTypeId = typeid;
      *      ViewBag.ErrorPricingType = info.PricingType;
      *      return View("Index", validatedModel);
      *  }
      */
     kptListLogic.DeleteItem(type, info);
     //var model = _kptListLogic.GetModel(type);
     return(View("Index"));
 }