Example #1
0
    public void SaveLogsToDB(int docversid, string tblname, int nrows)
    {
        SQL_utils sql2 = new SQL_utils();

        string htmlresults = "";

        foreach (ProcessLog log in logs)
        {
            numerrors   += log.numerrors;
            numwarnings += log.numwarnings;

            htmlresults += log.LogNotesToHtml();
        }


        string code1 = String.Format("insert into tblDocVers_ProcessingResults_OldLogs (  docversid, tblname, processing_results, nrows_attempted, numerrors, numwarnings, created, createdby, moved_to_oldlogs) " +
                                     " select docversid, tblname, processing_results, nrows_attempted, numerrors, numwarnings, created, createdby, getdate() from tblDocVers_ProcessingResults where docversid={0}", docversid);
        string code2 = String.Format("delete from tblDocVers_ProcessingResults where docversid={0}", docversid);

        string code3 = String.Format("insert into tblDocVers_ProcessingResults (docversid, tblname, processing_results, nrows_attempted, numerrors, numwarnings, created, createdby) values({0},'{1}','{2}',{3},{4},{5}, getdate(), sec.systemuser())"
                                     , docversid, tblname, LogNotesToHtml(), nrows, Numerrors(), Numwarnings());


        string result1 = sql2.NonQuery_from_SQLstring_withReturnMsg(code1);
        string result2 = sql2.NonQuery_from_SQLstring_withReturnMsg(code2);
        string result3 = sql2.NonQuery_from_SQLstring_withReturnMsg(code3);

        sql2.Close();
    }
Example #2
0
    protected void gv_CustomButtonCallback(object sender, ASPxGridViewCustomButtonCallbackEventArgs e)
    {
        ASPxGridView grid = sender as ASPxGridView;


        int    docversid = Convert.ToInt32(grid.GetRowValues(e.VisibleIndex, "docversid"));
        string fileext   = grid.GetRowValues(e.VisibleIndex, "fileext").ToString();

        if (docversid > 0)
        {
            SQL_utils sql = new SQL_utils("kawdata");

            if (e.ButtonID == "btnDel" | e.ButtonID == "btnDel2")
            {
                string result = sql.NonQuery_from_SQLstring_withReturnMsg(String.Format("exec def.spDeleteDocVers_and_Data {0}", docversid));

                try
                {
                    //Delete from file
                    string file_to_delete = Server.MapPath(String.Format("~/webdocs/DocVersID_{0}{1}", docversid, fileext));

                    if (File.Exists(file_to_delete))
                    {
                        File.Delete(file_to_delete);
                    }
                    else
                    {
                        Debug.WriteLine("DELETE FILE: ERROR - File Not Found.");
                    }
                }
                catch (IOException ioex)
                {
                    Debug.WriteLine(ioex.Message);
                }
            }
            else if (e.ButtonID == "btnZip" | e.ButtonID == "btnZip2")
            {
            }
        }

        //
    }