Пример #1
0
        protected void gv_usrs_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gv_usrs.PageIndex = e.NewPageIndex;
            string str_clte = txt_buscar_usrs.Text.ToUpper().Trim();

            try
            {
                if (str_clte == "TODOS")
                {
                    using (lab_liecEntities data_areas = new lab_liecEntities())
                    {
                        var i_areas = (from t_areas in data_areas.inf_usuarios
                                       select new
                        {
                            t_areas.cod_usr,
                            nom_cmpleto = t_areas.nombres + " " + t_areas.a_paterno + " " + t_areas.a_paterno,
                            t_areas.email,
                            t_areas.fecha_registro
                        }).OrderBy(x => x.cod_usr).ToList();

                        gv_usrs.DataSource = i_areas;
                        gv_usrs.DataBind();
                        gv_usrs.Visible = true;
                    }
                }
                else
                {
                    string   n_rub;
                    Char     char_s = '|';
                    string   d_rub  = txt_buscar_usrs.Text.Trim();
                    String[] de_rub = d_rub.Trim().Split(char_s);
                    n_rub = de_rub[1].Trim();

                    using (lab_liecEntities data_areas = new lab_liecEntities())
                    {
                        var i_areas = (from t_areas in data_areas.inf_usuarios
                                       where t_areas.cod_usr == n_rub
                                       select new
                        {
                            t_areas.cod_usr,
                            nom_cmpleto = t_areas.nombres + " " + t_areas.a_paterno + " " + t_areas.a_paterno,
                            t_areas.email,
                            t_areas.fecha_registro
                        }).OrderBy(x => x.cod_usr).ToList();

                        gv_usrs.DataSource = i_areas;
                        gv_usrs.DataBind();
                        gv_usrs.Visible = true;
                    }
                }
            }
            catch
            {
                txt_usr_coment.Text  = null;
                txt_buscar_usrs.Text = null;
                Mensaje("Área no existe, favor de revisar.");
            }
        }
Пример #2
0
        protected void chk_usrs_CheckedChanged(object sender, EventArgs e)
        {
            string str_rub;
            Guid   guid_rub;

            foreach (GridViewRow row in gv_usrs.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chkRow = (row.Cells[0].FindControl("chk_usrs") as CheckBox);
                    if (chkRow.Checked)
                    {
                        row.BackColor = Color.FromArgb(227, 76, 14);
                        str_rub       = row.Cells[1].Text;

                        using (lab_liecEntities edm_rub = new lab_liecEntities())
                        {
                            var i_rub = (from c in edm_rub.inf_usuarios
                                         where c.cod_usr == str_rub
                                         select c).FirstOrDefault();

                            guid_rub = i_rub.id_usuario;

                            var f_rub = (from r in edm_rub.inf_usuarios
                                         where r.id_usuario == guid_rub
                                         select new
                            {
                                r.id_area,
                                r.id_perfil,
                                r.email,
                                r.nombres,
                                r.a_paterno,
                                r.a_materno,
                                r.fecha_nacimiento,
                                r.usr
                            }).FirstOrDefault();
                            DateTime f_nac = Convert.ToDateTime(f_rub.fecha_nacimiento);

                            ddl_area_usr.SelectedValue   = f_rub.id_area.ToString();
                            ddl_perfil_usr.SelectedValue = f_rub.id_perfil.ToString();
                            txt_email_usr.Text           = f_rub.email;
                            txt_nombre_usr.Text          = f_rub.nombres;
                            txt_apaterno_usr.Text        = f_rub.a_paterno;
                            txt_amaterno_usr.Text        = f_rub.a_materno;
                            txt_fnac_usr.Text            = f_nac.ToString("yyyy-MM-dd");
                            txt_usr_coment.Text          = null;
                        }
                    }
                    else
                    {
                        row.BackColor = Color.White;
                    }
                }
            }
        }
Пример #3
0
        private void limpiar_con_rt_01()
        {
            DropDownList1.Items.Clear();
            using (lab_liecEntities m_genero = new lab_liecEntities())
            {
                var i_genero = (from f_tr in m_genero.fact_especimen
                                select f_tr).ToList();

                DropDownList1.DataSource     = i_genero;
                DropDownList1.DataTextField  = "desc_tipo_especimen";
                DropDownList1.DataValueField = "id_tipo_especimen";
                DropDownList1.DataBind();
            }
            DropDownList1.Items.Insert(0, new ListItem("Seleccionar", "0"));

            DropDownList1.Items.Clear();
            using (lab_liecEntities m_genero = new lab_liecEntities())
            {
                var i_genero = (from f_tr in m_genero.fact_especimen
                                select f_tr).ToList();

                DropDownList1.DataSource     = i_genero;
                DropDownList1.DataTextField  = "desc_tipo_especimen";
                DropDownList1.DataValueField = "id_tipo_especimen";
                DropDownList1.DataBind();
            }
            DropDownList1.Items.Insert(0, new ListItem("Seleccionar", "0"));


            DropDownList2.Items.Clear();
            using (lab_liecEntities m_genero = new lab_liecEntities())
            {
                var i_genero = (from f_tr in m_genero.fac_tipo_concreto
                                select f_tr).ToList();

                DropDownList2.DataSource     = i_genero;
                DropDownList2.DataTextField  = "desc_tipo_concreto";
                DropDownList2.DataValueField = "id_tipo_concreto";
                DropDownList2.DataBind();
            }
            DropDownList2.Items.Insert(0, new ListItem("Seleccionar", "0"));

            DropDownList3.Items.Clear();
            //using (lab_liecEntities m_genero = new lab_liecEntities())
            //{
            //    var i_genero = (from f_tr in m_genero.fac_situacion_concreto
            //                    select f_tr).ToList();

            //    DropDownList3.DataSource = i_genero;
            //    DropDownList3.DataTextField = "desc_situacion_concreto";
            //    DropDownList3.DataValueField = "id_situacion_concreto";
            //    DropDownList3.DataBind();
            //}
            DropDownList3.Items.Insert(0, new ListItem("Seleccionar", "0"));
        }
Пример #4
0
        protected void gv_e_env_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gv_e_env.PageIndex = e.NewPageIndex;
            string str_e = txt_buscar_e_env.Text.ToUpper().Trim();

            try
            {
                if (str_e == "TODOS")
                {
                    using (lab_liecEntities data_e_env = new lab_liecEntities())
                    {
                        var i_e_env = (from t_e_env in data_e_env.inf_email_envio
                                       join t_est in data_e_env.fact_est_e_env on t_e_env.id_est_e_env equals t_est.id_est_e_env

                                       select new
                        {
                            t_e_env.email,

                            t_e_env.fecha_registro
                        }).OrderBy(x => x.email).ToList();

                        gv_e_env.DataSource = i_e_env;
                        gv_e_env.DataBind();
                        gv_e_env.Visible = true;
                    }
                }
                else
                {
                    using (lab_liecEntities data_e_env = new lab_liecEntities())
                    {
                        var i_e_env = (from t_e_env in data_e_env.inf_email_envio
                                       join t_est in data_e_env.fact_est_e_env on t_e_env.id_est_e_env equals t_est.id_est_e_env
                                       where t_e_env.email == str_e
                                       select new
                        {
                            t_e_env.email,

                            t_e_env.fecha_registro
                        }).OrderBy(x => x.email).ToList();

                        gv_e_env.DataSource = i_e_env;
                        gv_e_env.DataBind();
                        gv_e_env.Visible = true;
                    }
                }
            }
            catch
            {
                txt_buscar_e_env.Text = null;
                Mensaje("Correo no existe, favor de revisar.");
            }
        }
Пример #5
0
        protected void gv_areas_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gv_areas.PageIndex = e.NewPageIndex;
            string str_clte = txt_buscar_areas.Text.ToUpper().Trim();

            if (str_clte == "TODOS")
            {
                using (lab_liecEntities data_areas = new lab_liecEntities())
                {
                    var i_areas = (from t_areas in data_areas.fact_areas
                                   select new
                    {
                        t_areas.cod_area,
                        t_areas.desc_areas,
                        t_areas.fecha_registro
                    }).OrderBy(x => x.cod_area).ToList();

                    gv_areas.DataSource = i_areas;
                    gv_areas.DataBind();
                    gv_areas.Visible = true;
                }
            }
            else
            {
                string   n_rub;
                Char     char_s = '|';
                string   d_rub  = txt_buscar_areas.Text.Trim();
                String[] de_rub = d_rub.Trim().Split(char_s);
                n_rub = de_rub[1].Trim();

                using (lab_liecEntities data_areas = new lab_liecEntities())
                {
                    var i_areas = (from t_areas in data_areas.fact_areas
                                   where t_areas.cod_area == n_rub

                                   select new
                    {
                        t_areas.cod_area,

                        t_areas.desc_areas,
                        t_areas.fecha_registro
                    }).OrderBy(x => x.cod_area).ToList();

                    gv_areas.DataSource = i_areas;
                    gv_areas.DataBind();
                    gv_areas.Visible = true;
                }
            }

            limp_txt_area();
        }
Пример #6
0
        protected void chk_e_env_CheckedChanged(object sender, EventArgs e)
        {
            string str_rub;
            Guid   guid_rub;

            foreach (GridViewRow row in gv_e_env.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chkRow = (row.Cells[0].FindControl("chk_e_env") as CheckBox);
                    if (chkRow.Checked)
                    {
                        row.BackColor = Color.FromArgb(227, 76, 14);
                        str_rub       = row.Cells[1].Text;

                        using (lab_liecEntities edm_rub = new lab_liecEntities())
                        {
                            var i_rub = (from c in edm_rub.inf_email_envio
                                         where c.email == str_rub
                                         select c).FirstOrDefault();

                            guid_rub = i_rub.id_email_env;

                            var f_rub = (from r in edm_rub.inf_email_envio
                                         where r.id_email_env == guid_rub
                                         select new
                            {
                                r.email,
                                r.usuario,
                                r.asunto,
                                r.servidor_smtp,
                                r.puerto
                            }).FirstOrDefault();

                            txt_correo_envio.Text  = f_rub.email;
                            txt_usuario_envio.Text = f_rub.usuario;

                            txt_asunto_envio.Text  = f_rub.asunto;
                            txt_servidor_smtp.Text = f_rub.servidor_smtp;
                            txt_puerto_envio.Text  = f_rub.puerto.ToString();
                        }
                    }
                    else
                    {
                        row.BackColor = Color.White;
                    }
                }
            }
        }
Пример #7
0
        protected void btn_cp_usr_Click(object sender, EventArgs e)
        {
            string str_codcp = txt_cp_usr.Text.Trim();

            using (lab_liecEntities db_sepomex = new lab_liecEntities())
            {
                var tbl_sepomex = (from c in db_sepomex.inf_sepomex
                                   where c.d_codigo == str_codcp
                                   select c).ToList();

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

                if (tbl_sepomex.Count == 1)
                {
                    txt_municipio_usr.Text = tbl_sepomex[0].d_mnpio;
                    txt_estado_usr.Text    = tbl_sepomex[0].d_estado;

                    rfv_callenum_usr.Enabled = true;
                    rfv_col_usr.Enabled      = true;
                }
                if (tbl_sepomex.Count > 1)
                {
                    ddl_col_usr.Items.Insert(0, new ListItem("SELECCIONAR", "0"));

                    txt_municipio_usr.Text = tbl_sepomex[0].d_mnpio;
                    txt_estado_usr.Text    = tbl_sepomex[0].d_estado;

                    rfv_callenum_usr.Enabled = true;
                    rfv_col_usr.Enabled      = true;
                }
                else if (tbl_sepomex.Count == 0)
                {
                    ddl_col_usr.Items.Clear();
                    ddl_col_usr.Items.Insert(0, new ListItem("SELECCIONAR", "0"));
                    txt_municipio_usr.Text = null;
                    txt_estado_usr.Text    = null;
                    txt_cp_usr.Focus();
                }
            }
            up_usrs.Update();
        }
Пример #8
0
        private void limp_txt_usr()
        {
            using (lab_liecEntities m_area = new lab_liecEntities())
            {
                var i_area = (from c in m_area.fact_areas
                              select c).ToList();

                ddl_area_usr.Items.Clear();

                ddl_area_usr.DataSource     = i_area;
                ddl_area_usr.DataTextField  = "desc_areas";
                ddl_area_usr.DataValueField = "id_area";
                ddl_area_usr.DataBind();

                ddl_area_usr.Items.Insert(0, new ListItem("SELECCIONAR", "0"));

                ddl_perfil_usr.Items.Clear();

                var i_perfil = (from c in m_area.fact_perfil
                                select c).ToList();

                ddl_perfil_usr.DataSource     = i_perfil;
                ddl_perfil_usr.DataTextField  = "desc_perfil";
                ddl_perfil_usr.DataValueField = "id_perfil";
                ddl_perfil_usr.DataBind();

                ddl_perfil_usr.Items.Insert(0, new ListItem("SELECCIONAR", "0"));
            }
            ddl_col_usr.Items.Clear();
            ddl_col_usr.Items.Insert(0, new ListItem("SELECCIONAR", "0"));

            txt_email_usr.Text     = null;
            txt_nombre_usr.Text    = null;
            txt_apaterno_usr.Text  = null;
            txt_amaterno_usr.Text  = null;
            txt_fnac_usr.Text      = null;
            txt_callenum_usr.Text  = null;
            txt_cp_usr.Text        = null;
            txt_municipio_usr.Text = null;
            txt_estado_usr.Text    = null;
        }
Пример #9
0
        protected void chk_areas_CheckedChanged(object sender, EventArgs e)
        {
            string str_rub;
            Guid   guid_rub;

            foreach (GridViewRow row in gv_areas.Rows)
            {
                if (row.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chkRow = (row.Cells[0].FindControl("chk_areas") as CheckBox);
                    if (chkRow.Checked)
                    {
                        row.BackColor = Color.FromArgb(227, 76, 14);
                        str_rub       = row.Cells[1].Text;

                        using (lab_liecEntities edm_rub = new lab_liecEntities())
                        {
                            var i_rub = (from c in edm_rub.fact_areas
                                         where c.cod_area == str_rub
                                         select c).FirstOrDefault();

                            guid_rub = i_rub.id_area;

                            var f_rub = (from r in edm_rub.fact_areas
                                         where r.id_area == guid_rub
                                         select new
                            {
                                r.desc_areas,
                            }).FirstOrDefault();

                            txt_areas_coment.Text = f_rub.desc_areas;
                        }
                    }
                    else
                    {
                        row.BackColor = Color.White;
                    }
                }
            }
        }
Пример #10
0
        protected void gv_usrs_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                string str_clteID = e.Row.Cells[1].Text;
                int    int_estatusID;

                using (lab_liecEntities data_clte = new lab_liecEntities())
                {
                    var i_clte = (from t_clte in data_clte.inf_usuarios
                                  where t_clte.cod_usr == str_clteID
                                  select new
                    {
                        t_clte.id_est_usr,
                    }).FirstOrDefault();

                    int_estatusID = int.Parse(i_clte.id_est_usr.ToString());
                }

                DropDownList DropDownList1 = (e.Row.FindControl("ddl_usrs_estatus") as DropDownList);

                using (lab_liecEntities db_sepomex = new lab_liecEntities())
                {
                    var tbl_sepomex = (from c in db_sepomex.fact_estatus
                                       select c).ToList();

                    DropDownList1.DataSource = tbl_sepomex;

                    DropDownList1.DataTextField  = "desc_est_usr";
                    DropDownList1.DataValueField = "id_est_usr";
                    DropDownList1.DataBind();
                    DropDownList1.Items.Insert(0, new ListItem("SELECCIONAR", "0"));
                    DropDownList1.SelectedValue = int_estatusID.ToString();
                }
            }
        }
Пример #11
0
        protected void btn_buscar_usrs_Click(object sender, EventArgs e)
        {
            gv_usrs.Visible = false;
            string str_clte = txt_buscar_usrs.Text.ToUpper().Trim();

            try
            {
                if (str_clte == "TODOS")
                {
                    limp_txt_usr();
                    using (lab_liecEntities data_areas = new lab_liecEntities())
                    {
                        var i_areas = (from t_areas in data_areas.inf_usuarios
                                       select new
                        {
                            t_areas.cod_usr,
                            nom_cmpleto = t_areas.nombres + " " + t_areas.a_paterno + " " + t_areas.a_materno,
                            t_areas.email,
                            t_areas.fecha_registro
                        }).OrderBy(x => x.cod_usr).ToList();

                        if (i_areas.Count == 0)
                        {
                            gv_usrs.Visible = false;
                            limp_txt_usr();
                            Mensaje("Sin registros, favor de agregar.");
                        }
                        else
                        {
                            gv_usrs.DataSource = i_areas;
                            gv_usrs.DataBind();
                            gv_usrs.Visible = true;
                        }
                    }
                }
                else
                {
                    string   n_rub;
                    Char     char_s = '|';
                    string   d_rub  = txt_buscar_usrs.Text.Trim();
                    String[] de_rub = d_rub.Trim().Split(char_s);
                    n_rub = de_rub[1].Trim();
                    limp_txt_usr();
                    using (lab_liecEntities data_areas = new lab_liecEntities())
                    {
                        var i_areas = (from t_areas in data_areas.inf_usuarios
                                       where t_areas.cod_usr == n_rub
                                       select new
                        {
                            t_areas.cod_usr,
                            nom_cmpleto = t_areas.nombres + " " + t_areas.a_paterno + " " + t_areas.a_materno,
                            t_areas.email,
                            t_areas.fecha_registro
                        }).OrderBy(x => x.cod_usr).ToList();

                        gv_usrs.DataSource = i_areas;
                        gv_usrs.DataBind();
                        gv_usrs.Visible = true;
                    }
                }
            }
            catch
            {
                gv_usrs.Visible = false;
                limp_txt_usr();
                Mensaje("Usuario no existe, favor de revisar.");
            }
        }
Пример #12
0
        protected void btn_guardar_usrs_Click(object sender, EventArgs e)
        {
            if (int_usr == 0)
            {
                Mensaje("Favor de seleccionar una acción");
            }
            else
            {
                //try
                //{
                Guid     guid_area, guid_emp, guid_usrs;
                int      idper_usr, idcol_usr;
                string   cod_usr, nom_usr, apater_usr, amater_usr, e_user, tel_usr, movil_usr, callenum_usr, cp_usr;
                DateTime fnac_user;


                guid_usrs    = Guid.NewGuid();
                guid_emp     = Guid.Parse("d8a03556-6791-45f3-babe-ecf267b865f1");
                guid_area    = Guid.Parse(ddl_area_usr.SelectedValue);
                idper_usr    = int.Parse(ddl_perfil_usr.SelectedValue);
                e_user       = txt_email_usr.Text.Trim();
                nom_usr      = txt_nombre_usr.Text.Trim().ToUpper();
                apater_usr   = txt_apaterno_usr.Text.Trim().ToUpper();
                amater_usr   = txt_amaterno_usr.Text.Trim().ToUpper();
                fnac_user    = DateTime.Parse(txt_fnac_usr.Text);
                tel_usr      = txt_tel_usr.Text.Trim();
                callenum_usr = txt_callenum_usr.Text.Trim().ToUpper();
                cp_usr       = txt_cp_usr.Text.Trim();
                idcol_usr    = int.Parse(ddl_col_usr.SelectedValue);
                movil_usr    = "";

                if (int_usr == 1)
                {
                    using (lab_liecEntities edm_fusr = new lab_liecEntities())
                    {
                        var i_fusr = (from c in edm_fusr.inf_usuarios
                                      where c.nombres == nom_usr
                                      where c.a_paterno == apater_usr
                                      where c.a_materno == amater_usr
                                      select c).ToList();

                        if (i_fusr.Count == 0)
                        {
                            var i_usr = (from c in edm_fusr.inf_usuarios
                                         select c).ToList();

                            if (i_usr.Count == 0)
                            {
                                cod_usr = "******" + string.Format("{0:000}", (object)(i_usr.Count + 1));

                                var a_usr = new inf_usuarios

                                {
                                    id_usuario       = guid_usrs,
                                    id_est_usr       = 1,
                                    id_area          = guid_area,
                                    id_perfil        = idper_usr,
                                    cod_usr          = cod_usr,
                                    nombres          = nom_usr,
                                    a_paterno        = apater_usr,
                                    a_materno        = amater_usr,
                                    fecha_nacimiento = fnac_user,
                                    id_emp           = guid_emp,
                                    fecha_registro   = DateTime.Now
                                };

                                var a_usr_cot = new inf_cont_usr

                                {
                                    callenum         = callenum_usr,
                                    d_codigo         = cp_usr,
                                    id_asenta_cpcons = idcol_usr,
                                    telefono         = tel_usr,
                                    movil            = movil_usr,
                                    email            = e_user,
                                    id_usuario       = guid_usrs
                                };

                                edm_fusr.inf_usuarios.Add(a_usr);
                                edm_fusr.inf_cont_usr.Add(a_usr_cot);
                                edm_fusr.SaveChanges();

                                limp_txt_usr();
                                Mensaje("Datos de usuario agregados con éxito.");
                            }
                            else
                            {
                                cod_usr = "******" + string.Format("{0:000}", (object)(i_usr.Count + 1));

                                var a_usr = new inf_usuarios

                                {
                                    id_usuario       = guid_usrs,
                                    id_est_usr       = 1,
                                    id_area          = guid_area,
                                    id_perfil        = idper_usr,
                                    cod_usr          = cod_usr,
                                    nombres          = nom_usr,
                                    a_paterno        = apater_usr,
                                    a_materno        = amater_usr,
                                    fecha_nacimiento = fnac_user,
                                    id_emp           = guid_emp,
                                    fecha_registro   = DateTime.Now
                                };

                                var a_usr_cot = new inf_cont_usr

                                {
                                    callenum         = callenum_usr,
                                    d_codigo         = cp_usr,
                                    id_asenta_cpcons = idcol_usr,
                                    telefono         = tel_usr,
                                    movil            = movil_usr,
                                    email            = e_user,
                                    id_usuario       = guid_usrs
                                };

                                edm_fusr.inf_usuarios.Add(a_usr);
                                edm_fusr.inf_cont_usr.Add(a_usr_cot);
                                edm_fusr.SaveChanges();

                                limp_txt_usr();
                                Mensaje("Datos de usuario agregados con éxito.");
                            }
                        }
                        else
                        {
                            limp_txt_usr();
                            rfv_usr_coment.Enabled = false;
                            Mensaje("Usuario existe en la base de datos, favor de revisar.");
                        }
                    }
                }
                else if (int_usr == 2)
                {
                    int    int_ddl, int_f_clte = 0;
                    int    int_estatusID = 0;
                    string str_fclte     = null;
                    string v_usrs        = null;
                    foreach (GridViewRow row in gv_usrs.Rows)
                    {
                        // int key = (int)GridView1.DataKeys[row.RowIndex].Value;
                        if (row.RowType == DataControlRowType.DataRow)
                        {
                            CheckBox chkRow = (row.Cells[0].FindControl("chk_usrs") as CheckBox);
                            if (chkRow.Checked)
                            {
                                int_f_clte = int_f_clte + 1;
                                str_fclte  = row.Cells[1].Text;
                                v_usrs     = row.Cells[2].Text;
                                DropDownList dl = (DropDownList)row.FindControl("ddl_usrs_estatus");

                                int_ddl = int.Parse(dl.SelectedValue);
                                if (int_ddl == 1)
                                {
                                    int_estatusID = 1;
                                    break;
                                }
                                else if (int_ddl == 2)
                                {
                                    int_estatusID = 2;
                                    break;
                                }
                                break;
                            }
                        }
                    }

                    if (int_estatusID == 0)
                    {
                        Mensaje("Favor de seleccionar una área.");
                    }
                    else
                    {
                        //using (var m_clte = new lab_liecEntities())
                        //{
                        //    var i_clte = (from c in m_clte.inf_usuarios
                        //                  where c.cod_usr == str_fclte
                        //                  select c).FirstOrDefault();

                        //    if (cod_user == i_clte.usr)
                        //    {
                        //        var i_usrs = (from c in m_clte.inf_usuarios
                        //                      where c.cod_usr == str_fclte
                        //                      select c).FirstOrDefault();

                        //        i_usrs.id_area = guid_area;
                        //        i_usrs.id_estatus = int_estatusID;
                        //        i_usrs.id_perfil = id_perfil;
                        //        i_usrs.email = e_user;
                        //        i_usrs.nombres = nom_usr;
                        //        i_usrs.a_paterno = apater_usr;
                        //        i_usrs.a_materno = amater_usr;
                        //        i_usrs.usr = cod_user;
                        //        i_usrs.clave = clave_usr;

                        //        m_clte.SaveChanges();

                        //        rfv_buscar_usrs.Enabled = false;
                        //        rfv_usr_coment.Enabled = false;
                        //        limp_txt_usr();
                        //        Mensaje("Datos de usuario actualizados con éxito.");
                        //    }
                        //    else
                        //    {
                        //        var i_nclte = (from c in m_clte.inf_usuarios
                        //                       where c.cod_usr == cod_user
                        //                       select c).ToList();

                        //        if (i_nclte.Count == 0)
                        //        {
                        //            var i_usrs = (from c in m_clte.inf_usuarios
                        //                          where c.cod_usr == str_fclte
                        //                          select c).FirstOrDefault();

                        //            i_usrs.id_estatus = int_estatusID;
                        //            i_usrs.id_area = guid_area;
                        //            i_usrs.id_perfil = id_perfil;
                        //            i_usrs.email = e_user;
                        //            i_usrs.nombres = nom_usr;
                        //            i_usrs.a_paterno = apater_usr;
                        //            i_usrs.a_materno = amater_usr;
                        //            i_usrs.usr = cod_user;
                        //            i_usrs.clave = clave_usr;

                        //            m_clte.SaveChanges();

                        //            m_clte.SaveChanges();

                        //            rfv_buscar_usrs.Enabled = false;
                        //            rfv_usr_coment.Enabled = false;
                        //            limp_txt_usr();
                        //            Mensaje("Datos de usuario actualizados con éxito.");
                        //        }
                        //        else
                        //        {
                        //            limp_txt_usr();
                        //            Mensaje("Usuario ya existe en la base de datos, favor de revisar.");
                        //        }
                        //    }
                        //}
                    }
                }
                //}
                //catch
                //{ }
            }
        }
Пример #13
0
        protected void btn_guardar_envio_Click(object sender, EventArgs e)
        {
            if (int_e_env == 0)
            {
                Mensaje("Favor de seleccionar una acción");
            }
            else
            {
                Guid   guid_ncorreoenvio = Guid.NewGuid();
                string str_correoenvio   = txt_correo_envio.Text;
                string str_usuarioenvio  = txt_usuario_envio.Text;
                string str_claveenvio    = encrypta.Encrypt(txt_clave_envio.Text);
                string str_asunto        = txt_asunto_envio.Text;
                string str_svrsmtp       = txt_servidor_smtp.Text;
                int    str_puertoenvio   = int.Parse(txt_puerto_envio.Text);

                Guid guid_fcorreoenvio;

                if (int_e_env == 1)
                {
                    using (lab_liecEntities data_user = new lab_liecEntities())
                    {
                        var items_user = (from c in data_user.inf_email_envio
                                          where c.email == str_correoenvio
                                          select c).ToList();

                        if (items_user.Count == 0)
                        {
                            var i_usuario = new inf_email_envio
                            {
                                id_email_env   = guid_ncorreoenvio,
                                id_est_e_env   = 1,
                                email          = str_correoenvio,
                                usuario        = str_usuarioenvio,
                                clave          = str_claveenvio,
                                asunto         = str_asunto,
                                servidor_smtp  = str_svrsmtp,
                                puerto         = str_puertoenvio,
                                fecha_registro = DateTime.Now,
                                id_emp         = guid_emp
                            };

                            data_user.inf_email_envio.Add(i_usuario);
                            data_user.SaveChanges();



                            limpia_e_env();
                            Mensaje("Datos agregados con éxito");
                        }
                        else
                        {
                            Mensaje("Correo ya existe en la base de datos, favor de reintentar o editar información");
                        }
                    }
                }
                else if (int_e_env == 2)
                {
                    using (var m_fusuarioff = new lab_liecEntities())
                    {
                        var i_fusuarioff = (from c in m_fusuarioff.inf_email_envio
                                            select c).FirstOrDefault();

                        guid_fcorreoenvio = i_fusuarioff.id_email_env;

                        var i_ff = (from c in m_fusuarioff.inf_email_envio
                                    where c.id_email_env == guid_fcorreoenvio
                                    select c).FirstOrDefault();

                        i_fusuarioff.email         = str_correoenvio;
                        i_fusuarioff.usuario       = str_usuarioenvio;
                        i_fusuarioff.clave         = str_claveenvio;
                        i_fusuarioff.asunto        = str_asunto;
                        i_fusuarioff.servidor_smtp = str_svrsmtp;
                        i_fusuarioff.puerto        = str_puertoenvio;

                        m_fusuarioff.SaveChanges();
                    }


                    Mensaje("Datos actualizados con éxito");
                }
            }
        }
Пример #14
0
        protected void btn_buscar_areas_Click(object sender, EventArgs e)
        {
            txt_areas_coment.Text = null;
            string str_clte = txt_buscar_areas.Text.ToUpper().Trim();

            try
            {
                if (str_clte == "TODOS")
                {
                    using (lab_liecEntities data_areas = new lab_liecEntities())
                    {
                        var i_areas = (from t_areas in data_areas.fact_areas
                                       join t_est in data_areas.fact_est_areas on t_areas.id_est_areas equals t_est.id_est_area

                                       select new
                        {
                            t_areas.cod_area,
                            t_est.desc_est_area,
                            t_areas.desc_areas,
                            t_areas.fecha_registro
                        }).OrderBy(x => x.cod_area).ToList();

                        gv_areas.DataSource = i_areas;
                        gv_areas.DataBind();
                        gv_areas.Visible = true;
                    }
                }
                else
                {
                    string   n_rub;
                    Char     char_s = '|';
                    string   d_rub  = txt_buscar_areas.Text.Trim();
                    String[] de_rub = d_rub.Trim().Split(char_s);
                    n_rub = de_rub[1].Trim();

                    using (lab_liecEntities data_areas = new lab_liecEntities())
                    {
                        var i_areas = (from t_areas in data_areas.fact_areas
                                       join t_est in data_areas.fact_est_areas on t_areas.id_est_areas equals t_est.id_est_area
                                       where t_areas.cod_area == n_rub

                                       select new
                        {
                            t_areas.cod_area,
                            t_est.desc_est_area,
                            t_areas.desc_areas,
                            t_areas.fecha_registro
                        }).OrderBy(x => x.cod_area).ToList();

                        gv_areas.DataSource = i_areas;
                        gv_areas.DataBind();
                        gv_areas.Visible = true;
                    }
                }
            }
            catch
            {
                txt_areas_coment.Text = null;
                txt_buscar_areas.Text = null;
                Mensaje("Área no existe, favor de revisar.");
            }
        }
Пример #15
0
        protected void btn_guardar_areas_Click(object sender, EventArgs e)
        {
            if (int_areas == 0)
            {
                Mensaje("Favor de seleccionar una acción");
            }
            else
            {
                try
                {
                    Guid guid_area = Guid.NewGuid();

                    string str_area = txt_areas_coment.Text.ToUpper().Trim();
                    string str_codigo_area;

                    if (int_areas == 1)
                    {
                        using (lab_liecEntities edm_nclte = new lab_liecEntities())
                        {
                            var i_nclte = (from c in edm_nclte.fact_areas
                                           where c.desc_areas == str_area
                                           select c).ToList();

                            if (i_nclte.Count == 0)
                            {
                                using (lab_liecEntities edm_fclte = new lab_liecEntities())
                                {
                                    var i_fclte = (from c in edm_fclte.fact_areas
                                                   select c).ToList();

                                    if (i_fclte.Count == 0)
                                    {
                                        str_codigo_area = "LIEC-AREA" + string.Format("{0:000}", (object)(i_nclte.Count + 1));

                                        using (var m_clte = new lab_liecEntities())
                                        {
                                            var i_clte = new fact_areas

                                            {
                                                id_area        = guid_area,
                                                cod_area       = str_codigo_area,
                                                id_est_areas   = 1,
                                                desc_areas     = str_area,
                                                id_emp         = guid_emp,
                                                fecha_registro = DateTime.Now
                                            };

                                            m_clte.fact_areas.Add(i_clte);
                                            m_clte.SaveChanges();
                                        }
                                        limp_txt_area();
                                        Mensaje("Datos de área agregados con éxito.");
                                    }
                                    else
                                    {
                                        str_codigo_area = "LIEC-AREA" + string.Format("{0:000}", (object)(i_fclte.Count + 1));

                                        using (var m_clte = new lab_liecEntities())
                                        {
                                            var i_clte = new fact_areas

                                            {
                                                id_area        = guid_area,
                                                cod_area       = str_codigo_area,
                                                id_est_areas   = 1,
                                                desc_areas     = str_area,
                                                id_emp         = guid_emp,
                                                fecha_registro = DateTime.Now
                                            };

                                            m_clte.fact_areas.Add(i_clte);
                                            m_clte.SaveChanges();
                                        }
                                        limp_txt_area();

                                        Mensaje("Datos de área agregados con éxito.");
                                    }
                                }
                            }
                            else
                            {
                                limp_txt_area();
                                rfv_areas_coment.Enabled = false;
                                Mensaje("Área existe en la base de datos, favor de revisar.");
                            }
                        }
                    }
                    else if (int_areas == 2)
                    {
                        int    int_ddl, int_f_clte = 0;
                        int    int_estatusID = 0;
                        string str_fclte     = null;
                        string v_area        = null;
                        foreach (GridViewRow row in gv_areas.Rows)
                        {
                            // int key = (int)GridView1.DataKeys[row.RowIndex].Value;
                            if (row.RowType == DataControlRowType.DataRow)
                            {
                                CheckBox chkRow = (row.Cells[0].FindControl("chk_areas") as CheckBox);
                                if (chkRow.Checked)
                                {
                                    int_f_clte = int_f_clte + 1;
                                    str_fclte  = row.Cells[1].Text;
                                    v_area     = row.Cells[2].Text;
                                    DropDownList dl = (DropDownList)row.FindControl("ddl_area_estatus");

                                    int_ddl = int.Parse(dl.SelectedValue);
                                    if (int_ddl == 1)
                                    {
                                        int_estatusID = 1;
                                        break;
                                    }
                                    else if (int_ddl == 2)
                                    {
                                        int_estatusID = 2;
                                        break;
                                    }
                                    break;
                                }
                            }
                        }

                        if (int_estatusID == 0)
                        {
                            Mensaje("Favor de seleccionar una área.");
                        }
                        else
                        {
                            using (var m_clte = new lab_liecEntities())
                            {
                                var i_clte = (from c in m_clte.fact_areas
                                              where c.cod_area == str_fclte
                                              select c).FirstOrDefault();

                                if (str_area == i_clte.desc_areas)
                                {
                                    var i_area = (from c in m_clte.fact_areas
                                                  where c.cod_area == str_fclte
                                                  select c).FirstOrDefault();

                                    i_area.id_est_areas = int_estatusID;
                                    i_area.desc_areas   = str_area;

                                    m_clte.SaveChanges();

                                    rfv_buscar_areas.Enabled = false;
                                    rfv_areas_coment.Enabled = false;
                                    limp_txt_area();
                                    Mensaje("Datos de área actualizados con éxito.");
                                }
                                else
                                {
                                    var i_nclte = (from c in m_clte.fact_areas
                                                   where c.desc_areas == str_area
                                                   select c).ToList();

                                    if (i_nclte.Count == 0)
                                    {
                                        var i_fareas = (from c in m_clte.fact_areas
                                                        where c.cod_area == str_fclte
                                                        select c).FirstOrDefault();

                                        i_fareas.id_est_areas = int_estatusID;
                                        i_fareas.desc_areas   = str_area;

                                        m_clte.SaveChanges();

                                        rfv_buscar_areas.Enabled = false;
                                        rfv_areas_coment.Enabled = false;
                                        limp_txt_area();
                                        string str_clte = txt_buscar_areas.Text.ToUpper().Trim();
                                        try
                                        {
                                            if (str_clte == "TODOS")
                                            {
                                                using (lab_liecEntities data_areas = new lab_liecEntities())
                                                {
                                                    var i_areas = (from t_areas in data_areas.fact_areas
                                                                   join t_est in data_areas.fact_est_areas on t_areas.id_est_areas equals t_est.id_est_area

                                                                   select new
                                                    {
                                                        t_areas.cod_area,
                                                        t_est.desc_est_area,
                                                        t_areas.desc_areas,
                                                        t_areas.fecha_registro
                                                    }).OrderBy(x => x.cod_area).ToList();

                                                    gv_areas.DataSource = i_areas;
                                                    gv_areas.DataBind();
                                                    gv_areas.Visible = true;
                                                }
                                            }
                                            else
                                            {
                                                string   n_rub;
                                                Char     char_s = '|';
                                                string   d_rub  = txt_buscar_areas.Text.Trim();
                                                String[] de_rub = d_rub.Trim().Split(char_s);
                                                n_rub = de_rub[1].Trim();

                                                using (lab_liecEntities data_areas = new lab_liecEntities())
                                                {
                                                    var i_areas = (from t_areas in data_areas.fact_areas
                                                                   join t_est in data_areas.fact_est_areas on t_areas.id_est_areas equals t_est.id_est_area
                                                                   where t_areas.cod_area == n_rub

                                                                   select new
                                                    {
                                                        t_areas.cod_area,
                                                        t_est.desc_est_area,
                                                        t_areas.desc_areas,
                                                        t_areas.fecha_registro
                                                    }).OrderBy(x => x.cod_area).ToList();

                                                    gv_areas.DataSource = i_areas;
                                                    gv_areas.DataBind();
                                                    gv_areas.Visible = true;
                                                }
                                            }
                                        }
                                        catch
                                        {
                                            txt_areas_coment.Text = null;
                                            txt_buscar_areas.Text = null;
                                            Mensaje("Área no existe, favor de revisar.");
                                        }
                                        Mensaje("Datos de área actualizados con éxito.");
                                    }
                                    else
                                    {
                                        limp_txt_area();
                                        Mensaje("Área ya existe en la base de datos, favor de revisar.");
                                    }
                                }
                            }
                        }
                    }
                }
                catch
                { }
            }
        }