public ManufacturerTemplate SaveInfo()
        {
            ManufacturerTemplate manufacturerTemplate = this.TemplateService.GetManufacturerTemplateById(this.ManufacturerTemplateId);

            if (manufacturerTemplate != null)
            {
                manufacturerTemplate.Name         = txtName.Text;
                manufacturerTemplate.TemplatePath = txtTemplatePath.Text;
                manufacturerTemplate.DisplayOrder = txtDisplayOrder.Value;
                manufacturerTemplate.UpdatedOn    = DateTime.UtcNow;

                this.TemplateService.UpdateManufacturerTemplate(manufacturerTemplate);
            }
            else
            {
                DateTime now = DateTime.UtcNow;
                manufacturerTemplate = new ManufacturerTemplate()
                {
                    Name         = txtName.Text,
                    TemplatePath = txtTemplatePath.Text,
                    DisplayOrder = txtDisplayOrder.Value,
                    CreatedOn    = now,
                    UpdatedOn    = now
                };
                this.TemplateService.InsertManufacturerTemplate(manufacturerTemplate);
            }

            return(manufacturerTemplate);
        }
Exemple #2
0
        public virtual void UpdateManufacturerTemplate(ManufacturerTemplate manufacturerTemplate)
        {
            if (manufacturerTemplate == null)
            {
                throw new ArgumentNullException("manufacturerTemplate");
            }

            _manufacturerTemplateRepository.Update(manufacturerTemplate);
        }
Exemple #3
0
        /// <summary>
        /// Inserts manufacturer template
        /// </summary>
        /// <param name="manufacturerTemplate">Manufacturer template</param>
        public virtual void InsertManufacturerTemplate(ManufacturerTemplate manufacturerTemplate)
        {
            if (manufacturerTemplate == null)
            {
                throw new ArgumentNullException("manufacturerTemplate");
            }

            _manufacturerTemplateRepository.Insert(manufacturerTemplate);
            //_unitOfWork.Commit();
        }
        /// <summary>
        /// Updates the manufacturer template
        /// </summary>
        /// <param name="manufacturerTemplate">Manufacturer template</param>
        public virtual void UpdateManufacturerTemplate(ManufacturerTemplate manufacturerTemplate)
        {
            if (manufacturerTemplate == null)
            {
                throw new ArgumentNullException("manufacturerTemplate");
            }

            _manufacturerTemplateRepository.Update(manufacturerTemplate);

            //event notification
            _eventPublisher.EntityUpdated(manufacturerTemplate);
        }
        /// <summary>
        /// Updates the manufacturer template
        /// </summary>
        /// <param name="manufacturerTemplate">Manufacturer template</param>
        public virtual async Task UpdateManufacturerTemplate(ManufacturerTemplate manufacturerTemplate)
        {
            if (manufacturerTemplate == null)
            {
                throw new ArgumentNullException("manufacturerTemplate");
            }

            await _manufacturerTemplateRepository.UpdateAsync(manufacturerTemplate);

            //event notification
            await _eventPublisher.EntityUpdated(manufacturerTemplate);
        }
        /// <summary>
        /// Inserts manufacturer template
        /// </summary>
        /// <param name="manufacturerTemplate">Manufacturer template</param>
        public virtual async Task InsertManufacturerTemplate(ManufacturerTemplate manufacturerTemplate)
        {
            if (manufacturerTemplate == null)
            {
                throw new ArgumentNullException("manufacturerTemplate");
            }

            await _manufacturerTemplateRepository.InsertAsync(manufacturerTemplate);

            //event notification
            await _mediator.EntityInserted(manufacturerTemplate);
        }
Exemple #7
0
        /// <summary>
        /// Inserts manufacturer template
        /// </summary>
        /// <param name="manufacturerTemplate">Manufacturer template</param>
        public virtual void InsertManufacturerTemplate(ManufacturerTemplate manufacturerTemplate)
        {
            if (manufacturerTemplate == null)
            {
                throw new ArgumentNullException(nameof(manufacturerTemplate));
            }

            _manufacturerTemplateRepository.Insert(manufacturerTemplate);

            //event notification
            _eventPublisher.EntityInserted(manufacturerTemplate);
        }
        /// <summary>
        /// Delete manufacturer template
        /// </summary>
        /// <param name="manufacturerTemplate">Manufacturer template</param>
        public virtual void DeleteManufacturerTemplate(ManufacturerTemplate manufacturerTemplate)
        {
            if (manufacturerTemplate == null)
            {
                throw new ArgumentNullException("manufacturerTemplate");
            }

            _manufacturerTemplateRepository.Delete(manufacturerTemplate);

            _cacheManager.RemoveByPattern(MANUFACTURERTEMPLATES_PATTERN_KEY);

            //event notification
            _eventPublisher.EntityDeleted(manufacturerTemplate);
        }
Exemple #9
0
 protected void SaveButton_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         try
         {
             ManufacturerTemplate manufacturerTemplate = ctrlManufacturerTemplateInfo.SaveInfo();
             Response.Redirect("ManufacturerTemplateDetails.aspx?ManufacturerTemplateID=" + manufacturerTemplate.ManufacturerTemplateID.ToString());
         }
         catch (Exception exc)
         {
             ProcessException(exc);
         }
     }
 }
 protected void SaveButton_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         try
         {
             ManufacturerTemplate manufacturerTemplate = Save();
             Response.Redirect("ManufacturerTemplates.aspx");
         }
         catch (Exception exc)
         {
             ProcessException(exc);
         }
     }
 }
        public void Can_save_and_load_manufacturerTemplate()
        {
            var manufacturerTemplate = new ManufacturerTemplate()
            {
                Name         = "Name 1",
                ViewPath     = "ViewPath 1",
                DisplayOrder = 1,
            };

            var fromDb = SaveAndLoadEntity(manufacturerTemplate);

            fromDb.ShouldNotBeNull();
            fromDb.Name.ShouldEqual("Name 1");
            fromDb.ViewPath.ShouldEqual("ViewPath 1");
            fromDb.DisplayOrder.ShouldEqual(1);
        }
        private void CreateChildControlsTree()
        {
            manufacturer = ManufacturerManager.GetManufacturerByID(this.ManufacturerID);
            if (manufacturer != null)
            {
                Control child = null;

                ManufacturerTemplate manufacturerTemplate = manufacturer.ManufacturerTemplate;
                if (manufacturerTemplate == null)
                {
                    throw new NopException(string.Format("Manufacturer template path can not be empty. ManufacturerID={0}", manufacturer.ManufacturerID));
                }

                child = base.LoadControl(manufacturerTemplate.TemplatePath);
                this.ManufacturerPlaceHolder.Controls.Add(child);
            }
        }
 public IActionResult ManufacturerTemplateAdd(ManufacturerTemplateModel model)
 {
     if (!ModelState.IsValid)
     {
         return(Json(new DataSourceResult {
             Errors = ModelState.SerializeErrors()
         }));
     }
     if (ModelState.IsValid)
     {
         var template = new ManufacturerTemplate();
         template = model.ToEntity(template);
         _manufacturerTemplateService.InsertManufacturerTemplate(template);
         return(new NullJsonResult());
     }
     return(ErrorForKendoGridJson(ModelState));
 }
        public ManufacturerTemplate SaveInfo()
        {
            ManufacturerTemplate manufacturerTemplate = TemplateManager.GetManufacturerTemplateByID(this.ManufacturerTemplateID);

            if (manufacturerTemplate != null)
            {
                manufacturerTemplate = TemplateManager.UpdateManufacturerTemplate(manufacturerTemplate.ManufacturerTemplateID, txtName.Text,
                                                                                  txtTemplatePath.Text, txtDisplayOrder.Value, manufacturerTemplate.CreatedOn, DateTime.Now);
            }
            else
            {
                DateTime now = DateTime.Now;
                manufacturerTemplate = TemplateManager.InsertManufacturerTemplate(txtName.Text,
                                                                                  txtTemplatePath.Text, txtDisplayOrder.Value, now, now);
            }

            return(manufacturerTemplate);
        }
Exemple #15
0
        public virtual IActionResult ManufacturerTemplateAdd(ManufacturerTemplateModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
            {
                return(AccessDeniedView());
            }

            if (!ModelState.IsValid)
            {
                return(ErrorJson(ModelState.SerializeErrors()));
            }

            var template = new ManufacturerTemplate();

            template = model.ToEntity(template);
            _manufacturerTemplateService.InsertManufacturerTemplate(template);

            return(Json(new { Result = true }));
        }
        private void BindData()
        {
            ManufacturerTemplate manufacturerTemplate = TemplateManager.GetManufacturerTemplateByID(this.ManufacturerTemplateID);

            if (manufacturerTemplate != null)
            {
                this.txtName.Text          = manufacturerTemplate.Name;
                this.txtTemplatePath.Text  = manufacturerTemplate.TemplatePath;
                this.txtDisplayOrder.Value = manufacturerTemplate.DisplayOrder;
                this.pnlCreatedOn.Visible  = true;
                this.pnlUpdatedOn.Visible  = true;
                this.lblCreatedOn.Text     = DateTimeHelper.ConvertToUserTime(manufacturerTemplate.CreatedOn).ToString();
                this.lblUpdatedOn.Text     = DateTimeHelper.ConvertToUserTime(manufacturerTemplate.UpdatedOn).ToString();
            }
            else
            {
                this.pnlCreatedOn.Visible = false;
                this.pnlUpdatedOn.Visible = false;
            }
        }
        public virtual ActionResult ManufacturerTemplateAdd([Bind(Exclude = "Id")] ManufacturerTemplateModel model)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
            {
                return(AccessDeniedView());
            }

            if (!ModelState.IsValid)
            {
                return(Json(new DataSourceResult {
                    Errors = ModelState.SerializeErrors()
                }));
            }

            var template = new ManufacturerTemplate();

            template = model.ToEntity(template);
            _manufacturerTemplateService.InsertManufacturerTemplate(template);

            return(new NullJsonResult());
        }
Exemple #18
0
        public ActionResult ManufacturerTemplateAdd([Bind(Exclude = "Id")] ManufacturerTemplateModel model, GridCommand command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
            {
                return(AccessDeniedView());
            }

            if (!ModelState.IsValid)
            {
                //display the first model error
                var modelStateErrors = this.ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage);
                return(Content(modelStateErrors.FirstOrDefault()));
            }

            var template = new ManufacturerTemplate();

            template = model.ToEntity(template);
            _manufacturerTemplateService.InsertManufacturerTemplate(template);

            return(ManufacturerTemplates(command));
        }
 public static ManufacturerTemplateModel ToModel(this ManufacturerTemplate entity)
 {
     return(entity.MapTo <ManufacturerTemplate, ManufacturerTemplateModel>());
 }
Exemple #20
0
 /// <summary>
 /// Updates the manufacturer template
 /// </summary>
 /// <param name="manufacturerTemplate">Manufacturer template</param>
 public virtual void UpdateManufacturerTemplate(ManufacturerTemplate manufacturerTemplate)
 {
     _manufacturerTemplateRepository.Update(manufacturerTemplate);
 }
 public static ManufacturerTemplate ToEntity(this ManufacturerTemplateModel model, ManufacturerTemplate destination)
 {
     return(model.MapTo(destination));
 }
        protected ManufacturerTemplate Save()
        {
            ManufacturerTemplate manufacturerTemplate = ctrlManufacturerTemplateInfo.SaveInfo();

            return(manufacturerTemplate);
        }
 /// <summary>
 /// Updates the manufacturer template
 /// </summary>
 /// <param name="manufacturerTemplate">Manufacturer template</param>
 /// <returns>A task that represents the asynchronous operation</returns>
 public virtual async Task UpdateManufacturerTemplateAsync(ManufacturerTemplate manufacturerTemplate)
 {
     await _manufacturerTemplateRepository.UpdateAsync(manufacturerTemplate);
 }
 /// <summary>
 /// Inserts manufacturer template
 /// </summary>
 /// <param name="manufacturerTemplate">Manufacturer template</param>
 /// <returns>A task that represents the asynchronous operation</returns>
 public virtual async Task InsertManufacturerTemplateAsync(ManufacturerTemplate manufacturerTemplate)
 {
     await _manufacturerTemplateRepository.InsertAsync(manufacturerTemplate);
 }
Exemple #25
0
 public static ManufacturerTemplateModel ToModel(this ManufacturerTemplate entity)
 {
     return(Mapper.Map <ManufacturerTemplate, ManufacturerTemplateModel>(entity));
 }
Exemple #26
0
 /// <summary>
 /// Inserts manufacturer template
 /// </summary>
 /// <param name="manufacturerTemplate">Manufacturer template</param>
 public virtual void InsertManufacturerTemplate(ManufacturerTemplate manufacturerTemplate)
 {
     _manufacturerTemplateRepository.Insert(manufacturerTemplate);
 }