public response Update(int id, string fieldValueCollection) { //UtilizatorDrept item = JsonConvert.DeserializeObject<UtilizatorDrept>(Find(id).Message); UtilizatorDrept item = (UtilizatorDrept)(Find(id).Result); return(item.Update(fieldValueCollection)); }
public response Update(string fieldValueCollection) { UtilizatorDrept tmpItem = JsonConvert.DeserializeObject <UtilizatorDrept>(fieldValueCollection); // sa vedem daca merge asa sau trebuie cu JObject //return JsonConvert.DeserializeObject<UtilizatorDrept>(Find(Convert.ToInt32(tmpItem.ID)).Message).Update(fieldValueCollection); return(((UtilizatorDrept)(Find(Convert.ToInt32(tmpItem.ID)).Result)).Update(fieldValueCollection)); }
/// <summary> /// Metoda pt. popularea relatiilor dintre utilizatori si drepturile asignate utilizatorului curent /// </summary> /// <returns>vector de SOCISA.UtilizatoriDrepturiJson</returns> public response GetUtilizatoriDrepturi() { 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()) { UtilizatorDrept d = new UtilizatorDrept(authenticatedUserId, connectionString, Convert.ToInt32(r["ID"])); aList.Add(d); } r.Close(); r.Dispose(); UtilizatorDrept[] toReturn = new UtilizatorDrept[aList.Count]; for (int i = 0; i < aList.Count; i++) { toReturn[i] = (UtilizatorDrept)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 GetAll() { try { DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "UTILIZATORI_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()) { UtilizatorDrept a = new UtilizatorDrept(authenticatedUserId, connectionString, (IDataRecord)r); aList.Add(a); } r.Close(); r.Dispose(); UtilizatorDrept[] toReturn = new UtilizatorDrept[aList.Count]; for (int i = 0; i < aList.Count; i++) { toReturn[i] = (UtilizatorDrept)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 Find(int _id) { try { UtilizatorDrept item = new UtilizatorDrept(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(UtilizatorDrept), _filter, authenticatedUserId, connectionString); _filter = newFilter == null ? _filter : newFilter; } catch { } DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "UTILIZATORI_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()) * { * UtilizatorDrept a = new UtilizatorDrept(authenticatedUserId, connectionString, (IDataRecord)r); * aList.Add(a); * } * r.Close(); r.Dispose(); da.CloseConnection(); * UtilizatorDrept[] toReturn = new UtilizatorDrept[aList.Count]; * for (int i = 0; i < aList.Count; i++) * toReturn[i] = (UtilizatorDrept)aList[i]; * return new response(true, JsonConvert.SerializeObject(toReturn, CommonFunctions.JsonSerializerSettings), toReturn, null, null); */ List <UtilizatorDrept> aList = new List <UtilizatorDrept>(); MySqlDataReader r = da.ExecuteSelectQuery(); while (r.Read()) { UtilizatorDrept a = new UtilizatorDrept(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(UtilizatorDrept item, string tableName, int childrenId) { return(item.GetChildren(tableName, childrenId)); }
public response GetChildrens(UtilizatorDrept item, string tableName) { return(item.GetChildrens(tableName)); }
public response Delete(UtilizatorDrept item) { return(item.Delete()); }
public response Update(UtilizatorDrept item) { return(item.Update()); }
public response Insert(UtilizatorDrept item) { return(item.Insert()); }
/// <summary> /// Metoda pentru stergerea utilizatorului curent /// </summary> /// <returns>SOCISA.response = new object(bool = status, string = error message, int = id-ul cheie returnat)</returns> public response Delete() { try { foreach (Action a in (Action[])this.GetActions().Result) { UtilizatorAction ua = new UtilizatorAction(authenticatedUserId, connectionString); ua.ID_UTILIZATOR = Convert.ToInt32(this.ID); ua.ID_ACTION = Convert.ToInt32(a.ID); ua.Delete(); } } catch (Exception exp) { LogWriter.Log(exp); } try { foreach (Drept d in (Drept[])this.GetDrepturi().Result) { UtilizatorDrept ud = new UtilizatorDrept(authenticatedUserId, connectionString); ud.ID_UTILIZATOR = Convert.ToInt32(this.ID); ud.ID_DREPT = Convert.ToInt32(d.ID); ud.Delete(); } } catch (Exception exp) { LogWriter.Log(exp); } try { foreach (Dosar d in (Dosar[])this.GetDosare().Result) { UtilizatorDosar ud = new UtilizatorDosar(authenticatedUserId, connectionString); ud.ID_UTILIZATOR = Convert.ToInt32(this.ID); ud.ID_DOSAR = Convert.ToInt32(d.ID); ud.Delete(); } } catch (Exception exp) { LogWriter.Log(exp); } try { foreach (SocietateAsigurare sa in (SocietateAsigurare[])this.GetSocietatiAdministrate().Result) { UtilizatorSocietateAdministrata usa = new UtilizatorSocietateAdministrata(authenticatedUserId, connectionString); usa.ID_UTILIZATOR = Convert.ToInt32(this.ID); usa.ID_SOCIETATE = Convert.ToInt32(sa.ID); usa.Delete(); } } catch (Exception exp) { LogWriter.Log(exp); } try { foreach (Setare s in (Setare[])this.GetSetari().Result) { UtilizatorSetare us = new UtilizatorSetare(authenticatedUserId, connectionString); us.ID_UTILIZATOR = Convert.ToInt32(this.ID); us.ID_SETARE = Convert.ToInt32(s.ID); us.Delete(); } } catch (Exception exp) { LogWriter.Log(exp); } response toReturn = new response(false, "", null, null, new List <Error>());; ArrayList _parameters = new ArrayList(); _parameters.Add(new MySqlParameter("_ID", this.ID)); DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "UTILIZATORIsp_soft_delete", _parameters.ToArray()); toReturn = da.ExecuteDeleteQuery(); return(toReturn); }