示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Charset         = "UTF-8";
            Response.ContentEncoding = System.Text.Encoding.UTF8;
            string    ModelID = eParameters.QueryString("ModelID");
            DataTable dt      = eOleDB.getDataTable("select ModelID,MC,Code,Auto,AspxFile from a_eke_sysModels where ModelID='" + ModelID + "'");

            if (dt.Rows.Count == 0)
            {
                Response.End();
            }



            string json = "";

            if (dt.Rows[0]["Auto"].ToString() == "True") //自动模块
            {
                json = getModelJson(ModelID);
            }
            else //自定义模块
            {
                #region 自定义模块
                eMTable models = new eMTable("a_eke_sysModels");
                models.Where.Add("ModelID='" + ModelID + "'");

                json = models.ExportJson();
                eJson _json = new eJson(json);
                _json.Convert = true;
                string text     = "";
                string file     = dt.Rows[0]["AspxFile"].ToString();
                string aspxFile = Server.MapPath("~/System/") + file;
                if (System.IO.File.Exists(aspxFile))
                {
                    text = eBase.ReadFile(aspxFile);
                    text = eBase.encode(text);
                    _json.Add("aspxFile", text);
                }
                string csFile = Server.MapPath("~/System/") + file + ".cs";
                if (System.IO.File.Exists(csFile))
                {
                    text = eBase.ReadFile(csFile);
                    text = eBase.encode(text);
                    _json.Add("csFile", text);
                }
                string desFile = Server.MapPath("~/System/") + file + ".designer.cs";
                if (System.IO.File.Exists(desFile))
                {
                    text = eBase.ReadFile(desFile);
                    text = eBase.encode(text);
                    _json.Add("desFile", text);
                }
                json = _json.ToString();
                #endregion
            }
            byte[] buffer    = Encoding.UTF8.GetBytes(json);
            byte[] outBuffer = new byte[buffer.Length + 3];
            outBuffer[0] = (byte)0xEF;
            outBuffer[1] = (byte)0xBB;
            outBuffer[2] = (byte)0xBF;
            Array.Copy(buffer, 0, outBuffer, 3, buffer.Length);
            if (outFile)
            {
                string fileName = dt.Rows[0]["mc"].ToString() + ".efw";
                if (Request.ServerVariables["HTTP_USER_AGENT"].ToString().ToLower().IndexOf("msie") > -1)
                {
                    fileName = HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8);                                                                                        //IE需要编码
                }
                Response.ContentType = "application/octet-stream";
                Response.AddHeader("Accept-Ranges", "bytes");
                Response.AddHeader("Content-Disposition", "attachment;filename=\"" + fileName + "\"");
                Response.Write(Encoding.UTF8.GetString(outBuffer));
            }
            else
            {
                Response.Write(json);
            }
            Response.End();
        }
示例#2
0
        protected void Action_Actioning(string Actioning)
        {
            if (Actioning == "add" || Actioning == "edit")
            {
                StringBuilder sb = new StringBuilder();
                //DataTable tb = eOleDB.getDataTable("SELECT id,name FROM sysobjects where category=0 and xtype='U' order by crdate");
                string sql = "SELECT id,name FROM sysobjects where xtype='U' "; //name!='dtproperties' and
                sql += " and (charindex('a_eke_sys',lower(name))=0 or lower(name)='a_eke_sysusers' or lower(name)='a_eke_syspowers' or lower(name)='a_eke_systokens'   )";
                sql += " and name not in (" + eBase.getSystemTables() + ")";
                sql += " order by name";//crdate";
                DataTable tb = eOleDB.getDataTable(sql);
                for (int i = 0; i < tb.Rows.Count; i++)
                {
                    sb.Append("<option value=\"" + tb.Rows[i]["name"].ToString() + "\"" + (tb.Rows[i]["name"].ToString() == edt.Fields["code"].ToString() ? " selected" : "") + ">" + tb.Rows[i]["name"].ToString() + "</option>\r\n");
                }
                LitTable.Text = sb.ToString();


                LitParent.Text = getModelTree("", "", f7.Value.ToString());
            }
            #region  制功能
            if (Actioning == "copy")
            {
                eMTable Model = new eMTable("a_eke_sysModels");
                Model.Where.Add("ModelID='" + Request.QueryString["ID"].ToString() + "'");


                eMTable sModel = new eMTable("a_eke_sysModels");
                Model.AddChild(sModel);

                eMTable sModel1 = new eMTable("a_eke_sysModels");
                sModel.AddChild(sModel1);

                eMTable sModel2 = new eMTable("a_eke_sysModels");
                sModel1.AddChild(sModel2);

                eMTable ModelTabs = new eMTable("a_eke_sysModelTabs");
                Model.AddChild(ModelTabs);
                sModel.AddChild(ModelTabs);
                sModel1.AddChild(ModelTabs);
                sModel2.AddChild(ModelTabs);


                eMTable ModelPanels = new eMTable("a_eke_sysModelPanels");
                Model.AddChild(ModelPanels);
                sModel.AddChild(ModelPanels);
                sModel1.AddChild(ModelPanels);
                sModel2.AddChild(ModelPanels);

                eMTable action = new eMTable("a_eke_sysActions");
                Model.AddChild(action);
                sModel.AddChild(action);
                sModel1.AddChild(action);
                sModel2.AddChild(action);

                string ct = eOleDB.getValue("select count(*) from a_eke_sysCheckUps where ModelID='" + Request.QueryString["ID"].ToString() + "'");
                if (ct.Length > 0 && ct != "0")
                {
                    eMTable CheckUps       = new eMTable("a_eke_sysCheckUps");
                    eMTable CheckupRecords = new eMTable("a_eke_sysCheckupRecords");
                    CheckUps.AddChild(CheckupRecords);
                    Model.AddChild(CheckUps);
                }


                eMTable Conditions = new eMTable("a_eke_sysConditions");
                Model.AddChild(Conditions);
                sModel.AddChild(Conditions);
                sModel1.AddChild(Conditions);
                sModel2.AddChild(Conditions);

                eMTable Conds     = new eMTable("a_eke_sysModelConditions");
                eMTable CondItems = new eMTable("a_eke_sysModelConditionItems");
                Conds.AddChild(CondItems);
                Model.AddChild(Conds);
                sModel.AddChild(Conds);
                sModel1.AddChild(Conds);
                sModel2.AddChild(Conds);


                eMTable Items = new eMTable("a_eke_sysModelItems");
                Model.AddChild(Items);
                sModel.AddChild(Items);
                sModel1.AddChild(Items);
                sModel2.AddChild(Items);



                Model.Copy();
                eOleDB.Execute("update a_eke_sysModels set MC='复件-' + MC where ModelID='" + Model.ID + "'");
                //eBase.Writeln(Model.ID);
                //eBase.End();


                if (Request.ServerVariables["HTTP_REFERER"] != null)
                {
                    Response.Redirect(Request.ServerVariables["HTTP_REFERER"].ToString(), true);
                }
                else
                {
                    Response.Redirect("Models.aspx", true);
                }
            }
            #endregion
            switch (Actioning)
            {
            case "":
                List();
                break;

            case "add":
                break;
            }
        }
示例#3
0
        private string getModelJson(string ModelID)
        {
            eMTable models = new eMTable("a_eke_sysModels");

            models.Where.Add("ModelID='" + ModelID + "'");

            eMTable Items = new eMTable("a_eke_sysModelItems");

            models.AddChild(Items);

            eMTable Conds     = new eMTable("a_eke_sysModelConditions");
            eMTable CondItems = new eMTable("a_eke_sysModelConditionItems");

            Conds.AddChild(CondItems);
            models.AddChild(Conds);

            eMTable action = new eMTable("a_eke_sysActions");

            models.AddChild(action);

            eMTable modelcond = new eMTable("a_eke_sysConditions");

            models.AddChild(modelcond);

            eMTable tabs = new eMTable("a_eke_sysModelTabs");

            models.AddChild(tabs);

            eMTable groups = new eMTable("a_eke_sysModelPanels");

            models.AddChild(groups);

            string ct = eOleDB.getValue("select count(*) from a_eke_sysCheckUps where ModelID='" + ModelID + "'");

            if (ct.Length > 0 && ct != "0")
            {
                eMTable checkups = new eMTable("a_eke_sysCheckUps");
                models.AddChild(checkups);
            }


            string json = models.ExportJson();

            eJson _json = new eJson(json);

            _json.Convert = true;
            string code     = eOleDB.getValue("select Code from a_eke_sysModels where ModelID='" + ModelID + "'");
            string modelSQL = eOleDB.getTableSql(code);

            _json.Add("modelSQL", HttpUtility.UrlEncode(modelSQL));

            DataTable dt = eOleDB.getDataTable("select ModelID,MC,Code,Auto,AspxFile from a_eke_sysModels where ParentID='" + ModelID + "' and delTag=0");

            foreach (DataRow dr in dt.Rows)
            {
                string js  = getModelJson(dr["ModelID"].ToString());
                eJson  _js = new eJson(js);
                _js.Convert = true;
                _json.Add("subModels", _js);
            }
            return(_json.ToString());
        }