示例#1
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"));
        }
示例#2
0
        public object createPlanDetail(TB_PLAN_DETAIL model)
        {
            object[] sqlParams =
            {
                new SqlParameter("@D_EXPRIRE",     model.D_EXPRIRE),
                new SqlParameter("@N_AMOUNT",      model.N_AMOUNT),
                new SqlParameter("@S_DETAIL",      model.S_DESCRIPTION),
                new SqlParameter("@S_DESCRIPTION", model.S_DESCRIPTION),
                new SqlParameter("@N_PLAN_ID",     model.N_PLAN_ID),
                new SqlParameter("@N_CUSTOMER_ID", model.N_CUSTOMER_ID)
            };
            var result = context.Database.SqlQuery <object>("Usp_InsertPlanDetail @D_EXPRIRE,@N_AMOUNT,@S_DETAIL,@S_DESCRIPTION,@N_PLAN_ID,@N_CUSTOMER_ID", sqlParams).SingleOrDefault();

            return(result);
        }