public ProcesView(int _CURENT_USER_ID, string conStr, string predefinedFilter) { NomenclatoareRepository tpr = new NomenclatoareRepository(_CURENT_USER_ID, conStr); this.TipuriProcese = (Nomenclator[])tpr.GetAll("tip_procese").Result; this.Instante = (Nomenclator[])tpr.GetAll("instante").Result; this.Complete = (Nomenclator[])tpr.GetAll("complete").Result; //ContracteRepository cr = new ContracteRepository(_CURENT_USER_ID, conStr); //this.Contracte = (Contract[])cr.GetAll().Result; ProceseRepository pr = new ProceseRepository(_CURENT_USER_ID, conStr); this.TipDocumenteScanateProcese = (string[])pr.GetTipDocumenteScanatePocese().Result; //PartiRepository par = new PartiRepository(_CURENT_USER_ID, conStr); //this.Parti = (Parte[])par.GetAll().Result; this.Calitati = (Nomenclator[])tpr.GetAll("calitati").Result; //Utilizator u = new Utilizator(_CURENT_USER_ID, conStr, _CURENT_USER_ID); //this.Societate = (SocietateAsigurare)u.GetSocietatiAsigurare().Result; this.Societate = new SocietateAsigurare(_CURENT_USER_ID, conStr, Convert.ToInt32(HttpContext.Current.Session["ID_SOCIETATE"])); //this.CurProces = new ProcesExtended(new Proces()); //this.procesJson = new ProcesJson(); StadiiRepository sr = new StadiiRepository(_CURENT_USER_ID, conStr); this.Stadii = (StadiuCombo[])sr.GetCombo().Result; this.Procese = null; this.CurProces = new ProcesExtended(new Proces()); this.FilteredRowsCount = 0; this.procesJson = new ProcesJson(); if (predefinedFilter != "empty") { try { //daca vrem sa aducem din start inregistrari !!! string initFilter = String.Format(" ((PROCESE.ID_DOSAR IS NULL AND (PROCESE.ID_RECLAMANT={0} OR PROCESE.ID_PARAT={0} OR PROCESE.ID_TERT={0})) OR (PROCESE.ID_DOSAR IS NOT NULL AND (DOSARE.ID_SOCIETATE_CASCO={0} OR DOSARE.ID_SOCIETATE_RCA={0}))) ", Convert.ToInt32(HttpContext.Current.Session["ID_SOCIETATE"])); ProceseRepository prep = new ProceseRepository(_CURENT_USER_ID, conStr); string filter = String.IsNullOrWhiteSpace(predefinedFilter) ? initFilter : predefinedFilter; string limit = String.Format(" LIMIT 0, {0} ", (CommonFunctions.ROWS_BLOCK_SIZE).ToString()); /* * this.Procese = (ProcesExtended[])prep.GetFilteredExtended(null, null, filter, limit).Result; * this.CurProces = this.Procese[0]; */ this.Procese = (Proces[])prep.GetFiltered(null, null, filter, limit).Result; this.CurProces = new ProcesExtended(this.Procese[0]); this.FilteredRowsCount = Convert.ToInt32(prep.CountFiltered(null, null, filter, null).Result); this.procesJson = new ProcesJson(); } catch { this.Procese = null; this.CurProces = new ProcesExtended(new Proces()); this.FilteredRowsCount = 0; this.procesJson = new ProcesJson(); } } }
public response GetFiltered(JToken jProces, JToken jprocesJson) { string conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString; int _CURENT_USER_ID = Convert.ToInt32(Session["CURENT_USER_ID"]); ProceseRepository pr = new ProceseRepository(_CURENT_USER_ID, conStr); string limit = null; if (jprocesJson != null) { if (jprocesJson["LimitStart"] != null && !String.IsNullOrEmpty(jprocesJson["LimitStart"].ToString()) && jprocesJson["LimitEnd"] != null && !String.IsNullOrEmpty(jprocesJson["LimitEnd"].ToString())) { limit = String.Format(" LIMIT {0},{1} ", jprocesJson["LimitStart"].ToString(), jprocesJson["LimitEnd"].ToString()); } } //response r = dr.GetFiltered(null, null, String.Format("{'jProces':{0},'jprocesJson':{1}}", JsonConvert.SerializeObject(jProces), JsonConvert.SerializeObject(jprocesJson)), null); string jsonParam = CreateFilterString(jProces, jprocesJson); //response r = pr.GetFilteredExtended(null, null, jsonParam, limit); response r = pr.GetFiltered(null, null, jsonParam, limit); r.InsertedId = Convert.ToInt32(pr.CountFiltered(null, null, jsonParam, null).Result); // folosim campul InsertedId pt. counter return(r); }