Ejemplo n.º 1
0
        protected void AddPolicyButton_OnClick(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(PolicyNameText.Text))
            {
                return;
            }
            if (PolicyId.Value != "0")
            {
                var policies = _hotelRepository.GetPolicesById(int.Parse(PolicyId.Value));
                if (policies != null)
                {
                    policies.Name = PolicyNameText.Text.Trim();
                    _hotelRepository.UpdatePolicies(policies);
                }
            }
            else
            {
                var policies = new Policies
                {
                    IsDelete = false,
                    Name     = PolicyNameText.Text.Trim()
                };
                _hotelRepository.AddPolicies(policies);
            }

            CacheLayer.Clear(CacheKeys.PoliciesCacheKey);
            BindPolicies(true);
        }