Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!this.Page.IsValid)
            {
                return;
            }

            bool isNew = (PrincipalId == -1);

            if (isNew)                  // New
            {
                // Check for unicity
                if (Mediachase.Ibn.Data.Services.Security.GetGlobalAceByPrincipal(mc, (int)(PrimaryKeyId)principal.Value) != null)
                {
                    // already exists
                    if (Page.Validators.Count > 0)
                    {
                        Page.Validators[0].IsValid = false;
                    }

                    return;
                }
            }


            // Saving
            MetaObject mo = null;

            if (!isNew)
            {
                mo = Mediachase.Ibn.Data.Services.Security.GetGlobalAceByPrincipal(mc, PrincipalId);
            }

            if (mo == null)
            {
                mo = new MetaObject(mc);
            }

            MetaObjectPropertyCollection properties = mo.Properties;

            properties[principalField].Value = principal.Value;
            for (int i = 0; i < rights.Count; i++)
            {
                string rightName = rights[i].ToString();
                properties[rightName].Value = ((CheckControl)checkControls[i]).Value;
            }

            mo.Save();

            // Closing window
            if (RefreshButton == String.Empty)
            {
                CHelper.CloseItAndRefresh(Response);
            }
            else              // Dialog Mode
            {
                CHelper.CloseItAndRefresh(Response, RefreshButton);
            }
        }
Ejemplo n.º 2
0
        private void btnSaveLostChanges_Click(object sender, EventArgs e)
        {
            AccessControlList ACLr = (AccessControlList)ViewState["ACL"];

            AccessControlList.SetACL(fs, ACLr, false);

            CommandParameters cp = new CommandParameters("FL_Security");

            Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, cp.ToString());

            CHelper.CloseItAndRefresh(Response);
        }
Ejemplo n.º 3
0
        protected void btnApprove_click(object sender, System.EventArgs e)
        {
            Mediachase.IBN.Business.TimeTracking.RegisterFinances(block, ddAccounts.SelectedValue, dtcDate.SelectedDate);

            // Closing window
            if (RefreshButton == String.Empty)
            {
                CHelper.CloseItAndRefresh(Response);
            }
            else              // Dialog Mode
            {
                CHelper.CloseItAndRefresh(Response, RefreshButton);
            }
        }
Ejemplo n.º 4
0
        private void btnSave_ServerClick(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }
            if (FileId > 0)
            {
                fs.RenameFile(FileId, txtTitle.Text, textDescription.Text);
                fs.AllowFileHistory(FileId, cbKeepHistory.Checked);
            }
            else if (LinkId == 0 && ParentFolderId >= 0)
            {
                string       data      = string.Format("[InternetShortcut]\r\nURL={0}", txtLink.Text);
                MemoryStream memStream = new MemoryStream();
                StreamWriter writer    = new StreamWriter(memStream, Encoding.Unicode);
                writer.Write(data);
                writer.Flush();
                memStream.Seek(0, SeekOrigin.Begin);
                string title         = txtTitle.Text;
                string html_filename = Mediachase.UI.Web.Util.CommonHelper.GetHtmlFileTitle(title);
                if (html_filename.IndexOf(".url") < 0)
                {
                    html_filename += ".url";
                }
                fs.SaveFile(ParentFolderId, html_filename, textDescription.Text, memStream);
            }

            CommandParameters cp = new CommandParameters("FL_NewLinkItem");

            if (Request["PrimaryKeyId"] != null)
            {
                cp.CommandName = "FL_Storage_EditFileItem";
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, cp.ToString());
            }
            else
            {
                if (Request["New"] != null)
                {
                    Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, cp.ToString());
                }
                else
                {
                    CHelper.CloseItAndRefresh(Response);
                }
            }
        }
Ejemplo n.º 5
0
        private void lbCopyFile_Click(object sender, EventArgs e)
        {
            int FileId = int.Parse(hdnFileId.Value);

            try
            {
                fs.CopyFile(FileId, FolderId);
            }
            catch { }

            if (Request["New"] != null)
            {
                CommandParameters cp = new CommandParameters("FL_Clipboard_Paste");
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, cp.ToString());
            }
            else
            {
                CHelper.CloseItAndRefresh(Response);
            }
        }
Ejemplo n.º 6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            // Saving
            Role role = Mediachase.Ibn.Data.Services.RoleManager.GetObjectRole(mc, RoleName);

            for (int i = 0; i < rights.Count; i++)
            {
                role.Properties[rights[i].ToString()].Value = ((CheckControl)checkControls[i]).Value;
            }
            role.Save();

            // Closing window
            if (RefreshButton == String.Empty)
            {
                CHelper.CloseItAndRefresh(Response);
            }
            else              // Dialog Mode
            {
                CHelper.CloseItAndRefresh(Response, RefreshButton);
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            MetaObject mo      = Mediachase.Ibn.Data.Services.RoleManager.GetObjectRole(mc, RoleName);
            MetaObject moState = StateMachineUtil.GetObjectRoleStateItem(ClassName, mo.PrimaryKeyId.Value, StateMachineId, StateId);

            if (moState == null)
            {
                MetaClass stateClass = StateMachineUtil.GetObjectRoleStateMetaClass(ClassName);
                moState = new MetaObject(stateClass);

                moState.Properties[StateMachineUtil.RoleField].Value         = mo.PrimaryKeyId.Value;
                moState.Properties[StateMachineUtil.StateMachineField].Value = StateMachineId;
                moState.Properties[StateMachineUtil.StateField].Value        = StateId;

                // Rights
                foreach (string rightName in Mediachase.Ibn.Data.Services.Security.GetRegisteredRights(ClassName))
                {
                    moState.Properties[rightName].Value = mo.Properties[rightName].Value;
                }
            }

            for (int i = 0; i < states.Count; i++)
            {
                string stateName = states[i].ToString();
                moState.Properties[stateName].Value = ((CheckControl)checkControls[i]).Value;
            }
            moState.Save();

            // Closing window
            if (RefreshButton == String.Empty)
            {
                CHelper.CloseItAndRefresh(Response);
            }
            else              // Dialog Mode
            {
                CHelper.CloseItAndRefresh(Response, RefreshButton);
            }
        }
Ejemplo n.º 8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!this.Page.IsValid)
            {
                return;
            }

            Mediachase.Ibn.Data.Services.StateMachine sm = null;
            if (SMId > 0)
            {
                sm = StateMachineManager.GetStateMachine(ClassName, SMId);
                sm.States.Clear();
            }
            else
            {
                sm = new Mediachase.Ibn.Data.Services.StateMachine(MetaDataWrapper.GetMetaClassByName(ClassName));
            }

            sm.Name = txtName.Text;

            foreach (string s in hdnStates.Value.Split(','))
            {
                sm.States.Add(new State(s));
            }

            sm.Save();

            // Closing window
            if (RefreshButton == String.Empty)
            {
                CHelper.CloseItAndRefresh(Response);
            }
            else              // Dialog Mode
            {
                CHelper.CloseItAndRefresh(Response, RefreshButton);
            }
        }
Ejemplo n.º 9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            AccessControlList ACLr = (AccessControlList)ViewState["ACL"];

            try
            {
                AccessControlList.SetACL(fs, ACLr);

                CommandParameters cp = new CommandParameters("FL_Security");

                if (Request["PrimaryKeyId"] != null)
                {
                    cp.CommandName = "FL_Storage_SecureItem";
                    Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, cp.ToString());
                }
                else
                {
                    if (Request["New"] != null)
                    {
                        Mediachase.Ibn.Web.UI.WebControls.CommandHandler.GetCloseOpenedFrameScript(this.Page, cp.ToString());
                    }
                    else
                    {
                        CHelper.CloseItAndRefresh(Response);
                    }
                }
            }
            catch (AllUserAccessWillBeDeniedException)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                        "openMenuLostrights();", true);
            }
            catch (AdminAccessWillBeDeniedException)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                        "openMenuLostrights();", true);
            }
        }
Ejemplo n.º 10
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            StateTransition[] stList = sm.GetAvailableTransitions(sm.GetState(FromState));
            foreach (StateTransition st in stList)
            {
                sm.Transitions.Remove(st);
            }

            for (int i = 1; i < tblMain.Rows.Count; i++)
            {
                HtmlTableRow  tr  = tblMain.Rows[i];
                HtmlTableCell td1 = tr.Cells[0];
                HtmlTableCell td2 = tr.Cells[1];

                CheckBox chk = td1.Controls[0] as CheckBox;
                TextBox  txt = td2.Controls[0] as TextBox;

                string toState = txt.ID.Substring(3);

                if (chk.Checked)
                {
                    sm.Transitions.Add(new StateTransition(txt.Text, FromState, toState));
                }
            }
            sm.Save();

            // Closing window
            if (RefreshButton == String.Empty)
            {
                CHelper.CloseItAndRefresh(Response);
            }
            else              // Dialog Mode
            {
                CHelper.CloseItAndRefresh(Response, RefreshButton);
            }
        }
Ejemplo n.º 11
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            using (MetaClassManagerEditScope editScope = DataContext.Current.MetaModel.BeginEdit())
            {
                Trigger trigger;
                if (TriggerName != String.Empty)
                {
                    trigger = TriggerManager.GetTrigger(ClassName, TriggerName);
                }
                else
                {
                    trigger      = new Trigger();
                    trigger.Name = txtName.Text.Trim();
                }

                trigger.ActionName    = ddlAction.SelectedValue;
                trigger.ConditionName = ddlCondition.SelectedValue;
                trigger.Create        = chkInsert.Checked;
                trigger.Delete        = chkDelete.Checked;
                trigger.Update        = chkUpdate.Checked;
                trigger.Description   = txtDescription.Text;

                List <string> conditionInParameters = new List <string>();
                for (int i = 0; i < tblCondition.Rows.Count; i++)
                {
                    TextBox txt = (TextBox)tblCondition.Rows[i].Cells[1].Controls[0];
                    conditionInParameters.Add(txt.Text.Trim());
                }
                trigger.ConditionInParameters = conditionInParameters;

                List <string> actionInParameters = new List <string>();
                for (int i = 0; i < tblAction.Rows.Count; i++)
                {
                    TextBox txt = (TextBox)tblAction.Rows[i].Cells[1].Controls[0];
                    actionInParameters.Add(txt.Text.Trim());
                }
                trigger.ActionInParameters = actionInParameters;

                if (TriggerName == String.Empty)
                {
                    TriggerManager.AddTrigger(ClassName, trigger);
                }

                editScope.SaveChanges();
            }

            // Closing window
            if (RefreshButton == String.Empty)
            {
                CHelper.CloseItAndRefresh(Response);
            }
            else              // Dialog Mode
            {
                CHelper.CloseItAndRefresh(Response, RefreshButton);
            }
        }