Exemple #1
0
        public IEnumerable <SocialListItem> GetSocialByCategory(SocialCategory category)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var categories =
                    ctx
                    .Socials
                    .Where(e => e.CategoryType == category)
                    .Select(
                        e =>
                        new SocialListItem
                {
                    SocialId     = e.SocialId,
                    CategoryType = e.CategoryType,
                    Title        = e.Title,
                    ResourceType = e.ResourceType,
                    City         = e.City,
                    State        = e.State,
                    InPerson     = e.InPerson,
                    Url          = e.Url,
                }
                        );

                return(categories.ToArray());
            }
        }
        protected void InsertAppData()
        {
            StringBuilder appDataSb = new StringBuilder();

            appDataSb.Append("window.appData = {");
            appDataSb.Append("dictionaries: {");
            appDataSb.Append("inputDocTypes: [" + FormatDictionaryList(InputDocType.GetAll(), "InputDocTypeID") + "], ");
            appDataSb.Append("inputMethods: [" + FormatDictionaryList(InputMethod.GetAll(), "InputMethodID") + "], ");
            appDataSb.Append("inputSigns: [" + FormatDictionaryList(InputSign.GetAll(), "InputSignID") + "], ");
            appDataSb.Append("inputSubjectTypes: [" + FormatDictionaryList(InputSubjectType.GetAll(), "InputSubjectTypeID") + "], ");
            appDataSb.Append("deliveryTypes: [" + FormatDictionaryList(DeliveryType.GetAll(), "DeliveryTypeID") + "] ,");
            appDataSb.Append("socialStatuses: [" + FormatDictionaryList(SocialStatus.GetAll(), "SocialStatusID") + "], ");
            appDataSb.Append("branchTypes: [" + FormatDictionaryList(BranchType.GetAll(), "BranchTypeID") + "], ");
            appDataSb.Append("socialCategories: [" + FormatDictionaryList(SocialCategory.GetAll(), "SocialCategoryID") + "], ");
            appDataSb.Append("cardStatuses: [" + FormatDictionaryList(CardStatus.GetAll(), "CardStatusID") + "], ");
            appDataSb.Append("labels: [" + FormatDictionaryList(Label.GetList(), "LabelID") + "], ");
            appDataSb.Append("docStatuses: [" + FormatDictionaryList(DocStatus.GetAll(), "DocStatusID") + "]");
            appDataSb.Append("}");
            appDataSb.Append("}");

            HtmlGenericControl scriptControl = new HtmlGenericControl("script");

            scriptControl.Attributes["type"] = "text/javascript";
            scriptControl.InnerHtml          = appDataSb.ToString();
            Page.Header.Controls.AddAt(0, scriptControl);
        }
Exemple #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ddlSocialCategory.DataSource = SocialCategory.GetAll();
                ddlSocialCategory.DataBind();

                ddlBranchType.DataSource = BranchType.GetAll();
                ddlBranchType.DataBind();
            }
        }