Ejemplo n.º 1
0
 public void GravarUngs(string licid, string ungid)
 {
     try{
     int _licid = int.Parse(licid);
     int _ungid = int.Parse(ungid);
     var ctx = new GedEntities();
     var pesq = ctx.LICITACAOUNG.Where(l => l.LICID == _licid && l.LICUNG == _ungid).ToList();
         if (pesq.Count == 0)
         {
             var lung = new LICITACAOUNG()
             {
                 LICID = _licid,
                 LICUNG = _ungid
             };
             ctx.LICITACAOUNG.Add(lung);
             ctx.SaveChanges();
             TempData["MsgFixa"] = "Gravado com sucesso.";
         }
     }
     catch (Exception ex)
     {
         TempData["MsgErro"] = "Erro, "+ex.Message;
     }
 }
Ejemplo n.º 2
0
        public ActionResult IncluirCheque(FormCollection frm)
        {
            int prcid = int.Parse(frm["txt_procid"].ToString());
            try
            {
                var proc = new Processo().GetProcesso(prcid);
                var db = new GedEntities();
                var chq = new CHEQUES();
                chq.TPDOC = "605";
                chq.CODMUN = proc.PRC_CODMUN.ToString(); ;
                chq.EXEORC = proc.PRC_DTREFDOC.Substring(2, 4) + "00";
                chq.ORGAO = proc.PRC_ORGAO.ToString(); ;
                chq.UNDORC = proc.PRC_UND_ORC.ToString(); ;
                chq.DTEMISNOTA = new Funcoes().AAAAMMDDSEMBARRA(proc.PRC_DTPAGAM.ToString());
                chq.NOTAEMP = proc.PRC_NOTAEMP.ToString();
                chq.NUMSUBEMP = proc.PRC_NUMSUBEMP ?? "000";
                chq.NOTAPAG = proc.PRC_NOTAPAG ?? "00000000";
                chq.DTREFDOC = proc.PRC_DTREFDOC.Substring(2,4) + proc.PRC_DTREFDOC.Substring(0,2);

                chq.DTEMISCHQ = new Funcoes().AAAAMMDDDataAtual();
                chq.TIPO = "2";
                chq.SITU = 9;

                chq.BANCO = new Funcoes().ZeroEsquerda(frm["txt_banco"].ToString(), 4);
                chq.CONTA = new Funcoes().ZeroEsquerda(frm["txt_conta"].ToString(), 9);
                chq.AGENCIA = new Funcoes().ZeroEsquerda(frm["txt_agencia"].ToString(), 6);
                chq.NCHQNDOC = frm["txt_numchq"].ToString();
                chq.VRCHEQUE = Convert.ToDecimal(frm["txt_valor"].Replace(".", ","));

                var _db = new GedEntities();
                _db.CHEQUES.Add(chq);
                _db.SaveChanges();
                TempData["Msg"] = "Cheque gravado com sucesso.";

            }catch(Exception ex)
            {
                TempData["MsgErro"] = "Erro, " + ex.Message;
            }
            return RedirectToAction("Edit", new { id = prcid });
        }
Ejemplo n.º 3
0
        public ActionResult Edit(FormCollection frm)
        {
            int licid = 0;
            try
            {
                licid = int.Parse(frm["txt_licid"].ToString());

                var ctx = new GedEntities();
                var lic = ctx.LICITACAO.Find(licid);
                //lic.ID = licid;
                lic.TPDOC = "501";
                lic.CODMUN = db.LICITACAO.First().CODMUN;
                lic.NUMPROC = frm["txt_numproc"].ToString();
                lic.MODALPROC = frm["MODALPROC"].ToString();
                lic.DESCOBJ = frm["txt_obj"].ToString();
                lic.TOTALORC = decimal.Parse(frm["txt_total"].ToString());
                lic.DTREAL = frm["txt_dtreal"].ToString();
                lic.MODALIC = frm["MODALIC"].ToString();
                lic.TIPOLIC = frm["txt_tipo"].ToString();
                lic.DTREFDOC = frm["txt_dtrefdoc"].ToString();

                ctx.SaveChanges();

                TempData["Msg"] = "Gravado com sucessso.";
                CarregarListas(licid);
                return View(licitacao);
            }
            catch(Exception ex)
            {
                TempData["Error"] = "Erro, verifique os dados e tente novamente, "+ex.Message;
                CarregarListas(licid);
                return View(licitacao);
            }
        }