예제 #1
0
        public JsonResult SearchJob(string prjid, string bidid)
        {
            var model = new ProjectBidViewModel();

            if (!string.IsNullOrWhiteSpace(prjid))
            {
                model.BidItemsList    = HardCardDal.getBidItems(prjid);
                model.ProjectHeaderId = prjid;
                IEnumerable <SelectListItem> ListBidItems = model.BidItemsList.Select(c => new SelectListItem
                {
                    Value = Convert.ToString(c.BidItemHeaderId),
                    Text  = String.Format("{0} - {1}", c.BidItemHeaderId, c.BidItemName)
                });
            }

            if (!string.IsNullOrWhiteSpace(bidid))
            {
                if (!string.IsNullOrWhiteSpace(prjid) && !string.IsNullOrWhiteSpace(bidid))
                {
                    var results = HardCardDal.getHardCardItem(prjid, bidid);
                    if (results.Rows.Count > 0)
                    {
                        foreach (DataRow row in results.Rows)
                        {
                            model.BidItemId       = Convert.ToString(row["BidItemHeaderId"]);
                            model.HardCardId      = Convert.ToString(row["HardCardID"]);
                            model.ProjectHeaderId = Convert.ToString(row["ProjectHeaderId"]);
                        }
                    }
                    else
                    {
                        model.BidItemId       = bidid;
                        model.ProjectHeaderId = prjid;
                    }
                }
            }
            return(Json(model));
        }
예제 #2
0
        public ActionResult Create(string PRJID = "", string BIDID = "")
        {
            int BIDId           = 0;
            int projectHeaderID = 0;
            var model           = new HardCard();

            if (!string.IsNullOrWhiteSpace(PRJID) && Int32.TryParse(PRJID, out projectHeaderID))
            {
                Session["PRJID"]      = PRJID;
                model.ProjectHeaderId = projectHeaderID;
            }

            if (!string.IsNullOrWhiteSpace(BIDID) && Int32.TryParse(BIDID, out BIDId))
            {
                Session["BIDID"]      = BIDId;
                model.BidItemHeaderid = BIDId;
            }
            if (Session["BIDID"] != null && Session["BIDID"] != null)
            {
                LookUpHardCardCombos(model);
                if (model.ProjectHeaderId == 0 || model.BidItemHeaderid == 0)
                {
                    return(View("create", model));
                }

                var hardCardItem = HardCardDal.getHardCardItem(PRJID, BIDID);
                if (hardCardItem.Rows.Count == 1)
                {
                    model.HardCardId = Convert.ToInt32(hardCardItem.Rows[0]["HardCardID"]);
                    HardCardDal.getHardCardDetails(model);
                }

                return(View("create", model));
            }
            return(RedirectToAction("error"));
        }