protected void List_RowCommand(object sender, CommandEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            int index = -1;

            if (int.TryParse(e.CommandArgument.ToString(), out index) &&
                e.CommandName.Equals("Conversion"))
            {
                List.SelectedIndex = index;
                List.Visible       = false;

                EditForm.Visible = true;
                EditForm.ChangeMode(DetailsViewMode.ReadOnly);

                ConversionList.Visible = true;
                ConversionList.DataBind();

                ShowLinkButtonBack();

                MasterDataSet.UnitsOfMeasureRow row = MeasureUnitsProvider.GetMeasureUnitRow((Guid)List.DataKeys[index]["UnitsOfMeasureId"]);
                if (row != null)
                {
                    LinkButtonBack.CommandArgument = row.GroupName;
                }

                base.AddBreadcrumbs();
            }
        }
        protected void EditForm_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            e.KeepInInsertMode = true;
            if (e.Exception != null)
            {
                e.ExceptionHandled = true;

                Exception ex = e.Exception.GetBaseException();
                if (ex is ConstraintException)
                {
                    ErrorPanel.InnerHtml = Resources.GroupsInstancesRolesControl_EditForm_InsertErrorMessage;
                }
                else
                {
                    ErrorPanel.InnerHtml = ex.Message;
                }
                ErrorPanel.Visible = true;
            }
            else
            {
                this.ShowList();
                List.DataBind();
            }
        }
Exemple #3
0
        protected void RecurrenceScheduleControl_Updated(object sender, RecurringScheduleEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            if (e.RecurringScheduleId != Guid.Empty)
            {
                RecurringScheduleProvider.UpdateRecurringSchedule(
                    e.RecurringScheduleId,
                    e.OrganizationId,
                    e.InstanceId,
                    e.LocalEntityType,
                    e.LocalEntityId,
                    e.Name,
                    TimeZoneInfo.ConvertTimeToUtc(e.StartDate, m_UserContext.TimeZone),
                    TimeZoneInfo.ConvertTimeToUtc(e.EndDate, m_UserContext.TimeZone),
                    e.RecurrenceRule,
                    DateTime.UtcNow,
                    (m_UserContext != null ? m_UserContext.UserId : Guid.Empty),
                    false);
                List.Visible = true;
                RecurrenceScheduleControl.Visible = false;
                List.DataBind();
                ResetBreadcrumbs();
            }
        }
Exemple #4
0
        protected void GridViewParameters_Action(object sender, CommonGridViewActionEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            switch (e.Action)
            {
            case CommandActions.Add:
                GridViewParameters.Visible = false;
                TableEditParameter.Visible = true;
                RuleParameterCaption.Text  = MagicForm.GetCaption(DetailsViewMode.Insert, Resources.RuleParametersControl_RuleParameterCaption_Text);
                m_EntityValue = null;
                m_FieldName   = null;
                DropDownListEntityTypes.DataBind();
                if (DropDownListEntityTypes.Items.Count > 0)
                {
                    DropDownListEntityTypes_SelectedIndexChanged(DropDownListEntityTypes, EventArgs.Empty);
                }
                break;

            case CommandActions.Edit:
                GridViewParameters.SelectedIndex = e.RowIndex;
                GridViewParameters.Visible       = false;
                TableEditParameter.Visible       = true;
                RuleParameterCaption.Text        = MagicForm.GetCaption(DetailsViewMode.Edit, Resources.RuleParametersControl_RuleParameterCaption_Text);
                ClientDataSet.RuleParametersRow row = RuleEngineProvider.GetRuleParameterRow(this.RuleParameterId);
                if (row != null)
                {
                    m_FieldName   = row.FieldName;
                    m_EntityValue = row.Value;
                    m_Term        = row.Term;
                    DropDownListEntityTypes.DataBind();
                    DropDownListEntityTypes.SelectedValue = row.EntityNodeTypeId.ToString();
                    DropDownListEntityTypes_SelectedIndexChanged(DropDownListEntityTypes, EventArgs.Empty);
                }
                break;

            case CommandActions.Delete:
                GridViewParameters.DataBind();
                break;

            default:
                break;
            }
        }
        protected void lbStep2_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(ddlDomains.SelectedValue))
            {
                try
                {
                    AppsService      service    = new AppsService(ddlDomains.SelectedValue, UserContext.Current.Organization.GoogleAdminAuthToken);
                    AppsExtendedFeed groupsFeed = service.Groups.RetrieveAllGroups();

                    DataTable dt = new DataTable();
                    dt.Columns.Add(Resources.GoogleIntegrationControl_NameColumn_HeaderText, typeof(string));
                    dt.Columns.Add(Resources.GoogleIntegrationControl_IdColumn_HeaderText, typeof(string));
                    dt.Columns.Add(Resources.GoogleIntegrationControl_DescriptionColumn_HeaderText, typeof(string));
                    dt.Columns.Add(Resources.GoogleIntegrationControl_MembersColumn_HeaderText, typeof(string));

                    for (int i = 0; i < groupsFeed.Entries.Count; i++)
                    {
                        GroupEntry    groupEntry = groupsFeed.Entries[i] as GroupEntry;
                        MemberFeed    memberFeed = service.Groups.RetrieveAllMembers(groupEntry.GroupId);
                        StringBuilder sb         = new StringBuilder();

                        for (int j = 0; j < memberFeed.Entries.Count; j++)
                        {
                            MemberEntry memberEntry = memberFeed.Entries[j] as MemberEntry;
                            if (string.Compare(memberEntry.MemberId, "*", true) == 0)
                            {
                                sb.AppendFormat(Resources.GoogleIntegrationControl_MembersColumn_AllUsersValue);
                            }
                            else
                            {
                                sb.AppendFormat("{0}<br>", memberEntry.MemberId);
                            }
                        }

                        dt.Rows.Add(groupEntry.GroupName, groupEntry.GroupId, groupEntry.Description, sb.ToString());
                    }

                    gvStep2Results.DataSource = dt;
                    gvStep2Results.DataBind();

                    mvStep2.SetActiveView(vwStep2Result);
                }
                catch (AppsException a)
                {
                    lblStep2Error.Text = string.Format(CultureInfo.CurrentCulture, Resources.GoogleIntegrationControl_GoogleAppsError_Text, a.ErrorCode, a.InvalidInput, a.Reason);
                    mvStep2.SetActiveView(vwStep2Error);
                }
                catch (Exception ex)
                {
                    ShowError(ex, lblStep2Error, mvStep2, vwStep2Error);
                }
            }
            else
            {
                lblStep2Error.Text = Resources.GoogleIntegrationControl_DomainMisingError_Text;
                mvStep2.SetActiveView(vwStep2Error);
            }
        }
Exemple #6
0
        protected bool ShowError(Exception exception)
        {
            bool result = ShowError(exception, ErrorPanel);

            if (!result)
            {
                EditFormReset();
                List.DataBind();
                this.ResetBreadcrumbs();
            }
            return(result);
        }
        private void ListDataBind()
        {
            InjectButton.Visible = (!LoginProvider.Current.LoginIsOrganizationAdministrator(m_UserContext.UserId, m_OrgId));

            List.SelectedIndex = -1;
            List.Visible       = true;
            List.DataBind();
            if (string.IsNullOrEmpty(List.SortExpression))
            {
                List.Sort("Name", SortDirection.Ascending);
            }
        }
Exemple #8
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (new Guid(DomainList.SelectedItem.Value) != new Guid() && new Guid(LdapGroupList.SelectedItem.Value) != new Guid())
            {
                LdapInfoProvider.InsertGroupMapping(new Guid(AppGroupTreeView.SelectedValue), UserContext.Current.OrganizationId, AppGroupTreeView.SelectedNode.Text, new Guid(DomainList.SelectedItem.Value), DomainList.SelectedItem.Text, new Guid(LdapGroupList.SelectedItem.Value), LdapGroupList.SelectedItem.Text);
                CommonGridView1.DataBind();
                LdapInfoProvider.UpdateLdapDomains(UserContext.Current.OrganizationId);

                AppGroupTreeView.UncheckAllNodes();
                AppGroupTreeView.UnselectAllNodes();
                DomainList.SelectedIndex    = 0;
                LdapGroupList.SelectedIndex = 0;
            }
        }
Exemple #9
0
        private void InitBillingControls()
        {
            DateTime?_expDate = UserContext.Current.Organization.ExpirationTime;

            ISubscription _custSubscr = ChargifyProvider.GetCustomerSubscription(Chargify, OrganizationId, InstanceId);

            if (_custSubscr != null && _custSubscr.CreditCard != null)
            {
                _expDate = _custSubscr.CurrentPeriodEndsAt;
                if (!IsPostBack)
                {
                    SettingCollection paidSettings = SettingProvider.GetAllPricedSettings(OrganizationId, InstanceId);
                    ChargifyProvider.UpdateSubscriptionAllocations(Chargify, _custSubscr.SubscriptionID, UserContext.Current.Instance, paidSettings, paidSettings);
                }
                TotalAmount    = m_TotalSum;
                SubscriptionId = _custSubscr.SubscriptionID;
                lCCStatus.Text = "Credit Card Registered and " + _custSubscr.State.ToString() + ".";
                TimeSpan _dateDiff = (TimeSpan)(_expDate - DateTime.UtcNow);
                if (_expDate.HasValue)
                {
                    smallNextBillDate.Visible   = true;
                    smallNextBillDate.InnerText = "Next billed on " + _expDate.Value.ToString("dd-MMM-yyyy");
                }
            }
            else
            {
                lCCStatus.Text = "No Credit Card on File.";
                if (!IsPostBack)
                {
                    DisablePurchaseButtons();
                }
            }
            if (_custSubscr != null && _custSubscr.CreditCard != null)
            {
                System.Collections.Generic.List <TransactionType> transTypes = new List <TransactionType>();
                transTypes.Add(TransactionType.Payment);
                System.Collections.Generic.IDictionary <int, ITransaction> trans = Chargify.GetTransactionsForSubscription(_custSubscr.SubscriptionID, 1, 25, transTypes);
                if (trans != null && trans.Count > 0)
                {
                    divPaymentHistoryHeader.Visible = true;
                    cgvTransactList.Visible         = true;
                    cgvTransactList.DataSource      = trans.Values;
                    cgvTransactList.DataBind();
                }
            }
        }
        protected void lbStep1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(ddlDomains.SelectedValue))
            {
                try
                {
                    AppsService service  = new AppsService(ddlDomains.SelectedValue, UserContext.Current.Organization.GoogleAdminAuthToken);
                    UserFeed    userFeed = service.RetrieveAllUsers();

                    DataTable dt = new DataTable();
                    dt.Columns.Add(Resources.GoogleIntegrationControl_UsernameColumn_HeaderText, typeof(string));
                    dt.Columns.Add(Resources.GoogleIntegrationControl_FirstNameColumn_HeaderText, typeof(string));
                    dt.Columns.Add(Resources.GoogleIntegrationControl_LastNameColumn_HeaderText, typeof(string));
                    dt.Columns.Add(Resources.GoogleIntegrationControl_AdminColumn_HeaderText, typeof(string));

                    for (int i = 0; i < userFeed.Entries.Count; i++)
                    {
                        UserEntry userEntry = userFeed.Entries[i] as UserEntry;
                        dt.Rows.Add(userEntry.Login.UserName, userEntry.Name.GivenName, userEntry.Name.FamilyName, userEntry.Login.Admin ? Resources.GoogleIntegrationControl_AdminColumn_Value : string.Empty);
                    }

                    gvStep1Results.DataSource = dt;
                    gvStep1Results.DataBind();

                    mvStep1.SetActiveView(vwStep1Result);

                    lbImportUsers.Text    = Resources.GoogleIntegrationControl_ImportUsers_LinkButton_Text;
                    lbImportUsers.Visible = lbImportUsers.Enabled = dt.Rows.Count > 0;
                }
                catch (AppsException a)
                {
                    lblStep1Error.Text = string.Format(CultureInfo.CurrentCulture, Resources.GoogleIntegrationControl_GoogleAppsError_Text, a.ErrorCode, a.InvalidInput, a.Reason);
                    mvStep1.SetActiveView(vwStep1Error);
                }
                catch (Exception ex)
                {
                    ShowError(ex, lblStep1Error, mvStep1, vwStep1Error);
                }
            }
            else
            {
                lblStep1Error.Text = Resources.GoogleIntegrationControl_DomainMisingError_Text;
                mvStep1.SetActiveView(vwStep1Error);
            }
        }
        protected void ShowResultsGetUserGroups()
        {
            Bll.LdapProcess ldapProcess = null;
            string          processId   = string.Format("GetUserGroups_{0}_{1}", UserContext.Current.OrganizationId, this.UserId);

            try
            {
                GetUserGroupsTimer.Enabled = false;
                ldapProcess = LdapInfoProvider.LdapProcesses.Find(x => x.ProcessId == processId);
                if (ldapProcess != null)
                {
                    switch (ldapProcess.ThreadStateType)
                    {
                    case Bll.ThreadStateType.Failed:
                        GetUserGroupsButton.Enabled = true;
                        GetUserGroupsMultiView.SetActiveView(GetUserGroupsViewError);
                        GetUserGroupsViewErrorLiteral.Text = ldapProcess.MessageError;
                        LdapInfoProvider.LdapProcesses.Remove(ldapProcess);
                        break;

                    case Bll.ThreadStateType.Finished:
                        GetUserGroupsButton.Enabled = true;
                        GetUserGroupsMultiView.SetActiveView(GetUserGroupsViewResult);
                        UserGroupsCommonGridView.DataSource = ldapProcess.Data as DataView;
                        UserGroupsCommonGridView.DataBind();
                        LdapInfoProvider.LdapProcesses.Remove(ldapProcess);
                        break;

                    case Bll.ThreadStateType.Running:
                        GetUserGroupsMultiView.SetActiveView(GetUserGroupsViewProcess);
                        GetUserGroupsTimer.Enabled  = true;
                        GetUserGroupsButton.Enabled = false;
                        break;
                    }
                }
            }
            finally
            {
                ldapProcess = null;
                processId   = null;
            }
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            Micajah.Common.Pages.MasterPage.InitializeSetupPage(this.Page);

            ExportLink.Text        = Resources.ActivityReportControl_ExportLink_Text;
            ExportLink.NavigateUrl = Request.Url.ToString() + "?file=excel";

            this.SetPageTitle();

            this.InitializeSettings();

            if (!this.IsExport)
            {
                this.InitializeList();

                List.DataSource = this.ReportDataSource;
                List.DataBind();
            }
        }
Exemple #13
0
        protected void Tree_ContextMenuItemClick(object sender, RadTreeViewContextMenuEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            List.Visible = false;
            if (e.MenuItem.Value.StartsWith("CREATE", StringComparison.OrdinalIgnoreCase))
            {
                string[] menuItemValues = e.MenuItem.Value.Split('_');
                bool     maxRestricted  = false;
                if (new Guid(e.Node.Value) != Guid.Empty)
                {
                    EntityNodeType ent = Entity.NodeTypes[menuItemValues[1]];
                    if (ent != null && ent.MaxRestrict > 0)
                    {
                        maxRestricted = IsRestricted(e.Node, menuItemValues[1], ent.MaxRestrict, this.Entity.HierarchyMaxDepth);
                    }
                }

                if (!maxRestricted)
                {
                    Guid        entityId = Bll.Providers.EntityNodeProvider.InsertEntityNode(UserContext.Current.OrganizationId, this.SelectedInstanceId, "new", new Guid(menuItemValues[1]), this.EntityId, new Guid(e.Node.Value), this.Entity.HierarchyStartLevel);
                    RadTreeNode rtn      = new RadTreeNode();
                    rtn.Text          = "new";
                    rtn.Value         = entityId.ToString("N");
                    rtn.Category      = menuItemValues[1];
                    rtn.ContextMenuID = "Menu" + menuItemValues[1];
                    e.Node.Nodes.Add(rtn);
                    e.Node.Expanded = true;
                    Bll.Providers.EntityNodeProvider.UpdateEntityNodePath(entityId, rtn.GetFullPath(" > "));
                    StartNodeInEditMode(rtn.Value);
                }
                else
                {
                    RestrictErrorLabel.Text    = Resources.EntityControl_RestrictErrorLabel_Text;
                    RestrictErrorLabel.Visible = true;
                }
            }
            else if (e.MenuItem.Value.ToUpperInvariant() == "DELETE")
            {
                EntityNodeProvider.DeleteEntityNode(new Guid(e.Node.Value));
                Tree.FindNodeByValue(e.Node.Value).Remove();
            }
            else if (e.MenuItem.Value.ToUpperInvariant() == "CLONE")
            {
                Guid sourceId = new Guid(e.Node.Value);
                ClientDataSet.EntityNodeRow source = EntityNodeProvider.GetEntityNode(sourceId);

                if (source.IsParentEntityNodeIdNull())
                {
                    source.ParentEntityNodeId = Guid.Empty;
                }

                RadTreeNode rtn = new RadTreeNode();
                rtn.Text          = e.Node.Text + "_Copy" + (e.Node.ParentNode.Nodes.Count + 1).ToString(CultureInfo.InvariantCulture);
                rtn.Value         = EntityNodeProvider.InsertEntityNode(UserContext.Current.OrganizationId, this.SelectedInstanceId, rtn.Text, source.EntityNodeTypeId, source.EntityId, source.ParentEntityNodeId, this.Entity.HierarchyStartLevel).ToString();
                rtn.Category      = e.Node.Category;
                rtn.ContextMenuID = e.Node.ContextMenuID;
                e.Node.ParentNode.Nodes.Add(rtn);
                Bll.Providers.EntityNodeProvider.UpdateEntityNodePath(new Guid(rtn.Value), rtn.GetFullPath(" > "));
                CloneNode(e.Node, rtn);
            }

            else if (e.MenuItem.Value == Resources.EntityControl_AddNodeType || e.MenuItem.Value == Resources.EntityControl_EditNodeType)
            {
                List.DataBind();
                List.Visible = true;
            }
            else
            {
                if (!string.IsNullOrEmpty(e.MenuItem.Value))
                {
                    Response.Redirect(string.Format(CultureInfo.InvariantCulture, e.MenuItem.Value, e.Node.Value));
                }
            }
        }