Exemplo n.º 1
0
        public ActionResult List()
        {
            var modelDB = new PlanDBModel();
            var list    = modelDB.getListPlan();

            return(View(list));
        }
Exemplo n.º 2
0
        public ActionResult PlanDetail(PlanDetailModel model)
        {
            var            id     = Request.Params["customerId"].ToString();
            TB_PLAN_DETAIL detail = new TB_PLAN_DETAIL();

            detail.N_AMOUNT      = model.amount;
            detail.N_CUSTOMER_ID = int.Parse(id);
            detail.N_PLAN_ID     = model.planId;
            detail.S_DESCRIPTION = model.description;
            detail.S_DETAIL      = model.detail;
            detail.D_EXPRIRE     = model.exprireDate;
            var modelDB  = new CustomerDBModel();
            var modelDB2 = new PlanDBModel();

            modelDB.createPlanDetail(detail);
            var plan = modelDB2.getPlanById(model.planId);

            Random      rnd      = new Random();
            int         ramdom01 = rnd.Next(10000, 99999);
            int         ramdom02 = rnd.Next(10000, 99999);
            TB_CUSTOMER customer = new TB_CUSTOMER();

            customer.N_ID   = int.Parse(id);
            customer.S_CODE = plan.S_NAME[0].ToString() + ramdom01.ToString() + ramdom02.ToString();
            modelDB.updateCodeById(customer);
            return(RedirectToAction("List"));
        }
Exemplo n.º 3
0
        public ActionResult UpdateStatusPlan(int n_id, string s_status)
        {
            var modelDB = new PlanDBModel();

            s_status = s_status.Equals("Active") ? "InActive" : "Active";
            modelDB.updateStatusPlan(n_id, s_status);
            return(RedirectToAction("List", "Plan"));
        }
Exemplo n.º 4
0
        // GET:
        public ActionResult SelectPlan(int id)
        {
            CustomerDetailModel customerDetailModel = new CustomerDetailModel();
            var modelDB = new PlanDBModel();
            var list    = modelDB.getListPlan();

            customerDetailModel.Plans      = list;
            customerDetailModel.customerId = id;
            return(View(customerDetailModel));
        }
        // GET: ProductList
        public ActionResult Index()
        {
            InfoSession modelSession = new InfoSession();

            modelSession           = SessionHelper.GetInfoSession();
            Session["infoSession"] = modelSession;
            var        productModelDB = new ProductDBModel();
            var        planModelDB    = new PlanDBModel();
            IndexModel model          = new IndexModel();

            model.Products = productModelDB.getListProduct();
            model.Plans    = planModelDB.getListPlan();
            return(View(model));
        }
Exemplo n.º 6
0
        // GET: Admin/Store/Edit/5
        public ActionResult Edit(int n_id)
        {
            var modelDB = new PlanDBModel();
            var model   = new PlanModel();
            var result  = modelDB.getPlanById(n_id);

            model.id          = result.N_ID;
            model.name        = result.S_NAME;
            model.type        = result.S_TYPE;
            model.detail      = result.S_DETAIL;
            model.description = result.S_DESCRIPTION;
            model.status      = result.S_STATUS;
            model.createdDate = result.D_CREATED;
            return(View(model));
        }
Exemplo n.º 7
0
        public ActionResult Create(PlanModel model)
        {
            try
            {
                var     modelDB = new PlanDBModel();
                TB_PLAN plan    = new TB_PLAN();
                plan.S_NAME        = model.name;
                plan.S_TYPE        = model.type;
                plan.S_DETAIL      = model.detail;
                plan.S_DESCRIPTION = model.description;
                modelDB.createPlan(plan);

                return(RedirectToAction("List"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 8
0
        // GET: Detail
        public ActionResult Index(int id, string type)
        {
            if (id < 1)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                InfoSession modelSession = new InfoSession();

                modelSession           = SessionHelper.GetInfoSession();
                Session["infoSession"] = modelSession;
                DetailModel detailModel = new DetailModel();
                if (type.Equals("PLAN"))
                {
                    var planDBModel = new PlanDBModel();
                    var model       = planDBModel.getPlanById(id);
                    detailModel.id          = model.N_ID;
                    detailModel.name        = model.S_NAME;
                    detailModel.type        = type;
                    detailModel.detail      = model.S_DETAIL;
                    detailModel.description = model.S_DESCRIPTION;
                    detailModel.total       = 1;
                }
                else
                {
                    var productDBModel = new ProductDBModel();
                    var model          = productDBModel.getProductById(id);
                    detailModel.id          = model.N_ID;
                    detailModel.name        = model.S_NAME;
                    detailModel.type        = type;
                    detailModel.detail      = model.S_DETAIL;
                    detailModel.description = model.S_DESCRIPTION;
                    detailModel.price       = model.N_PRICE;
                    detailModel.total       = 1;
                }
                return(View(detailModel));
            }
        }