Beispiel #1
0
        public static void SaveButton_OnClickStep(IInsertDepartment form, EventArgs args)
        {
            IWebDialogService dialogService = form.Services.Get <IWebDialogService>();
            IOwner            owner         = EntityFactory.Create <IOwner>();

            owner.OwnerDescription = form.OwnerDescription.Text;
            owner.Type             = OwnerType.Department;
            if (!owner.IsValidName(form.OwnerDescription.Text))
            {
                string msg = form.GetResource("InvalidNameMessage").ToString();
                if (dialogService != null && !string.IsNullOrEmpty(msg))
                {
                    dialogService.ShowMessage(msg, form.GetResource("InvalidNameMessageTitle").ToString());
                }

                return;
            }

            if (owner.OwnerNameExists(form.OwnerDescription.Text))
            {
                string msg = form.GetResource("DuplicateOwnerMessage").ToString();
                if (dialogService != null && !string.IsNullOrEmpty(msg))
                {
                    dialogService.ShowMessage(msg, form.GetResource("DuplicateOwnerTitle").ToString());
                }

                return;
            }

            owner.Save();

            IOwnerSecurityProfile securityProfile = EntityFactory.GetById <IOwnerSecurityProfile>("PROF00000001");

            if (form.securityProfileLookup.LookupResultValue != null)
            {
                securityProfile = form.securityProfileLookup.LookupResultValue as IOwnerSecurityProfile;
            }

            // get a department object.  This is a view of the owner object
            IDepartment department = EntityFactory.GetById <IDepartment>(owner.Id);

            // add an ownerJoin record for the new team.  Both the parent and the
            // child ids will point to the team
            department.AddMemberWithSecurityProfile(owner, securityProfile);

            HttpContext.Current.Response.Redirect(string.Format("~/Department.aspx?entityId={0}", owner.Id.ToString()), false);
        }
        public static void SaveButton_OnClickStep(IInsertDepartment form, EventArgs args)
        {
            IWebDialogService dialogService = form.Services.Get<IWebDialogService>();
            IOwner owner = EntityFactory.Create<IOwner>();
            owner.OwnerDescription = form.OwnerDescription.Text;
            owner.Type = OwnerType.Department;
            if (!owner.IsValidName(form.OwnerDescription.Text))
            {
                string msg = form.GetResource("InvalidNameMessage").ToString();
                if (dialogService != null && !string.IsNullOrEmpty(msg))
                    dialogService.ShowMessage(msg, form.GetResource("InvalidNameMessageTitle").ToString());

                return;
            }

            if (owner.OwnerNameExists(form.OwnerDescription.Text))
            {
                string msg = form.GetResource("DuplicateOwnerMessage").ToString();
                if (dialogService != null && !string.IsNullOrEmpty(msg))
                    dialogService.ShowMessage(msg, form.GetResource("DuplicateOwnerTitle").ToString());

                return;
            }

            owner.Save();

            IOwnerSecurityProfile securityProfile = EntityFactory.GetById<IOwnerSecurityProfile>("PROF00000001");
            if (form.securityProfileLookup.LookupResultValue != null)
                securityProfile = form.securityProfileLookup.LookupResultValue as IOwnerSecurityProfile;

            // get a department object.  This is a view of the owner object
            IDepartment department = EntityFactory.GetById<IDepartment>(owner.Id);
            // add an ownerJoin record for the new team.  Both the parent and the
            // child ids will point to the team
            department.AddMemberWithSecurityProfile(owner, securityProfile);

            HttpContext.Current.Response.Redirect(string.Format("~/Department.aspx?entityId={0}", owner.Id.ToString()), false);
        }
 public static void OnLoad1Step( IInsertDepartment form,  EventArgs args)
 {
     IOwnerSecurityProfile securityProfile = EntityFactory.GetById<IOwnerSecurityProfile>("PROF00000001"); // read/write default
     form.securityProfileLookup.LookupResultValue = securityProfile;
 }
        public static void OnLoad1Step(IInsertDepartment form, EventArgs args)
        {
            IOwnerSecurityProfile securityProfile = EntityFactory.GetById <IOwnerSecurityProfile>("PROF00000001");            // read/write default

            form.securityProfileLookup.LookupResultValue = securityProfile;
        }