public ResultPerson getPerson(int person_id) { get_person_Result pers; ResultPerson resultPerson = new ResultPerson(); Person searchedPerson; FinflowEntities fe = new FinflowEntities(); var dataResultStoredProcedure = fe.get_person(person_id).GetEnumerator(); if (dataResultStoredProcedure.MoveNext()) { pers = dataResultStoredProcedure.Current; if (pers != null) { searchedPerson = new Person(); searchedPerson.person_id = pers.person_id; searchedPerson.Name = pers.Name; searchedPerson.Surname = pers.Surname; searchedPerson.DateOfBirth = pers.DateOfBirth; resultPerson.person = searchedPerson; resultPerson.code = 0; } } else { resultPerson.code = -1; resultPerson.error = "Запись не найдена."; } return(resultPerson); }
public Result remittanceChangeStatus(TransferModifyState _transferModifyState) { int code = 0; string error = ""; ObjectParameter op_code = new ObjectParameter("code", code); ObjectParameter op_error = new ObjectParameter("error", error); Result resultOfChangeStatus = new Result(); FinflowEntities fe = new FinflowEntities(); fe.remittance_change_status(_transferModifyState.Remittance_Id, _transferModifyState.c_status_id, op_code, op_error); code = Convert.ToInt32(op_code.Value); error = Convert.ToString(error); if (code < 0) { resultOfChangeStatus.code = -1; resultOfChangeStatus.error = "Ошибка. " + error; return(resultOfChangeStatus); } else { resultOfChangeStatus.code = 0; resultOfChangeStatus.error = ""; return(resultOfChangeStatus); } }
public Result deletePerson(int _person_id) { ResultPerson resultPerson = new ResultPerson(); int code = 0; string str_result = ""; FinflowEntities ge = new FinflowEntities(); ge.iud_person(3, new ObjectParameter("person_id", _person_id), null, null, null, new ObjectParameter("code", code), new ObjectParameter("str_result", str_result)); if (code < 0) { resultPerson.code = -1; resultPerson.error = str_result; } else { resultPerson.code = 0; resultPerson.error = "ok"; } return(resultPerson); }
public Result updatePerson(Person modifiedPerson) { ResultPerson resultPerson = new ResultPerson(); int code = 0; string str_result = ""; FinflowEntities ge = new FinflowEntities(); ge.iud_person(2, new ObjectParameter("person_id", modifiedPerson.person_id), modifiedPerson.Name, modifiedPerson.Surname, modifiedPerson.DateOfBirth, new ObjectParameter("code", code), new ObjectParameter("str_result", str_result)); if (code < 0) { resultPerson.code = -1; resultPerson.error = str_result; } else { resultPerson.code = 0; resultPerson.error = "ok"; } return(resultPerson); }
public ResultRemittance addRemittance(Models.Remittance newRemittance) { int code = 0; string error = ""; ResultRemittance resultOfAddRemittance = new ResultRemittance(); FinflowEntities fe = new FinflowEntities(); ObjectParameter op_Remittance_Id = new ObjectParameter("Remittance_Id", newRemittance.Remittance_Id); ObjectParameter op_code_result = new ObjectParameter("code_result", code); ObjectParameter op_error = new ObjectParameter("error", error); fe.iud_remittance(1, op_Remittance_Id, newRemittance.Code, newRemittance.c_status_id, newRemittance.Sender_id, newRemittance.Receiver_id, op_code_result, op_error); code = Convert.ToInt32(op_code_result.Value); error = Convert.ToString(op_error.Value); if (code < 0) { resultOfAddRemittance.code = -1; resultOfAddRemittance.error = "Ошибка. " + error; return(resultOfAddRemittance); } else { resultOfAddRemittance.code = 0; resultOfAddRemittance.error = ""; resultOfAddRemittance.remittance = newRemittance; resultOfAddRemittance.remittance.Remittance_Id = Guid.Parse(op_Remittance_Id.Value.ToString()); return(resultOfAddRemittance); } }
public ResultFunds addFunds(Models.Funds newFunds) { ResultFunds resultAddfund = new ResultFunds(); int code = 0;; string error = ""; FinflowEntities fe = new FinflowEntities(); ObjectParameter op_funds_id = new ObjectParameter("Funds_id", newFunds.Funds_id); ObjectParameter op_code = new ObjectParameter("code", code); ObjectParameter op_error = new ObjectParameter("error", error); var result = fe.iud_funds(1, op_funds_id, newFunds.SendAmount, newFunds.SendCurrency, newFunds.ReceiveAmount, newFunds.ReceiveCurrency, newFunds.Rate, newFunds.Remittance_Id, op_code, op_error); code = Convert.ToInt32(op_code.Value); error = Convert.ToString(op_error.Value); if (code < 0) { resultAddfund.code = -1; resultAddfund.error = "Ошибка. " + error; return(resultAddfund); } else { resultAddfund.code = 0; resultAddfund.error = ""; return(resultAddfund); } }
public ResultPerson addPerson(Person newPerson) { ResultPerson resultPerson = new ResultPerson(); int code = 0; string str_result = ""; FinflowEntities ge = new FinflowEntities(); ObjectParameter sp_objectParam_person_id = new ObjectParameter("person_id", newPerson.person_id); ObjectParameter sp_objectParam_code = new ObjectParameter("code", code); ObjectParameter sp_objectParam_str_result = new ObjectParameter("str_result", code); ge.iud_person(1, sp_objectParam_person_id, newPerson.Name, newPerson.Surname, newPerson.DateOfBirth, sp_objectParam_code, sp_objectParam_str_result); code = Convert.ToInt32(sp_objectParam_code.Value); str_result = Convert.ToString(sp_objectParam_str_result.Value); if (code < 0) { resultPerson.code = -1; resultPerson.error = str_result; } else { resultPerson.code = 0; resultPerson.error = ""; newPerson.person_id = Convert.ToInt32(sp_objectParam_person_id.Value); } return(resultPerson); }