コード例 #1
0
        public JsonResult Delete(int id)
        {
            string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            DocumenteScanateRepository dsr = new DocumenteScanateRepository(Convert.ToInt32(Session["CURENT_USER_ID"]), conStr);
            DocumentScanat             d   = (DocumentScanat)dsr.Find(id).Result;
            response r = d.Delete();

            return(Json(r, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public JsonResult RestoreOrphanDocument(int id)
        {
            string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int    _id    = Convert.ToInt32(Session["CURENT_USER_ID"]);
            DocumenteScanateRepository dsr = new DocumenteScanateRepository(_id, conStr);
            response r = dsr.RestoreOrphanDocument(id);

            return(Json(r, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
        public JsonResult Avizare(DocumentScanat CurDocumentScanat)
        {
            response r      = new response();
            string   conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            DocumenteScanateRepository dsr = new DocumenteScanateRepository(Convert.ToInt32(Session["CURENT_USER_ID"]), conStr);
            DocumentScanat             d   = (DocumentScanat)dsr.Find(Convert.ToInt32(CurDocumentScanat.ID)).Result;

            r = d.Avizare(CurDocumentScanat.VIZA_CASCO);
            return(Json(r, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
        //[AuthorizeUser(ActionName = "Dosare", Recursive = false)]
        //[AuthorizeToken]
        public JsonResult Detail(int id)
        {
            string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            DocumenteScanateRepository dsr = new DocumenteScanateRepository(Convert.ToInt32(Session["CURENT_USER_ID"]), conStr);
            response r = dsr.Find(id);

            //return Json(r, JsonRequestBehavior.AllowGet);
            JsonResult result = Json(r, JsonRequestBehavior.AllowGet);

            result.MaxJsonLength = Int32.MaxValue;
            return(result);
        }
コード例 #5
0
        public JsonResult GetOrphanDocuments()
        {
            string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int    id     = Convert.ToInt32(Session["CURENT_USER_ID"]);
            DocumenteScanateRepository dsr = new DocumenteScanateRepository(id, conStr);

            DocumentScanat[]      docs = (DocumentScanat[])dsr.GetOrphanDocuments().Result;
            List <OrphanDocument> ofs  = new List <OrphanDocument>();

            foreach (DocumentScanat ds in docs)
            {
                OrphanDocument od = new OrphanDocument();
                od.DOCUMENT_SCANAT = ds; od.SELECTED = true;
                ofs.Add(od);
            }
            return(Json(ofs, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        public JsonResult GetOrphanFiles()
        {
            string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            int    id     = Convert.ToInt32(Session["CURENT_USER_ID"]);
            DocumenteScanateRepository dsr = new DocumenteScanateRepository(id, conStr);

            string[]          files = (string[])dsr.GetOrphanFiles().Result;
            List <OrphanFile> ofs   = new List <OrphanFile>();

            foreach (string file in files)
            {
                OrphanFile of = new OrphanFile();
                of.FILE_NAME = file; of.SELECTED = true;
                ofs.Add(of);
            }
            return(Json(ofs, JsonRequestBehavior.AllowGet));
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: andpsy/socisaV2
        public static void RestoreOrphanDocuments()
        {
            string   LOG_FILE = "c:\\Uploads\\Log.txt";
            response r        = new response();
            string   conStr   = CommonFunctions.StringCipher.Decrypt(ConfigurationManager.ConnectionStrings["MySqlConnectionString"].ToString(), CommonFunctions.StringCipher.RetrieveKey());
            int      id       = 1;
            DocumenteScanateRepository dsr = new DocumenteScanateRepository(id, conStr);

            DocumentScanat[] docs = (DocumentScanat[])dsr.GetOrphanDocuments().Result;
            //FileManager.RestoreFilesFromDb(docs);
            StreamWriter sw = File.AppendText(LOG_FILE);

            sw.Write(String.Format("{0} documente orfane\r\n*****************************************************\r\n\r\n", docs.Length));
            sw.Flush(); sw.Dispose();
            foreach (DocumentScanat ds in docs)
            {
                r = FileManager.RestoreFileFromDb(ds);
                string message = String.Format("{0} ({1}) - {2}\r\n", ds.CALE_FISIER, ds.ID_DOSAR, r.Status ? "Recuperat" : r.Message);
                Console.Write(message);
                sw = File.AppendText(LOG_FILE);
                sw.Write(message);
                sw.Flush(); sw.Dispose();
            }
        }