예제 #1
0
        protected void clickSaveCodigo(object sender, EventArgs args)
        {
            try
            {
                Entrada_inventario oEI = JsonConvert.DeserializeObject <Entrada_inventario>(hf_entrada_inventario.Value);
                List <Entrada_inventario_detail> lstEntInvDet  = JsonConvert.DeserializeObject <List <Entrada_inventario_detail> >(hf_entrada_inventario_detail.Value);
                List <Entrada_inventario_lote>   lstEntInvLote = JsonConvert.DeserializeObject <List <Entrada_inventario_lote> >(hf_entrada_inventario_lote.Value);

                if (lstEntInvDet == null || lstEntInvDet.Count == 0)
                {
                    throw new Exception("Es necesario desglosar bultos y piezas por bulto");
                }

                oEI.LstEntInvDet = lstEntInvDet;

                if (lstEntInvLote == null)
                {
                    lstEntInvLote = new List <Entrada_inventario_lote>();
                }

                oEI.LstEntInvLote = lstEntInvLote;

                oEI.Id_usuario = ((MstCasc)this.Master).getUsrLoged().Id;
                EntradaCtrl.InventarioSave(oEI);
                ClientScript.RegisterStartupScript(this.GetType(), "alertSave", "<script type=\"text/javascript\">alert('Se guardó correctamente el registro');</script>");
                //window.location.href='frmInventario.aspx?_kp=" + hf_id_entrada.Value + "';
                btnSaveCodigo.PostBackUrl = "frmInventario.aspx?_kp=" + hf_id_entrada.Value;
                fillEntrada(Convert.ToInt32(hf_id_entrada.Value));
            }
            catch (Exception e)
            {
                ((MstCasc)this.Master).setError = e.Message;
            }
        }