예제 #1
0
        public async Task<ActionResult> Add(VF_API_CLIENT_OBJECTS model)
        {
            try
            {
                model.DB_OBJECT_MODIFIED_DATE = DateTime.Now;
                model.DB_OBJECT_CREATED_DATE = DateTime.Now;

                await _clientObjectProvider.Save(model);
                var client = _catalogClientProvider.GetAll().Where(x => x.TRANSDEV_ID == model.TRANSDEV_ID).First();

                SuccessMessage = "New Endpoint is Added";

                return RedirectToAction("Edit", "Clients", new { id = client.CLIENT_ID });
            }
            catch(Exception ex)
            {
                ExceptionDetails = ex;
                ErrorMessage = "Unexpected error occured while creating an endpoint";
            }

            List<SelectListItem> items = GetProviders();
            ViewBag.Providviders = new SelectList(items, "Value", "Text");

            return View(model);
        }
예제 #2
0
        public ActionResult Add(Guid id)
        {
            List<SelectListItem> items = GetProviders();
            ViewBag.Providviders=  new SelectList(items, "Value", "Text");

            var model = new VF_API_CLIENT_OBJECTS();
            model.TRANSDEV_ID = _catalogClientProvider.GetAll().Where(e => e.CLIENT_ID == id).FirstOrDefault().TRANSDEV_ID;

            return View(model);
        }
예제 #3
0
        public async Task<int> Save(VF_API_CLIENT_OBJECTS clientObject)
        {
            using (var context = new Entities())
            {
                if (clientObject.CLIENT_OBJECT_ID == System.Guid.Empty)
                {
                    clientObject.CLIENT_OBJECT_ID = System.Guid.NewGuid();
                    context.Entry(clientObject).State = EntityState.Added;
                }
                else
                {
                    context.Entry(clientObject).State = EntityState.Modified;
                }

                return await context.SaveChangesAsync();
            }
        }
예제 #4
0
        /// <summary>
        /// Execute DataProvide
        /// </summary>
        /// <param name="clients">VF_API_CLIENT_OBJECTS</param>
        /// <returns>QueryResult of DataTable</returns>
        public async Task<QueryResult<DataTable>> Execute(VF_API_CLIENT_OBJECTS client)
        {
            using (var context = new Entities())
            {
                var adaptor = new SqlServerTableAdaptor();

                var parameters = new SqlServerTableParameters();
                parameters.UserID = client.DB_USER;
                parameters.Password = client.DB_USER_PASSWORD;
                parameters.DataSource = client.DB_SERVER_NAME;
                parameters.InitialCatalog = client.DB_NAME;
                parameters.IntegratedSecurity = client.DB_INTEGRATED_SECURITY;
                parameters.ObjectName = client.DB_OBJECT_NAME;
                parameters.SchemaName = client.DB_SCHEMA;

                return adaptor.Execute(parameters);
            }
        }