コード例 #1
0
        public ActionResult Create()
        {
            AgentClassesModel model = new AgentClassesModel();

            ViewData["Deals"] = new SelectList(ent.Tkt_DealMasters, "DealMasterId", "DealName", 0);
            return(View(model));
        }
コード例 #2
0
        public ActionResult Details(int id)
        {
            AgentClassesModel model = new AgentClassesModel();

            model = _ser.GetAgentClass(id);
            return(View(model));
        }
コード例 #3
0
        public ActionResult Edit(int id)
        {
            AgentClassesModel model = new AgentClassesModel();

            model             = _ser.GetAgentClass(id);
            ViewData["Deals"] = new SelectList(ent.Tkt_DealMasters, "DealMasterId", "DealName", 0);
            return(View(model));
        }
コード例 #4
0
        public AgentClassesModel GetAgentClass(int AgentTypeId)
        {
            var result = ent.AgentClasses.Where(x => x.AgentClassId == AgentTypeId).FirstOrDefault();
            AgentClassesModel model = new AgentClassesModel();

            model.AgentTypeClasses = result.AgentClassName;
            model.AgentClassId     = result.AgentClassId;
            model.Description      = result.ClassDescription;
            return(model);
        }
コード例 #5
0
        public ActionResult Index(int?page)
        {
            int currentPageIndex    = page.HasValue ? page.Value : 1;
            int defaultPageSize     = 30;
            AgentClassesModel model = new AgentClassesModel();

            model.AgentClassList = _ser.GetAgentClassList().ToPagedList(currentPageIndex, defaultPageSize);

            return(View(model));
        }
コード例 #6
0
        public ActionResult Create(AgentClassesModel model, int[] Deals)
        {
            ViewData["Deals"] = new SelectList(ent.Tkt_DealMasters, "DealMasterId", "DealName", 0);



            bool check = _ser.CheckAgentClassName(model.AgentTypeClasses);

            if (check == true)
            {
                int AgentTypeId = _ser.SaveAgentClass(model.AgentTypeClasses, model.Description);
                return(RedirectToAction("Index"));
            }
            else
            {
                TempData["AgentTypeName"] = "Agent Class Name already Exists";
                return(View(model));
            }
        }
コード例 #7
0
        //public void EditTicketDeals(int AgentTypeDealsId,int AgentTypeId,int AgentDealMasterId)
        //{
        //    AgentTypeDeals obj = ent.AgentTypeDeals.Where(x => x.AgentTypeDealsId == AgentTypeDealsId).FirstOrDefault();
        //    obj.AgentTypeId = AgentTypeId;
        //    obj.DealMasterId = AgentDealMasterId;
        //    ent.ApplyCurrentValues(obj.EntityKey.EntitySetName, obj);
        //    ent.SaveChanges();
        //}
        public IEnumerable <AgentClassesModel> GetAgentClassList()
        {
            int sno    = 0;
            var result = ent.AgentClasses;
            List <AgentClassesModel> model = new List <AgentClassesModel>();

            foreach (var item in result)
            {
                sno++;
                AgentClassesModel obj = new AgentClassesModel
                {
                    SNO = sno,
                    AgentTypeClasses = item.AgentClassName,
                    AgentClassId     = item.AgentClassId,
                    Description      = item.ClassDescription,
                };
                model.Add(obj);
            }
            return(model.AsEnumerable());
        }
コード例 #8
0
        public ActionResult Edit(AgentClassesModel model, int[] Deals, int id)
        {
            bool   check   = true;
            string NewName = model.AgentTypeClasses;
            string Name    = ent.AgentClasses.Where(x => x.AgentClassId == id).Select(x => x.AgentClassName).FirstOrDefault();

            if (Name.ToUpper() != model.AgentTypeClasses.ToUpper())
            {
                check = _ser.CheckAgentClassName(model.AgentTypeClasses);
            }
            if (check == true)
            {
                _ser.EditAgentClass(model.AgentTypeClasses, model.Description, id);
                return(RedirectToAction("Index"));
            }
            else
            {
                model = _ser.GetAgentClass(id);
                model.AgentTypeClasses    = NewName;
                TempData["AgentTypeName"] = "Agent Class Name already Exists";
                return(View(model));
            }
        }