Пример #1
0
        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);
        }
Пример #2
0
        // -----------------------------------------------------------------------------
        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();
        }
Пример #3
0
        public PostsForm()
        {
            InitializeComponent();
            _context = new CRUDContext();
            client   = new RestClient("https://jsonplaceholder.typicode.com");

            posts = new List <Post>();
            users = new List <User>();
        }
Пример #4
0
        // 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());
        }
Пример #5
0
        // -----------------------------------------------------------------------------
        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();
                }
            }
        }
Пример #6
0
        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));
        }
Пример #7
0
 public ProductsController(CRUDContext context)
 {
     _context = context;
 }
 public CustomerController(CRUDContext crudContext)
 {
     this._crudContext = crudContext;
 }
 public FileTaskRepository(CRUDContext context)
 {
     _context = context;
 }
Пример #10
0
 public EmployeesController(CRUDContext context)
 {
     _context = context;
     _ILog    = Log.GetIntance;
 }
Пример #11
0
 public CustomersController(CRUDContext context)
 {
     _context = context;
 }
Пример #12
0
 public PaisController(CRUDContext context)
 {
     this.context = context;
 }
 public CRUDController()
 {
     _context = new CRUDContext();
 }
Пример #14
0
 public Repositorio(CRUDContext _context)
 {
     context = _context;
     dbSet   = context.Set <T>();
 }
Пример #15
0
 public ToDoesController(CRUDContext context)
 {
     _context = context;
 }
 public AuthorizationRepository(CRUDContext _cRUDContext)
 {
     CRUDContext = _cRUDContext;
 }
Пример #17
0
 public BookServices(CRUDContext context)
 {
     this.context = context;
 }
Пример #18
0
 public BookController(CRUDContext context)
 {
     this.context = context;
 }
Пример #19
0
 public ClienteRepositorio(CRUDContext db)
 {
     _db = db;
 }
Пример #20
0
 public ClientRepository(CRUDContext context)
     : base(context)
 {
 }
Пример #21
0
 public SalesController(CRUDContext context)
 {
     _context = context;
 }
Пример #22
0
 public PedidoRepositorio(CRUDContext db)
 {
     _db = db;
 }
Пример #23
0
        //private IDbSet<T> dbEntity = null;

        public Repository()
        {
            db = new CRUDContext();
        }
Пример #24
0
 public UserRepository(CRUDContext context)
 {
     _context = context;
 }
Пример #25
0
 public CustomersController(CRUDContext CRUDContext)
 {
     _CRUDContext = CRUDContext;
 }
Пример #26
0
 public Repository(CRUDContext context)
 {
     Db    = context;
     DbSet = Db.Set <TEntity>();
 }
Пример #27
0
 public PacienteController(CRUDContext context)
 {
     this.context = context;
 }
Пример #28
0
 public CourseRepository(CRUDContext _db)
 {
     db = _db;
 }
Пример #29
0
 public HomeController(CRUDContext context)
 {
     dbContext = context;
 }
Пример #30
0
 public CategoryService(CRUDContext context)
 {
     _context = context;
 }