コード例 #1
0
        public ActionResult Create(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary  = WebHelper.JsonToDictionary(collection.Header);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            PersonalDTO personaDTO = new PersonalDTO();

            try
            {
                personaDTO.PersonalId      = Convert.ToInt32(headerDictionary["PersonalId"]);
                personaDTO.NumeroDocumento = Convert.ToString(headerDictionary["NumeroDocumento"]);
                personaDTO.Apellidos       = Convert.ToString(headerDictionary["Apellidos"]);
                personaDTO.FechaNacimiento = Convert.ToDateTime(headerDictionary["FechaNacimiento"]);
                personaDTO.Telefono        = Convert.ToString(headerDictionary["Telefono"]);
                personaDTO.Correo          = Convert.ToString(headerDictionary["Correo"]);
                personaDTO.Usuario         = Convert.ToString(headerDictionary["Usuario"]);
                personaDTO.Password        = Convert.ToString(headerDictionary["Password"]);
                personaDTO.Estado          = EstadoConstante.ACTIVO;
                personaDTO.UsuarioDTO      = new UsuarioDTO
                {
                    PersonalId = personaDTO.PersonalId,
                    Nombre     = string.Concat(personaDTO.Nombres, " ", personaDTO.Apellidos),
                    UserName   = personaDTO.Usuario,
                    Password   = personaDTO.Password,
                    Estado     = EstadoConstante.ACTIVO
                };
                personalService.InsertarUsuario(personaDTO);
                jsonResultMessage.message = "Usuario grabado satisfactoriamente.";

                return(Json(jsonResultMessage));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        public ActionResult GrabarDatos(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary  = WebHelper.JsonToDictionary(collection.Header);
            Dictionary <string, string> detailDictionary  = WebHelper.JsonToDictionary(collection.Detail);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            OrdenItemDTO pedidoItemDTO = new OrdenItemDTO();

            try
            {
                pedidoItemDTO.OrdenId               = Convert.ToInt32(headerDictionary["OrdenId"]);
                pedidoItemDTO.BienServicioId        = Convert.ToInt32(detailDictionary["BienServicioId"]);
                pedidoItemDTO.Cantidad              = Convert.ToDecimal(detailDictionary["CantidadCesta"]);
                pedidoItemDTO.ValorUnitario         = 0;
                pedidoItemDTO.Estado                = EstadoConstante.ACTIVO;
                pedidoItemDTO.UsuarioCreacionId     = 1;
                pedidoItemDTO.FechaCreacion         = DateTime.Now;
                pedidoItemDTO.UsuarioModificacionId = null;
                pedidoItemDTO.FechaModificacion     = null;
                _pedidoItemService.Create(pedidoItemDTO);
                jsonResultMessage.message = "Proveedor grabado satisfactoriamente.";
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
            }
            return(Json(jsonResultMessage));
        }
コード例 #3
0
        public ActionResult Create(JsonHeader collection)
        {
            JsonResultMessage jsonResultMessage = new JsonResultMessage();
            BienServicioDTO   productoDTO       = new BienServicioDTO();

            try
            {
                productoDTO = CargarProductoDTO(collection);
                switch (collection.EditAction)
                {
                case EditActionConstant.NEW:
                    _productoService.Create(productoDTO);
                    jsonResultMessage.message = "Grabado satisfactoriamente.";
                    break;

                case EditActionConstant.EDIT:
                    _productoService.Update(productoDTO);
                    jsonResultMessage.message = "Actualizado satisfactoriamente.";
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
            }
            return(Json(jsonResultMessage));
        }
コード例 #4
0
        public ActionResult Create(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary  = WebHelper.JsonToDictionary(collection.Row);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            MarcaDTO marcaDTO = new MarcaDTO();

            try
            {
                marcaDTO.MarcaId = Convert.ToInt32(headerDictionary["MarcaId"]);
                marcaDTO.Codigo  = headerDictionary["Codigo"].ToString();
                marcaDTO.Nombre  = headerDictionary["Nombre"].ToUpper().ToString();

                marcaDTO.Estado = EstadoConstante.ACTIVO;
                if (collection.EditAction == EditActionConstant.NEW)
                {
                    marcaService.Create(marcaDTO);
                }
                else
                {
                    marcaService.Update(marcaDTO);
                }


                jsonResultMessage.message = "Marca grabado satisfactoriamente.";
                return(Json(jsonResultMessage));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
        private OrdenDTO CargarPedidoDTO(JsonHeader collection)
        {
            OrdenDTO pedidoDTO = new OrdenDTO();
            Dictionary <string, string> headerDictionary = WebHelper.JsonToDictionary(collection.Header);
            Dictionary <string, string> detailDictionary = WebHelper.JsonToDictionary(collection.Detail);

            if (collection.EditAction == EditActionConstant.EDIT)
            {
                pedidoDTO.OrdenId = Convert.ToInt32(headerDictionary["OrdenId"]);
            }

            pedidoDTO.Codigo               = headerDictionary["Codigo"].ToString();
            pedidoDTO.Operacion            = OperacionConstant.INGRESO;
            pedidoDTO.AlmacenId            = Convert.ToInt32(headerDictionary["AlmacenId"]);
            pedidoDTO.FechaOrden           = Convert.ToDateTime(headerDictionary["FechaOrden"]);
            pedidoDTO.DocumentoComercialId = Convert.ToInt32(headerDictionary["DocumentoComercialId"]);
            pedidoDTO.TipoOperacionId      = Convert.ToInt32(headerDictionary["TipoOperacionId"]);
            pedidoDTO.MonedaId             = Convert.ToInt32(headerDictionary["MonedaId"]);
            pedidoDTO.PersonalId           = 1;
            pedidoDTO.PeriodoEmpresaId     = 1;
            pedidoDTO.Observacion          = headerDictionary["Observacion"].ToString().Trim();
            pedidoDTO.NumeroDocumento      = string.Empty;
            pedidoDTO.VehiculoId           = null;
            pedidoDTO.FormaPagoId          = null;
            pedidoDTO.ProveedorId          = null;
            pedidoDTO.Anulado              = EstadoConstante.ACTIVO;
            pedidoDTO.Descuento            = 0;

            return(pedidoDTO);
        }
コード例 #6
0
        public async Task <ActionResult> Create(JsonHeader collection)
        {
            JsonResultMessage jsonResultMessage = new JsonResultMessage();
            OrdenDTO          pedidoDTO         = new OrdenDTO();

            try
            {
                pedidoDTO = CargarPedidoDTO(collection);
                pedidoDTO.OrderItemList = ListPedidoItem(collection);
                switch (collection.EditAction)
                {
                case EditActionConstant.NEW:
                    await _pedidoService.InsertarTransferencia(pedidoDTO);

                    jsonResultMessage.message = "Inventario grabado satisfactoriamente.";
                    break;

                case EditActionConstant.EDIT:
                    //_pedidoService.UpdateInventarioItem(pedidoDTO);
                    jsonResultMessage.message = "Inventario actualizado satisfactoriamente.";
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
            }
            return(Json(jsonResultMessage));
        }
コード例 #7
0
        public ActionResult Create(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary  = WebHelper.JsonToDictionary(collection.Row);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            TipoPrecioDTO tipoPrecioDTO = new TipoPrecioDTO();

            try
            {
                if (collection.EditAction == EditActionConstant.EDIT)
                {
                    tipoPrecioDTO.TipoPrecioId = Convert.ToInt32(headerDictionary["TipoPrecioId"]);
                }

                tipoPrecioDTO.Nombre = headerDictionary["Nombre"].ToString().Trim();
                tipoPrecioDTO.Estado = EstadoConstante.ACTIVO;

                if (collection.EditAction == EditActionConstant.NEW)
                {
                    tipoPrecioService.Create(tipoPrecioDTO);
                }
                else
                {
                    tipoPrecioService.Update(tipoPrecioDTO);
                }

                jsonResultMessage.message = "Tipo precio grabado satifactoriamente";
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
                throw ex;
            }
            return(Json(jsonResultMessage));
        }
コード例 #8
0
        private OrdenDTO CargarPedidoDTO(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary = WebHelper.JsonToDictionary(collection.Header);

            OrdenDTO ordenDTO = new OrdenDTO();

            if (collection.EditAction == EditActionConstant.EDIT)
            {
                ordenDTO.OrdenId = Convert.ToInt32(headerDictionary["OrdenId"]);
            }

            ordenDTO.Codigo               = headerDictionary["Codigo"].ToString();
            ordenDTO.FechaOrden           = Convert.ToDateTime(headerDictionary["FechaOrden"]);
            ordenDTO.DocumentoComercialId = Convert.ToInt32(headerDictionary["DocumentoComercialId"]);
            ordenDTO.MonedaId             = Convert.ToInt32(headerDictionary["MonedaId"]);
            ordenDTO.NumeroDocumento      = headerDictionary["NumeroDocumento"].ToString();
            ordenDTO.ImpuestoId           = Convert.ToInt32(headerDictionary["ImpuestoId"]);
            ordenDTO.AlmacenId            = Convert.ToInt32(headerDictionary["AlmacenId"]);
            ordenDTO.AlmacenDestinoId     = Convert.ToInt32(headerDictionary["AlmacenDestinoId"]);
            ordenDTO.ProveedorId          = Convert.ToInt32(headerDictionary["ProveedorId"]);
            ordenDTO.TipoOperacionId      = TipoOperacion(headerDictionary["TipoOperacionId"]);
            ordenDTO.Observacion          = headerDictionary["Observacion"].ToString().Trim();
            ordenDTO.Operacion            = OperacionConstant.SALIDA;
            ordenDTO.Anulado              = EstadoConstante.ACTIVO;
            ordenDTO.PeriodoEmpresaId     = this.GetPeriodoEmpresaId();
            ordenDTO.PersonalId           = this.GetPersonalUsuarioId();
            ordenDTO.VehiculoId           = null;
            ordenDTO.FormaPagoId          = null;
            ordenDTO.Descuento            = 0;
            return(ordenDTO);
        }
コード例 #9
0
        public ActionResult Create(JsonHeader collection)
        {
            JsonResultMessage jsonResultMessage = new JsonResultMessage();
            OrdenDTO          pedidoDTO         = new OrdenDTO();

            try
            {
                pedidoDTO = CargarPedidoDTO(collection);
                pedidoDTO.OrderItemList = ListPedidoItem(collection);
                switch (collection.EditAction)
                {
                case EditActionConstant.NEW:
                    _pedidoService.InsertPedidoItem(pedidoDTO);
                    jsonResultMessage.message = "Pedido grabado satisfactoriamente.";
                    break;

                case EditActionConstant.EDIT:
                    jsonResultMessage.message = "Pedido actualizado satisfactoriamente.";
                    break;
                }
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
            }
            return(Json(jsonResultMessage));
        }
コード例 #10
0
        private OrdenDTO cargarPedidoDTO(JsonHeader collection)
        {
            OrdenDTO pedidoDTO = new OrdenDTO();
            Dictionary <string, string> headerDictionary = WebHelper.JsonToDictionary(collection.Header);
            Dictionary <string, string> detailDictionary = WebHelper.JsonToDictionary(collection.Detail);

            if (collection.EditAction == EditActionConstant.EDIT)
            {
                pedidoDTO.OrdenId = Convert.ToInt32(headerDictionary["OrdenId"]);
            }

            pedidoDTO.Codigo               = headerDictionary["Codigo"].ToString();
            pedidoDTO.AlmacenId            = Convert.ToInt32(headerDictionary["AlmacenId"]);
            pedidoDTO.FechaOrden           = Convert.ToDateTime(headerDictionary["FechaOrden"]);
            pedidoDTO.PeriodoEmpresaId     = this.GetPeriodoEmpresaId();
            pedidoDTO.DocumentoComercialId = Convert.ToInt32(headerDictionary["DocumentoComercialId"]);
            pedidoDTO.FormaPagoId          = Convert.ToInt32(headerDictionary["FormaPagoId"]);
            pedidoDTO.ProveedorId          = Convert.ToInt32(headerDictionary["ProveedorId"]);
            pedidoDTO.TipoOperacionId      = tipoOperacion(headerDictionary["TipoOperacionId"]);
            pedidoDTO.MonedaId             = Convert.ToInt32(headerDictionary["MonedaId"]);
            pedidoDTO.PersonalId           = this.GetPersonalUsuarioId();
            pedidoDTO.Cantidad             = 0;
            pedidoDTO.Observacion          = headerDictionary["Observacion"].ToString().Trim();
            pedidoDTO.Descuento            = Convert.ToDecimal(detailDictionary["Descuento"]);
            pedidoDTO.Anulado              = EstadoConstante.ACTIVO;

            return(pedidoDTO);
        }
コード例 #11
0
        public ActionResult PeriodoEmpresaGuardar(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary  = WebHelper.JsonToDictionary(collection.Header);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            PeriodoEmpresaDTO           periodoDTO        = new PeriodoEmpresaDTO();

            try
            {
                periodoDTO.PeriodoEmpresaId = Convert.ToInt32(headerDictionary["PeriodoEmpresaId"]);
                periodoDTO.PeriodoId        = Convert.ToInt32(headerDictionary["PeriodoId"]);
                periodoDTO.SucursalId       = Convert.ToInt32(headerDictionary["SucursalId"]);
                periodoDTO.Estado           = EstadoConstante.ACTIVO;
                if (collection.EditAction == EditActionConstant.NEW)
                {
                    periodoEmpresaService.Create(periodoDTO);
                }
                else
                {
                    periodoEmpresaService.Update(periodoDTO);
                }

                jsonResultMessage.message = "Periodo empresa grabado satisfactoriamente.";
                return(Json(jsonResultMessage));
            }
            catch (Exception ex)
            {
                throw ex;
            };
        }
コード例 #12
0
 public void Recipient(KeyedHashAlgorithm key, JsonHeader header)
 {
     _recipients.Add(new Recipient
     {
         EncryptionKey = key,
         Header        = header,
     });
 }
コード例 #13
0
 public void Recipient(AsymmetricAlgorithm key, JsonHeader header)
 {
     _recipients.Add(new Recipient
     {
         EncryptionKey = key,
         Header        = header,
     });
 }
コード例 #14
0
ファイル: JsonParser.cs プロジェクト: ckkwing/MediaCenter
        /// <summary>
        /// when init, fill data to memory
        /// </summary>
        /// <param name="jsonPath"></param>
        IList <JsonFolder> ParseJsonData(string jsonPath)
        {
            IList <JsonFolder> result = new List <JsonFolder>();

            try
            {
                using (StreamReader streamReader = new StreamReader(new FileStream(jsonPath, FileMode.Open,
                                                                                   FileAccess.Read, FileShare.Read)))
                {
                    //first line is head info.
                    string headerStr = streamReader.ReadLine();
                    Header = ParseHeader(headerStr);
                    if (!Header.IsNull())
                    {
                        string rootPath = Header.RootPath;

                        //check version
                        double minorVersion = 0;
                        double.TryParse(Header.Header.Minor, out minorVersion);
                        //Debug.Assert(minorVersion >= 1.7, "Json File Minor version is less than 1.7, this is old file, maybe fail!");
                    }

                    StringBuilder sb = new StringBuilder();
                    while (!streamReader.EndOfStream)
                    {
                        //skip blank line
                        string line = streamReader.ReadLine();
                        if (line.IsNullOrEmpty())
                        {
                            line = sb.ToString();
                            if (line.Contains(tagCopyright) ||
                                line.Contains(tagDateDescriptor))
                            {
                                sb.Clear();
                                continue;
                            }

                            JsonFolder folder = GetFolders(line);
                            if (!folder.IsNull())
                            {
                                result.Add(folder);
                            }
                            sb.Clear();
                        }
                        else
                        {
                            sb.AppendLine(line);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Debug("Failed", ex);
            }
            return(result);
        }
コード例 #15
0
        public ActionResult Create(JsonHeader collection)
        {
            AlmacenDTO almacenDTO = new AlmacenDTO();
            Dictionary <string, string> editDictionary    = WebHelper.JsonToDictionary(collection.Header);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();

            try
            {
                if (collection.EditAction == EditActionConstant.EDIT)
                {
                    almacenDTO.AlmacenId = Convert.ToInt32(editDictionary["AlmacenId"]);
                }

                //almacenDTO.EmpresaId = Convert.ToInt32(editDictionary["EmpresaId"]);
                almacenDTO.SucursalId = Convert.ToInt32(editDictionary["SucursalId"]);

                almacenDTO.Nombre    = editDictionary["Nombre"].ToString();
                almacenDTO.Direccion = editDictionary["Direccion"].ToString();
                almacenDTO.Nombre    = editDictionary["Nombre"].ToString();
                almacenDTO.Telefono  = editDictionary["Telefono"].ToString();
                if (editDictionary.ContainsKey("StockSn"))
                {
                    almacenDTO.StockSn = "S";
                }
                else
                {
                    almacenDTO.StockSn = "N";
                }

                almacenDTO.Estado            = EstadoConstante.ACTIVO;
                almacenDTO.UsuarioCreacionId = 1;
                almacenDTO.FechaCreacion     = DateTime.Now;

                if (collection.EditAction == EditActionConstant.NEW)
                {
                    almacenService.Create(almacenDTO);
                }
                else
                {
                    almacenService.Update(almacenDTO);
                }

                jsonResultMessage.message = "Almacen grabado satisfactoriamente.";
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
            }
            return(Json(jsonResultMessage));
        }
コード例 #16
0
ファイル: JsonParser.cs プロジェクト: ckkwing/MediaCenter
        /// <summary>
        ///  get json header
        /// </summary>
        /// <param name="line"></param>
        /// <returns></returns>
        JsonHeader ParseHeader(string line)
        {
            JsonHeader header = null;

            line = line.Replace(tagHeader, "Header");
            try
            {
                header = JsonMapper.ToObject <JsonHeader>(line);
            }
            catch (Exception ex)
            {
                LogHelper.Debug("read head fail,{0}", ex);
            }
            return(header);
        }
コード例 #17
0
        public ActionResult Create(JsonHeader collection)
        {
            ParametroSistemaDTO         parametroSistemaDTO = new ParametroSistemaDTO();
            Dictionary <string, string> editDictionary      = WebHelper.JsonToDictionary(collection.Header);
            JsonResultMessage           jsonResultMessage   = new JsonResultMessage();

            try
            {
                if (collection.EditAction == EditActionConstant.EDIT)
                {
                    parametroSistemaDTO.ParametroSistemaId = Convert.ToInt32(editDictionary["ParametroSistemaId"]);
                }

                parametroSistemaDTO.Codigo = Convert.ToString(editDictionary["Codigo"]);
                parametroSistemaDTO.Nombre = Convert.ToString(editDictionary["Nombre"]);

                parametroSistemaDTO.ValorCadena   = editDictionary["ValorCadena"].ToString();
                parametroSistemaDTO.ValorNumerico = Convert.ToDecimal(editDictionary["ValorNumerico"]);
                if (!string.IsNullOrEmpty(editDictionary["ValorFecha"]))
                {
                    parametroSistemaDTO.ValorFecha = Convert.ToDateTime(editDictionary["ValorFecha"]);
                }

                parametroSistemaDTO.Estado            = EstadoConstante.ACTIVO;
                parametroSistemaDTO.UsuarioCreacionId = 1;
                parametroSistemaDTO.FechaCreacion     = DateTime.Now;

                if (collection.EditAction == EditActionConstant.NEW)
                {
                    parametroSistemaService.Create(parametroSistemaDTO);
                }
                else
                {
                    parametroSistemaService.Update(parametroSistemaDTO);
                }

                jsonResultMessage.message = "Parametro grabado satisfactoriamente.";
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
            }
            return(Json(jsonResultMessage));
        }
コード例 #18
0
        public ActionResult Create(JsonHeader collection)
        {
            Dictionary <string, string> editDictionary    = WebHelper.JsonToDictionary(collection.Header);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            PersonalDTO personalDTO = new PersonalDTO();

            try
            {
                if (collection.EditAction == EditActionConstant.EDIT)
                {
                    personalDTO.PersonalId = Convert.ToInt32(editDictionary["PersonalId"]);
                }

                personalDTO.Nombres         = editDictionary["Nombres"].ToUpper().ToString();
                personalDTO.Apellidos       = editDictionary["Apellidos"].ToUpper().ToString();
                personalDTO.NumeroDocumento = editDictionary["NumeroDocumento"].ToString();
                personalDTO.FechaNacimiento = Convert.ToDateTime(editDictionary["FechaNacimiento"]);
                personalDTO.Telefono        = editDictionary["Telefono"].ToString();
                personalDTO.Celular         = editDictionary["Celular"].ToString();
                personalDTO.Correo          = editDictionary["Correo"].ToUpper().ToString();

                personalDTO.Estado            = EstadoConstante.ACTIVO;
                personalDTO.UsuarioCreacionId = 1;
                personalDTO.FechaCreacion     = DateTime.Now;

                if (collection.EditAction == EditActionConstant.NEW)
                {
                    _personalService.Create(personalDTO);
                }
                else
                {
                    _personalService.Update(personalDTO);
                }

                jsonResultMessage.message = "Personal grabado satisfactoriamente.";
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
                throw ex;
            }
            return(Json(jsonResultMessage));
        }
コード例 #19
0
        private BienServicioDTO CargarProductoDTO(JsonHeader collection)
        {
            Dictionary <string, string> editDictionary = WebHelper.JsonToDictionary(collection.Header);

            BienServicioDTO productoDTO = new BienServicioDTO();

            if (collection.EditAction == EditActionConstant.EDIT)
            {
                productoDTO.BienServicioId = Convert.ToInt32(editDictionary["BienServicioId"]);
            }

            if (editDictionary.ContainsKey("ProveedorId"))
            {
                productoDTO.ProveedorId = Convert.ToInt32(editDictionary["ProveedorId"]);
            }
            else
            {
                productoDTO.ProveedorId = null;
            }
            productoDTO.TipoExistenciaId = Convert.ToInt32(editDictionary["TipoExistenciaId"]);
            productoDTO.LineaId          = Convert.ToInt32(editDictionary["LineaId"]);
            productoDTO.Codigo           = editDictionary["Codigo"].ToString();
            //productoDTO.CodigoBarra = editDictionary["CodigoBarra"].ToString();
            productoDTO.CodigoComercial = editDictionary["CodigoComercial"].ToString();
            productoDTO.MonedaId        = Convert.ToInt32(editDictionary["MonedaId"]);
            productoDTO.TipoBienId      = Convert.ToInt32(editDictionary["TipoBienId"]);
            productoDTO.UnidadMedidaId  = Convert.ToInt32(editDictionary["UnidadMedidaId"]);
            productoDTO.Descripcion     = editDictionary["Descripcion"].ToUpper().ToString();
            productoDTO.MarcaId         = Convert.ToInt32(editDictionary["MarcaId"]);
            productoDTO.CategoriaId     = Convert.ToInt32(editDictionary["CategoriaId"]);
            productoDTO.PrecioUnitario  = Convert.ToDecimal(editDictionary["PrecioUnitario"]);
            productoDTO.StockMinimo     = Convert.ToDecimal(editDictionary["StockMinimo"]);
            productoDTO.StockMaximo     = Convert.ToDecimal(editDictionary["StockMaximo"]);
            productoDTO.AlmacenId       = null;
            // productoDTO.PrecioVenta = Convert.ToDecimal(editDictionary["PrecioVenta"]);
            // productoDTO.PrecioCompra = Convert.ToDecimal(editDictionary["PrecioCompra"]);
            //productoDTO.Peso = Convert.ToDecimal(editDictionary["Peso"]);
            productoDTO.Procedencia = editDictionary["Procedencia"].Trim();
            productoDTO.Observacion = editDictionary["Observacion"].Trim();



            return(productoDTO);
        }
コード例 #20
0
        public ActionResult DireccionGuardar(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary  = WebHelper.JsonToDictionary(collection.Header);
            Dictionary <string, string> detailDictionary  = WebHelper.JsonToDictionary(collection.Detail);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            DireccionProveedorDTO       direccionDTO      = new DireccionProveedorDTO();

            try
            {
                direccionDTO.DireccionId     = Convert.ToInt32(detailDictionary["DireccionId"]);
                direccionDTO.ProveedorId     = Convert.ToInt32(headerDictionary["ProveedorId"]);
                direccionDTO.NombreDireccion = detailDictionary["NombreDireccion"].ToUpper().ToString();
                direccionDTO.Referencia      = detailDictionary["Referencia"].Trim();
                direccionDTO.DistritoId      = Convert.ToInt32(detailDictionary["DistritoContactoId"]);
                direccionDTO.Estado          = EstadoConstante.ACTIVO;
                if (detailDictionary.ContainsKey("Fiscal"))
                {
                    direccionDTO.Fiscal = detailDictionary["Fiscal"].Trim();
                }
                else
                {
                    direccionDTO.Fiscal = "0";
                }


                if (collection.EditAction == EditActionConstant.NEW)
                {
                    _direccionService.Create(direccionDTO);
                }
                else
                {
                    _direccionService.Update(direccionDTO);
                }



                jsonResultMessage.message = "Direccion grabado satisfactoriamente.";
                return(Json(jsonResultMessage));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #21
0
        public void SetColumnsHeaderJson(string json)
        {
            JsonHeader jh = JsonConvert.DeserializeObject <JsonHeader>(json);

            if (jh == null)
            {
                MessageBox.Show("json不符合规定格式!");
            }
            else
            {
                int cnt = json.Count(x => x == 'T');
                for (int i = 0; i < cnt; i++)
                {
                    this.Columns.Add(new DataGridViewTextBoxColumn());
                }
            }
            this.jh = jh;
            hTree   = this.GenerateStackedHeader();
        }
コード例 #22
0
        private List <OrdenItemDTO> ListPedidoItem(JsonHeader collection)
        {
            List <OrdenItemDTO> listPedido = new List <OrdenItemDTO>();

            Dictionary <string, string>[] rowDictionary = WebHelper.JsonToArrayDictionary(collection.Row);
            foreach (Dictionary <string, string> dictionary in rowDictionary)
            {
                var pedidoItemDTO = new OrdenItemDTO
                {
                    OrdenItemId    = Convert.ToInt32(dictionary["OrdenItemId"]),
                    OrdenId        = Convert.ToInt32(dictionary["OrdenId"]),
                    BienServicioId = Convert.ToInt32(dictionary["BienServicioId"]),
                    Cantidad       = Convert.ToDecimal(dictionary["Cantidad"]),
                    ValorUnitario  = Convert.ToDecimal(dictionary["ValorUnitario"]),
                    Estado         = EstadoConstante.ACTIVO
                };
                listPedido.Add(pedidoItemDTO);
            }

            return(listPedido);
        }
コード例 #23
0
        public ActionResult Create(JsonHeader collection)
        {
            Dictionary <string, string> editDictionary    = WebHelper.JsonToDictionary(collection.Header);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            SucursalDTO sucursalDTO = new SucursalDTO();

            try
            {
                if (collection.EditAction == EditActionConstant.EDIT)
                {
                    sucursalDTO.SucursalId = Convert.ToInt32(editDictionary["SucursalId"]);
                }

                sucursalDTO.EmpresaId  = Convert.ToInt32(editDictionary["EmpresaId"]);
                sucursalDTO.Nombre     = editDictionary["Nombre"].ToString();
                sucursalDTO.Direccion  = editDictionary["Direccion"].ToString();
                sucursalDTO.Telefono   = editDictionary["Telefono"].ToString();
                sucursalDTO.Capacidad  = editDictionary["Capacidad"].ToString();
                sucursalDTO.DistritoId = Convert.ToInt32(editDictionary["DistritoId"]);
                sucursalDTO.Estado     = EstadoConstante.ACTIVO;


                if (collection.EditAction == EditActionConstant.NEW)
                {
                    sucursalService.Create(sucursalDTO);
                }
                else
                {
                    sucursalService.Update(sucursalDTO);
                }

                jsonResultMessage.message = "Sucursal grabado satisfactoriamente.";
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
            }
            return(Json(jsonResultMessage));
        }
コード例 #24
0
        public ActionResult Create(JsonHeader collection)
        {
            TablaDTO tablaDTO = new TablaDTO();
            Dictionary <string, string> editDictionary    = WebHelper.JsonToDictionary(collection.Header);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();

            try
            {
                if (collection.EditAction == EditActionConstant.EDIT)
                {
                    tablaDTO.TablaId = Convert.ToInt32(editDictionary["TablaId"]);
                }

                tablaDTO.Codigo  = Convert.ToString(editDictionary["Codigo"]);
                tablaDTO.Nombre  = Convert.ToString(editDictionary["Nombre"]);
                tablaDTO.Formato = editDictionary["Formato"].ToString();


                tablaDTO.Estado            = EstadoConstante.ACTIVO;
                tablaDTO.UsuarioCreacionId = 1;
                tablaDTO.FechaCreacion     = DateTime.Now;

                if (collection.EditAction == EditActionConstant.NEW)
                {
                    tablaService.Create(tablaDTO);
                }
                else
                {
                    tablaService.Update(tablaDTO);
                }

                jsonResultMessage.message = "Tabla grabado satisfactoriamente.";
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
            }
            return(Json(jsonResultMessage));
        }
コード例 #25
0
ファイル: ButtonBuilder.cs プロジェクト: akerspoket/WhyStay
    // The path should be at the top of the folderstructure for buildings.
    // This script will be going through every json in that file structure and create structures from them
    void Start()
    {
        m_buildingTypes.AddRange(transform.GetComponentsInChildren <Transform>());

        // Build all buttons for buildings

        string absoluteBuildingFolderPath = Application.dataPath + m_buildingFolderPath;

        int buttonsCreated = 0;
        // Get all json files in the root folder and sub directories by using a recursive method
        List <string> allJsonFiles = FindAllJsonFilesInRoot(absoluteBuildingFolderPath);

        // Lopp through all found json files
        foreach (var jsonFile in allJsonFiles)
        {
            // Create the header from the json file
            string     t_jsonText = System.IO.File.ReadAllText(jsonFile);
            JsonHeader header     = JsonUtility.FromJson <JsonHeader>(t_jsonText);
            // Go through every possible building type. Note that a new building type will need to recide in AllBuildings
            foreach (Transform buildingType in m_buildingTypes)
            {
                // Go through all classes that inherit building json info
                foreach (var classType in buildingType.GetComponents <BuildingJsonInfo>())
                {
                    // If we found the correct building type
                    if (classType.name == header.handledByClass)
                    {
                        // Create a new button for the building
                        GameObject newButton = (GameObject)Instantiate(buildingButton, GetComponentInParent <Canvas>().transform);
                        newButton.GetComponentInChildren <Text>().text = header.name;
                        newButton.GetComponent <ButtonInfo>().SetGameObjectToSpawn(buildingType.gameObject);
                        newButton.GetComponent <ButtonInfo>().SetJsonInfoToSpawnWith(t_jsonText);
                        newButton.transform.localPosition += new Vector3(1000 * buttonsCreated, 0, 0);
                        buttonsCreated++;
                    }
                }
            }
        }
    }
コード例 #26
0
        public ActionResult GrabarSerie(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary  = WebHelper.JsonToDictionary(collection.Header);
            Dictionary <string, string> detailDictionary  = WebHelper.JsonToDictionary(collection.Detail);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();

            try
            {
                SerieDTO serieDTO = new SerieDTO();
                serieDTO.SerieId              = Convert.ToInt32(detailDictionary["SerieId"]);
                serieDTO.AlmacenId            = Convert.ToInt32(headerDictionary["AlmacenId"]);
                serieDTO.DocumentoComercialId = Convert.ToInt32(detailDictionary["DocumentoComercialId"]);
                serieDTO.NumeroSerie          = Convert.ToString(detailDictionary["NumeroSerie"]);
                serieDTO.NumeroLinea          = Convert.ToInt32(detailDictionary["NumeroLinea"]);
                serieDTO.FormatoDocumento     = Convert.ToString(detailDictionary["FormatoDocumento"]);
                serieDTO.IgvSn             = Convert.ToString(detailDictionary["IgvSn"]);
                serieDTO.Observacion       = Convert.ToString(detailDictionary["Observacion"]);
                serieDTO.Estado            = EstadoConstante.ACTIVO;
                serieDTO.UsuarioCreacionId = 1;
                serieDTO.FechaCreacion     = DateTime.Now;

                if (collection.EditAction != EditActionConstant.EDIT)
                {
                    serieService.Create(serieDTO);
                }
                else
                {
                    serieService.Update(serieDTO);
                }


                jsonResultMessage.message = "Numero serie para esta almacen grabado satisfactoriamente.";
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(jsonResultMessage));
        }
コード例 #27
0
        public ActionResult Create(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary  = WebHelper.JsonToDictionary(collection.Row);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            UnidadMedidaDTO             unidadMedidaDTO   = new UnidadMedidaDTO();

            try
            {
                if (collection.EditAction == EditActionConstant.EDIT)
                {
                    unidadMedidaDTO.UnidadMedidaId = Convert.ToInt32(headerDictionary["UnidadMedidaId"]);
                }

                unidadMedidaDTO.Codigo       = headerDictionary["Codigo"].ToString().Trim();
                unidadMedidaDTO.Nombre       = headerDictionary["Nombre"].ToString().Trim();
                unidadMedidaDTO.Abreaviatura = headerDictionary["Abreaviatura"].ToString().Trim();
                unidadMedidaDTO.Estado       = EstadoConstante.ACTIVO;


                if (collection.EditAction == EditActionConstant.NEW)
                {
                    unidadMedidaService.Create(unidadMedidaDTO);
                }
                else
                {
                    unidadMedidaService.Update(unidadMedidaDTO);
                }

                jsonResultMessage.message = "Unidad medida grabado satifactoriamente";
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
                throw ex;
            }
            return(Json(jsonResultMessage));
        }
コード例 #28
0
        public ActionResult Create(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary      = WebHelper.JsonToDictionary(collection.Row);
            JsonResultMessage           jsonResultMessage     = new JsonResultMessage();
            DocumentoComercialDTO       documentoComercialDTO = new DocumentoComercialDTO();

            try
            {
                if (collection.EditAction == EditActionConstant.EDIT)
                {
                    documentoComercialDTO.DocumentoComercialId = Convert.ToInt32(headerDictionary["DocumentoComercialId"]);
                }

                documentoComercialDTO.Codigo = headerDictionary["Codigo"].ToString().Trim();
                documentoComercialDTO.Nombre = headerDictionary["Nombre"].ToString().Trim();
                documentoComercialDTO.Estado = EstadoConstante.ACTIVO;


                if (collection.EditAction == EditActionConstant.NEW)
                {
                    documentoComercialService.Create(documentoComercialDTO);
                }
                else
                {
                    documentoComercialService.Update(documentoComercialDTO);
                }

                jsonResultMessage.message = "Documento comercial grabado satifactoriamente";
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
                throw ex;
            }
            return(Json(jsonResultMessage));
        }
コード例 #29
0
        public ActionResult ContactoGuardar(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary  = WebHelper.JsonToDictionary(collection.Header);
            Dictionary <string, string> detailDictionary  = WebHelper.JsonToDictionary(collection.Detail);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            ContactoDTO contactoDTO = new ContactoDTO();

            try
            {
                contactoDTO.ContactoId              = Convert.ToInt32(detailDictionary["ContactoId"]);
                contactoDTO.ProveedorId             = Convert.ToInt32(headerDictionary["ProveedorId"]);
                contactoDTO.AreaId                  = Convert.ToInt32(detailDictionary["AreaId"]);
                contactoDTO.NombreContacto          = detailDictionary["NombreContacto"].ToUpper().ToString();
                contactoDTO.NumeroDocumentoContacto = detailDictionary["NumeroDocumentoContacto"].ToString().Trim();
                contactoDTO.TelefonoContacto        = detailDictionary["TelefonoContacto"].Trim();
                contactoDTO.CelularContacto         = detailDictionary["CelularContacto"].Trim();
                contactoDTO.DireccionContacto       = detailDictionary["DireccionContacto"].Trim();
                contactoDTO.EmailContacto           = detailDictionary["EmailContacto"].Trim();
                contactoDTO.Estado                  = EstadoConstante.ACTIVO;
                if (collection.EditAction == EditActionConstant.NEW)
                {
                    _contactoService.InsertarContacto(contactoDTO);
                }
                else
                {
                    _contactoService.Update(contactoDTO);
                }


                jsonResultMessage.message = "Contacto grabado satisfactoriamente.";
                return(Json(jsonResultMessage));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #30
0
        public ActionResult Create(JsonHeader collection)
        {
            Dictionary <string, string> headerDictionary  = WebHelper.JsonToDictionary(collection.Header);
            JsonResultMessage           jsonResultMessage = new JsonResultMessage();
            ContactoDTO contactoDTO = new ContactoDTO();

            try
            {
                contactoDTO.ContactoId              = Convert.ToInt32(headerDictionary["ContactoId"]);
                contactoDTO.AreaId                  = Convert.ToInt32(headerDictionary["AreaId"]);
                contactoDTO.NombreContacto          = headerDictionary["NombreContacto"].ToString();
                contactoDTO.NumeroDocumentoContacto = headerDictionary["NumeroDocumentoContacto"].ToString();
                contactoDTO.TelefonoContacto        = headerDictionary["TelefonoContacto"].ToString();
                contactoDTO.CelularContacto         = headerDictionary["CelularContacto"].ToString();
                contactoDTO.EmailContacto           = headerDictionary["EmailContacto"].ToString();
                contactoDTO.DireccionContacto       = headerDictionary["DireccionContacto"].ToString();

                if (collection.EditAction == EditActionConstant.NEW)
                {
                    contactoService.Create(contactoDTO);
                }
                else
                {
                    contactoService.Update(contactoDTO);
                }

                jsonResultMessage.message = "Contacto grabado satisfactoriamente.";
                return(Json(jsonResultMessage));
            }
            catch (Exception ex)
            {
                jsonResultMessage.success = false;
                jsonResultMessage.message = ex.Message;
            }
            return(Json(jsonResultMessage));
        }