public response GetAll() { try { DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "DREPTURIsp_select", new object[] { new MySqlParameter("_SORT", null), new MySqlParameter("_ORDER", null), new MySqlParameter("_FILTER", null), new MySqlParameter("_LIMIT", null) }); ArrayList aList = new ArrayList(); MySqlDataReader r = da.ExecuteSelectQuery(); while (r.Read()) { Drept a = new Drept(authenticatedUserId, connectionString, (IDataRecord)r); aList.Add(a); } r.Close(); r.Dispose(); Drept[] toReturn = new Drept[aList.Count]; for (int i = 0; i < aList.Count; i++) { toReturn[i] = (Drept)aList[i]; } return(new response(true, JsonConvert.SerializeObject(toReturn, CommonFunctions.JsonSerializerSettings), toReturn, null, null)); } catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.ToString(), null, null, new System.Collections.Generic.List <Error>() { new Error(exp) })); } }
/// <summary> /// Metoda pt. popularea drepturilor care sunt asignate utilizatorului curent /// </summary> /// <returns>SOCISA.DrepturiJson</returns> public response GetDrepturi() { try { DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "UTILIZATORI_DREPTURIsp_GetByIdUtilizator", new object[] { new MySqlParameter("_ID_UTILIZATOR", this.ID) }); MySqlDataReader r = da.ExecuteSelectQuery(); ArrayList aList = new ArrayList(); while (r.Read()) { Drept d = new Drept(authenticatedUserId, connectionString, Convert.ToInt32(r["ID_DREPT"])); aList.Add(d); } r.Close(); r.Dispose(); Drept[] toReturn = new Drept[aList.Count]; for (int i = 0; i < aList.Count; i++) { toReturn[i] = (Drept)aList[i]; } return(new response(true, Newtonsoft.Json.JsonConvert.SerializeObject(toReturn, CommonFunctions.JsonSerializerSettings), toReturn, null, null)); } catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.ToString(), null, null, new List <Error>() { new Error(exp) })); } }
public response Update(string fieldValueCollection) { Drept tmpItem = JsonConvert.DeserializeObject <Drept>(fieldValueCollection); // sa vedem daca merge asa sau trebuie cu JObject //return JsonConvert.DeserializeObject<Drept>(Find(Convert.ToInt32(tmpItem.ID)).Message).Update(fieldValueCollection); return(((Drept)(Find(Convert.ToInt32(tmpItem.ID)).Result)).Update(fieldValueCollection)); }
public response Update(int id, string fieldValueCollection) { //Drept item = JsonConvert.DeserializeObject<Drept>(Find(id).Message); Drept item = (Drept)(Find(id).Result); return(item.Update(fieldValueCollection)); }
public response Find(int _id) { try { Drept item = new Drept(authenticatedUserId, connectionString, _id); return(new response(true, JsonConvert.SerializeObject(item, CommonFunctions.JsonSerializerSettings), item, null, null));; } catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.ToString(), null, null, new System.Collections.Generic.List <Error>() { new Error(exp) })); } }
public response GetFiltered(string _sort, string _order, string _filter, string _limit) { try { try { string newFilter = Filtering.GenerateFilterFromJsonObject(typeof(Drept), _filter, authenticatedUserId, connectionString); _filter = newFilter == null ? _filter : newFilter; } catch { } DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "DREPTURIsp_select", new object[] { new MySqlParameter("_SORT", _sort), new MySqlParameter("_ORDER", _order), new MySqlParameter("_FILTER", _filter), new MySqlParameter("_LIMIT", _limit) }); /* * ArrayList aList = new ArrayList(); * MySqlDataReader r = da.ExecuteSelectQuery(); * while (r.Read()) * { * Drept a = new Drept(authenticatedUserId, connectionString, (IDataRecord)r); * aList.Add(a); * } * r.Close(); r.Dispose(); da.CloseConnection(); * Drept[] toReturn = new Drept[aList.Count]; * for (int i = 0; i < aList.Count; i++) * toReturn[i] = (Drept)aList[i]; * return new response(true, JsonConvert.SerializeObject(toReturn, CommonFunctions.JsonSerializerSettings), toReturn, null, null); */ List <Drept> aList = new List <Drept>(); MySqlDataReader r = da.ExecuteSelectQuery(); while (r.Read()) { Drept a = new Drept(authenticatedUserId, connectionString, (IDataRecord)r); aList.Add(a); } r.Close(); r.Dispose(); da.CloseConnection(); return(new response(true, JsonConvert.SerializeObject(aList.ToArray(), CommonFunctions.JsonSerializerSettings), aList.ToArray(), null, null)); } catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.ToString(), null, null, new System.Collections.Generic.List <Error>() { new Error(exp) })); } }
public response GetChildren(Drept item, string tableName, int childrenId) { return(item.GetChildren(tableName, childrenId)); }
public response GetChildrens(Drept item, string tableName) { return(item.GetChildrens(tableName)); }
public response Delete(Drept item) { return(item.Delete()); }
public response Update(Drept item) { return(item.Update()); }
public response Insert(Drept item) { return(item.Insert()); }