public async Task <bool> Handle(ChangeSetRequest message, IOutputPort <ChangeSetResponse> outputPort) { ChangeSetResponse response = new ChangeSetResponse(message); try { CRUDContext <TService> context = new CRUDContext <TService>(message, response, (TService)_service, _serviceContainer); context.Properties.Add(CRUDContext <TService> .CHANGE_METHODS_KEY, _serviceMethods); await _pipeline(context); } catch (Exception ex) { if (ex is TargetInvocationException) { ex = ex.InnerException; } string err = _serviceMethods.OnError(ex); response.error = new ErrorInfo(err, ex.GetType().Name); } outputPort.Handle(response); return(response.error == null); }
// ----------------------------------------------------------------------------- private void GetBatchFromDB() { string sqlStmt = "SELECT [" + _UpdateDetectionVariables.IdColumnName + "], [" + _UpdateDetectionVariables.PnrColumnName + "], [" + _UpdateDetectionVariables.TableColumnName + "], [" + _UpdateDetectionVariables.TimestampColumnName + "] FROM [" + DatabaseName + "].[" + _UpdateDetectionVariables.SchemaName + "].[" + _UpdateDetectionVariables.StagingTableName + "]"; CRUDContext dbCtx = new CRUDContext(_UpdateDetectionVariables.ConnectionStringName, sqlStmt); dsUpdatedCPRs = dbCtx.ExecuteDataSet(); }
public PostsForm() { InitializeComponent(); _context = new CRUDContext(); client = new RestClient("https://jsonplaceholder.typicode.com"); posts = new List <Post>(); users = new List <User>(); }
// GET: Home public ActionResult Index() { var students = new CRUDContext().Students.Include(x => x.Address).ToList(); //(from s in new CRUDContext().Students.Include(x => x.Address) // select s).ToList(); List <StudentModel> studentModels = new List <StudentModel>(); foreach (Student s in students) { studentModels.Add(StudentMapper.ContextToModel(s)); } ViewBag.Students = studentModels; return(View()); }
// ----------------------------------------------------------------------------- public void DeletePersonFromStaging(string cprNo) { if (dsUpdatedCPRs != null) { DataTable dt = dsUpdatedCPRs.Tables[0]; if (dt != null) { decimal pnr = GetCprNoAsDecimalFromString(cprNo); DataRow[] rowsForThisPerson = dt.Select(_UpdateDetectionVariables.PnrColumnName + "=" + pnr.ToString()); int idColIdx = dt.Columns.IndexOf(_UpdateDetectionVariables.IdColumnName); StringBuilder sb = new StringBuilder(); foreach (DataRow row in rowsForThisPerson) { if (ShouldIStop()) { return; } sb.Append(row[idColIdx].ToString() + ","); } string delStmt = sb.ToString(); // Remove trailing delimiter delStmt = delStmt.Substring(0, delStmt.Length - 1); // Build delete statement to delete this persons rows from batch () delStmt = "DELETE FROM [" + DatabaseName + "].[" + _UpdateDetectionVariables.SchemaName + "].[" + _UpdateDetectionVariables.StagingTableName + "] WHERE [" + _UpdateDetectionVariables.IdColumnName + "] IN (" + delStmt + ")"; CRUDContext dbCtx = new CRUDContext(_UpdateDetectionVariables.ConnectionStringName, delStmt); int rowCnt = dbCtx.ExecuteNonQuery(); } } }
public ActionResult Register(StudentModel studentModel) { try { CRUDContext db = new CRUDContext(); if (studentModel.Id > 0) { Student student = db.Students.Include(x => x.Address).Where(x => x.Id == studentModel.Id).FirstOrDefault(); student.Email = studentModel.Email; student.Name = studentModel.Name; db.Entry(student).State = EntityState.Modified; } else { db.Students.Add(StudentMapper.ModelToContext(studentModel)); } db.SaveChanges(); var students = new CRUDContext().Students.Include(x => x.Address).ToList(); List <StudentModel> studentModels = new List <StudentModel>(); foreach (Student s in students) { studentModels.Add(StudentMapper.ContextToModel(s)); } return(Json(studentModels, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(Json(e.Message, JsonRequestBehavior.AllowGet)); } return(Json(false, JsonRequestBehavior.AllowGet)); }
public ProductsController(CRUDContext context) { _context = context; }
public CustomerController(CRUDContext crudContext) { this._crudContext = crudContext; }
public FileTaskRepository(CRUDContext context) { _context = context; }
public EmployeesController(CRUDContext context) { _context = context; _ILog = Log.GetIntance; }
public CustomersController(CRUDContext context) { _context = context; }
public PaisController(CRUDContext context) { this.context = context; }
public CRUDController() { _context = new CRUDContext(); }
public Repositorio(CRUDContext _context) { context = _context; dbSet = context.Set <T>(); }
public ToDoesController(CRUDContext context) { _context = context; }
public AuthorizationRepository(CRUDContext _cRUDContext) { CRUDContext = _cRUDContext; }
public BookServices(CRUDContext context) { this.context = context; }
public BookController(CRUDContext context) { this.context = context; }
public ClienteRepositorio(CRUDContext db) { _db = db; }
public ClientRepository(CRUDContext context) : base(context) { }
public SalesController(CRUDContext context) { _context = context; }
public PedidoRepositorio(CRUDContext db) { _db = db; }
//private IDbSet<T> dbEntity = null; public Repository() { db = new CRUDContext(); }
public UserRepository(CRUDContext context) { _context = context; }
public CustomersController(CRUDContext CRUDContext) { _CRUDContext = CRUDContext; }
public Repository(CRUDContext context) { Db = context; DbSet = Db.Set <TEntity>(); }
public PacienteController(CRUDContext context) { this.context = context; }
public CourseRepository(CRUDContext _db) { db = _db; }
public HomeController(CRUDContext context) { dbContext = context; }
public CategoryService(CRUDContext context) { _context = context; }