public response Update(string fieldValueCollection) { Compensare tmpItem = JsonConvert.DeserializeObject <Compensare>(fieldValueCollection); // sa vedem daca merge asa sau trebuie cu JObject //return JsonConvert.DeserializeObject<Auto>(Find(Convert.ToInt32(tmpItem.ID)).Message).Update(fieldValueCollection); return(((Compensare)(Find(Convert.ToInt32(tmpItem.ID)).Result)).Update(fieldValueCollection)); }
public response Update(int id, string fieldValueCollection) { //Compensare item = JsonConvert.DeserializeObject<Auto>( Find(id).Message); Compensare item = (Compensare)(Find(id).Result); return(item.Update(fieldValueCollection)); }
public void UpdateDosareAfterCompensare() { foreach (Edge e in this.Edges) { if (e.Weight == 0) { foreach (int id_dosar in e.IduriDosare) { //update compensare si status dosar = "compensat" Dosar d = new Dosar(authenticatedUserId, connectionString, id_dosar); Compensare compensare = new Compensare(authenticatedUserId, connectionString); compensare.ID_DOSAR = id_dosar; compensare.DATA = DateTime.Now.Date; compensare.SUMA = d.VALOARE_REGRES; compensare.REST = 0; response r = compensare.Insert(); if (r.Status) { d.ChangeStatus("COMPENSAT"); } } } else { double sum = 0; foreach (int id_dosar in e.IduriDosare) { Dosar d = new Dosar(authenticatedUserId, connectionString, id_dosar); sum += Convert.ToDouble(d.VALOARE_REGRES); Compensare compensare = new Compensare(authenticatedUserId, connectionString); compensare.ID_DOSAR = id_dosar; compensare.DATA = DateTime.Now.Date; string _status = ""; if (e.InitialWeight - sum > e.Weight) { //update compensare si status dosar = "compensat" compensare.SUMA = d.VALOARE_REGRES; compensare.REST = 0; _status = "COMPENSAT"; } else { //update compensare cu rest si status dosar = "compensat partial" - TO DO compensare.SUMA = e.InitialWeight - (sum - d.VALOARE_REGRES); compensare.REST = d.VALOARE_REGRES - compensare.SUMA; _status = "COMPENSAT_PARTIAL"; } response r = compensare.Insert(); if (r.Status) { d.ChangeStatus(_status); } } } } }
public response Find(int _id) { try { Compensare item = new Compensare(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) })); } }
public response GetFiltered(string _sort, string _order, string _filter, string _limit) { try { try { string newFilter = Filtering.GenerateFilterFromJsonObject(typeof(Auto), _filter, authenticatedUserId, connectionString); _filter = newFilter == null ? _filter : newFilter; } catch { } DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "COMPENSARIsp_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()) * { * Compensare c = new Compensare(authenticatedUserId, connectionString, (IDataRecord)r); * aList.Add(c); * } * r.Close(); r.Dispose(); da.CloseConnection(); * Compensare[] toReturn = new Compensare[aList.Count]; * for (int i = 0; i < aList.Count; i++) * toReturn[i] = (Compensare)aList[i]; * return new response(true, JsonConvert.SerializeObject(toReturn, CommonFunctions.JsonSerializerSettings), toReturn, null, null); */ List <Compensare> aList = new List <Compensare>(); MySqlDataReader r = da.ExecuteSelectQuery(); while (r.Read()) { Compensare c = new Compensare(authenticatedUserId, connectionString, (IDataRecord)r); aList.Add(c); } 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) })); } }
public response GetRaportCompensareRcaCascoDesfasurat(DateTime _data, int _ID_SOCIETATE_RCA) { try { DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "RAPORTsp_GetDosareCompensareRcaCascoDesfasurat", new object[] { new MySqlParameter("_DATA", _data), new MySqlParameter("_ID_SOCIETATE_RCA", _ID_SOCIETATE_RCA) }); List <Compensare> lstToReturn = new List <Compensare>(); MySqlDataReader r = da.ExecuteSelectQuery(); while (r.Read()) { Compensare c = new Compensare(); c.DATA = _data; c.ID_DOSAR = Convert.ToInt32(r["ID_DOSAR"]); c.SUMA = Convert.ToDouble(r["SUMA"]); c.REST = Convert.ToDouble(r["REST"]); lstToReturn.Add(c); } r.Close(); r.Dispose(); da.CloseConnection(); return(new response(true, JsonConvert.SerializeObject(lstToReturn, CommonFunctions.JsonSerializerSettings), lstToReturn, null, null)); } catch (Exception exp) { LogWriter.Log(exp); return(new response(false, exp.ToString(), null, null, new List <Error>() { new Error(exp) })); } }
public response GetChildren(Compensare item, string tableName, int childrenId) { return(item.GetChildren(tableName, childrenId)); }
public response GetChildrens(Compensare item, string tableName) { return(item.GetChildrens(tableName)); }
public response Delete(Compensare item) { return(item.Delete()); }
public response Update(Compensare item) { return(item.Update()); }
public response Insert(Compensare item) { return(item.Insert()); }