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

            return(item.Update(fieldValueCollection));
        }
示例#2
0
        public response Update(string fieldValueCollection)
        {
            Proces tmpItem = JsonConvert.DeserializeObject <Proces>(fieldValueCollection); // sa vedem daca merge asa sau trebuie cu JObject

            //return JsonConvert.DeserializeObject<Proces>(Find(Convert.ToInt32(tmpItem.ID)).Message).Update(fieldValueCollection);
            return(((Proces)(Find(Convert.ToInt32(tmpItem.ID)).Result)).Update(fieldValueCollection));
        }
示例#3
0
 public response GetAll()
 {
     try
     {
         DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "PROCESEsp_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())
         {
             Proces a = new Proces(authenticatedUserId, connectionString, (IDataRecord)r);
             aList.Add(a);
         }
         r.Close(); r.Dispose();
         Proces[] toReturn = new Proces[aList.Count];
         for (int i = 0; i < aList.Count; i++)
         {
             toReturn[i] = (Proces)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)
         })); }
 }
示例#4
0
        /// <summary>
        /// Metoda pentru inserarea relatiei Dosar-stadiu curenta
        /// </summary>
        /// <returns>SOCISA.response = new object(bool = status, string = error message, int = id-ul cheie returnat)</returns>
        public response Insert()
        {
            response toReturn = Validare();

            if (!toReturn.Status)
            {
                return(toReturn);
            }

            /*
             * if (this.Stadiu != null)
             * {
             *  response toReturnS = this.Stadiu.Insert();
             *  if (toReturnS.Status && toReturnS.InsertedId != null)
             *      this.ID_STADIU = Convert.ToInt32(toReturnS.InsertedId);
             * }
             */

            PropertyInfo[] props       = this.GetType().GetProperties();
            ArrayList      _parameters = new ArrayList();
            var            col         = CommonFunctions.table_columns(authenticatedUserId, connectionString, "procese_stadii");

            foreach (PropertyInfo prop in props)
            {
                if (col != null && col.ToUpper().IndexOf(prop.Name.ToUpper()) > -1) // ca sa includem in Array-ul de parametri doar coloanele tabelei, nu si campurile externe si/sau alte proprietati
                {
                    string propName  = prop.Name;
                    string propType  = prop.PropertyType.ToString();
                    object propValue = prop.GetValue(this, null);
                    propValue = propValue == null ? DBNull.Value : propValue;
                    if (propType != null)
                    {
                        if (propName.ToUpper() != "ID") // il vom folosi doar la Edit!
                        {
                            _parameters.Add(new MySqlParameter(String.Format("_{0}", propName.ToUpper()), propValue));
                        }
                    }
                }
            }
            DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "PROCESE_STADIIsp_insert", _parameters.ToArray());

            toReturn = da.ExecuteInsertQuery();
            if (toReturn.Status)
            {
                this.ID = toReturn.InsertedId;
                try
                {
                    if (toReturn.Status)
                    {
                        Proces p = new Proces(authenticatedUserId, connectionString, Convert.ToInt32(this.ID_PROCES));
                        p.ChangeStadiuCurent(Convert.ToInt32(((ProcesStadiu)p.GetStadiuCurent().Result).ID));
                        Dosar d = new Dosar(authenticatedUserId, connectionString, Convert.ToInt32(p.ID_DOSAR));
                        d.SetDataUltimeiModificari(DateTime.Now);
                    }
                }
                catch { }
            }
            return(toReturn);
        }
示例#5
0
 public response Find(int _id)
 {
     try
     {
         Proces item = new Proces(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
        public ProcesExtended(Proces p, bool _selected, int?_ID_SOCIETATE)
        {
            this.Proces = p;
            //this.Dosar = (Dosar)p.GetDosar().Result;
            try { this.TipProces = (Nomenclator)p.GetTipProces().Result; }
            catch { this.TipProces = new Nomenclator(); }
            try { this.Instanta = (Nomenclator)p.GetInstanta().Result; }
            catch { this.Instanta = new Nomenclator(); }
            try { this.Complet = (Nomenclator)p.GetComplet().Result; }
            catch { this.Complet = new Nomenclator(); }
            try { this.Contract = (Contract)p.GetContract().Result; }
            catch { this.Contract = new Contract(); }
            try
            {
                ProcesStadiu ps = (ProcesStadiu)p.GetStadiuCurent().Result;
                this.StadiuCurent = new ProcesStadiuExtended(ps);
            }
            catch
            {
                this.StadiuCurent = new ProcesStadiuExtended(new ProcesStadiu());
            }

            /*
             * try
             * {
             *  ProcesStadiu[] pss = (ProcesStadiu[])p.GetStadii().Result;
             *  this.Stadii = new ProcesStadiuExtended[pss.Length];
             *  for (int i = 0; i < pss.Length; i++)
             *  {
             *      this.Stadii[i] = new ProcesStadiuExtended(pss[i]);
             *  }
             * }
             * catch
             * {
             *  this.StadiuCurent = new ProcesStadiuExtended(new ProcesStadiu());
             *  this.Stadii = null;
             * }
             */

            this.Reclamant = this.Proces.GetReclamant(_ID_SOCIETATE).Result;
            this.Parat     = this.Proces.GetParat(_ID_SOCIETATE).Result;
            this.Tert      = this.Proces.GetTert(_ID_SOCIETATE).Result;
            if (_ID_SOCIETATE != null)
            {
                this.Calitate = (Nomenclator)(this.Proces.GetCalitate(Convert.ToInt32(_ID_SOCIETATE)).Result);
            }
            this.selected = _selected;
        }
示例#7
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);
        }
示例#8
0
 public response GetChildrens(Proces item, string tableName)
 {
     return(item.GetChildrens(tableName));
 }
示例#9
0
 public response Delete(Proces item, int _ID_DOSAR)
 {
     return(item.Delete(_ID_DOSAR));
 }
示例#10
0
 public response Delete(Proces item)
 {
     return(item.Delete());
 }
示例#11
0
 public response GetComplet(Proces item)
 {
     return(item.GetComplet());
 }
示例#12
0
 public response Insert(Proces item)
 {
     return(item.Insert());
 }
示例#13
0
 public ProcesExtended(Proces p, bool _selected) : this(p, _selected, null)
 {
 }
示例#14
0
 public ProcesExtended(Proces p) : this(p, false)
 {
 }
示例#15
0
 public response GetChildren(Proces item, string tableName, int childrenId)
 {
     return(item.GetChildren(tableName, childrenId));
 }
示例#16
0
 /*
  * public response Insert(Proces item, int _ID_DOSAR)
  * {
  *  return item.Insert(_ID_DOSAR);
  * }
  */
 public response Update(Proces item)
 {
     return(item.Update());
 }
示例#17
0
 public response GetInstanta(Proces item)
 {
     return(item.GetInstanta());
 }
示例#18
0
 public response Update(Proces item, int _ID_DOSAR)
 {
     return(item.Update(_ID_DOSAR));
 }
示例#19
0
 public response GetTipProces(Proces item)
 {
     return(item.GetTipProces());
 }
示例#20
0
 public response Insert(Proces item, int _ID_DOSAR)
 {
     return(item.Insert(_ID_DOSAR));
 }