コード例 #1
0
        protected void btnGravar_Click(object sender, EventArgs e)
        {
            tblPreventivaAtividade table = new tblPreventivaAtividade();

            try
            {
                table.cmpCoPreventivaAtividade     = ((ListItem)lstAtividadeObra.SelectedItem).Value;
                table.cmpDcItemAtividadePreventiva = txtDescriptionItemObra.Text;
                table.cmpNoUsuario = ((HzLogin)Session["login"]).cmpNoUsuario;

                if (table.UpDate(Global.GetConnection()))
                {
                    this.loadObraAtividades();
                }
                if (ViewState["IdEquipamentoObra"] != null)
                {
                    tblPreventivaEquipamentocs PrevEquip = new tblPreventivaEquipamentocs();
                    //((ListItem)cmbGrupoAtividade.SelectedItem).Value;
                    int grupoAtividade = int.Parse(cmbGrupoAtividade.SelectedItem.Value.ToString());
                    PrevEquip.IncluirPreventivaEquipamentos(Global.GetConnection(), int.Parse(ViewState["cmpCoPreventiva"].ToString()), int.Parse(ViewState["IdEquipamentoObra"].ToString()), grupoAtividade);
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
            }
        }
コード例 #2
0
        /// <summary>
        /// Evento de clique do botão.
        /// Adiciona uma atividade da obra.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAddAtividade_Click(object sender, EventArgs e)
        {
            tblPreventivaAtividade table = new tblPreventivaAtividade();

            try
            {
                table.cmpCoPreventivaAtividade     = "0";
                table.cmpCoObraGrupoLista          = ((ListItem)cmbObra.SelectedItem).Value;
                table.cmpCoPreventiva              = ViewState["cmpCoPreventiva"] == null ? "0" : ViewState["cmpCoPreventiva"].ToString();
                table.cmpCoPeriodicidade           = ((ListItem)cmbPeriodicidade.SelectedItem).Value;
                table.cmpCoTipoAtividade           = ((ListItem)cmbTipoAtividade.SelectedItem).Value;
                table.cmpCoItemAtividade           = ((ListItem)lstItemAtividade.SelectedItem).Value;
                table.cmpTpPreventiva              = ((ListItem)rdbType.SelectedItem).Value;
                table.cmpDcItemAtividadePreventiva = ((ListItem)lstItemAtividade.SelectedItem).Text.TrimEnd();
                table.cmpNoUsuario = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpNoUsuario.TrimEnd();
                if (!(ViewState["cmpCoPreventiva"] = table.Save(Global.GetConnection())).Equals("0"))
                {
                    this.loadObraAtividades();
                }
            }
            catch (Exception ex)
            {
                Global.ShowError(Global.Title, ex);
            }
        }
コード例 #3
0
        public bool SetlstAgendaPreventivaValoresAtividade1()
        {
            if (Session["cmpcousuario"] != null)
            {
                tblPreventivaAtividade prevAtividade = new tblPreventivaAtividade();
                prevAtividade.cmpCoPreventivaAtividade = "2";
                prevAtividade.cmpValores = true;
                prevAtividade.cmpValor   = 10;
                prevAtividade.cmpCkValor = true;
                prevAtividade.UpdadeValores(Global.GetConnection());

                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        protected void btnSalvarEspelho_Click(object sender, EventArgs e)
        {
            tblPreventiva preventiva = new tblPreventiva();

            ListCampos ls = new ListCampos();
            ListCampo lc = new ListCampo();
            lc.NomeCampo = "cmpCoPreventiva";
            lc.TipoCampo = TipoCampo.Numero;
            lc.ValorCampo = this.Session["cmpCoPreventiva"].ToString();
            ls.Add(lc);

            DataTable dtPreventiva = tblPreventiva.GetAll(Global.GetConnection(),ls);
            preventiva.cmpCoPreventiva = this.Session["cmpCoPreventiva"].ToString();
            preventiva.cmpCoObraGrupoLista = dtPreventiva.Rows[0]["cmpCoObraGrupoLista"].ToString();
            preventiva.cmpCoPeriodicidade = dtPreventiva.Rows[0]["cmpCoPeriodicidade"].ToString();
            preventiva.cmpCoTipoAtividade = dtPreventiva.Rows[0]["cmpCoTipoAtividade"].ToString();
            preventiva.cmpTpPreventiva = dtPreventiva.Rows[0]["cmpTpPreventiva"].ToString();
            preventiva.cmpNoUsuario = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpNoUsuario;
            DataTable dtCoPreventiva= preventiva.IncluirPreventivaEspelho(Global.GetConnection());

            for (int i = 0; i < dtPreventiva.Rows.Count-1; i++)
            {
                tblPreventivaAtividade table = new tblPreventivaAtividade();
                table.cmpCoPreventivaAtividade = "0";
                table.cmpCoObraGrupoLista = dtPreventiva.Rows[0]["cmpCoObraGrupoLista"].ToString();
                table.cmpCoPreventiva =dtCoPreventiva.Rows[0][0].ToString();
                table.cmpCoPeriodicidade =  dtPreventiva.Rows[0]["cmpCoPeriodicidade"].ToString();
                table.cmpCoTipoAtividade = dtPreventiva.Rows[0]["cmpCoTipoAtividade"].ToString();
                table.cmpCoItemAtividade = dtPreventiva.Rows[0]["cmpCoItemAtividade"].ToString();
                table.cmpTpPreventiva = dtPreventiva.Rows[0]["cmpTpPreventiva"].ToString();
                table.cmpDcItemAtividadePreventiva = dtPreventiva.Rows[0]["cmpDcItemAtividadePreventiva"].ToString();
                table.cmpNoUsuario = ((HzLibGeneral.Util.HzLogin)Session["login"]).cmpNoUsuario.TrimEnd();
                table.Save(Global.GetConnection());

                tblPreventivaEquipamentocs prevEquip = new tblPreventivaEquipamentocs();
                prevEquip.IncluirPreventivaEquipamentos(Global.GetConnection(), int.Parse(dtCoPreventiva.Rows[0][0].ToString()), int.Parse(Session["cmpIdEquipamentoObra"].ToString()), int.Parse(dtPreventiva.Rows[0]["cmpCoGrupoAtividade"].ToString()));
            }
           

            //prevatv.Save();
            this.ModalPopupExtender1.Show();
        }
コード例 #5
0
 public bool SetlstAgendaPreventivaValoresAtividade(List <tblPreventivaAtividade> lstListaAtividades)
 {
     if (Session["cmpcousuario"] != null)
     {
         for (int i = 0; i < lstListaAtividades.Count; i++)
         {
             tblPreventivaAtividade prevAtividade = new tblPreventivaAtividade();
             prevAtividade.cmpCoPreventivaAtividade = lstListaAtividades[i].cmpCoPreventivaAtividade;
             prevAtividade.cmpValores = lstListaAtividades[i].cmpValores;
             prevAtividade.cmpValor   = lstListaAtividades[i].cmpValor;
             prevAtividade.cmpCkValor = lstListaAtividades[i].cmpCkValor;
             prevAtividade.UpdadeValores(Global.GetConnection());
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }