Ejemplo n.º 1
0
        public async void Exporta(string filename, string almacen, string dbname)
        {
            FileHelper fileHelper   = new FileHelper();
            string     file_exit    = "RES_ALMACEN_" + almacen + ".csv";
            string     errorMessage = null;

            try
            {
                List <UbiNoc> ubics = new List <UbiNoc>();
                //ubics = await App.Database.GetItemsAsync();
                ubics = await App.Database.GetUbiNocFich(filename);

                fileHelper.AppendText(file_exit, "CO_UNIDAD|"
                                      + "DS_UNIDAD|"
                                      + "FhAuditoria|"
                                      + "UBICACION|"
                                      + "DM|"
                                      + "NOC|"
                                      + "DS_NOC|"
                                      + "CANT_SIGLE|"
                                      + "CANT_REAL|"
                                      + "ESTADO_OP|"
                                      + "OBS|"
                                      + "ERROR|" + "REVISADA|FICHERO"
                                      + Environment.NewLine);
                foreach (UbiNoc ubinoci in ubics)
                {
                    fileHelper.AppendText(file_exit, ubinoci.Uco + "|"
                                          + ubinoci.DsUco + "|"
                                          + ubinoci.FhAuditoria + "|"
                                          + ubinoci.Ubicacion + "|"
                                          + ubinoci.DataMining + "|"
                                          + ubinoci.Noc + "|"
                                          + ubinoci.Descripcion + "|"
                                          + ubinoci.Cantidad + "|"
                                          + ubinoci.CantReal + "|"
                                          + ubinoci.EstadoOp + "|"
                                          + ubinoci.Obs + "|"
                                          + ubinoci.Error + "|" + ubinoci.Check + "|" + ubinoci.Fichero
                                          + Environment.NewLine);
                }
            }
            catch (Exception exc)
            {
                errorMessage = exc.Message;
            }
        }
Ejemplo n.º 2
0
        public void AppendLog(Exception ex, LogMessageType messageType)
        {
            string fileName = LogPath + LogHelper.GetFileNameYYYMMDD(_fileType, _fileExt);

            string textEntry = LogHelper.BuildExceptionMessage(ex, messageType);

            Console.WriteLine(textEntry);

            FileHelper.AppendText(fileName, textEntry);
        }
Ejemplo n.º 3
0
        // Help methods that use our FileSystem abstraction
        public void AppendLog(String message, LogMessageType messageType)
        {
            string textEntry = string.Format("{0:MM-dd-yyyy HH:mm:ss:ffff} :{1}: [{2}] {3}", DateTime.Now, System.Threading.Thread.CurrentThread.ManagedThreadId, messageType.ToString(), message);

            Console.WriteLine(textEntry);

            string fileName = LogPath + LogHelper.GetFileNameYYYMMDD(_fileType, _fileExt);

            FileHelper.AppendText(fileName, textEntry);
        }
Ejemplo n.º 4
0
 private void WriteOrAppendFile(string outputFileName, string content, string encoding = "utf-8", bool append = false)
 {
     if (append)
     {
         FileHelper.AppendText(outputFileName, content, System.Text.Encoding.GetEncoding(encoding));
     }
     else
     {
         FileHelper.WriteText(outputFileName, content, System.Text.Encoding.GetEncoding(encoding));
     }
 }
 public string WirteText()
 {
     try
     {
         string txtpath = "/Upload/test.txt";
         string path    = System.Web.Hosting.HostingEnvironment.MapPath(txtpath);//对应物理路径
         FileHelper.CreateFile(path);
         string txt = string.Empty;
         txt += " 当前执行时间: " + DateTime.Now.ToString() + "\r\n";
         FileHelper.AppendText(path, txt);
     }
     catch (Exception)
     {
     }
     return("ok");
 }
Ejemplo n.º 6
0
 private void WriteLog(string msg)
 {
     FileHelper.AppendText("ErrorLog.txt", msg + "\n");
 }