Ejemplo n.º 1
0
        private bool UpdateSortOrder(string blockId, int newSort)
        {
            PolicyBlock b = this.Blocks.Where(y => y.Bvin == blockId).FirstOrDefault();

            if (b != null)
            {
                b.SortOrder = newSort;
            }
            return(true);
        }
        private bool Save()
        {
            bool result = false;

            PolicyBlock b;
            b = MTApp.ContentServices.Policies.FindBlock(this.BvinField.Value);
            if (b == null) b = new PolicyBlock();
            
                b.Name = this.NameField.Text.Trim();
                b.Description = this.DescriptionField.Text.Trim();
                b.DescriptionPreTransform = this.DescriptionField.PreTransformText;

                Policy p = MTApp.ContentServices.Policies.Find(this.PolicyIdField.Value);
                
                if (this.BvinField.Value == string.Empty)
                {
                    b.PolicyID = this.PolicyIdField.Value;
                    if (p != null)
                    {
                        p.Blocks.Add(b);
                        result = MTApp.ContentServices.Policies.Update(p);                        
                    }                    
                }
                else
                {
                    result = MTApp.ContentServices.Policies.UpdateBlock(b);
                }

                if (result == true)
                {
                    // Update bvin field so that next save will call updated instead of create
                    this.BvinField.Value = b.Bvin;
                }
            
            return result;
        }
Ejemplo n.º 3
0
 public bool UpdateBlock(PolicyBlock item)
 {
     return(this.blockRepository.Update(item));
 }