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

            //return JsonConvert.DeserializeObject<DosarStadiuSentinta>(Find(Convert.ToInt32(tmpItem.ID)).Message).Update(fieldValueCollection);
            return(((DosarStadiuSentinta)(Find(Convert.ToInt32(tmpItem.ID)).Result)).Update(fieldValueCollection));
        }
Beispiel #3
0
        public response Insert(int _ID_DOSAR_STADIU)
        {
            response toReturn = Insert();

            if (toReturn.Status)
            {
                this.ID = toReturn.InsertedId;
                DosarStadiuSentinta dssj = new DosarStadiuSentinta();
                dssj.ID_DOSAR_STADIU = _ID_DOSAR_STADIU;
                dssj.ID_SENTINTA     = Convert.ToInt32(this.ID);
                dssj.Insert();
            }

            /*
             * if (this.Solutie != null)
             * {
             *  response toReturnS = Solutie.Insert();
             *  if (toReturnS.Status && toReturnS.InsertedId != null)
             *  {
             *      this.ID_SOLUTIE = toReturnS.InsertedId;
             *      //this.UpdateSentinta();
             *  }
             * }
             */

            return(toReturn);
        }
        public response Update(int id, string fieldValueCollection)
        {
            //DosarStadiuSentinta item = JsonConvert.DeserializeObject<DosarStadiuSentinta>(Find(id).Message);
            DosarStadiuSentinta item = (DosarStadiuSentinta)(Find(id).Result);

            return(item.Update(fieldValueCollection));
        }
Beispiel #5
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(false, "", null, null, new List <Error>());;

            Sentinta[] sentinte = (Sentinta[])this.GetSentinte().Result;
            try
            {
                foreach (Sentinta sj in sentinte)
                {
                    DosarStadiuSentinta dssj = new DosarStadiuSentinta();
                    dssj.ID_DOSAR_STADIU = Convert.ToInt32(this.ID);
                    dssj.ID_SENTINTA     = Convert.ToInt32(sj.ID);
                    dssj.Delete();
                    sj.Delete();
                }
            }
            catch { }

            ArrayList _parameters = new ArrayList();

            _parameters.Add(new MySqlParameter("_ID", this.ID));
            DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "DOSARE_STADIIsp_soft_delete", _parameters.ToArray());

            toReturn = da.ExecuteDeleteQuery();
            return(toReturn);
        }
 public response Find(int _id)
 {
     try
     {
         DosarStadiuSentinta item = new DosarStadiuSentinta(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)
         })); }
 }
Beispiel #7
0
        public response Delete(int _ID_DOSAR_STADIU)
        {
            response toReturn = new response(true, "", null, null, new List <Error>());;

            DosarStadiuSentinta dssj = new DosarStadiuSentinta();

            dssj.ID_DOSAR_STADIU = _ID_DOSAR_STADIU;
            dssj.ID_SENTINTA     = Convert.ToInt32(this.ID);
            toReturn             = dssj.Delete();

            if (toReturn.Status)
            {
                toReturn = Delete();
                /* this.Solutie.Delete(); */
            }
            return(toReturn);
        }
 public response GetChildren(DosarStadiuSentinta item, string tableName, int childrenId)
 {
     return(item.GetChildren(tableName, childrenId));
 }
 public response GetChildrens(DosarStadiuSentinta item, string tableName)
 {
     return(item.GetChildrens(tableName));
 }
 public response Delete(DosarStadiuSentinta item)
 {
     return(item.Delete());
 }
 public response Update(DosarStadiuSentinta item)
 {
     return(item.Update());
 }
 public response Insert(DosarStadiuSentinta item)
 {
     return(item.Insert());
 }