コード例 #1
0
        public JsonResult Crear(PlanViewModel plan)
        {
            var resultado = new baseRespuesta();

            resultado = validaciones(plan);

            if (resultado.ok == true)
            {
                EntitiesNoMasAccidentes     bd     = new EntitiesNoMasAccidentes();
                NoMasAccidentes.Models.PLAN planes = new PLAN();

                planes.NOMBRE      = plan.nombre;
                planes.VALOR       = Int32.Parse(plan.valor);
                planes.DESCRIPCION = plan.descripcion;
                planes.ACTIVO      = "S";

                bd.PLAN.Add(planes);
                bd.SaveChanges();
                resultado.mensaje = "<i class='zmdi zmdi-check zmdi-hc-fw'></i>Plan Registrado Correctamente</br>";
            }
            else
            {
                resultado.mensaje = "<b>Error</b></br>" + resultado.mensaje;
            }
            return(Json(resultado));
        }
コード例 #2
0
        public JsonResult Create01(string para01, string para02, string para03)
        {
            string id          = para01;
            string pro_id      = para02;
            string plan_number = para03;

            int plan_num;

            int.TryParse(plan_number, out plan_num);

            PLAN pLAN    = db.PLAN.Find(pro_id);
            PLAN newPlan = new PLAN();

            newPlan.PRODUCT_ID = pro_id;
            newPlan.PLAN_ID    = id;
            newPlan.PLAN_NUM   = plan_num;


            if (pLAN == null)
            {
                db.PLAN.Add(newPlan);
                db.SaveChanges();
            }

            var list = db.PLAN.Select(n => new { PLAN_ID = n.PLAN_ID, PRODUCT_ID = n.PRODUCT_ID, PRODUCT_NAME = n.PRODUCT_ATTRIBUTE.PRODUCT_NAME, SUPPLIER_ID = n.PRODUCT_ATTRIBUTE.SUPPLIER_ID, PURCHASE_PRICE = n.PRODUCT_ATTRIBUTE.PURCHASE_PRICE, PLAN_NUM = n.PLAN_NUM });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public string test(string para01, string para02)
        {
            string id     = para01;
            string pro_id = para02;

            PLAN pLAN = db.PLAN.Find(id);

            if (pLAN != null)
            {
                return("1");
            }
            PRODUCT_ATTRIBUTE pRODUCT = db.PRODUCT_ATTRIBUTE.Find(pro_id);

            if (pRODUCT == null)
            {
                return("2");
            }
            PLAN plAN = db.PLAN.Find(pro_id);

            if (pRODUCT != null)
            {
                return("3");
            }
            return("4");
        }
コード例 #4
0
        public string test(string para01, string para02, string para03)
        {
            string stock_id   = para01;
            string plan_id    = para02;
            string expense_id = para03;

            STOCK sTOCK = db.STOCK.Find(stock_id);

            if (sTOCK != null)
            {
                return("1");
            }
            EXPENSE eXPENSE = db.EXPENSE.Find(expense_id);

            if (eXPENSE == null)
            {
                return("2");
            }
            PLAN pLAN = db.PLAN.Find(plan_id);

            if (pLAN == null)
            {
                return("3");
            }
            return("4");
        }
コード例 #5
0
ファイル: PLANsController.cs プロジェクト: lzyzxc/DB
        public ActionResult DeleteConfirmed(string id)
        {
            PLAN pLAN = db.PLAN.Find(id);

            db.PLAN.Remove(pLAN);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #6
0
ファイル: AccionesSeguro.cs プロジェクト: psnull/hipocrates
 public PLAN obtenerPlanAfiliado(AFILIADO afiliado)
 {
     using (var entities = new SeguroEntities())
     {
         PLAN plan = (from p in entities.PLAN
                      where afiliado.ID_PLAN == p.ID_PLAN
                      select p).First <PLAN>();
         return(plan);
     }
 }
コード例 #7
0
ファイル: PLANsController.cs プロジェクト: lzyzxc/DB
 public ActionResult Edit([Bind(Include = "PLAN_ID,PRODUCT_ID,PLAN_NUM")] PLAN pLAN)
 {
     if (ModelState.IsValid)
     {
         db.Entry(pLAN).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PRODUCT_ID = new SelectList(db.PRODUCT_ATTRIBUTE, "PRODUCT_ID", "SUPPLIER_ID", pLAN.PRODUCT_ID);
     return(View(pLAN));
 }
コード例 #8
0
 public static int crearPlan(string nombrePlan, int idEmpresa)
 {
     using (var entities = new SeguroEntities())
     {
         PLAN plan = new PLAN();
         plan.NOMBRE     = nombrePlan;
         plan.ID_EMPRESA = idEmpresa;
         entities.PLAN.Add(plan);
         entities.SaveChangesAsync();
         return(plan.ID_PLAN);
     }
 }
コード例 #9
0
        public JsonResult Create01(string para01, string para02, string para03, string para04, string para05, string para06, string para07)
        {
            string stock_id   = para01;
            string bat_id     = para02;
            string plan_id    = para03;
            string pro_date   = para04;
            string expense_id = para05;
            string stock_num  = para06;
            string stock_date = para07;


            int num;

            int.TryParse(stock_num, out num);
            DateTime x = Convert.ToDateTime(stock_date);
            DateTime y = Convert.ToDateTime(pro_date);

            PRODUCT pRODUCT    = db.PRODUCT.Find(bat_id);
            PLAN    pLAN       = db.PLAN.Find(plan_id);
            PRODUCT newProduct = new PRODUCT();

            newProduct.PRODUCT_ID   = pLAN.PRODUCT_ID;
            newProduct.SHEIF_ID     = "0";
            newProduct.DISCOUNT     = 1;
            newProduct.BATCH_ID     = bat_id;
            newProduct.BATCH_NUMBER = num;
            newProduct.PRODUCT_DATE = y;
            if (pRODUCT == null)
            {
                db.PRODUCT.Add(newProduct);
                db.SaveChanges();
            }

            STOCK sTOCK    = db.STOCK.Find(stock_id);
            STOCK newStock = new STOCK();

            newStock.STOCK_ID   = stock_id;
            newStock.BATCH_ID   = bat_id;
            newStock.EXPENSE_ID = expense_id;
            newStock.STOCK_NUM  = num;
            newStock.STOCK_DATE = x;
            newStock.PLAN_ID    = plan_id;

            if (sTOCK == null)
            {
                db.STOCK.Add(newStock);
                db.SaveChanges();
            }

            var list = db.STOCK.Select(n => new { STOCK_ID = n.STOCK_ID, BATCH_ID = n.PRODUCT.BATCH_ID, PRODUCT_ID = n.PRODUCT.PRODUCT_ID, PRODUCT_NAME = n.PRODUCT.PRODUCT_ATTRIBUTE.PRODUCT_NAME, PLAN_ID = n.PLAN_ID, EXPENSE_ID = n.EXPENSE_ID, STOCK_NUM = n.STOCK_NUM, STOCK_DATE = n.STOCK_DATE });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
コード例 #10
0
ファイル: PLANsController.cs プロジェクト: lzyzxc/DB
        // GET: PLANs/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PLAN pLAN = db.PLAN.Find(id);

            if (pLAN == null)
            {
                return(HttpNotFound());
            }
            return(View(pLAN));
        }
コード例 #11
0
ファイル: PLANsController.cs プロジェクト: lzyzxc/DB
        // GET: PLANs/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PLAN pLAN = db.PLAN.Find(id);

            if (pLAN == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PRODUCT_ID = new SelectList(db.PRODUCT_ATTRIBUTE, "PRODUCT_ID", "SUPPLIER_ID", pLAN.PRODUCT_ID);
            return(View(pLAN));
        }
コード例 #12
0
        public void Delete(string id)
        {
            if (id == null)
            {
                return;
            }
            PLAN pLAN = db.PLAN.Find(id);

            if (pLAN == null)
            {
                return;
            }

            db.PLAN.Remove(pLAN);
            db.SaveChanges();
        }
コード例 #13
0
 public void obtenerPlanAfiliadoTest()
 {
     using (var entities = new SeguroEntities())
     {
         #region prep
         T_EMPRESA tipoEmpresa = new T_EMPRESA();
         tipoEmpresa.NOMBRE = "Empresa publica";
         entities.T_EMPRESA.Add(tipoEmpresa);
         entities.SaveChangesAsync();
         EMPRESA empresa = new EMPRESA();
         empresa.NOMBRE       = "Fonasa";
         empresa.ID_T_EMPRESA = tipoEmpresa.ID_T_EMPRESA;
         entities.EMPRESA.Add(empresa);
         entities.SaveChangesAsync();
         PLAN plan = new PLAN();
         plan.NOMBRE     = "Plan bacan";
         plan.ID_EMPRESA = empresa.ID_EMPRESA;
         entities.PLAN.Add(plan);
         entities.SaveChangesAsync();
         AFILIADO afiliado = new AFILIADO();
         afiliado.RUT         = 999;
         afiliado.VERIFICADOR = "k";
         afiliado.ID_PLAN     = plan.ID_PLAN;
         AFILIADO sinPlan = new AFILIADO();
         sinPlan.RUT = 123;
         entities.AFILIADO.Add(sinPlan);
         entities.AFILIADO.Add(afiliado);
         entities.SaveChangesAsync();
         #endregion
         //Caso 1: obtiene plan correctamente
         AccionesSeguro accionesSeguro = new AccionesSeguro();
         PLAN           resultado1     = accionesSeguro.obtenerPlanAfiliado(afiliado);
         Assert.IsTrue(resultado1.NOMBRE == plan.NOMBRE);
         //Caso 2: afiliado no tiene plan
         try
         {
             PLAN resultado2 = accionesSeguro.obtenerPlanAfiliado(sinPlan);
             Assert.Fail("No debería tocar esta parte");
         }
         catch (Exception)
         {
         }
     }
 }
コード例 #14
0
        public JsonResult Edit(string para01, string para02, string para03, string para04, string para05, string para06)
        {
            string plan_id     = para01;
            string pro_id      = para02;
            string pro_name    = para03;
            string sup_id      = para04;
            string purchase    = para05;
            string plan_number = para06;

            int pur;

            int.TryParse(purchase, out pur);
            int plan_num;

            int.TryParse(plan_number, out plan_num);

            PLAN pLAN = db.PLAN.Find(plan_id);

            pLAN.PLAN_ID    = plan_id;
            pLAN.PRODUCT_ID = pro_id;
            pLAN.PRODUCT_ATTRIBUTE.PRODUCT_NAME   = pro_name;
            pLAN.PRODUCT_ATTRIBUTE.SUPPLIER_ID    = sup_id;
            pLAN.PRODUCT_ATTRIBUTE.PURCHASE_PRICE = pur;
            pLAN.PLAN_NUM = plan_num;

            db.Entry(pLAN).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw;
            }


            var list = db.PLAN.Include(n => n.PRODUCT_ATTRIBUTE).Select(n => new { PLAN_ID = n.PLAN_ID, PRODUCT_ID = n.PRODUCT_ID, PRODUCT_NAME = n.PRODUCT_ATTRIBUTE.PRODUCT_NAME, SUPPLIER_ID = n.PRODUCT_ATTRIBUTE.SUPPLIER_ID, PURCHASE_PRICE = n.PRODUCT_ATTRIBUTE.PURCHASE_PRICE, PLAN_NUM = n.PLAN_NUM });

            return(Json(new { code = 0, msg = "", count = 1000, data = list }, JsonRequestBehavior.AllowGet));
        }
コード例 #15
0
ファイル: AccionesSeguro.cs プロジェクト: psnull/hipocrates
        public int obtenerDescuentoPrestacion(int rutAfiliado, string codigoPrestacion, int precioPrestacion)
        {
            //obtenerner afiliado
            AFILIADO afiliado = obtenerAfiliado(rutAfiliado);

            if (afiliado == null)
            {
                return(0);
            }
            //obtener plan afiliado
            PLAN plan = obtenerPlanAfiliado(afiliado);
            //obtener beneficios del afiliado
            List <BENEFICIO> beneficios = obtenerBeneficiosPlan(plan.ID_PLAN);
            //obtener prestacion
            PRESTACION prestacion = obtenerPrestacion(codigoPrestacion);
            //obtener beneficio aplicable a la prestación
            BENEFICIO beneficio = obtenerBeneficioPrestacion(prestacion, beneficios);
            //obtener descuento
            int descuento = calcularDescuentoPrestacion(precioPrestacion, beneficio);

            return(descuento);
        }
コード例 #16
0
 public void MOdPlan(int codigo, string nombreplan, string descripcionplan, int periodo, bool dias, bool semana, bool mes, int cantidadinteres, int idmora)
 {
     PLAN.GetDataModPlan(codigo, nombreplan, descripcionplan, periodo, dias, semana, mes, cantidadinteres, idmora);
 }