예제 #1
0
 public response GetAll()
 {
     try
     {
         DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "INTERVENIENTISsp_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())
         {
             Intervenient a = new Intervenient(authenticatedUserId, connectionString, (IDataRecord)r);
             aList.Add(a);
         }
         r.Close(); r.Dispose();
         Intervenient[] toReturn = new Intervenient[aList.Count];
         for (int i = 0; i < aList.Count; i++)
         {
             toReturn[i] = (Intervenient)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)
         })); }
 }
예제 #2
0
        public response Update(string fieldValueCollection)
        {
            Intervenient tmpItem = JsonConvert.DeserializeObject <Intervenient>(fieldValueCollection); // sa vedem daca merge asa sau trebuie cu JObject

            //return JsonConvert.DeserializeObject<Intervenient>(Find(Convert.ToInt32(tmpItem.ID)).Message).Update(fieldValueCollection);
            return(((Intervenient)(Find(Convert.ToInt32(tmpItem.ID)).Result)).Update(fieldValueCollection));
        }
예제 #3
0
        public response Update(int id, string fieldValueCollection)
        {
            //Intervenient item = JsonConvert.DeserializeObject<Intervenient>(Find(id).Message);
            Intervenient item = (Intervenient)(Find(id).Result);

            return(item.Update(fieldValueCollection));
        }
예제 #4
0
 public response Find(string _denumire)
 {
     try
     {
         Intervenient item = new Intervenient(authenticatedUserId, connectionString, _denumire);
         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)
         })); }
 }
예제 #5
0
        public response GetFiltered(string _sort, string _order, string _filter, string _limit)
        {
            try
            {
                try
                {
                    string newFilter = Filtering.GenerateFilterFromJsonObject(typeof(Intervenient), _filter, authenticatedUserId, connectionString);
                    _filter = newFilter == null ? _filter : newFilter;
                }
                catch { }
                DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "INTERVENIENTISsp_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())
                 * {
                 *  Intervenient a = new Intervenient(authenticatedUserId, connectionString, (IDataRecord)r);
                 *  aList.Add(a);
                 * }
                 * r.Close(); r.Dispose(); da.CloseConnection();
                 * Intervenient[] toReturn = new Intervenient[aList.Count];
                 * for (int i = 0; i < aList.Count; i++)
                 *  toReturn[i] = (Intervenient)aList[i];
                 * return new response(true, JsonConvert.SerializeObject(toReturn, CommonFunctions.JsonSerializerSettings), toReturn, null, null);
                 */
                List <Intervenient> aList = new List <Intervenient>();
                MySqlDataReader     r     = da.ExecuteSelectQuery();
                while (r.Read())
                {
                    Intervenient a = new Intervenient(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)
                })); }
        }
예제 #6
0
 public response GetChildren(Intervenient item, string tableName, int childrenId)
 {
     return(item.GetChildren(tableName, childrenId));
 }
예제 #7
0
 public response GetChildrens(Intervenient item, string tableName)
 {
     return(item.GetChildrens(tableName));
 }
예제 #8
0
 public response Delete(Intervenient item)
 {
     return(item.Delete());
 }
예제 #9
0
 public response Update(Intervenient item)
 {
     return(item.Update());
 }
예제 #10
0
 public response Insert(Intervenient item)
 {
     return(item.Insert());
 }