public JsonResult Edit(DocumentScanatProces CurDocumentScanatProces)
        {
            response r      = new response();
            string   conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;

            if (CurDocumentScanatProces.ID == null)         // insert
            {
                DocumentScanatProces d   = new DocumentScanatProces(Convert.ToInt32(Session["CURENT_USER_ID"]), conStr);
                PropertyInfo[]       pis = CurDocumentScanatProces.GetType().GetProperties();
                foreach (PropertyInfo pi in pis)
                {
                    pi.SetValue(d, pi.GetValue(CurDocumentScanatProces));
                }
                r = d.Insert();
                //return Json(r, JsonRequestBehavior.AllowGet);
                JsonResult result = Json(r, JsonRequestBehavior.AllowGet);
                result.MaxJsonLength = Int32.MaxValue;
                return(result);
            }
            else // edit
            {
                DocumenteScanateProceseRepository dsr = new DocumenteScanateProceseRepository(Convert.ToInt32(Session["CURENT_USER_ID"]), conStr);
                DocumentScanatProces d = (DocumentScanatProces)dsr.Find(Convert.ToInt32(CurDocumentScanatProces.ID)).Result;
                //string s = JsonConvert.SerializeObject(CurDocumentScanat, Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter() { DateTimeFormat = "dd.MM.yyyy" });
                string s = CommonFunctions.GenerateJsonFromModifiedFields(d, CurDocumentScanatProces);
                r = d.Update(s);
                //return Json(r, JsonRequestBehavior.AllowGet);
                JsonResult result = Json(r, JsonRequestBehavior.AllowGet);
                result.MaxJsonLength = Int32.MaxValue;
                return(result);
            }
        }
        public JsonResult Delete(int id)
        {
            string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            DocumenteScanateProceseRepository dsr = new DocumenteScanateProceseRepository(Convert.ToInt32(Session["CURENT_USER_ID"]), conStr);
            DocumentScanatProces d = (DocumentScanatProces)dsr.Find(id).Result;
            response             r = d.Delete();

            return(Json(r, JsonRequestBehavior.AllowGet));
        }
        //[AuthorizeUser(ActionName = "Dosare", Recursive = false)]
        //[AuthorizeToken]
        public JsonResult Detail(int id)
        {
            string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            DocumenteScanateProceseRepository dsr = new DocumenteScanateProceseRepository(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);
        }