private void btnAgregar_Click(object sender, EventArgs e)
        {
            clienteSeleccionado = ((Cliente)cmbCliente.SelectedItem);
            cuenta = clienteSeleccionado.Cuenta;
            switch ((int)cmbTipoTarjeta.SelectedItem)
            {
            case (int)TipoTarjetaEnum.Visa:
            {
                TCVisa visa = new TCVisa((int)cmbPeriodo.SelectedItem, cuenta.Saldo, TCServicio.ProximoNroTarjeta().ToString(), clienteSeleccionado.ID);
                TCServicio.Insertar(visa);
                MessageBox.Show("Se ha creado correctamente la tarjeta nro " + visa.NroPlastico);
                break;
            }

            case (int)TipoTarjetaEnum.Master:
            {
                TCMaster master = new TCMaster((int)cmbPeriodo.SelectedItem, cuenta.Saldo, TCServicio.ProximoNroTarjeta().ToString(), clienteSeleccionado.ID);
                TCServicio.Insertar(master);
                MessageBox.Show("Se ha creado correctamente la tarjeta nro " + master.NroPlastico);
                break;
            }

            case (int)TipoTarjetaEnum.Amex:
            {
                TCAmex amex = new TCAmex((int)cmbPeriodo.SelectedItem, cuenta.Saldo, TCServicio.ProximoNroTarjeta().ToString(), clienteSeleccionado.ID);
                TCServicio.Insertar(amex);
                MessageBox.Show("Se ha creado correctamente la tarjeta nro " + amex.NroPlastico);
                break;
            }
            }
        }
Пример #2
0
 public JsonResult Save(string tcMasterType, TCMaster tcMaster)
 {
     try
     {
         if (ModelState.IsValid)
         {
             tcMaster.IsDeleted = false;
             if (tcMaster.Id > 0)
             {
                 tcMaster.UpdatedDate = DateTime.Now;
                 _repository.Update(tcMaster);
                 return(Json(Functions.OutPutResponse(true, "Record updated successfully", tcMaster)));
             }
             tcMaster.CreatedDate = DateTime.Now;
             _repository.Insert(tcMaster);
             _repository.Save();
             return(Json(Functions.OutPutResponse(true, "Record inserted successfully", tcMaster)));
         }
         return(Json(Functions.OutPutResponse(false, "Invalid Data", ModelState)));
     }
     catch (Exception ex)
     {
         return(Json(Functions.OutPutResponse(false, ex.Message)));
     }
 }
Пример #3
0
        public ActionResult Edit(string tcMasterType, int Id)
        {
            TCMaster tcMaster = new TCMaster();

            tcMaster = _repository.GetById(Id);
            return(View(tcMasterType, new TCMasterViewModel {
                TCMaster = tcMaster
            }));
        }
Пример #4
0
        public ActionResult Add(string tcMasterType)
        {
            TCMaster tcMaster = new TCMaster {
                Type = tcMasterType
            };

            return(View(tcMasterType, new TCMasterViewModel {
                TCMaster = tcMaster
            }));
        }
Пример #5
0
 public ActionResult Find(string tcMasterType, int?id = null)
 {
     if (id.HasValue)
     {
         TCMaster tcMaster = _repository.GetById(id.Value);
         return(Json(tcMaster, JsonRequestBehavior.AllowGet));
     }
     else
     {
         IEnumerable <TCMaster> tcMasters = master.GetAllTCMaster(tcMasterType);
         return(Json(new { data = tcMasters }, JsonRequestBehavior.AllowGet));
     }
 }
Пример #6
0
 public JsonResult Delete(int Id)
 {
     try
     {
         if (ModelState.IsValid)
         {
             TCMaster tcMaster = new TCMaster();
             tcMaster             = _repository.GetById(Id);
             tcMaster.UpdatedDate = DateTime.Now;
             tcMaster.IsDeleted   = true;
             _repository.Update(tcMaster);
             return(Json(Functions.OutPutResponse(true, "Record deleted successfully", tcMaster), JsonRequestBehavior.AllowGet));
         }
     }
     catch (Exception ex)
     {
         return(Json(Functions.OutPutResponse(false, ex.Message)));
     }
     return(null);
 }