示例#1
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 });
        }
示例#2
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;
     }
 }
示例#3
0
        public ActionResult Download(int? id)
        {
            //string path = HttpContext.Server.MapPath("~/DOCS/");
            try
            {
                var list = new GedEntities().DOCUMENTOS.Where(d => d.DOC_PROC_ID == id).ToList();
                if (list.Count == 0)
                {
                    throw new Exception("Não existe documentos para download.");
                }

                using (ZipFile zip = new ZipFile())
                {
                    zip.AlternateEncodingUsage = ZipOption.AsNecessary;
                    //zip.AddDirectoryByName("Files");
                    zip.AddDirectoryByName("DOCS_" + id.ToString());
                    foreach (var doc in list)
                    {
                        // Get every file size
                        //byte[] fileBytes = System.IO.File.ReadAllBytes(Server.MapPath("~/DOCS/"+doc.DOC_ARQUIVO));
                        // Get every file path
                        string filePath = Server.MapPath("~/DOCS/" + doc.DOC_ARQUIVO);
                        //zip.AddFile(filePath, "Files");
                        zip.AddFile(filePath, "DOCS_" + id.ToString());
                    }
                    Response.Clear();
                    Response.BufferOutput = false;
                    //string zipName = String.Format("Zip_{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss"));
                    string zipName = String.Format("Zip_DOCS_{0}.zip", id.ToString());
                    Response.ContentType = "application/zip";
                    Response.AddHeader("content-disposition", "attachment; filename=" + zipName);
                    zip.Save(Response.OutputStream);
                    Response.End();
                }
            }
            catch(Exception ex)
            {
                TempData["MsgErro"] = "Erro, " + ex.Message;
            }
            return RedirectToAction("Documentos", new { procID=id });
        }
示例#4
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);
            }
        }