예제 #1
0
        protected void Unnamed_Click(object sender, EventArgs e)
        {
            //play_video.Visible = false;
            //div_panel.Visible = false;
            //UpdatePanel2.Update();
            GridViewRow row = (sender as LinkButton).NamingContainer as GridViewRow;

            var    two_user = new int?[] { 1, 3, 4, 5, 8, 9 };
            string status   = row.Cells[5].Text.ToString().Trim();

            int id_m_ext = int.Parse(row.Cells[0].Text);
            int id_m;

            switch (status)
            {
            case "XML":

                break;

            case "ACTIVO":

                string str_session_p;
                str_session = row.Cells[1].Text;
                str_video   = row.Cells[2].Text + ".mp4";

                //using (var data_mat = new db_transcriptEntities())
                //{
                //    var items_mat = (from c in data_mat.inf_material
                //                     where c.sesion == str_session
                //                     select c).FirstOrDefault();
                //    str_session_p
                //}

                using (var edm_material = new db_transcriptEntities())
                {
                    var i_material = new inf_material_dep
                    {
                        sesion             = str_session,
                        video              = str_video,
                        id_usuario         = guid_fidusuario,
                        id_material        = 0,
                        fecha_registro     = DateTime.Now,
                        fecha_registro_alt = DateTime.Now
                    };

                    edm_material.inf_material_dep.Add(i_material);
                    edm_material.SaveChanges();
                }

                using (var data_mat = new db_transcriptEntities())
                {
                    var items_mat = (from c in data_mat.inf_material_ext
                                     where c.id_material_ext == id_m_ext
                                     select c).FirstOrDefault();

                    id_m = items_mat.id_material;
                }

                using (var data_mat = new db_transcriptEntities())
                {
                    var items_mat = (from c in data_mat.inf_material
                                     where c.id_material == id_m
                                     select c).FirstOrDefault();

                    string sessionf = items_mat.sesion;

                    string d_pdf = "videos\\" + sessionf + "\\" + str_session + "\\" + str_session + "\\ExtraFiles\\" + str_session + "_Report.pdf";
                    iframe_pdf.Visible           = true;
                    iframe_pdf.Attributes["src"] = d_pdf;

                    string str_namefile = @"videos\\" + sessionf + "\\" + str_session + "\\" + str_session + "\\" + str_video;

                    play_video.Attributes["src"] = str_namefile;
                }

                s_gn = 1;

                break;

            case "ERROR":
                using (var data_mat = new db_transcriptEntities())
                {
                    var items_mat = (from c in data_mat.inf_material
                                     where c.sesion == str_session
                                     select c).FirstOrDefault();

                    items_mat.id_estatus_material = 3;

                    data_mat.SaveChanges();
                }

                break;

            case "NUEVO":

                using (var data_mat = new db_transcriptEntities())
                {
                    var items_mat = (from c in data_mat.inf_material
                                     where c.sesion == str_session
                                     select c).FirstOrDefault();

                    items_mat.id_estatus_material = 3;

                    data_mat.SaveChanges();
                }

                flist_user(two_user);
                break;
            }
            //play_video.Visible = true;
            //div_panel.Visible = true;
            //UpdatePanel2.Update();
            //Response.Redirect(Request.Url.AbsoluteUri);
        }
예제 #2
0
        protected void cmd_save_days_Click(object sender, EventArgs e)
        {
            int str_ndias = Convert.ToInt32(txt_days.Text);

            int str_count;

            using (db_transcriptEntities edm_cadvideos = new db_transcriptEntities())
            {
                var i_cadvideos = (from c in edm_cadvideos.inf_caducidad_videos

                                   select c).Count();
                str_count = i_cadvideos;
            }

            if (str_count == 0)
            {
                using (var edm_cadvideos = new db_transcriptEntities())
                {
                    var i_cadvideos = new inf_caducidad_videos
                    {
                        dias_caducidad = str_ndias,
                        id_usuario     = guid_fidusuario,
                        id_tribunal    = guid_fidcentro,
                        fecha_registro = DateTime.Now
                    };
                    edm_cadvideos.inf_caducidad_videos.Add(i_cadvideos);
                    edm_cadvideos.SaveChanges();
                }
                using (db_transcriptEntities edm_fecha_transf = new db_transcriptEntities())
                {
                    var ii_fecha_transf = (from u in edm_fecha_transf.inf_caducidad_videos
                                           select u).ToList();

                    if (ii_fecha_transf.Count == 0)
                    {
                    }
                    else
                    {
                        using (var insert_user = new db_transcriptEntities())
                        {
                            var items_user = new inf_caducidad_videos_dep
                            {
                                id_usuario          = guid_fidusuario,
                                id_caducidad_videos = ii_fecha_transf[0].id_caducidad_videos,
                                id_tipo_accion      = id_accion(),
                                fecha_registro      = DateTime.Now,
                            };
                            insert_user.inf_caducidad_videos_dep.Add(items_user);
                            insert_user.SaveChanges();
                        }
                    }
                }
                txt_days.Text = "";
                using (db_transcriptEntities edm_cadvideos = new db_transcriptEntities())
                {
                    var i_cadvideos = (from u in edm_cadvideos.inf_caducidad_videos
                                       where u.dias_caducidad == str_ndias
                                       select new
                    {
                        u.id_caducidad_videos,
                        u.dias_caducidad,
                        u.fecha_registro
                    }).ToList();

                    gv_dayvideosf.DataSource = i_cadvideos;
                    gv_dayvideosf.DataBind();
                    gv_dayvideosf.Visible = true;
                }

                rb_add_dayvideos.Visible = false;

                lblModalTitle.Text = "transcript";
                lblModalBody.Text  = "Dias de respaldo, agregado con éxito";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
                upModal.Update();
            }
            else
            {
                foreach (GridViewRow row in gv_dayvideos.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        CheckBox chkRow = (row.Cells[0].FindControl("chk_select") as CheckBox);
                        if (chkRow.Checked)
                        {
                            int str_code = Convert.ToInt32(row.Cells[1].Text);

                            using (var edm_cadvideos = new db_transcriptEntities())
                            {
                                var i_cadvideos = (from c in edm_cadvideos.inf_caducidad_videos
                                                   where c.id_caducidad_videos == str_code
                                                   select c).FirstOrDefault();

                                i_cadvideos.dias_caducidad = str_ndias;
                                edm_cadvideos.SaveChanges();
                            }
                            using (db_transcriptEntities edm_fecha_transf = new db_transcriptEntities())
                            {
                                var ii_fecha_transf = (from u in edm_fecha_transf.inf_caducidad_videos
                                                       select u).ToList();

                                if (ii_fecha_transf.Count == 0)
                                {
                                }
                                else
                                {
                                    using (var insert_user = new db_transcriptEntities())
                                    {
                                        var items_user = new inf_caducidad_videos_dep
                                        {
                                            id_usuario          = guid_fidusuario,
                                            id_caducidad_videos = ii_fecha_transf[0].id_caducidad_videos,
                                            id_tipo_accion      = id_accion(),
                                            fecha_registro      = DateTime.Now,
                                        };
                                        insert_user.inf_caducidad_videos_dep.Add(items_user);
                                        insert_user.SaveChanges();
                                    }
                                }
                            }
                            txt_days.Text      = "";;
                            lblModalTitle.Text = "transcript";
                            lblModalBody.Text  = "Dias de respaldo, actualizado con éxito";
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
                            upModal.Update();

                            using (db_transcriptEntities edm_cadvideos = new db_transcriptEntities())
                            {
                                var i_cadvideos = (from u in edm_cadvideos.inf_caducidad_videos
                                                   where u.id_caducidad_videos == str_code
                                                   select new
                                {
                                    u.id_caducidad_videos,
                                    u.dias_caducidad,
                                    u.fecha_registro
                                }).ToList();

                                gv_dayvideos.DataSource = i_cadvideos;
                                gv_dayvideos.DataBind();
                                gv_dayvideos.Visible = true;
                            }
                        }
                    }
                }
            }
        }
예제 #3
0
        protected void gv_material_ext_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                GridViewRow gvr = (GridViewRow)(((Button)e.CommandSource).NamingContainer);

                string status      = gvr.Cells[5].Text.ToString().Trim();
                int    id_sessionf = int.Parse(gvr.Cells[0].Text);
                int    id_session;
                string str_sessionf;
                using (var data_mat = new db_transcriptEntities())
                {
                    var items_mat = (from c in data_mat.inf_material_ext
                                     where c.id_material_ext == id_sessionf
                                     select c).FirstOrDefault();

                    id_session = items_mat.id_material;
                }
                using (var data_mat = new db_transcriptEntities())
                {
                    var items_mat = (from c in data_mat.inf_material
                                     where c.id_material == id_session
                                     select c).FirstOrDefault();

                    str_sessionf = items_mat.sesion;
                }

                str_session = gvr.Cells[1].Text;
                str_video   = gvr.Cells[2].Text + ".mp4";
                var two_user = new int?[] { 1, 3, 4, 5, 8, 9 };

                switch (status)
                {
                case "ACTIVO":

                    using (var edm_material = new db_transcriptEntities())
                    {
                        var i_material = new inf_material_dep
                        {
                            sesion             = str_session,
                            video              = str_video,
                            id_usuario         = guid_fidusuario,
                            id_material        = 0,
                            fecha_registro     = DateTime.Now,
                            fecha_registro_alt = DateTime.Now
                        };

                        edm_material.inf_material_dep.Add(i_material);
                        edm_material.SaveChanges();
                    }

                    string d_pdf = "videos\\" + str_sessionf + "\\" + str_session + "\\" + str_session + "\\ExtraFiles\\" + str_session + "_Report.pdf";
                    iframe_pdf.Visible           = true;
                    iframe_pdf.Attributes["src"] = d_pdf;

                    string str_namefile = @"videos\\" + str_sessionf + "\\" + str_session + "\\" + str_session + "\\" + str_video;

                    play_video.Visible           = true;
                    play_video.Attributes["src"] = str_namefile;
                    Button btn      = e.CommandSource as Button;
                    string name_btn = btn.Text;

                    if (name_btn == "PDF")
                    {
                        lblModalTitle.Text = "transcript";
                        Label1.Text        = "Expediente:" + str_sessionf + " - Sesión:" + str_session + " - Archivo:" + str_video.Replace(".mp4", "");
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal_pdf", "$('#myModal_pdf').modal();", true);
                        up_pdf.Update();
                    }
                    else

                    {
                        lblModalTitle.Text = "transcript";
                        Label2.Text        = "Expediente:" + str_sessionf + " - Sesión:" + str_session + " - Archivo:" + str_video.Replace(".mp4", "");
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal_video", "$('#myModal_video').modal();", true);
                        up_video.Update();
                    }

                    break;

                case "ERROR":

                    using (var data_mat = new db_transcriptEntities())
                    {
                        var items_mat = (from c in data_mat.inf_material
                                         where c.sesion == str_session
                                         select c).FirstOrDefault();

                        items_mat.id_estatus_material = 3;

                        data_mat.SaveChanges();
                    }

                    flist_user(two_user);
                    break;

                case "NUEVO":

                    using (var data_mat = new db_transcriptEntities())
                    {
                        var items_mat = (from c in data_mat.inf_material
                                         where c.sesion == str_session
                                         select c).FirstOrDefault();

                        items_mat.id_estatus_material = 3;

                        data_mat.SaveChanges();
                    }

                    flist_user(two_user);
                    break;
                }
            }
            catch
            { }
        }
예제 #4
0
        private void guarda_registro()
        {
            string str_empresa  = txt_tribunal.Text.ToUpper();
            string str_telefono = txt_telefono.Text;
            string str_email    = txt_email.Text;
            string str_callenum = txt_callenum.Text.ToUpper();
            string str_cp       = txt_cp.Text;
            int    int_idcodigocp;
            int    int_colony = Convert.ToInt32(ddl_colonia.SelectedValue);

            using (db_transcriptEntities db_sepomex = new db_transcriptEntities())
            {
                var tbl_sepomex = (from c in db_sepomex.inf_sepomex
                                   where c.d_codigo == str_cp
                                   where c.id_asenta_cpcons == int_colony
                                   select c).ToList();

                int_idcodigocp = tbl_sepomex[0].id_codigo;
            }

            using (var data_user = new db_transcriptEntities())
            {
                var items_user = (from c in data_user.inf_tribunal
                                  where c.id_tribunal == guid_fidcentro
                                  select c).FirstOrDefault();

                items_user.nombre   = str_empresa;
                items_user.telefono = str_telefono;
                items_user.email    = str_email;
                items_user.callenum = str_callenum;

                items_user.id_codigo = int_idcodigocp;

                data_user.SaveChanges();
            }
            using (db_transcriptEntities edm_fecha_transf = new db_transcriptEntities())
            {
                var ii_fecha_transf = (from u in edm_fecha_transf.inf_tribunal
                                       select u).ToList();

                if (ii_fecha_transf.Count == 0)
                {
                }
                else
                {
                    using (var insert_userf = new db_transcriptEntities())
                    {
                        var items_userf = new inf_tribunal_dep
                        {
                            id_usuario     = guid_fidusuario,
                            id_tribunal    = ii_fecha_transf[0].id_tribunal,
                            id_tipo_accion = id_accion(),
                            fecha_registro = DateTime.Now,
                        };
                        insert_userf.inf_tribunal_dep.Add(items_userf);
                        insert_userf.SaveChanges();
                    }
                }
            }
            using (db_transcriptEntities data_user = new db_transcriptEntities())
            {
                var inf_user = (from i_u in data_user.inf_usuarios
                                join i_tu in data_user.fact_tipo_usuarios on i_u.id_tipo_usuario equals i_tu.id_tipo_usuario
                                join i_e in data_user.inf_tribunal on i_u.id_tribunal equals i_e.id_tribunal
                                where i_u.id_usuario == guid_fidusuario
                                select new
                {
                    i_u.nombres,
                    i_u.a_paterno,
                    i_u.a_materno,
                    i_tu.desc_tipo_usuario,
                    i_tu.id_tipo_usuario,
                    i_e.nombre,
                    i_e.id_tribunal
                }).FirstOrDefault();

                lbl_fuser.Text         = inf_user.nombres + " " + inf_user.a_paterno + " " + inf_user.a_materno;
                lbl_profileuser.Text   = inf_user.desc_tipo_usuario;
                lbl_idprofileuser.Text = inf_user.id_tipo_usuario.ToString();
                lbl_centername.Text    = inf_user.nombre;
                guid_fidcentro         = inf_user.id_tribunal;
            }

            using (db_transcriptEntities m_tribunal = new db_transcriptEntities())
            {
                var i_tribunal = (from u in m_tribunal.inf_tribunal
                                  where u.id_tribunal == guid_fidcentro
                                  select u).FirstOrDefault();

                txt_tribunal.Text = i_tribunal.nombre;
                txt_telefono.Text = i_tribunal.telefono;
                txt_email.Text    = i_tribunal.email;
                txt_callenum.Text = i_tribunal.callenum;

                using (db_transcriptEntities db_sepomex = new db_transcriptEntities())
                {
                    var tbl_sepomex = (from c in db_sepomex.inf_sepomex
                                       where c.id_codigo == i_tribunal.id_codigo
                                       select c).ToList();

                    ddl_colonia.DataSource     = tbl_sepomex;
                    ddl_colonia.DataTextField  = "d_asenta";
                    ddl_colonia.DataValueField = "id_asenta_cpcons";
                    ddl_colonia.DataBind();

                    txt_cp.Text = tbl_sepomex[0].d_codigo;
                    ddl_colonia.SelectedValue = tbl_sepomex[0].id_asenta_cpcons.ToString();
                    txt_municipio.Text        = tbl_sepomex[0].D_mnpio;
                    txt_estado.Text           = tbl_sepomex[0].d_estado;
                }
            }

            lblModalTitle.Text = "transcript";
            lblModalBody.Text  = "Datos de tribunal actualizado con éxito";
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
            upModal.Update();
        }
예제 #5
0
        private void guarda_registro()
        {
            Guid guid_fempresa = Guid.NewGuid();
            Guid id_fempresa   = Guid.Parse("9A3C8442-2B53-45B7-9B5C-144BFA9C93BE");

            string str_empresa  = txt_tribunal.Text.ToUpper();
            string str_telefono = txt_telefono.Text;
            string str_email    = txt_email.Text;
            string str_callenum = txt_callenum.Text.ToUpper();
            string str_cp       = txt_cp.Text;
            int    int_colony   = Convert.ToInt32(ddl_colonia.SelectedValue);
            int    int_idcodigocp;
            Guid   guid_nusuario = Guid.NewGuid();

            string str_nombres  = txt_name_user.Text.ToUpper();
            string str_apaterno = txt_apater.Text.ToUpper();
            string str_amaterno = txt_amater.Text.ToUpper();

            string str_usuairo  = txt_code_user.Text.ToLower();
            string str_password = encrypta.Encrypt(txt_password.Text);

            using (db_transcriptEntities db_sepomex = new db_transcriptEntities())
            {
                var tbl_sepomex = (from c in db_sepomex.inf_sepomex
                                   where c.d_codigo == str_cp
                                   where c.id_asenta_cpcons == int_colony
                                   select c).ToList();

                int_idcodigocp = tbl_sepomex[0].id_codigo;
            }

            using (var m_empresa = new db_transcriptEntities())
            {
                var i_empresa = new inf_tribunal
                {
                    id_tribunal = guid_fempresa,

                    id_estatus     = 1,
                    nombre         = str_empresa,
                    telefono       = str_telefono,
                    email          = str_email,
                    callenum       = str_callenum,
                    id_codigo      = int_idcodigocp,
                    fecha_registro = DateTime.Now,
                    id_empresa     = id_fempresa
                };

                m_empresa.inf_tribunal.Add(i_empresa);
                m_empresa.SaveChanges();
            }

            using (var m_usuario = new db_transcriptEntities())
            {
                var i_usuario = new inf_usuarios
                {
                    id_usuario      = guid_nusuario,
                    id_estatus      = 1,
                    id_tipo_usuario = 1,
                    nombres         = str_nombres,
                    a_paterno       = str_apaterno,
                    a_materno       = str_amaterno,
                    codigo_usuario  = str_usuairo,
                    clave           = str_password,
                    fecha_registro  = DateTime.Now,
                    id_tribunal     = guid_fempresa
                };
                m_usuario.inf_usuarios.Add(i_usuario);
                m_usuario.SaveChanges();
            }

            limpiar_textbox();

            lblModalTitle.Text = "transcript";
            lblModalBody.Text  = "Datos de administrador y tribunal actualizados con éxito";
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
            upModal.Update();
        }
예제 #6
0
        protected void cmd_save_Click(object sender, EventArgs e)
        {
            if (rb_add.Checked == false & rb_edit.Checked == false & rb_del.Checked == false)
            {
                Mensaje("Favor de seleccionar una acción.");
            }
            else
            {
                Guid str_iduser = Guid.NewGuid();

                string str_nameuser = txt_name_user.Text.ToUpper();
                string str_apater   = txt_apater.Text.ToUpper();
                string str_amater   = txt_amater.Text.ToUpper();
                string str_codeuser = txt_code_user.Text.ToLower();
                string str_password = encrypta.Encrypt(txt_password.Text.ToLower());
                Guid   f_id_user;

                if (rb_add.Checked)
                {
                    try
                    {
                        string str_filter_code;
                        using (db_transcriptEntities data_user = new db_transcriptEntities())
                        {
                            var items_user = (from c in data_user.inf_usuarios
                                              where c.codigo_usuario == str_codeuser
                                              select c).FirstOrDefault();

                            str_filter_code = items_user.codigo_usuario.ToString();
                        }

                        if (str_codeuser == str_filter_code)
                        {
                            txt_code_user.Text = "";
                            Mensaje("Usuario ya existe en la base, agregar otro usuario.");
                        }
                    }
                    catch
                    {
                        int save_user = (int)(Session["ss_save_user"]);

                        using (var insert_user = new db_transcriptEntities())
                        {
                            var items_user = new inf_usuarios
                            {
                                id_usuario      = str_iduser,
                                nombres         = str_nameuser,
                                a_paterno       = str_apater,
                                a_materno       = str_amater,
                                id_tipo_usuario = save_user,
                                codigo_usuario  = str_codeuser,
                                clave           = str_password,
                                id_estatus      = 1,
                                fecha_registro  = DateTime.Now,
                                id_tribunal     = guid_fidcentro
                            };
                            insert_user.inf_usuarios.Add(items_user);
                            insert_user.SaveChanges();
                        }

                        using (var insert_user = new db_transcriptEntities())
                        {
                            var items_user = new inf_usuarios_dep
                            {
                                id_usuario     = guid_fidusuario,
                                id_tipo_accion = id_accion(),
                                id_usuario_alt = str_iduser,
                                fecha_registro = DateTime.Now,
                            };
                            insert_user.inf_usuarios_dep.Add(items_user);
                            insert_user.SaveChanges();
                        }

                        clean_data();
                        Mensaje("Datos de usuario guardados con éxito.");
                    }
                }
                else if (rb_edit.Checked)
                {
                    foreach (GridViewRow row in gv_usuarios.Rows)
                    {
                        if (row.RowType == DataControlRowType.DataRow)
                        {
                            CheckBox chkRow = (row.Cells[1].FindControl("chk_select") as CheckBox);
                            if (chkRow.Checked)
                            {
                                string codeuser = row.Cells[1].Text;

                                string str_filter_code;

                                if (codeuser == str_codeuser)
                                {
                                    using (db_transcriptEntities data_user = new db_transcriptEntities())
                                    {
                                        var items_user = (from c in data_user.inf_usuarios
                                                          where c.codigo_usuario == codeuser
                                                          select c).FirstOrDefault();

                                        f_id_user = items_user.id_usuario;
                                    }

                                    using (var data_user = new db_transcriptEntities())
                                    {
                                        var items_user = (from c in data_user.inf_usuarios
                                                          where c.id_usuario == f_id_user
                                                          select c).FirstOrDefault();

                                        items_user.nombres        = str_nameuser;
                                        items_user.a_paterno      = str_apater;
                                        items_user.a_materno      = str_amater;
                                        items_user.codigo_usuario = str_codeuser;
                                        items_user.clave          = str_password;

                                        data_user.SaveChanges();
                                    }
                                    using (var insert_user = new db_transcriptEntities())
                                    {
                                        var items_user = new inf_usuarios_dep
                                        {
                                            id_usuario     = guid_fidusuario,
                                            id_tipo_accion = id_accion(),
                                            id_usuario_alt = str_iduser,
                                            fecha_registro = DateTime.Now,
                                        };
                                        insert_user.inf_usuarios_dep.Add(items_user);
                                        insert_user.SaveChanges();
                                    }
                                    clean_data();

                                    rb_edit.Checked = false;

                                    gv_usuarios.Visible = false;
                                    txt_search.Visible  = false;
                                    cmd_search.Visible  = false;
                                    Mensaje("Datos de usuario actualizados con éxito.");
                                }
                                else
                                {
                                    using (db_transcriptEntities data_user = new db_transcriptEntities())
                                    {
                                        var items_user = (from c in data_user.inf_usuarios
                                                          where c.codigo_usuario == str_codeuser
                                                          select c).ToList();

                                        if (items_user.Count == 0)
                                        {
                                            using (db_transcriptEntities data_userf = new db_transcriptEntities())
                                            {
                                                var items_userf = (from c in data_userf.inf_usuarios
                                                                   where c.codigo_usuario == codeuser
                                                                   select c).FirstOrDefault();

                                                f_id_user = items_userf.id_usuario;
                                            }

                                            using (var data_userb = new db_transcriptEntities())
                                            {
                                                var items_userb = (from c in data_userb.inf_usuarios
                                                                   where c.id_usuario == f_id_user
                                                                   select c).FirstOrDefault();

                                                items_userb.nombres        = str_nameuser;
                                                items_userb.a_paterno      = str_apater;
                                                items_userb.a_materno      = str_amater;
                                                items_userb.codigo_usuario = str_codeuser;
                                                items_userb.clave          = str_password;

                                                data_userb.SaveChanges();
                                            }
                                            using (var insert_user = new db_transcriptEntities())
                                            {
                                                var items_userb = new inf_usuarios_dep
                                                {
                                                    id_usuario     = guid_fidusuario,
                                                    id_tipo_accion = id_accion(),
                                                    id_usuario_alt = str_iduser,
                                                    fecha_registro = DateTime.Now,
                                                };
                                                insert_user.inf_usuarios_dep.Add(items_userb);
                                                insert_user.SaveChanges();
                                            }
                                            clean_data();

                                            rb_edit.Checked = false;

                                            gv_usuarios.Visible = false;
                                            txt_search.Visible  = false;
                                            cmd_search.Visible  = false;

                                            Mensaje("Datos de usuario actualizados con éxito.");
                                        }
                                        else
                                        {
                                            str_filter_code = items_user[0].codigo_usuario.ToString();

                                            if (str_codeuser == str_filter_code)
                                            {
                                                txt_code_user.Text = "";
                                                Mensaje("Usuario ya existe en la base, agregar otro usuario.");
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                else if (rb_del.Checked)
                {
                    foreach (GridViewRow row in gv_usuarios.Rows)
                    {
                        if (row.RowType == DataControlRowType.DataRow)
                        {
                            CheckBox chkRow = (row.Cells[0].FindControl("chk_select") as CheckBox);
                            if (chkRow.Checked)
                            {
                                string codeuser = row.Cells[1].Text;

                                using (db_transcriptEntities data_user = new db_transcriptEntities())
                                {
                                    var items_user = (from c in data_user.inf_usuarios
                                                      where c.codigo_usuario == codeuser
                                                      select c).FirstOrDefault();

                                    f_id_user = items_user.id_usuario;
                                }

                                using (var data_user = new db_transcriptEntities())
                                {
                                    var items_user = (from c in data_user.inf_usuarios
                                                      where c.id_usuario == f_id_user
                                                      select c).FirstOrDefault();

                                    data_user.inf_usuarios.Remove(items_user);
                                    data_user.SaveChanges();
                                }
                                using (var insert_user = new db_transcriptEntities())
                                {
                                    var items_user = new inf_usuarios_dep
                                    {
                                        id_usuario     = guid_fidusuario,
                                        id_tipo_accion = id_accion(),
                                        id_usuario_alt = str_iduser,
                                        fecha_registro = DateTime.Now,
                                    };
                                    insert_user.inf_usuarios_dep.Add(items_user);
                                    insert_user.SaveChanges();
                                }
                                clean_data();

                                rb_del.Checked = false;

                                gv_usuarios.Visible = false;
                                txt_search.Visible  = false;
                                cmd_search.Visible  = false;

                                Mensaje("Datos de usuario eliminados con éxito.");
                            }
                        }
                    }
                }
            }
        }
예제 #7
0
        protected void cmd_save_Click(object sender, EventArgs e)
        {
            string str_nameuser = txt_name_user.Text.ToUpper();
            string str_apater   = txt_apater.Text.ToUpper();
            string str_amater   = txt_amater.Text.ToUpper();
            string str_codeuser = txt_code_user.Text.ToLower();
            string str_password = encrypta.Encrypt(txt_password.Text.ToLower());

            using (db_transcriptEntities data_user = new db_transcriptEntities())
            {
                var items_user = (from c in data_user.inf_usuarios
                                  where c.id_usuario == guid_fidusuario
                                  select c).ToList();

                if (items_user[0].codigo_usuario == str_codeuser)
                {
                    using (var data_userf = new db_transcriptEntities())
                    {
                        var items_userf = (from c in data_userf.inf_usuarios
                                           where c.id_usuario == guid_fidusuario
                                           select c).FirstOrDefault();

                        items_userf.codigo_usuario = str_codeuser;
                        items_userf.nombres        = str_nameuser;
                        items_userf.a_paterno      = str_apater;
                        items_userf.a_materno      = str_amater;
                        items_userf.clave          = str_password;

                        data_userf.SaveChanges();
                    }

                    using (db_transcriptEntities edm_usuario = new db_transcriptEntities())
                    {
                        var i_usuario = (from i_u in edm_usuario.inf_usuarios
                                         join i_tu in edm_usuario.fact_tipo_usuarios on i_u.id_tipo_usuario equals i_tu.id_tipo_usuario
                                         join i_e in edm_usuario.inf_tribunal on i_u.id_tribunal equals i_e.id_tribunal
                                         where i_u.id_usuario == guid_fidusuario
                                         select new
                        {
                            i_u.nombres,
                            i_u.a_paterno,
                            i_u.a_materno,
                            i_tu.desc_tipo_usuario,
                            i_tu.id_tipo_usuario,
                            i_e.nombre,
                            i_e.id_tribunal
                        }).FirstOrDefault();

                        lbl_fuser.Text         = i_usuario.nombres + " " + i_usuario.a_paterno + " " + i_usuario.a_materno;
                        lbl_profileuser.Text   = i_usuario.desc_tipo_usuario;
                        lbl_idprofileuser.Text = i_usuario.id_tipo_usuario.ToString();
                        lbl_centername.Text    = i_usuario.nombre;
                        guid_fidcentro         = i_usuario.id_tribunal;
                    }

                    clean_data();

                    chkb_editar.Checked = false;

                    Mensaje("Datos de usuario actualizados con éxito.");
                }
                else
                {
                    using (db_transcriptEntities data_userb = new db_transcriptEntities())
                    {
                        var items_userb = (from c in data_userb.inf_usuarios
                                           where c.codigo_usuario == str_codeuser
                                           select c).ToList();

                        if (items_userb.Count == 0)
                        {
                            using (var data_userf = new db_transcriptEntities())
                            {
                                var items_userf = (from c in data_userf.inf_usuarios
                                                   where c.id_usuario == guid_fidusuario
                                                   select c).FirstOrDefault();

                                items_userf.codigo_usuario = str_codeuser;
                                items_userf.nombres        = str_nameuser;
                                items_userf.a_paterno      = str_apater;
                                items_userf.a_materno      = str_amater;
                                items_userf.clave          = str_password;

                                data_userf.SaveChanges();
                            }

                            using (db_transcriptEntities edm_usuario = new db_transcriptEntities())
                            {
                                var i_usuario = (from i_u in edm_usuario.inf_usuarios
                                                 join i_tu in edm_usuario.fact_tipo_usuarios on i_u.id_tipo_usuario equals i_tu.id_tipo_usuario
                                                 join i_e in edm_usuario.inf_tribunal on i_u.id_tribunal equals i_e.id_tribunal
                                                 where i_u.id_usuario == guid_fidusuario
                                                 select new
                                {
                                    i_u.nombres,
                                    i_u.a_paterno,
                                    i_u.a_materno,
                                    i_tu.desc_tipo_usuario,
                                    i_tu.id_tipo_usuario,
                                    i_e.nombre,
                                    i_e.id_tribunal
                                }).FirstOrDefault();

                                lbl_fuser.Text         = i_usuario.nombres + " " + i_usuario.a_paterno + " " + i_usuario.a_materno;
                                lbl_profileuser.Text   = i_usuario.desc_tipo_usuario;
                                lbl_idprofileuser.Text = i_usuario.id_tipo_usuario.ToString();
                                lbl_centername.Text    = i_usuario.nombre;
                                guid_fidcentro         = i_usuario.id_tribunal;
                            }

                            clean_data();

                            chkb_editar.Checked = false;

                            Mensaje("Datos de usuario actualizados con éxito.");
                        }
                        else
                        {
                            txt_code_user.Text = "";
                            Mensaje("Usuario ya existe en la base, agregar otro usuario.");
                        }
                    }
                }
            }
        }
예제 #8
0
        protected void cmd_save_Click(object sender, EventArgs e)
        {
            if (rb_add_transformation.Checked || rb_edit_transformation.Checked)
            {
                string str_date = txt_date.Text;
                string str_hora = txt_hora.Text;
                //string str_format = ddl_fhora.SelectedValue;
                //string dateString = str_date + " " + str_hora + " " + str_format;
                string   dateString  = str_date + " " + str_hora;
                DateTime str_horario = DateTime.Parse(dateString);

                if (rb_add_transformation.Checked)
                {
                    using (var edm_fecha_transf = new db_transcriptEntities())
                    {
                        var ii_fecha_transf = new inf_fecha_transformacion
                        {
                            horario        = str_horario,
                            id_usuario     = guid_fidusuario,
                            id_tribunal    = guid_fidcentro,
                            fecha_registro = DateTime.Now
                        };
                        edm_fecha_transf.inf_fecha_transformacion.Add(ii_fecha_transf);
                        edm_fecha_transf.SaveChanges();
                    }

                    using (db_transcriptEntities edm_fecha_transf = new db_transcriptEntities())
                    {
                        var ii_fecha_transf = (from u in edm_fecha_transf.inf_fecha_transformacion
                                               select u).ToList();

                        if (ii_fecha_transf.Count == 0)
                        {
                        }
                        else
                        {
                            using (var insert_user = new db_transcriptEntities())
                            {
                                var items_user = new inf_fecha_transformacion_dep
                                {
                                    id_usuario = guid_fidusuario,
                                    id_fecha_transformacion = ii_fecha_transf[0].id_fecha_transformacion,
                                    id_tipo_accion          = id_accion(),
                                    fecha_registro          = DateTime.Now,
                                };
                                insert_user.inf_fecha_transformacion_dep.Add(items_user);
                                insert_user.SaveChanges();
                            }
                        }
                    }

                    clean_txt();
                    using (db_transcriptEntities edm_fecha_transf = new db_transcriptEntities())
                    {
                        var ii_fecha_transf = (from u in edm_fecha_transf.inf_fecha_transformacion
                                               where u.horario == str_horario
                                               select new
                        {
                            u.id_fecha_transformacion,
                            u.horario,
                            u.fecha_registro
                        }).ToList();

                        gv_transformationf.DataSource = ii_fecha_transf;
                        gv_transformationf.DataBind();
                        gv_transformationf.Visible = true;
                    }
                    rb_add_transformation.Visible = false;
                    lblModalTitle.Text            = "transcript";
                    lblModalBody.Text             = "Horario de carga de videos, agregado con éxito";
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
                    upModal.Update();
                }
                else if (rb_edit_transformation.Checked)
                {
                    foreach (GridViewRow row in gv_transformation.Rows)
                    {
                        if (row.RowType == DataControlRowType.DataRow)
                        {
                            CheckBox chkRow = (row.Cells[0].FindControl("chk_select") as CheckBox);
                            if (chkRow.Checked)
                            {
                                int str_code = Convert.ToInt32(row.Cells[1].Text);

                                using (var edm_fecha_transf = new db_transcriptEntities())
                                {
                                    var ii_fecha_transf = (from c in edm_fecha_transf.inf_fecha_transformacion
                                                           where c.id_fecha_transformacion == str_code
                                                           select c).FirstOrDefault();

                                    ii_fecha_transf.horario = str_horario;

                                    edm_fecha_transf.SaveChanges();
                                }
                                using (db_transcriptEntities edm_fecha_transf = new db_transcriptEntities())
                                {
                                    var ii_fecha_transf = (from u in edm_fecha_transf.inf_fecha_transformacion
                                                           select u).ToList();

                                    if (ii_fecha_transf.Count == 0)
                                    {
                                    }
                                    else
                                    {
                                        using (var insert_user = new db_transcriptEntities())
                                        {
                                            var items_user = new inf_fecha_transformacion_dep
                                            {
                                                id_usuario = guid_fidusuario,
                                                id_fecha_transformacion = ii_fecha_transf[0].id_fecha_transformacion,
                                                id_tipo_accion          = id_accion(),
                                                fecha_registro          = DateTime.Now,
                                            };
                                            insert_user.inf_fecha_transformacion_dep.Add(items_user);
                                            insert_user.SaveChanges();
                                        }
                                    }
                                }
                                clean_txt();
                                lblModalTitle.Text = "transcript";
                                lblModalBody.Text  = "Horario de carga de videos, actualizado con éxito";
                                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
                                upModal.Update();

                                using (db_transcriptEntities edm_fecha_transf = new db_transcriptEntities())
                                {
                                    var ii_fecha_transf = (from u in edm_fecha_transf.inf_fecha_transformacion
                                                           select new
                                    {
                                        u.id_fecha_transformacion,
                                        u.horario,
                                        u.fecha_registro
                                    }).ToList();

                                    gv_transformation.DataSource = ii_fecha_transf;
                                    gv_transformation.DataBind();
                                    gv_transformation.Visible = true;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                lblModalTitle.Text = "transcript";
                lblModalBody.Text  = "Favor de seleccionar una accion";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "myModal", "$('#myModal').modal();", true);
                upModal.Update();
            }
        }