示例#1
0
    /// <summary>
    /// UniGrid external databound.
    /// </summary>
    object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        ImageButton btn = null;

        switch (sourceName.ToLower())
        {
        // Display delete button
        case "remove":
            btn = (ImageButton)sender;

            // Display delete button only for users with appropriate permission
            DataRowView drv = (parameter as GridViewRow).DataItem as DataRowView;
            if (ValidationHelper.GetInteger(drv["ContactSiteID"], 0) > 0)
            {
                btn.Enabled = modifySiteContacts || modifySiteCG;
            }
            else
            {
                btn.Enabled = modifyGlobalContacts || modifyGlobalCG;
            }
            if (!btn.Enabled)
            {
                btn.Attributes.Add("src", GetImageUrl("Design/Controls/UniGrid/Actions/DeleteDisabled.png"));
            }
            break;
        }

        return(CMControlsHelper.UniGridOnExternalDataBound(sender, sourceName, parameter));
    }
示例#2
0
 object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
 {
     if (sourceName == "birthday")
     {
         return(((DateTime)parameter).ToShortDateString());
     }
     return(CMControlsHelper.UniGridOnExternalDataBound(sender, sourceName, parameter));
 }
示例#3
0
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        ImageButton btn = null;

        switch (sourceName)
        {
        case "edit":
            btn = ((ImageButton)sender);
            btn.Attributes.Add("onClick", "EditAccount(" + btn.CommandArgument + "); return false;");
            break;
        }
        return(CMControlsHelper.UniGridOnExternalDataBound(sender, sourceName, parameter));
    }
示例#4
0
    /// <summary>
    /// UniGrid databound.
    /// </summary>
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        // Display full name for primary contact
        DataRowView drv = parameter as DataRowView;

        switch (sourceName.ToLower())
        {
        // Display information that contact is merged
        case "contactmergedwithcontactid":
            int mergedIntoSite   = ValidationHelper.GetInteger(drv["ContactMergedWithContactID"], 0);
            int mergedIntoGlobal = ValidationHelper.GetInteger(drv["ContactGlobalContactID"], 0);
            int siteID           = ValidationHelper.GetInteger(drv["ContactSiteID"], 0);
            if (((siteID > 0) && (mergedIntoSite > 0)) || ((siteID == 0) && (mergedIntoGlobal > 0)))
            {
                return(GetString("general.yes"));
            }
            break;

        // Display delete button
        case "delete":
            ImageButton btn = (ImageButton)sender;
            btn.OnClientClick = string.Format("dialogParams_{0} = '{1}';{2};return false;",
                                              ClientID,
                                              btn.CommandArgument,
                                              Page.ClientScript.GetCallbackEventReference(this, "dialogParams_" + ClientID, "Delete", null));

            // Display delete button only for users with appropriate permission
            if (this.SiteID == UniSelector.US_GLOBAL_OR_SITE_RECORD)
            {
                drv = (parameter as GridViewRow).DataItem as DataRowView;
                if (ValidationHelper.GetInteger(drv["ContactSiteID"], 0) > 0)
                {
                    btn.Enabled = modifySite;
                }
                else
                {
                    btn.Enabled = modifyGlobal;
                }
            }
            else
            {
                btn.Enabled = modifyPermission;
            }
            if (!btn.Enabled)
            {
                btn.Attributes.Add("src", GetImageUrl("Design/Controls/UniGrid/Actions/DeleteDisabled.png"));
            }
            break;
        }
        return(CMControlsHelper.UniGridOnExternalDataBound(sender, sourceName, parameter));
    }
示例#5
0
    object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        ImageButton btn = null;

        switch (sourceName.ToLower())
        {
        case "delete":
            if (!ModifyGroupPermission)
            {
                btn         = (ImageButton)sender;
                btn.Enabled = false;
                btn.Attributes.Add("src", GetImageUrl("Design/Controls/UniGrid/Actions/DeleteDisabled.png"));
            }
            break;
        }

        return(CMControlsHelper.UniGridOnExternalDataBound(sender, sourceName, parameter));
    }
示例#6
0
    /// <summary>
    /// Unigrid external databoud event handler.
    /// </summary>
    object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        ImageButton btn = null;

        switch (sourceName.ToLower())
        {
        case "edit":
            btn = ((ImageButton)sender);
            btn.Attributes.Add("onClick", "EditContact(" + btn.CommandArgument + "); return false;");
            break;

        case "selectrole":
            btn = (ImageButton)sender;
            if ((ai.AccountMergedWithAccountID != 0) || !modifyAccountContact)
            {
                btn.Enabled = false;
                btn.Attributes.Add("src", GetImageUrl("Design/Controls/UniGrid/Actions/contactroledisabled.png"));
            }
            else
            {
                btn.OnClientClick = string.Format("dialogParams_{0} = '{1}';{2};return false;",
                                                  ClientID,
                                                  btn.CommandArgument,
                                                  Page.ClientScript.GetCallbackEventReference(this, "dialogParams_" + ClientID, "SelectRole", null));
            }
            break;

        case "remove":
            if ((ai.AccountMergedWithAccountID != 0) || !modifyAccountContact)
            {
                btn         = (ImageButton)sender;
                btn.Enabled = false;
                btn.Attributes.Add("src", GetImageUrl("Design/Controls/UniGrid/Actions/DeleteDisabled.png"));
            }
            break;
        }
        return(CMControlsHelper.UniGridOnExternalDataBound(sender, sourceName, parameter));;
    }
示例#7
0
    /// <summary>
    /// UniGrid databound.
    /// </summary>
    protected object gridElem_OnExternalDataBound(object sender, string sourceName, object parameter)
    {
        ImageButton btn = null;

        DataRowView drv = parameter as DataRowView;

        switch (sourceName.ToLower())
        {
        // Display delete button
        case "delete":
            btn = (ImageButton)sender;
            btn.OnClientClick = string.Format("dialogParams_{0} = '{1}';{2};return false;",
                                              ClientID,
                                              btn.CommandArgument,
                                              Page.ClientScript.GetCallbackEventReference(this, "dialogParams_" + ClientID, "Delete", null));

            // Display delete button only for users with appropriate permission
            if (this.SiteID == UniSelector.US_GLOBAL_OR_SITE_RECORD)
            {
                drv = (parameter as GridViewRow).DataItem as DataRowView;
                if (ValidationHelper.GetInteger(drv["AccountSiteID"], 0) > 0)
                {
                    btn.Enabled = modifySite;
                }
                else
                {
                    btn.Enabled = modifyGlobal;
                }
            }
            else
            {
                btn.Enabled = modifyPermission;
            }
            if (!btn.Enabled)
            {
                btn.Attributes.Add("src", GetImageUrl("Design/Controls/UniGrid/Actions/DeleteDisabled.png"));
            }
            break;

        // Display information if account is merged
        case "accountmergedwithaccountid":
            int mergedIntoSite   = ValidationHelper.GetInteger(drv["AccountMergedWithAccountID"], 0);
            int mergedIntoGlobal = ValidationHelper.GetInteger(drv["AccountGlobalAccountID"], 0);
            int siteID           = ValidationHelper.GetInteger(drv["AccountSiteID"], 0);
            if (((siteID > 0) && (mergedIntoSite > 0)) || ((siteID == 0) && (mergedIntoGlobal > 0)))
            {
                return(GetString("general.yes"));
            }
            return(null);

        case "primarycontactname":
            string name = ValidationHelper.GetString(drv["PrimaryContactFullName"], "");
            if (!string.IsNullOrEmpty(name.Trim()))
            {
                return(string.Format(@"<img class='UnigridActionButton' style='cursor:pointer;' onclick='EditContact({0});return false;' src='{1}' title='{2}'> {3}",
                                     ValidationHelper.GetString(drv["AccountPrimaryContactID"], "0"),
                                     GetImageUrl("Design/Controls/UniGrid/Actions/contactdetail.png"),
                                     GetString("om.contact.viewdetail"),
                                     HTMLHelper.HTMLEncode(name)));
            }
            return(null);
        }
        return(CMControlsHelper.UniGridOnExternalDataBound(sender, sourceName, parameter));
    }