public SentintaView(int _CURENT_USER_ID, int _ID_PROCES_STADIU, string conStr) { ProcesStadiu ps = new ProcesStadiu(_CURENT_USER_ID, conStr, _ID_PROCES_STADIU); this.CurSentinta = (Sentinta)ps.GetSentinta().Result; ContracteRepository cr = new ContracteRepository(_CURENT_USER_ID, conStr); this.Sentinte = (Sentinta[])cr.GetAll().Result; }
public JsonResult Delete(int id) { response r = new response(); string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString; int _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]); //DosareRepository dr = new DosareRepository(_CURENT_USER_ID, conStr); ProcesStadiu ps = new ProcesStadiu(_CURENT_USER_ID, conStr, id); r = ps.Delete(); return(Json(r, JsonRequestBehavior.AllowGet)); }
public JsonResult GetStadiuCurent(int id) { response r = new response(); string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString; int _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]); Proces p = new Proces(_CURENT_USER_ID, conStr, id); ProcesStadiu ps = (ProcesStadiu)p.GetStadiuCurent().Result; ProcesStadiuExtended toReturn = new ProcesStadiuExtended(ps); return(Json(JsonConvert.SerializeObject(toReturn, Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter() { DateTimeFormat = CommonFunctions.DATE_FORMAT }), JsonRequestBehavior.AllowGet)); }
//[AuthorizeUser(ActionName = "Dosare", Recursive = false)] public JsonResult ImportSedintaPortal(int IdSedintaPortal, ProcesStadiu ProcesStadiu, Sentinta Sentinta) { response r = new response(); string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString; int uid = Convert.ToInt32(Session["CURENT_USER_ID"]); if (Sentinta.NR_SENTINTA != null && Sentinta.DATA_SENTINTA != null) { Sentinta s = new Sentinta(uid, conStr); PropertyInfo[] pis1 = Sentinta.GetType().GetProperties(); foreach (PropertyInfo pi in pis1) { pi.SetValue(s, pi.GetValue(Sentinta)); } r = s.Insert(); if (r.Status) { ProcesStadiu.ID_SENTINTA = r.InsertedId; } } ProcesStadiu ps = new ProcesStadiu(uid, conStr); PropertyInfo[] pis = ProcesStadiu.GetType().GetProperties(); foreach (PropertyInfo pi in pis) { pi.SetValue(ps, pi.GetValue(ProcesStadiu)); } r = ps.Insert(); if (r.Status) { try { SedintaPortal sp = new SedintaPortal(uid, conStr, IdSedintaPortal); sp.Delete(); } catch (Exception exp) { LogWriter.Log(exp); } } return(Json(r, JsonRequestBehavior.AllowGet)); }
public JsonResult Edit(ProcesStadiuExtended ProcesStadiuExtended) { response toReturn = new response(); string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString; int uid = Convert.ToInt32(Session["CURENT_USER_ID"]); Sentinta s = null; ProcesStadiu ps = null; if (ProcesStadiuExtended != null) { if (ProcesStadiuExtended.Sentinta != null && ProcesStadiuExtended.ProcesStadiu.ID_SENTINTA != null) { s = new Sentinta(uid, conStr); PropertyInfo[] pis = ProcesStadiuExtended.Sentinta.GetType().GetProperties(); foreach (PropertyInfo pi in pis) { pi.SetValue(s, pi.GetValue(ProcesStadiuExtended.Sentinta)); } } ps = new ProcesStadiu(uid, conStr); PropertyInfo[] pis2 = ProcesStadiuExtended.ProcesStadiu.GetType().GetProperties(); foreach (PropertyInfo pi in pis2) { pi.SetValue(ps, pi.GetValue(ProcesStadiuExtended.ProcesStadiu)); } } if (ps.ID == null) // insert { if (!ProcesStadiuExtended.Stadiu.STADIU_CU_SENTINTA) { ps.ID_SENTINTA = null; s = null; } if (s != null) { toReturn = s.Insert(); } if (s == null || toReturn.Status) { toReturn = ps.Insert(); toReturn.Message = JsonConvert.SerializeObject(new ProcesStadiuExtended(ps), Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter() { DateTimeFormat = CommonFunctions.DATE_FORMAT }); } } else //update { ProcesStadiu existingPS = new ProcesStadiu(uid, conStr, Convert.ToInt32(ps.ID)); if (!ProcesStadiuExtended.Stadiu.STADIU_CU_SENTINTA) { ps.ID_SENTINTA = null; } if (existingPS.ID_SENTINTA != null && ps.ID_SENTINTA != null) { toReturn = s.Update(); } if (existingPS.ID_SENTINTA == null && ps.ID_SENTINTA != null) { toReturn = s.Insert(); if (toReturn.Status) { ps.ID_SENTINTA = toReturn.InsertedId; } } if (existingPS.ID_SENTINTA != null && ps.ID_SENTINTA == null) { if (s != null) { toReturn = s.Delete(); } } if (toReturn.Status) { toReturn = ps.Update(); toReturn.Message = JsonConvert.SerializeObject(new ProcesStadiuExtended(ps), Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter() { DateTimeFormat = CommonFunctions.DATE_FORMAT }); } } return(Json(toReturn, JsonRequestBehavior.AllowGet)); }