Exemplo n.º 1
0
    protected void CreateFont_Btn_Click(object sender, EventArgs e)
    {
        string  fontsrc = Font_DP.SelectedValue + ".ttf";
        string  tlp     = SafeSC.ReadFileStr("/WebFont/tlp.html");
        DataRow dr      = codeBll.NewModel();

        dr["Text"]     = StringHelper.SubStr(T1.Text, 500, "");
        dr["FlowCode"] = DateTime.Now.ToString("yyyyMMddHHmm") + function.GetRandomString(6);
        dr["CDate"]    = DateTime.Now;
        tlp            = tlp.Replace("{Text}", dr["Text"].ToString());
        string fontdir = "/WebFont/Users/" + dr["FlowCode"].ToString() + "/";

        dr["FontDir"] = function.VToP(fontdir);
        SafeSC.WriteFile(fontdir + "tlp.html", tlp);
        dr["ZStatus"] = 0;
        //1,将选定的字体拷入
        string src = "/WebFont/Fonts/" + fontsrc;
        string tar = fontdir + "pen.ttf";

        Copy(src, tar);
        int id = codeBll.Insert(dr);

        result_div.Visible     = true;
        result_t_div.InnerText = T1.Text;
        r_quote_t.Text         = GetQuote(dr["FlowCode"].ToString(), "pen");
        font_css.InnerHtml     = GetQuote(dr["FlowCode"].ToString(), "pen");
        //2,运行命令开始生成(命令行中已处理)
        //3,拷贝完成后回发指令,表示完成,客户端可预览或下载
        while (Response.IsClientConnected)
        {
            System.Threading.Thread.Sleep(1000);
            dr = codeBll.SelByID(id);
            if (dr["ZStatus"].ToString().Equals("1"))
            {
                break;
            }
        }
    }
        protected void Add_Btn_Click(object sender, EventArgs e)
        {
            M_CommonData CData    = new M_CommonData();
            M_AdminInfo  adminMod = B_Admin.GetLogin();
            M_ModelInfo  model    = modelBll.SelReturnModel(ModelID);

            artBll = new B_CodeModel(model.TableName);
            if (GeneralID > 0)
            {
                CData = conBll.SelReturnModel(GeneralID);
            }
            else
            {
                CData.NodeID    = NodeID;
                CData.ModelID   = ModelID;
                CData.TableName = model.TableName;
                CData.Inputer   = adminMod.AdminName;
                string parentTree = "";
                CData.FirstNodeID = nodeBll.SelFirstNodeID(NodeID, ref parentTree);
                CData.ParentTree  = parentTree;
            }
            //------------------------
            CData.Title = Title_T.Text.Trim();
            switch ((sender as Button).CommandArgument)
            {
            case "add":
                CData.Status = (int)ZLEnum.ConStatus.Audited;
                break;

            case "draft":
                CData.Status = (int)ZLEnum.ConStatus.Draft;
                break;

            default:
                break;
            }
            if (GeneralID > 0)
            {
                DataRow dr = artBll.SelByID(CData.ItemID);
                dr["Content"] = content_t.Text;
                artBll.UpdateByID(dr, "ID");
                conBll.UpdateByID(CData);
            }
            else
            {
                DataRow dr = artBll.NewModel();
                dr["Content"]   = content_t.Text;
                CData.ItemID    = artBll.Insert(dr);
                CData.GeneralID = conBll.insert(CData);
            }
            //----------------同步版权印
            double       repPrice = DataConverter.CDouble(RepPrice_T.Text.Trim());
            double       matPrice = DataConverter.CDouble(MatPrice_T.Text.Trim());
            string       content  = StringHelper.StripHtml(content_t.Text);
            M_Content_CR crMod    = crBll.CreateFromContent(CData, content, repPrice, matPrice);

            string  result = copyBll.Create(crMod);
            JObject obj    = JsonConvert.DeserializeObject <JObject>(result);

            crMod.Status  = DataConverter.CLng(obj["value"]);
            crMod.WorksID = obj["data"].ToString();
            crBll.Insert(crMod);
            if (crMod.Status == 1)
            {
                function.WriteSuccessMsg("操作成功,文章编号为:" + crMod.WorksID, "WorksList.aspx");
            }
            else
            {
                function.WriteErrMsg("操作失败:" + obj["msg"]);
            }
        }