Пример #1
0
        public response Update(string fieldValueCollection)
        {
            Sentinta tmpItem = JsonConvert.DeserializeObject <Sentinta>(fieldValueCollection); // sa vedem daca merge asa sau trebuie cu JObject

            //return JsonConvert.DeserializeObject<Sentinta>(Find(Convert.ToInt32(tmpItem.ID)).Message).Update(fieldValueCollection);
            return(((Sentinta)(Find(Convert.ToInt32(tmpItem.ID)).Result)).Update(fieldValueCollection));
        }
Пример #2
0
 /// <summary>
 /// Metoda pt. popularea Sentintelor dosarului
 /// </summary>
 /// <returns>vector de SOCISA.SentinteJson</returns>
 public response GetSentinte()
 {
     try
     {
         DataAccess      da    = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "DOSARE_STADII_SENTINTEsp_GetByIdDosarStadiu", new object[] { new MySqlParameter("_ID_DOSAR_STADIU", this.ID) });
         MySqlDataReader r     = da.ExecuteSelectQuery();
         ArrayList       aList = new ArrayList();
         while (r.Read())
         {
             Sentinta a = new Sentinta(authenticatedUserId, connectionString, Convert.ToInt32(r["ID_SENTINTA"]));
             aList.Add(a);
         }
         r.Close(); r.Dispose();
         Sentinta[] toReturn = new Sentinta[aList.Count];
         for (int i = 0; i < aList.Count; i++)
         {
             toReturn[i] = (Sentinta)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)
         })); }
 }
Пример #3
0
        public response Update(int id, string fieldValueCollection)
        {
            //Sentinta item = JsonConvert.DeserializeObject<Sentinta>(Find(id).Message);
            Sentinta item = (Sentinta)(Find(id).Result);

            return(item.Update(fieldValueCollection));
        }
Пример #4
0
 public response GetAll()
 {
     try
     {
         DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "SENTINTEsp_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())
         {
             Sentinta a = new Sentinta(authenticatedUserId, connectionString, (IDataRecord)r);
             aList.Add(a);
         }
         r.Close(); r.Dispose();
         Sentinta[] toReturn = new Sentinta[aList.Count];
         for (int i = 0; i < aList.Count; i++)
         {
             toReturn[i] = (Sentinta)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)
         })); }
 }
Пример #5
0
 public response Find(int _id)
 {
     try
     {
         Sentinta item = new Sentinta(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
 /// <summary>
 /// Metoda pt. popularea Sentintelor dosarului
 /// </summary>
 /// <returns>vector de SOCISA.SentinteJson</returns>
 public response GetSentinta()
 {
     try
     {
         Sentinta toReturn = new Sentinta(authenticatedUserId, connectionString, Convert.ToInt32(this.ID_SENTINTA));
         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)
         })); }
 }
Пример #7
0
        public response GetFiltered(string _sort, string _order, string _filter, string _limit)
        {
            try
            {
                try
                {
                    string newFilter = Filtering.GenerateFilterFromJsonObject(typeof(Sentinta), _filter, authenticatedUserId, connectionString);
                    _filter = newFilter == null ? _filter : newFilter;
                }
                catch { }
                DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "SENTINTEsp_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())
                 * {
                 *  Sentinta a = new Sentinta(authenticatedUserId, connectionString, (IDataRecord)r);
                 *  aList.Add(a);
                 * }
                 * r.Close(); r.Dispose(); da.CloseConnection();
                 * Sentinta[] toReturn = new Sentinta[aList.Count];
                 * for (int i = 0; i < aList.Count; i++)
                 *  toReturn[i] = (Sentinta)aList[i];
                 * return new response(true, JsonConvert.SerializeObject(toReturn, CommonFunctions.JsonSerializerSettings), toReturn, null, null);
                 */
                List <Sentinta> aList = new List <Sentinta>();
                MySqlDataReader r     = da.ExecuteSelectQuery();
                while (r.Read())
                {
                    Sentinta a = new Sentinta(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)
                })); }
        }
Пример #8
0
        /// <summary>
        /// Metoda pentru stergerea relatiei Dosare-stadii curente
        /// </summary>
        /// <returns>SOCISA.response = new object(bool = status, string = error message, int = id-ul cheie returnat)</returns>
        public response Delete()
        {
            response toReturn = new response(true, "", null, null, new List <Error>());

            Sentinta sentinta = (Sentinta)this.GetSentinta().Result;

            if (sentinta.ID != null)
            {
                toReturn = sentinta.Delete();
            }

            if (toReturn.Status)
            {
                DocumentScanatProces[] dsps = (DocumentScanatProces[])this.GetDocumente().Result;
                foreach (DocumentScanatProces dsp in dsps)
                {
                    toReturn = dsp.Delete();
                    if (!toReturn.Status)
                    {
                        break;
                    }
                }
                if (toReturn.Status)
                {
                    ArrayList _parameters = new ArrayList();
                    _parameters.Add(new MySqlParameter("_ID", this.ID));
                    DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "PROCESE_STADIIsp_soft_delete", _parameters.ToArray());
                    toReturn = da.ExecuteDeleteQuery();
                    if (toReturn.Status)
                    {
                        try
                        {
                            Proces p = new Proces(authenticatedUserId, connectionString, Convert.ToInt32(this.ID_PROCES));
                            p.ChangeStadiuCurent(Convert.ToInt32(((ProcesStadiu)p.GetStadiuCurent().Result).ID));
                        }
                        catch { }
                    }
                }
            }
            return(toReturn);
        }
Пример #9
0
 public response GetChildren(Sentinta item, string tableName, int childrenId)
 {
     return(item.GetChildren(tableName, childrenId));
 }
Пример #10
0
 public response GetChildrens(Sentinta item, string tableName)
 {
     return(item.GetChildrens(tableName));
 }
Пример #11
0
 public response Delete(Sentinta item)
 {
     return(item.Delete());
 }
Пример #12
0
 public response Update(Sentinta item)
 {
     return(item.Update());
 }
Пример #13
0
 public response Insert(Sentinta item)
 {
     return(item.Insert());
 }