コード例 #1
0
        public response Update(int id, string fieldValueCollection)
        {
            //Setare item = JsonConvert.DeserializeObject<Setare>(Find(id).Message);
            Setare item = (Setare)(Find(id).Result);

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

            //return JsonConvert.DeserializeObject<Setare>(Find(Convert.ToInt32(tmpItem.ID)).Message).Update(fieldValueCollection);
            return(((Setare)(Find(Convert.ToInt32(tmpItem.ID)).Result)).Update(fieldValueCollection));
        }
コード例 #4
0
 /// <summary>
 /// Metoda pt. popularea setarilor care sunt asignate utilizatorului curent
 /// </summary>
 /// <returns>vector de SOCISA.SetariJson</returns>
 public response GetSetari()
 {
     try
     {
         DataAccess      da    = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "UTILIZATORI_SETARIsp_GetByIdUtilizator", new object[] { new MySqlParameter("_ID_UTILIZATOR", this.ID) });
         MySqlDataReader r     = da.ExecuteSelectQuery();
         ArrayList       aList = new ArrayList();
         while (r.Read())
         {
             Setare a = new Setare(authenticatedUserId, connectionString, Convert.ToInt32(r["ID_SETARE"]));
             aList.Add(a);
         }
         r.Close(); r.Dispose();
         Setare[] toReturn = new Setare[aList.Count];
         for (int i = 0; i < aList.Count; i++)
         {
             toReturn[i] = (Setare)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)
         })); }
 }
コード例 #5
0
 public response Find(int _id)
 {
     try
     {
         Setare item = new Setare(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)
         })); }
 }
コード例 #6
0
ファイル: ISetariRepopsitory.cs プロジェクト: andpsy/socisaV2
        public response GetFiltered(string _sort, string _order, string _filter, string _limit)
        {
            try
            {
                try
                {
                    string newFilter = Filtering.GenerateFilterFromJsonObject(typeof(Setare), _filter, authenticatedUserId, connectionString);
                    _filter = newFilter == null ? _filter : newFilter;
                }
                catch { }
                DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "SETARIsp_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())
                 * {
                 *  Setare a = new Setare(authenticatedUserId, connectionString, (IDataRecord)r);
                 *  aList.Add(a);
                 * }
                 * r.Close(); r.Dispose(); da.CloseConnection();
                 * Setare[] toReturn = new Setare[aList.Count];
                 * for (int i = 0; i < aList.Count; i++)
                 *  toReturn[i] = (Setare)aList[i];
                 * return new response(true, JsonConvert.SerializeObject(toReturn, CommonFunctions.JsonSerializerSettings), toReturn, null, null);
                 */
                List <Setare>   aList = new List <Setare>();
                MySqlDataReader r     = da.ExecuteSelectQuery();
                while (r.Read())
                {
                    Setare a = new Setare(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)
                })); }
        }
コード例 #7
0
 public response GetChildren(Setare item, string tableName, int childrenId)
 {
     return(item.GetChildren(tableName, childrenId));
 }
コード例 #8
0
 public response GetChildrens(Setare item, string tableName)
 {
     return(item.GetChildrens(tableName));
 }
コード例 #9
0
 public response Delete(Setare item)
 {
     return(item.Delete());
 }
コード例 #10
0
 public response Update(Setare item)
 {
     return(item.Update());
 }
コード例 #11
0
 public response Insert(Setare item)
 {
     return(item.Insert());
 }