Ejemplo n.º 1
0
        //初始化设置
        public void Init()
        {
            if (mainDlg == null || string.IsNullOrEmpty(ProPath) || string.IsNullOrEmpty(ProName))
            {
                //缺少初值,所有控件禁用  正常情况不应执行到这里
                tsrSheetTree.Enabled = false;
                tabSheetTool.Enabled = false;
            }
            else
            {
                XmlFile = ToFullPath(NXFun.ProcessXML);
                IsEdit  = false;

                tsrSheetTree.Enabled = true;
                tabSheetTool.Enabled = true;
                //初始化子组件
                CharEdit.ProPath = ProPath;
                CharEdit.ProName = ProName;
                CharEdit.mainDlg = mainDlg;
                CharEdit.Init();

                LabelEdit.ProPath = ProPath;
                LabelEdit.ProName = ProName;
                LabelEdit.mainDlg = mainDlg;
                LabelEdit.Init();

                FreshSheetTree();
            }
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string method  = context.Request["method"].ToString().Trim().ToLower();
            string usrid   = string.Empty;
            string type    = context.Request["type"].ToString().Trim().ToLower();
            string labelid = string.Empty;
            string title   = string.Empty;
            string content = string.Empty;

            User usr = (context.Session["USER"] != null) ? (User)context.Session["USER"] : null;

            if (usr == null)
            {
                string username = (context.Request.Cookies["username"] != null) ? context.Request.Cookies["username"].ToString().Trim() : "";
                if (username != "")
                {
                    usr = UserGet.GetFeature(username);
                }
            }
            if (usr == null)
            {
                context.Response.Write("{\"status\":\"fail\",\"message\":\"用户没登录\"}");
                context.Response.Flush();
                context.Response.End();
            }
            else
            {
                if (usr.Privilege == 0)
                {
                    usrid = "%";
                }
                else
                {
                    usrid = usr.Id;
                }
            }

            switch (method)
            {
            case "add":
                labelid = Guid.NewGuid().ToString();
                string geometry = context.Request["geometry"].ToString().Trim();
                title   = context.Request["title"].ToString().Trim();
                content = context.Request["content"].ToString().Trim();

                if (LabelAdd.AddFeature(type, labelid, usrid, geometry, title, content))
                {
                    context.Response.Write("{\"status\":\"success\"}");
                }
                else
                {
                    context.Response.Write("{\"status\":\"fail\"}");
                }
                break;

            case "get":
                int page = Int32.Parse(context.Request["page"].ToString());
                int size = Int32.Parse(context.Request["size"].ToString());
                context.Response.Write(LabelGet.GetFeature(type, usrid, size, page));
                break;

            case "del":
                labelid = context.Request["labelid"].ToString().Trim();
                if (LabelDel.DelFeature(labelid))
                {
                    context.Response.Write("{\"status\":\"success\"}");
                }
                else
                {
                    context.Response.Write("{\"status\":\"fail\"}");
                }
                break;

            case "edit":
                labelid = context.Request["labelid"].ToString().Trim();
                title   = context.Request["title"].ToString().Trim();
                content = context.Request["content"].ToString().Trim();
                if (LabelEdit.EditFeature(labelid, title, content))
                {
                    context.Response.Write("{\"status\":\"success\"}");
                }
                else
                {
                    context.Response.Write("{\"status\":\"fail\"}");
                }
                break;
            }
        }
Ejemplo n.º 3
0
 public Label Edit(LabelEdit label)
 {
     return(_api.Put().With(label).To <Label>(string.Format(ProjectLabelUrl, label.Id)));
 }