예제 #1
0
        protected void BtnConfirmDeleting_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 IdToDelete = Convert.ToInt32(HydIdToDelete.Value);

                ImageEFRepository   rep = new ImageEFRepository("");
                Ls.Prj.Entity.Image ImgToStoreInAudit = rep.SelectEntity(IdToDelete);


                //cancella la riga
                DeleteEntity(IdToDelete);

                //cancella l'immagine fisica
                string DestPdfFullPath = HttpContext.Current.Server.MapPath("~/Public/Photos/");
                string ImgName         = ImgToStoreInAudit.ImageName;
                System.IO.File.Delete(DestPdfFullPath + ImgName);

                AuditPageManager ObjPageManager = new AuditPageManager();
                ObjPageManager.InsertAudit(LoginUsr, "Image deleted: " + ImgToStoreInAudit.ImageName);


                BindRepeater();

                DivDelete.Attributes.Add("Class", "ParentDivDeleting Disattivato");
            }
            catch (Exception ex)
            {
                PrintError(ex);
            }
        }
        protected void BtnConfirmDeleting_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 IdToDelete = Convert.ToInt32(HydIdToDelete.Value);

                DocumentEFRepository rep = new DocumentEFRepository("");
                Document             DocToStoreInAudit = rep.SelectEntity(IdToDelete);

                //cancella i capitoli associati
                DeleteChapters(DocToStoreInAudit.IdDocument);
                //cancella la riga del documento
                DeleteEntity(IdToDelete);

                //cancella il pdf fisico
                string DestPdfFullPath = HttpContext.Current.Server.MapPath("~/Public/Images/");
                string PdfName         = DocToStoreInAudit.PDFName;

                if (PdfName != null)
                {
                    System.IO.File.Delete(DestPdfFullPath + PdfName);

                    AuditPageManager ObjPageManager = new AuditPageManager();
                    ObjPageManager.InsertAudit(LoginUsr, "Document deleted: " + DocToStoreInAudit.DocName);
                }
                BindRepeater();
                DivDelete.Attributes.Add("Class", "ParentDivDeleting Disattivato");
            }
            catch (Exception ex)
            {
                PrintError(ex);
            }
        }
예제 #3
0
        protected void BtnSalva_Click(object sender, EventArgs e)
        {
            try
            {
                AuditPageManager ObjPageManager = new AuditPageManager();
                //qui va validazione... meglio lato client
                if (Request.QueryString["Id"] != null)
                {
                    //modifica
                    Tag Result = UpdateTag(Convert.ToInt32(Request.QueryString["Id"]));

                    ObjPageManager.InsertAudit(LoginUsr, "Tag updated: " + Result.TagName + ", Machine: " + Result.Machine);
                }
                else
                {
                    Tag Result = InsertTag();

                    ObjPageManager.InsertAudit(LoginUsr, "Tag inserted: " + Result.TagName + ", Machine: " + Result.Machine);
                    //inserimento
                }
                Response.Redirect("Tags.aspx");
            }
            catch (Exception ex)
            {
                //qui segnalare errore su un pannello del form
                PrintError(ex);
            }
        }
예제 #4
0
        protected void BtnSalva_Click(object sender, EventArgs e)
        {
            try
            {
                AuditPageManager ObjPageManager = new AuditPageManager();
                //qui va validazione... meglio lato client
                if (Request.QueryString["Id"] != null)
                {
                    //modifica
                    Ls.Prj.Entity.Image Result = UpdateImg(Convert.ToInt32(Request.QueryString["Id"]));


                    ObjPageManager.InsertAudit(LoginUsr, "Tag updated: " + Result.ImageName);
                }
                else
                {
                    //inserimento

                    Ls.Prj.Entity.Image Result = InsertImg();
                    ObjPageManager.InsertAudit(LoginUsr, "Tag inserted: " + Result.ImageName);
                    //salva il documento definitivamente
                    string             OrigFullPath = HttpContext.Current.Server.MapPath("~/Public/Photos/Temp/");
                    string             DestFullPath = HttpContext.Current.Server.MapPath("~/Public/Photos/");
                    System.IO.FileInfo Fi           = new System.IO.FileInfo(OrigFullPath + HidTempFileNamePlusExt.Value);

                    string Name = Result.IdImage + "_" + TxtNomeImmagine.Text.Replace(" ", "_") + Fi.Extension;
                    try
                    {
                        System.IO.File.Move(OrigFullPath + HidTempFileNamePlusExt.Value, DestFullPath + Name);
                        try
                        {
                            Ls.Prj.Entity.Image Result2 = UpdateFileNameOfImg(Result.IdImage, Name);
                        }
                        catch (Exception ex)
                        {
                            PrintError(ex);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("No image, please upload it.");
                    }
                }
                Response.Redirect("Images.aspx");
            }
            catch (Exception ex)
            {
                //qui segnalare errore su un pannello del form
                PrintError(ex);
            }
        }
예제 #5
0
        protected void RepCapters_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Salva")
            {
                try
                {
                    TextBox TxtArg = (TextBox)e.Item.FindControl("TxtArg");
                    TextBox TxtDev = (TextBox)e.Item.FindControl("TxtDev");
                    TextBox TxtAli = (TextBox)e.Item.FindControl("TxtAli");
                    Literal LitOk  = (Literal)e.Item.FindControl("LitOk");
                    LitOk.Visible = true;

                    Chapter ModChap = UpdateChapter(Convert.ToInt32(e.CommandArgument), TxtArg.Text, TxtDev.Text, TxtAli.Text);

                    AuditPageManager ObjPageManager = new AuditPageManager();
                    ObjPageManager.InsertAudit(LoginUsr, "Chapter of document " + ModChap.Document.DocName + " updated: '" + ModChap.ChapterName + "'");
                }
                catch (Exception ex)
                {
                    PrintError(ex);
                }
            }
        }
예제 #6
0
        protected void BtnConfirmDeleting_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 IdToDelete = Convert.ToInt32(HydIdToDelete.Value);

                TagEFRepository rep = new TagEFRepository("");
                Tag             TagToStoreInAudit = rep.SelectEntity(IdToDelete);

                DeleteEntity(IdToDelete);

                AuditPageManager ObjPageManager = new AuditPageManager();
                ObjPageManager.InsertAudit(LoginUsr, "Tag deleted: " + TagToStoreInAudit.TagName + ", Machine: " + TagToStoreInAudit.Machine);


                BindRepeater();

                DivDelete.Attributes.Add("Class", "ParentDivDeleting Disattivato");
            }
            catch (Exception ex)
            {
                PrintError(ex);
            }
        }
예제 #7
0
        protected void BtnSalva_Click(object sender, EventArgs e)
        {
            try
            {
                AuditPageManager ObjPageManager = new AuditPageManager();
                //qui va validazione... meglio lato client
                if (Request.QueryString["Id"] != null)
                {
                    //modifica
                    Document Result = UpdateDoc(Convert.ToInt32(Request.QueryString["Id"]));


                    ObjPageManager.InsertAudit(LoginUsr, "Tag updated: " + Result.DocName);
                }
                else
                {
                    //inserimento

                    Document Result = InsertDoc();
                    ObjPageManager.InsertAudit(LoginUsr, "Tag inserted: " + Result.DocName);
                    //salva il documento definitivamente
                    string OrigPdfFullPath = HttpContext.Current.Server.MapPath("~/Public/Images/Temp/");
                    string DestPdfFullPath = HttpContext.Current.Server.MapPath("~/Public/Images/");
                    string PdfName         = Result.IdDocument + "_" + TxtNomeDocumento.Text.Replace(" ", "_") + ".pdf";
                    try
                    {
                        System.IO.File.Move(OrigPdfFullPath + HidTempFileName.Value, DestPdfFullPath + PdfName);
                        try
                        {
                            Document Result2 = UpdateFileNameOfDoc(Result.IdDocument, PdfName);
                            //ora estrae dal documento pdf i capitoli e se li salva nel db
                            //con numero di pagina
                            List <Title> TitleLst = Utility.ReadPdfFile(DestPdfFullPath + PdfName);
                            //per ciascun titolo salva nel db nei capitoli
                            foreach (Title CurrTit in TitleLst)
                            {
                                Chapter Cap = new Chapter();
                                Cap.ChapterName = CurrTit.Riga;
                                Cap.Argument    = Result.Argument;
                                Cap.Device      = Result.Device;
                                Cap.Alias       = Result.Alias;
                                Cap.PageNumber  = CurrTit.Pagina;
                                Cap.IdDocument  = Result.IdDocument;
                                Cap.Enabled     = true;

                                InsertChapter(Cap);
                            }
                            //Response.Redirect("DocumentDetail.aspx?Id=" + Result.IdDocument);
                            //Response.Redirect("Documents.aspx");
                        }
                        catch (Exception ex)
                        {
                            PrintError(ex);
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception("No pdf document, please upload it.");
                    }
                }
                Response.Redirect("Documents.aspx");
            }
            catch (Exception ex)
            {
                //qui segnalare errore su un pannello del form
                PrintError(ex);
            }
        }