public response GetAll() { try { DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "MESAJE_UTILIZATORIsp_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()) { MesajUtilizator a = new MesajUtilizator(authenticatedUserId, connectionString, (IDataRecord)r); aList.Add(a); } r.Close(); r.Dispose(); MesajUtilizator[] toReturn = new MesajUtilizator[aList.Count]; for (int i = 0; i < aList.Count; i++) { toReturn[i] = (MesajUtilizator)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) })); } }
public response Update(string fieldValueCollection) { MesajUtilizator tmpItem = JsonConvert.DeserializeObject <MesajUtilizator>(fieldValueCollection); // sa vedem daca merge asa sau trebuie cu JObject //return JsonConvert.DeserializeObject<MesajUtilizator>(Find(Convert.ToInt32(tmpItem.ID)).Message).Update(fieldValueCollection); return(((MesajUtilizator)(Find(Convert.ToInt32(tmpItem.ID)).Result)).Update(fieldValueCollection)); }
public response SendToInvolvedParties() { try { response toReturn = new response(true, "", null, null, new List <Error>()); Dosar d = (Dosar)this.GetDosar().Result; Utilizator[] utilizatori = (Utilizator[])d.GetInvolvedParties().Result; foreach (Utilizator utilizator in utilizatori) { MesajUtilizator mesajUtilizator = new MesajUtilizator(authenticatedUserId, connectionString) { ID_UTILIZATOR = Convert.ToInt32(utilizator.ID), ID_MESAJ = Convert.ToInt32(this.ID) }; response r = mesajUtilizator.Insert(); if (!r.Status) { toReturn.AddResponse(r); } } return(toReturn); } catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.ToString(), null, null, new List <Error>() { new Error(exp) })); } }
public response Update(int id, string fieldValueCollection) { //MesajUtilizator item = JsonConvert.DeserializeObject<MesajUtilizator>(Find(id).Message); MesajUtilizator item = (MesajUtilizator)(Find(id).Result); return(item.Update(fieldValueCollection)); }
public response Find(int _id) { try { MesajUtilizator item = new MesajUtilizator(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(MesajUtilizator), _filter, authenticatedUserId, connectionString); _filter = newFilter == null ? _filter : newFilter; } catch { } DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "MESAJE_UTILIZATORIsp_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()) * { * MesajUtilizator a = new MesajUtilizator(authenticatedUserId, connectionString, (IDataRecord)r); * aList.Add(a); * } * r.Close(); r.Dispose(); da.CloseConnection(); * MesajUtilizator[] toReturn = new MesajUtilizator[aList.Count]; * for (int i = 0; i < aList.Count; i++) * toReturn[i] = (MesajUtilizator)aList[i]; * return new response(true, JsonConvert.SerializeObject(toReturn, CommonFunctions.JsonSerializerSettings), toReturn, null, null); */ List <MesajUtilizator> aList = new List <MesajUtilizator>(); MySqlDataReader r = da.ExecuteSelectQuery(); while (r.Read()) { MesajUtilizator a = new MesajUtilizator(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 GetMessageReadDate(int idUtilizator) { try { DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "MESAJE_UTILIZATORIsp_GetByIdMesajIdUtilizator", new object[] { new MySqlParameter("_ID_MESAJ", this.ID), new MySqlParameter("_ID_UTILIZATOR", idUtilizator) }); IDataReader r = da.ExecuteSelectQuery(); while (r.Read()) { MesajUtilizator mesajUtilizator = new MesajUtilizator(authenticatedUserId, connectionString, (IDataRecord)r); return(new response(true, mesajUtilizator.DATA_CITIRE.ToString(), mesajUtilizator.DATA_CITIRE, null, null)); } r.Close(); r.Dispose(); return(new response(true, null, null, null, null)); } catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.ToString(), null, null, new List <Error>() { new Error(exp) })); } }
public response GetChildren(MesajUtilizator item, string tableName, int childrenId) { return(item.GetChildren(tableName, childrenId)); }
public response GetChildrens(MesajUtilizator item, string tableName) { return(item.GetChildrens(tableName)); }
public response Delete(MesajUtilizator item) { return(item.Delete()); }
public response Update(MesajUtilizator item) { return(item.Update()); }
public response Insert(MesajUtilizator item) { return(item.Insert()); }