示例#1
0
    private void GridView()
    {
        PCMSODAL ObjPCMSODAL = new PCMSODAL();

        GridView1.DataSource = ObjPCMSODAL.SelectAll(txtCliente.Text);
        GridView1.DataBind();
    }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         PCMSODAL ObjPCMSODAL = new PCMSODAL();
         GridView1.DataSource = ObjPCMSODAL.PCMSO_Completo(Convert.ToInt32(Request.QueryString["idCliente"]), Convert.ToInt32(Request.QueryString["id"]));
         GridView1.DataBind();
         ClienteDadosBasicos1.IdCliente = Convert.ToInt32(Request.QueryString["idCliente"]);
     }
 }
示例#3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         PCMSODAL ObjPCMSODAL = new PCMSODAL();
         GridView1.DataSource = ObjPCMSODAL.PCMSO_Completo(Convert.ToInt32(Request.QueryString["idCliente"]), Convert.ToInt32(Request.QueryString["id"]));
         GridView1.DataBind();
         ClienteDadosBasicos1.IdCliente = Convert.ToInt32(Request.QueryString["idCliente"]);
     }
 }
示例#4
0
    //Salva o PCMSO
    protected void btnSalvar_Click(object sender, EventArgs e)
    {
        try
        {
            Validacoes ObjValidacoes = new Validacoes();
            //Preenche dados referente a tabela PCMSO
            PCMSO ObjPCMSO = new PCMSO();
            ObjPCMSO.id        = Convert.ToInt32(Request.QueryString["id"]);
            ObjPCMSO.idCliente = Convert.ToInt32(ddlCliente.ValorInformado);
            //Preenche dados referente a tabela PCMSOXSetor
            ObjPCMSO.RefObjPCMSOXSetor.idSetor = Convert.ToInt32(ClienteSetor1.ValorInformado);
            ObjPCMSO.RefObjPCMSOXSetor.idCargo = Convert.ToInt32(ClienteCargo1.ValorInformado);
            //Preenche dados referente a tabela PCMSOXRiscosOcupacionais em uma lista
            if (RiscosOcupacionais1.ValorInformado != string.Empty && RiscosOcupacionaisItens1.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais1.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens1.ValorInformado)));
            }
            if (RiscosOcupacionais2.ValorInformado != string.Empty && RiscosOcupacionaisItens2.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais2.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens2.ValorInformado)));
            }
            if (RiscosOcupacionais3.ValorInformado != string.Empty && RiscosOcupacionaisItens3.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais3.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens3.ValorInformado)));
            }
            if (RiscosOcupacionais4.ValorInformado != string.Empty && RiscosOcupacionaisItens4.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais4.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens4.ValorInformado)));
            }
            if (RiscosOcupacionais5.ValorInformado != string.Empty && RiscosOcupacionaisItens5.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais5.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens5.ValorInformado)));
            }
            if (RiscosOcupacionais6.ValorInformado != string.Empty && RiscosOcupacionaisItens6.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais6.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens6.ValorInformado)));
            }
            if (RiscosOcupacionais7.ValorInformado != string.Empty && RiscosOcupacionaisItens7.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais7.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens7.ValorInformado)));
            }
            if (RiscosOcupacionais8.ValorInformado != string.Empty && RiscosOcupacionaisItens8.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais8.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens8.ValorInformado)));
            }
            if (RiscosOcupacionais9.ValorInformado != string.Empty && RiscosOcupacionaisItens9.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais9.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens9.ValorInformado)));
            }
            if (RiscosOcupacionais10.ValorInformado != string.Empty && RiscosOcupacionaisItens10.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais10.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens10.ValorInformado)));
            }
            //Preenche dados referente a tabela PCMSOXExamesComplementares em uma lista
            //Exame Admissional
            if (ddlAdm1.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm1.ValorInformado), null));
            }
            if (ddlAdm2.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm2.ValorInformado), null));
            }
            if (ddlAdm3.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm3.ValorInformado), null));
            }
            if (ddlAdm4.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm4.ValorInformado), null));
            }
            if (ddlAdm5.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm5.ValorInformado), null));
            }
            if (ddlAdm6.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm6.ValorInformado), null));
            }
            if (ddlAdm7.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm7.ValorInformado), null));
            }
            if (ddlAdm8.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm8.ValorInformado), null));
            }
            if (ddlAdm9.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm9.ValorInformado), null));
            }
            if (ddlAdm10.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm10.ValorInformado), null));
            }
            //Exame Periodico
            if (ddlPer1.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer1.ValorInformado), Convert.ToString(ddlPeriodicidade1.ValorInformado)));
            }
            if (ddlPer2.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer2.ValorInformado), Convert.ToString(ddlPeriodicidade2.ValorInformado)));
            }
            if (ddlPer3.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer3.ValorInformado), Convert.ToString(ddlPeriodicidade3.ValorInformado)));
            }
            if (ddlPer4.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer4.ValorInformado), Convert.ToString(ddlPeriodicidade4.ValorInformado)));
            }
            if (ddlPer5.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer5.ValorInformado), Convert.ToString(ddlPeriodicidade5.ValorInformado)));
            }
            if (ddlPer6.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer6.ValorInformado), Convert.ToString(ddlPeriodicidade6.ValorInformado)));
            }
            if (ddlPer7.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer7.ValorInformado), Convert.ToString(ddlPeriodicidade7.ValorInformado)));
            }
            if (ddlPer8.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer8.ValorInformado), Convert.ToString(ddlPeriodicidade8.ValorInformado)));
            }
            if (ddlPer9.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer9.ValorInformado), Convert.ToString(ddlPeriodicidade9.ValorInformado)));
            }
            if (ddlPer10.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer10.ValorInformado), Convert.ToString(ddlPeriodicidade10.ValorInformado)));
            }
            //Exame Demissional
            if (ddlDem1.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem1.ValorInformado), null));
            }
            if (ddlDem2.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem2.ValorInformado), null));
            }
            if (ddlDem3.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem3.ValorInformado), null));
            }
            if (ddlDem4.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem4.ValorInformado), null));
            }
            if (ddlDem5.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem5.ValorInformado), null));
            }
            if (ddlDem6.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem6.ValorInformado), null));
            }
            if (ddlDem7.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem7.ValorInformado), null));
            }
            if (ddlDem8.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem8.ValorInformado), null));
            }
            if (ddlDem9.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem9.ValorInformado), null));
            }
            if (ddlDem10.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem10.ValorInformado), null));
            }
            //Exame Mudança de Função
            if (ddlMud1.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud1.ValorInformado), null));
            }
            if (ddlMud2.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud2.ValorInformado), null));
            }
            if (ddlMud3.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud3.ValorInformado), null));
            }
            if (ddlMud4.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud4.ValorInformado), null));
            }
            if (ddlMud5.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud5.ValorInformado), null));
            }
            if (ddlMud6.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud6.ValorInformado), null));
            }
            if (ddlMud7.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud7.ValorInformado), null));
            }
            if (ddlMud8.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud8.ValorInformado), null));
            }
            if (ddlMud9.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud9.ValorInformado), null));
            }
            if (ddlMud10.ValorInformado != string.Empty)
            {
                ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud10.ValorInformado), null));
            }

            //Chama o DAL
            PCMSODAL ObjPCMSODAL = new PCMSODAL();
            ObjPCMSODAL.Insert(ObjPCMSO);
        }
        catch (Exception ex)
        {
            Response.Write(ex);
            Response.End();
        }
    }
示例#5
0
    private void Deletar(int id)
    {
        PCMSODAL ObjPCMSODAL = new PCMSODAL();

        ObjPCMSODAL.Delete(id);
    }
    //Salva o PCMSO
    protected void btnSalvar_Click(object sender, EventArgs e)
    {
        try
        {
            Validacoes ObjValidacoes = new Validacoes();
            //Preenche dados referente a tabela PCMSO
            PCMSO ObjPCMSO = new PCMSO();
            ObjPCMSO.id = Convert.ToInt32(Request.QueryString["id"]);
            ObjPCMSO.idCliente = Convert.ToInt32(ddlCliente.ValorInformado);
            //Preenche dados referente a tabela PCMSOXSetor
            ObjPCMSO.RefObjPCMSOXSetor.idSetor = Convert.ToInt32(ClienteSetor1.ValorInformado);
            ObjPCMSO.RefObjPCMSOXSetor.idCargo = Convert.ToInt32(ClienteCargo1.ValorInformado);
            //Preenche dados referente a tabela PCMSOXRiscosOcupacionais em uma lista
            if (RiscosOcupacionais1.ValorInformado != string.Empty && RiscosOcupacionaisItens1.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais1.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens1.ValorInformado)));
            if (RiscosOcupacionais2.ValorInformado != string.Empty && RiscosOcupacionaisItens2.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais2.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens2.ValorInformado)));
            if (RiscosOcupacionais3.ValorInformado != string.Empty && RiscosOcupacionaisItens3.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais3.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens3.ValorInformado)));
            if (RiscosOcupacionais4.ValorInformado != string.Empty && RiscosOcupacionaisItens4.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais4.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens4.ValorInformado)));
            if (RiscosOcupacionais5.ValorInformado != string.Empty && RiscosOcupacionaisItens5.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais5.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens5.ValorInformado)));
            if (RiscosOcupacionais6.ValorInformado != string.Empty && RiscosOcupacionaisItens6.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais6.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens6.ValorInformado)));
            if (RiscosOcupacionais7.ValorInformado != string.Empty && RiscosOcupacionaisItens7.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais7.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens7.ValorInformado)));
            if (RiscosOcupacionais8.ValorInformado != string.Empty && RiscosOcupacionaisItens8.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais8.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens8.ValorInformado)));
            if (RiscosOcupacionais9.ValorInformado != string.Empty && RiscosOcupacionaisItens9.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais9.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens9.ValorInformado)));
            if (RiscosOcupacionais10.ValorInformado != string.Empty && RiscosOcupacionaisItens10.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXRiscosOcupacionais.Add(new PCMSOXRiscosOcupacionais(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), Convert.ToInt32(RiscosOcupacionais10.ValorInformado), Convert.ToInt32(RiscosOcupacionaisItens10.ValorInformado)));
            //Preenche dados referente a tabela PCMSOXExamesComplementares em uma lista
            //Exame Admissional
            if (ddlAdm1.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm1.ValorInformado),null));
            if (ddlAdm2.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm2.ValorInformado), null));
            if (ddlAdm3.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm3.ValorInformado), null));
            if (ddlAdm4.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm4.ValorInformado), null));
            if (ddlAdm5.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm5.ValorInformado), null));
            if (ddlAdm6.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm6.ValorInformado), null));
            if (ddlAdm7.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm7.ValorInformado), null));
            if (ddlAdm8.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm8.ValorInformado), null));
            if (ddlAdm9.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm9.ValorInformado), null));
            if (ddlAdm10.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 1, Convert.ToInt32(ddlAdm10.ValorInformado), null));
            //Exame Periodico
            if (ddlPer1.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer1.ValorInformado), Convert.ToString(ddlPeriodicidade1.ValorInformado)));
            if (ddlPer2.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer2.ValorInformado), Convert.ToString(ddlPeriodicidade2.ValorInformado)));
            if (ddlPer3.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer3.ValorInformado), Convert.ToString(ddlPeriodicidade3.ValorInformado)));
            if (ddlPer4.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer4.ValorInformado), Convert.ToString(ddlPeriodicidade4.ValorInformado)));
            if (ddlPer5.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer5.ValorInformado), Convert.ToString(ddlPeriodicidade5.ValorInformado)));
            if (ddlPer6.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer6.ValorInformado), Convert.ToString(ddlPeriodicidade6.ValorInformado)));
            if (ddlPer7.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer7.ValorInformado), Convert.ToString(ddlPeriodicidade7.ValorInformado)));
            if (ddlPer8.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer8.ValorInformado), Convert.ToString(ddlPeriodicidade8.ValorInformado)));
            if (ddlPer9.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer9.ValorInformado), Convert.ToString(ddlPeriodicidade9.ValorInformado)));
            if (ddlPer10.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 3, Convert.ToInt32(ddlPer10.ValorInformado), Convert.ToString(ddlPeriodicidade10.ValorInformado)));
            //Exame Demissional
            if (ddlDem1.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem1.ValorInformado), null));
            if (ddlDem2.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem2.ValorInformado), null));
            if (ddlDem3.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem3.ValorInformado), null));
            if (ddlDem4.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem4.ValorInformado), null));
            if (ddlDem5.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem5.ValorInformado), null));
            if (ddlDem6.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem6.ValorInformado), null));
            if (ddlDem7.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem7.ValorInformado), null));
            if (ddlDem8.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem8.ValorInformado), null));
            if (ddlDem9.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem9.ValorInformado), null));
            if (ddlDem10.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 2, Convert.ToInt32(ddlDem10.ValorInformado), null));
            //Exame Mudança de Função
            if (ddlMud1.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud1.ValorInformado), null));
            if (ddlMud2.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud2.ValorInformado), null));
            if (ddlMud3.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud3.ValorInformado), null));
            if (ddlMud4.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud4.ValorInformado), null));
            if (ddlMud5.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud5.ValorInformado), null));
            if (ddlMud6.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud6.ValorInformado), null));
            if (ddlMud7.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud7.ValorInformado), null));
            if (ddlMud8.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud8.ValorInformado), null));
            if (ddlMud9.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud9.ValorInformado), null));
            if (ddlMud10.ValorInformado != string.Empty) ObjPCMSO.RefPCMSOXExamesComplementares.Add(new PCMSOXExamesComplementares(ObjPCMSO.id, Convert.ToInt32(ClienteCargo1.ValorInformado), 4, Convert.ToInt32(ddlMud10.ValorInformado), null));

            //Chama o DAL
            PCMSODAL ObjPCMSODAL = new PCMSODAL();
            ObjPCMSODAL.Insert(ObjPCMSO);
        }
        catch (Exception ex)
        {
            Response.Write(ex);
            Response.End();
        }
    }
 private void GridView()
 {
     PCMSODAL ObjPCMSODAL = new PCMSODAL();
     GridView1.DataSource = ObjPCMSODAL.SelectAll(txtCliente.Text);
     GridView1.DataBind();
 }
 private void Deletar(int id)
 {
     PCMSODAL ObjPCMSODAL = new PCMSODAL();
     ObjPCMSODAL.Delete(id);
 }