Esempio n. 1
0
        string Oracle(WebMeta meta)
        {
            if (meta.ContainsKey("Port") == false)
            {
                meta["Port"] = "1521";
            }
            var str = "User Id={2};Password={3};Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST={0})(PORT={4})))(CONNECT_DATA=(SERVICE_NAME={1})))";

            return(String.Format(str, meta["Server"], meta["Database"], meta["User"], meta["Password"], meta["Port"]));
        }
Esempio n. 2
0
        //
        void Sliders(Design_Item parent, List <Design_Item> baners, UISection U)
        {
            if (baners.Count > 0)
            {
                WebMeta config = UMC.Data.JSON.Deserialize <WebMeta>(parent.Data) ?? new UMC.Web.WebMeta();


                var type    = config["type"];
                var sType   = "slider";
                var slider2 = new UISlider(config.ContainsKey("auto"));
                switch (type)
                {
                case "Small":
                    slider2.Small();
                    sType = "4-1";
                    break;

                case "Square":
                    slider2.Square();
                    sType = "350";
                    break;

                default:
                    type = "slider";
                    break;
                }

                Sliders(slider2, parent.Id.Value, sType, baners);


                int[] paddings = UIStyle.Padding(config);
                if (paddings.Length > 0)
                {
                    slider2.Style.Padding(paddings);
                }
                U.Add(slider2);
            }
            else if (_editer)
            {
                UIDesc desc = new UIDesc("\ue907");
                desc.Click(new UIClick(parent.Id.ToString())
                           .Send("Design", "Item"));
                desc.Desc("{desc}\r\n配置横幅栏");
                desc.Style.AlignCenter().Name("desc", new UIStyle().Font("wdk").Size(38));
                U.Add(desc);
            }
        }
Esempio n. 3
0
        public override void ProcessActivity(WebRequest request, WebResponse response)
        {
            Guid designId = UMC.Data.Utility.Guid(this.AsyncDialog("Id", g => this.DialogValue(Guid.Empty.ToString()))).Value;//this.DialogValue(response.Ticket[AttributeNames.TICKET_STORE_ID])), true).Value;


            if (_isEditer)
            {
                WebMeta form = request.SendValues ?? request.Arguments;

                this.AsyncDialog("Model", anycId =>
                {
                    if (form.ContainsKey("limit") == false)
                    {
                        this.Context.Send(new UISectionBuilder(request.Model, request.Command, new WebMeta().Put("Id", designId))
                                          .RefreshEvent("Design", "image")
                                          .Builder(), true);
                    }
                    var entity = Database.Instance().ObjectEntity <Design_Item>();
                    entity.Where.And().Equal(new Design_Item {
                        design_id = Guid.Empty, for_id = Guid.Empty
                    });
                    entity.Order.Asc(new Design_Item {
                        Seq = 0
                    });
                    //IObjectEntity<Design_Item> entity = Database.instance().objectEntity(Design_Item.class);
                    //    entity.where().and().equal(new Design_Item().Design_id(Utility.uuidEmpty).For_id(Utility.uuidEmpty));
                    //    entity.order().asc(new Design_Item().Seq(0));
                    Design_Item[] headers = entity.Query();

                    UISection section = UISection.Create(new UITitle("UMC"));

                    int limit = UMC.Data.Utility.Parse(form.Get("limit"), 10);
                    int start = UMC.Data.Utility.Parse(form.Get("start"), 0);

                    switch (headers.Length)
                    {
                    case 0:
                        break;

                    case 1:
                        section.Title.Title = (headers[0].ItemName);
                        //     section.title().right('\ue907', new UIClick("Id", headers[0].Id.toString(), "Model", "none").model(request.model(), request.cmd()));
                        break;

                    default:
                        if (start == 0)
                        {
                            List <WebMeta> items = new List <WebMeta>();
                            foreach (Design_Item item in headers)
                            {
                                items.Add(new UMC.Web.WebMeta().Put("text", item.ItemName).Put("search", new WebMeta().Put("Id", item.Id)));
                            }
                            section.Add(UICell.Create("TabFixed", new UMC.Web.WebMeta().Put("items", items)));
                        }
                        break;
                    }


                    if (designId == Guid.Empty)
                    {
                        switch (headers.Length)
                        {
                        case 0:
                            break;

                        default:
                            new UIDesigner(true).Section(section, headers[0].Id.Value);
                            break;
                        }
                    }
                    else
                    {
                        new UIDesigner(true).Section(section, designId);
                    }
                    if (section.Length == 0)
                    {
                        section.Add("Desc", new UMC.Web.WebMeta().Put("desc", "未有设计分类项,请添加").Put("icon", "\uEA05")
                                    , new UMC.Web.WebMeta().Put("desc", "{icon}\n{desc}"),
                                    new UIStyle().Align(1).Color(0xaaa).Padding(20, 20).BgColor(0xfff).Size(12).Name("icon", new UIStyle().Font("wdk").Size(60)));
                    }
                    UIFooter footer = new UIFooter();
                    footer.IsFixed  = true;// e);

                    switch (headers.Length)
                    {
                    case 0:

                        footer.AddText(new UIEventText("添加分类项").Click(new UIClick("Model", "News", "Type", "Append").Send(request.Model, request.Command)));
                        break;

                    default:
                        Guid did = designId;
                        if (designId == Guid.Empty)
                        {
                            did = headers[0].Id.Value;
                        }
                        footer.AddIcon(new UIEventText("分类项").Icon('\uf009').Click(new UIClick("Model", "News", "Id", did.ToString()).Send(request.Model, request.Command)));


                        footer.AddText(new UIEventText("增加UI组件").Click(new UIClick(did.ToString()).Send("Design", "Item")));
                        footer.AddText(new UIEventText("查看效果").Style(new UIStyle().BgColor(0xef4f4f))
                                       .Click(new UIClick("Model", "News", "Type", "View").Send(request.Model, request.Command)));


                        break;
                    }


                    section.UIFooter = (footer);
                    response.Redirect(section);
                    return(this.DialogValue("none"));
                });
                String type = this.AsyncDialog("Type", g =>
                {
                    UIRadioDialog di = new UIRadioDialog();
                    di.Title         = ("页面设计");
                    di.Options.Put("编辑分类项", "Edit");
                    di.Options.Put("增加分类项", "Append");
                    di.Options.Put("删除此分类", "Delete");
                    return(di);
                });
                switch (type)
                {
                case "Edit":
                    Design(request, designId);
                    break;

                case "Append":
                    Design(request, Guid.NewGuid());    //.randomUUID());
                    break;

                case "Delete":
                    Delete(designId);
                    break;

                case "View":
                    if (request.IsApp)
                    {
                        List <WebMeta> tabs = new List <WebMeta>();

                        Database.Instance().ObjectEntity <Design_Item>()
                        .Where.And().Equal(new Design_Item()
                        {
                            design_id = Guid.Empty, for_id = Guid.Empty
                        })                                                                                               //(Utility.uuidEmpty).For_id(Utility.uuidEmpty))

                        .Entities.Order.Asc(new Design_Item()
                        {
                            Seq = 0
                        })
                        .Entities.Query(dr =>
                        {
                            tabs.Add(new UMC.Web.WebMeta().Put("text", dr.ItemName).Put("search", new UMC.Web.WebMeta().Put("Id", dr.Id.ToString())).Put("cmd", "Home", "model", "Design"));
                        });
                        if (tabs.Count == 1)
                        {
                            UISectionBuilder builder = new UISectionBuilder("Design", "Home", new WebMeta().Put("Id", tabs[0].GetMeta("search").Get("Id")));
                            //                            builder.builder()
                            this.Context.Send(builder.Builder(), true);    //"Tab", new WebMeta().put("sections", tabs).put("text", "UMC界面设计"), true);
                        }
                        else
                        {
                            this.Context.Send("Tab", new WebMeta().Put("sections", tabs).Put("text", "UMC界面设计"), true);
                        }
                    }
                    else
                    {
                        this.AsyncDialog("From", k =>
                        {
                            UIFormDialog fm = new UMC.Web.UIFormDialog();
                            fm.Title        = ("移动效果体验");
                            fm.AddImage(new Uri(UMC.Data.Utility.QRUrl("https://oss.365lu.cn/Click/Deisgn/Home/")));


                            fm.AddPrompt("请用支持UMC协议的APP“扫一扫”。");

                            return(fm);
                        });
                        break;
                    }
                    break;
                }
            }
            else
            {
                if (designId == Guid.Empty)
                {
                    var entity = Database.Instance().ObjectEntity <Design_Item>();
                    entity.Where.And().Equal(new Design_Item {
                        design_id = Guid.Empty, for_id = Guid.Empty
                    });
                    entity.Order.Asc(new Design_Item {
                        Seq = 0
                    });

                    List <WebMeta> tabs = new List <WebMeta>();
                    entity.Query(dr =>
                    {
                        tabs.Add(new UMC.Web.WebMeta().Put("text", dr.ItemName).Put("search", new UMC.Web.WebMeta().Put("Id", dr.Id)).Put("cmd", "UI", "model", "Design"));
                    });

                    var     chash = new Hashtable();
                    UITitle title = new UITitle("UMC移动界面");
                    title.Left('\uea0e', UIClick.Search());

                    title.Right(new UIEventText().Icon('\uf2c0').Click(new UIClick().Send("Account", "Info")));


                    chash.Add("sections", tabs);
                    chash.Add("title", title);
                    response.Redirect(chash);
                }
                else
                {
                    UIDesigner designer = new UIDesigner(false);
                    response.Redirect(designer.Section("", designId));
                }
            }
        }
Esempio n. 4
0
        void Config(WebRequest request, Guid itemId)
        {
            UMC.Data.WebResource webr = UMC.Data.WebResource.Instance();

            var entity = Database.Instance().ObjectEntity <Design_Item>();

            entity.Where.Reset().And().Equal(new Design_Item()
            {
                Id = itemId
            });

            Design_Item item = entity.Single();

            switch (item.Type ?? 0)
            {
            case UIDesigner.StoreDesignTypeItem:
            case UIDesigner.StoreDesignTypeProduct:
                item = entity.Where.Reset().And().Equal(new Design_Item()
                {
                    Id = item.for_id
                }).Entities.Single();
                break;
            }
            Design_Item finalItem = item;
            WebMeta     meta      = this.AsyncDialog(g =>
            {
                WebMeta data = UMC.Data.JSON.Deserialize <WebMeta>(finalItem.Data) ?? new UMC.Web.WebMeta();
                //WebMeta data = Utility.isNull(UMC.Data.JSON.deserialize(finalItem.Data, WebMeta.class), new UMC.Web.WebMeta());

                UIFormDialog from = new UIFormDialog();
                from.Title        = ("配置");


                from.AddText("缩进", "Padding", data.Get("Padding") ?? "0");
                from.AddNumber("展示顺序", "Seq", finalItem.Seq);


                switch (finalItem.Type)
                {
                case UIDesigner.StoreDesignTypeBanners:
                    from.Title = ("广告横幅");
                    break;

                case UIDesigner.StoreDesignTypeItems:
                    from.Title = ("分块区配置");
                    from.AddRadio("风格", "Model").Put("展示标题", "Title", data.Get("Model").Equals("Title") || data.ContainsKey("Model") == false).Put("仅显示图片 ", "Image", data.Get("Model").Equals("Image"));

                    break;

                case UIDesigner.StoreDesignTypeTitleDesc:
                    from.Title = ("图文区配置");

                    String total = data.Get("Total") ?? "1";          // data["Total"] ??"1";
                    String model = data.Get("Hide") ?? "";            // data["Hide"] ??"";
                    ;
                    from.AddCheckBox("界面", "Hide", "T").Put("不显示标题", "HideTitle", model.IndexOf("HideTitle") > -1)
                    .Put("不显描述 ", "HideDesc", model.IndexOf("HideDesc") > -1)
                    .Put("不显左角价格 ", "HideLeft", model.IndexOf("HideLeft") > -1)
                    .Put("不显右角说明 ", "HideRight", model.IndexOf("HideRight") > -1);


                    from.AddNumber("图文数量", "Total", Utility.Parse(total, 0));
                    break;

                case UIDesigner.StoreDesignTypeCaption:

                    from.Title = "标题配置";
                    from.AddText("标题", "ItemName", item.ItemName);
                    from.AddCheckBox("标题隐藏", "Show", "Y").Put("隐藏", "Hide", data["Show"] == "Hide");

                    break;

                case UIDesigner.StoreDesignTypeProducts:
                    from.Title = "商品展示配置";
                    from.AddText("标题", "ItemName", item.ItemName);
                    from.AddRadio("展示风格", "Model").Put("分块展示", "Area", data["Model"] == "Area" || data.ContainsKey("Model") == false).Put("分行展示 ", "Rows", data["Model"] == "Rows");

                    from.AddNumber("单行商品数", "Total", data["Total"] ?? "2");

                    break;

                case UIDesigner.StoreDesignTypeCustom:
                    String config = data.Get("Config");
                    if (String.IsNullOrEmpty(config) == false && config.StartsWith("UI"))
                    {
                        if (config.StartsWith("UI"))
                        {
                            this.Context.Response.Redirect("Design", config);
                        }
                        var d = config.IndexOf('.');
                        if (d > 0)
                        {
                            this.Context.Response.Redirect("Design", config.Substring(d + 1));
                        }
                    }

                    this.Prompt("参数错误");

                    break;

                default:
                    this.Prompt("参数错误");
                    break;
                }
                from.Submit("确认", request, "Design");
                return(from);
            }, "Setting");
            String show = meta.Get("Show");

            if (String.IsNullOrEmpty(show) == false)
            {
                meta.Put("Show", show.Contains("Hide") ? "Hide" : "Show");
            }
            entity.Where.Reset().And().Equal(new Design_Item()
            {
                Id = item.Id
            });
            entity.Update(new Design_Item
            {
                ItemName     = meta["ItemName"],
                ModifiedDate = DateTime.Now,
                Seq          = UMC.Data.Utility.IntParse(meta["Seq"], 0),
                Data         = UMC.Data.JSON.Serialize(meta)
            });
        }
Esempio n. 5
0
        int CheckRow(string text, int index, bool isNextLIne)
        {
            if (String.IsNullOrEmpty(text))
            {
                return(index + 1);
            }
            int oldIndex = -1;

            while (index + 1 < text.Length && text[index] != '\n')
            {
                if (oldIndex == index)
                {
                    index++;
                    continue;
                }
                else
                {
                    oldIndex = index;
                }

                switch (text[index])
                {
                case '\r':
                    index++;
                    continue;

                case '!':
                    if (text[index + 1] == '[' && isNextLIne)
                    {
                        int end = text.IndexOf("]", index + 1);
                        if (end > index)
                        {
                            String content = text.Substring(index + 1, end - index - 1).Trim('[', ']');
                            if (content.IndexOf('\n') == -1)
                            {
                                if (text[end + 1] == '(')
                                {
                                    Append();
                                    int end2 = text.IndexOf(")", end + 1);
                                    if (end2 > end)
                                    {
                                        var url  = text.Substring(end + 1, end2 - end - 1).Trim(' ', '(', ')').Split(' ')[0];
                                        var cell = UICell.Create("CMSImage", new WebMeta().Put("src", url));
                                        cell.Style.Padding(0, 10);
                                        cells.Add(cell);
                                        index = end2 + 1;

                                        continue;
                                    }
                                }
                                else
                                {
                                    Append();

                                    if (webRel.ContainsKey(content))
                                    {
                                        var cell = UICell.Create("CMSImage", new WebMeta().Put("src", webRel[content]));
                                        cell.Style.Padding(0, 10);
                                        cells.Add(cell);
                                    }
                                    else
                                    {
                                        var src = new WebMeta().Put("src", content);
                                        this.webRels.Add(src);
                                        var cell = UICell.Create("CMSImage", src);
                                        cell.Style.Padding(0, 10);
                                        cells.Add(cell);
                                    }
                                    index = end + 1;

                                    continue;
                                }
                            }
                        }
                    }
                    break;

                case '[':
                {
                    int end = text.IndexOf("]", index + 1);
                    if (end > index)
                    {
                        String content = text.Substring(index, end - index).Trim('[', ']');
                        if (content.IndexOf('\n') == -1)
                        {
                            if (text.Length > end + 1 && text[end + 1] == '(')
                            {
                                int end2 = text.IndexOf(")", end + 1);
                                if (end2 > end)
                                {
                                    var url = text.Substring(end + 1, end2 - end - 1).Trim(' ', '(', ')').Split(' ')[0];


                                    AppendData();
                                    style.Name("m" + data.Count.ToString(), new UIStyle().Click(new UIClick(url)
                                        {
                                            Key = "Url"
                                        }));
                                    data.Put("m" + data.Count.ToString(), content);

                                    index = end2 + 1;

                                    continue;
                                }
                            }
                            else
                            {
                                if (String.IsNullOrEmpty(content.Trim()) == false)
                                {
                                    AppendData();

                                    if (webRel.ContainsKey(content))
                                    {
                                        style.Name("m" + data.Count.ToString(), new UIStyle().Click(new UIClick(webRel[content])
                                            {
                                                Key = "Url"
                                            }));
                                    }
                                    else
                                    {
                                        var click = new UIClick(content)
                                        {
                                            Key = "Url"
                                        };
                                        this.links.Add(click);
                                        style.Name("m" + data.Count.ToString(), new UIStyle().Click(click));
                                    }
                                    data.Put("m" + data.Count.ToString(), content);
                                }
                                else
                                {
                                    dataText.Append("[");
                                    dataText.Append(content);
                                    dataText.Append("]");
                                }

                                index = end + 1;

                                continue;
                            }
                        }
                    }
                }
                break;

                case '`':
                {
                    int end = text.IndexOf("`", index + 1);
                    if (end > index)
                    {
                        String content = text.Substring(index, end - index);
                        if (content.IndexOf('\n') == -1)
                        {
                            AppendData();
                            style.Name("m" + data.Count.ToString(), new UIStyle().Color(0xCC6600));
                            data.Put("m" + data.Count.ToString(), content.Trim('`'));


                            index = end + 1;

                            continue;
                        }
                    }
                }
                break;

                case '~':
                    if (text[index + 1] == '~')
                    {
                        int end = text.IndexOf("~~", index + 1);
                        if (end > index)
                        {
                            String content = text.Substring(index, end - index);
                            if (content.IndexOf('\n') == -1)
                            {
                                AppendData();
                                style.Name("m" + data.Count.ToString(), new UIStyle().DelLine());
                                data.Put("m" + data.Count.ToString(), content.Trim('~'));

                                index = end + 2;

                                continue;
                            }
                        }
                    }
                    else
                    {
                        int end = text.IndexOf("~", index + 1);
                        if (end > index)
                        {
                            String content = text.Substring(index, end - index);
                            if (content.IndexOf('\n') == -1)
                            {
                                AppendData();
                                style.Name("m" + data.Count.ToString(), new UIStyle().UnderLine());
                                data.Put("m" + data.Count.ToString(), content.Trim('~'));
                                index = end + 1;

                                continue;
                            }
                        }
                    }
                    break;

                case '*':
                    if (text[index + 1] == '*')
                    {
                        int end = text.IndexOf("**", index + 1);

                        if (end > index)
                        {
                            String content = text.Substring(index, end - index);
                            if (content.IndexOf('\n') == -1)
                            {
                                AppendData();
                                style.Name("m" + data.Count.ToString(), new UIStyle().Bold());
                                data.Put("m" + data.Count.ToString(), content.Trim('*'));

                                index = end + 2;

                                continue;
                            }
                        }
                    }
                    else
                    {
                        int end = text.IndexOf("*", index + 1);
                        if (end > index)
                        {
                            String content = text.Substring(index + 1, end - index);
                            if (content.IndexOf('\n') == -1)
                            {
                                AppendData();
                                style.Name("m" + data.Count.ToString(), new UIStyle().UnderLine());
                                data.Put("m" + data.Count.ToString(), content.Trim('*'));
                                index = end + 1;

                                continue;;
                            }
                        }
                    }
                    break;
                }
                dataText.Append(text[index]);
                index++;
            }
            if (index + 1 == text.Length)
            {
                dataText.Append(text[index]);
            }
            if (isNextLIne)
            {
                Append();
                return(index + 1);
                //Check(text, index + 1);
            }
            return(index);
        }
Esempio n. 6
0
        public override void ProcessActivity(WebRequest request, WebResponse response)
        {
            var Type = this.AsyncDialog("Type", "Client");
            var user = UMC.Security.Identity.Current;

            switch (Type)
            {
            case "Client":
                if (user.IsAuthenticated == false)
                {
                    response.Redirect(request.Model, "Login");
                }
                break;

            case "Cashier":
                if (request.IsCashier == false)
                {
                    response.Redirect("Settings", "Login");
                }

                break;
            }
            var Model = this.AsyncDialog("Model", gkey =>
            {
                WebMeta form = request.SendValues ?? new UMC.Web.WebMeta();

                if (form.ContainsKey("limit") == false)
                {
                    this.Context.Send(new UISectionBuilder(request.Model, request.Command, request.Arguments)
                                      .RefreshEvent("UI.Setting", "image", "Email", "Mobile")
                                      .Builder(), true);
                }
                var account = Security.Account.Create(user.Id.Value);
                var dic     = UMC.Web.UISection.Create();
                var name    = user.Name;
                switch (Type)
                {
                default:
                    dic.Title         = new UITitle("账户信息");
                    var imageTextView = new UMC.Web.UI.UIImageTextValue(Data.WebResource.Instance().ImageResolve(user.Id.Value, "1", 4), "头像", "");
                    imageTextView.Style.Name("image-width", "100");
                    imageTextView.Click(new UIClick("id", user.Id.ToString(), "seq", "1")
                    {
                        Model = "Design", Command = "Picture"
                    });
                    //dic.AddImageTextValue(Data.WebResource.Instance().ImageResolve(user.Id.Value, "1", 4), "头像", 100, new UIClick("id", user.Id.ToString(), "seq", "1")
                    //{ Model = "Design", Command = "Picture" });
                    dic.Add(imageTextView);

                    dic.AddCell("昵称", user.Alias, new UIClick(new WebMeta(request.Arguments).Put(gkey, "Alias")).Send(request.Model, request.Command));


                    dic.AddCell('\uf084', "登录账号", name, new UIClick()
                    {
                        Model = "Account", Command = "Password"
                    });
                    break;

                case "Small":

                    var Discount = new UIHeader.Portrait(Data.WebResource.Instance().ImageResolve(user.Id.Value, "1", 4));


                    Discount.Value(user.Alias);

                    var ac2 = account[Security.Account.SIGNATURE_ACCOUNT_KEY];
                    Discount.Time(ac2 == null ? "未有签名" : ac2.Name);

                    var color = 0xfff;
                    Discount.Gradient(color, color);
                    Discount.Click(new UIClick("id", user.Id.ToString(), "seq", "1")
                    {
                        Model = "Design", Command = "Picture"
                    });
                    var header = new UIHeader();

                    var style = new UIStyle();
                    header.AddPortrait(Discount);
                    header.Put("style", style);

                    style.Name("value").Color(0x111).Size(18).Click(new UIClick(new WebMeta(request.Arguments).Put(gkey, "Alias")).Send(request.Model, request.Command));
                    style.Name("time").Click(new UIClick(new WebMeta(request.Arguments).Put(gkey, "Signature")).Send(request.Model, request.Command));

                    dic.UIHeader = header;

                    break;
                }



                var ac = account[Security.Account.EMAIL_ACCOUNT_KEY];
                if (ac != null && String.IsNullOrEmpty(ac.Name) == false)
                {
                    name = ac.Name;

                    int c = name.IndexOf('@');
                    if (c > 0)
                    {
                        var cname = name.Substring(0, c);
                        name      = name.Substring(0, 2) + "***" + name.Substring(c);
                    }
                    if ((ac.Flags & Security.UserFlags.UnVerification) == Security.UserFlags.UnVerification)
                    {
                        name = name + "(未验证)";
                    }
                }
                else
                {
                    name = "点击绑定";
                }

                var cui = Type == "Small" ? dic : dic.NewSection();

                cui.AddCell('\uf199', "邮箱", name, new UIClick()
                {
                    Command = "Email", Model = "Account"
                });

                ac = account[Security.Account.MOBILE_ACCOUNT_KEY];
                if (ac != null && String.IsNullOrEmpty(ac.Name) == false)
                {
                    name = ac.Name;
                    if (name.Length > 3)
                    {
                        name = name.Substring(0, 3) + "****" + name.Substring(name.Length - 3);
                    }
                    if ((ac.Flags & Security.UserFlags.UnVerification) == Security.UserFlags.UnVerification)
                    {
                        name = name + "(未验证)";
                    }
                }
                else
                {
                    name = "点击绑定";
                }

                cui.AddCell('\ue91a', "手机号码", name, new UIClick()
                {
                    Command = "Mobile", Model = "Account"
                });

                switch (Type)
                {
                case "Small":
                    response.Redirect(dic);
                    break;

                default:
                    ac = account[Security.Account.SIGNATURE_ACCOUNT_KEY];
                    dic.NewSection().AddCell("个性签名", ac == null ? "未有签名" : ac.Name, new UIClick(new WebMeta(request.Arguments).Put(gkey, "Signature")).Send(request.Model, request.Command));

                    break;
                }


                if (request.IsApp == false && request.IsWeiXin == false)
                {
                    UICell cell = UICell.Create("UI", new UMC.Web.WebMeta().Put("text", "退出登录").Put("Icon", "\uf011").Put("click", new UIClick()
                    {
                        Model = "Account", Command = "Close"
                    }));
                    cell.Style.Name("text", new UIStyle().Color(0xf00));
                    dic.NewSection().NewSection().Add(cell);
                }


                response.Redirect(dic);
                return(this.DialogValue("none"));
            });

            switch (Model)
            {
            case "Alias":
                String Alias = this.AsyncDialog("Alias", a => new UITextDialog()
                {
                    Title = "修改别名", DefaultValue = user.Alias
                });
                Membership.Instance().ChangeAlias(user.Name, Alias);
                this.Prompt(String.Format("您的账户的别名已修改成{0}", Alias), false);
                this.Context.Send("UI.Setting", true);


                break;

            case "Signature":

                var account = Security.Account.Create(user.Id.Value);


                var ac    = account[Security.Account.SIGNATURE_ACCOUNT_KEY];
                var reset = Web.UIFormDialog.AsyncDialog("value", g =>
                {
                    var selt   = new Web.UIFormDialog();
                    selt.Title = "个性签名";
                    selt.AddTextarea("个性签名", "Signature", ac == null ? "" : ac.Name);
                    selt.Submit("确认提交", request, "UI.Setting");
                    return(selt);
                });
                var Signature = reset["Signature"];
                Security.Account.Post(Signature, user.Id.Value, Security.UserFlags.Normal, Security.Account.SIGNATURE_ACCOUNT_KEY);



                WebMeta print = new UMC.Web.WebMeta();
                print["type"]      = "UI.Setting";
                print["Signature"] = Signature;
                this.Context.Send(print, true);


                break;
            }
        }
Esempio n. 7
0
        public override void ProcessActivity(WebRequest request, WebResponse response)
        {
            var user = UMC.Security.Identity.Current;

            if (user.IsAuthenticated == false)
            {
                response.Redirect(request.Model, "Login");
            }
            var Model = this.AsyncDialog("Model", gkey =>
            {
                WebMeta form = request.SendValues ?? new UMC.Web.WebMeta();

                if (form.ContainsKey("limit") == false)
                {
                    this.Context.Send(new UISectionBuilder(request.Model, request.Command)
                                      .RefreshEvent("UI.Setting", "image", "Email", "Mobile")
                                      .Builder(), true);
                }

                //    var rel = Utility.Database.ObjectEntity<Entities.VIPMember>().Where.And().Equal(relt).Entities.Single() ?? relt;


                var account = Security.Account.Create(user.Id.Value);
                var dic     = UMC.Web.UISection.Create(new UITitle("ÕË»§ÐÅÏ¢"));
                dic.AddImageTextValue(Data.WebResource.Instance().ImageResolve(user.Id.Value, "1", 4), "Í·Ïñ", 100, new UIClick("id", user.Id.ToString(), "seq", "1")
                {
                    Model = "Design", Command = "Image"
                });

                dic.AddCell("êdzÆ", user.Alias, new UIClick("Alias")
                {
                    Command = "Setting", Model = "Account"
                });                                                                                                //.Put("Model", "Account").Put("Command", "Setting").Put("SendValue", "Alias");


                //dic.Title.Right(new UIEventText("ÃÜÂë").Click(new UIClick() { Model = "Account", Command = "Password" }));


                var name = user.Name;
                dic.AddCell('\uf084', "µÇ¼Õ˺Å", name, new UIClick()
                {
                    Model = "Account", Command = "Password"
                });



                var ac = account[Security.Account.EMAIL_ACCOUNT_KEY];
                if (ac != null && String.IsNullOrEmpty(ac.Name) == false)
                {
                    name = ac.Name;

                    int c = name.IndexOf('@');
                    if (c > 0)
                    {
                        var cname = name.Substring(0, c);
                        name      = name.Substring(0, 2) + "***" + name.Substring(c);
                    }
                    if ((ac.Flags & Security.UserFlags.UnVerification) == Security.UserFlags.UnVerification)
                    {
                        name = name + "(δÑéÖ¤)";
                    }
                }
                else
                {
                    name = "µã»÷°ó¶¨";
                }

                var cui = dic.NewSection().AddCell('\uf199', "ÓÊÏä", name, new UIClick()
                {
                    Command = "Email", Model = "Account"
                });
                //.Put("Model", "Account").Put("Command", "Email")

                //.Put("Name", "Email");

                ac = account[Security.Account.MOBILE_ACCOUNT_KEY];
                if (ac != null && String.IsNullOrEmpty(ac.Name) == false)
                {
                    name = ac.Name;
                    if (name.Length > 3)
                    {
                        name = name.Substring(0, 3) + "****" + name.Substring(name.Length - 3);
                    }
                    if ((ac.Flags & Security.UserFlags.UnVerification) == Security.UserFlags.UnVerification)
                    {
                        name = name + "(δÑéÖ¤)";
                    }
                }
                else
                {
                    name = "µã»÷°ó¶¨";
                }

                cui.AddCell('\ue91a', "ÊÖ»úºÅÂë", name, new UIClick()
                {
                    Command = "Mobile", Model = "Account"
                });

                UICell cell = UICell.Create("UI", new UMC.Web.WebMeta().Put("text", "Í˳öµÇ¼").Put("Icon", "\uf011").Put("click", new UIClick()
                {
                    Model = "Account", Command = "Close"
                }));
                cell.Style.Name("text", new UIStyle().Color(0xf00));
                dic.NewSection().NewSection().Add(cell);



                response.Redirect(dic);
                return(this.DialogValue("none"));
            });

            switch (Model)
            {
            case "Alias":
                String Alias = this.AsyncDialog("Alias", a => new UITextDialog()
                {
                    Title = "Ð޸ıðÃû"
                });
                Membership.Instance().ChangeAlias(user.Name, Alias);
                this.Prompt(String.Format("ÄúµÄÕË»§µÄ±ðÃûÒÑÐ޸ijÉ{0}", Alias), false);
                this.Context.Send("Setting", true);


                break;
            }
        }