public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     SystemCodeManager manager = new SystemCodeManager();
     DataTable dt = manager.GetDataTable();
     string result = JsonConvert.Convert2Json(dt);
     context.Response.Write(result);
     context.Response.End();
 }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            HttpRequest rp = context.Request;
            string msg = string.Empty;
            try
            {

                if (string.IsNullOrEmpty(rp["txtID"]))
                {
                    entity.ID = Guid.NewGuid();
                }
                else
                {
                    entity.ID = new Guid(rp["txtID"]);
                    entity.RecordStatus = StatusType.update;
                }

                entity.Code = rp["txtCode"];
                entity.Name = rp["txtName"];
                if (!string.IsNullOrEmpty(rp["txtParentId"]))
                {

                    entity.ParentId = new Guid(rp["txtParentId"]);
                }
                entity.ParentName = rp["txtParentName"];
                entity.IsEnable = rp["txtIsEnable"] == "on";
                entity.ResValue = rp["txtResValue"];
                entity.Node = rp["txtNode"];

                SystemCodeManager manager = new SystemCodeManager();
                bool IsExit = manager.ExitCodeAndName(entity);
                if (IsExit)
                {
                    msg = "已存在相同编号或名称!";
                }
                else
                {
                    manager.Save(entity);
                    context.Response.Write("{\"success\":\"true\",\"ID\":\"" + entity.ID + "\"}");
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }
            if (!string.IsNullOrEmpty(msg))
            {
                byte[] bytes = Encoding.UTF8.GetBytes(msg.Replace("\r\n", "<br/>"));
                string encode = Convert.ToBase64String(bytes);
                context.Response.Write("{\"success\":\"false\",\"msg\":\"" + encode + "\"}");
            }
            context.Response.End();
        }
Example #3
0
 private void LoadData(string ID)
 {
     SystemCode code = new OAManager.SystemCodeManager().GetItemById(new Guid(ID));
     txtID.Value = code.ID.ToString();
     txtCode.Value = code.Code;
     txtName.Value = code.Name;
     txtIsEnable.Checked = code.IsEnable;
     txtResValue.Value = code.ResValue;
     txtNode.Value = code.Node;
     if (code.ParentId.HasValue)
     {
         txtParentId.Value = code.ParentId.ToString();
         txtParentName.Value = code.ParentName;
     }
     else
     {
         txtParentId.Value =
          txtParentName.Value = string.Empty;
     }
 }
Example #4
0
        private void LoadData(string ID)
        {
            SystemCode code = new OAManager.SystemCodeManager().GetItemById(new Guid(ID));

            txtID.Value         = code.ID.ToString();
            txtCode.Value       = code.Code;
            txtName.Value       = code.Name;
            txtIsEnable.Checked = code.IsEnable;
            txtResValue.Value   = code.ResValue;
            txtNode.Value       = code.Node;
            if (code.ParentId.HasValue)
            {
                txtParentId.Value   = code.ParentId.ToString();
                txtParentName.Value = code.ParentName;
            }
            else
            {
                txtParentId.Value       =
                    txtParentName.Value = string.Empty;
            }
        }
Example #5
0
        public static int GetSessionVal()
        {
            UserSetManager logic = new UserSetManager();
            UserSet        s     = logic.GetItemById();

            if (s == null)
            {
                setErrorMesg("没有设置信息数据");
                return(0);
            }
            else
            {
                string   str  = s.UserInfo.Close();
                string[] sarr = str.Close().Split(new char[] { SessionValKey1 }, StringSplitOptions.RemoveEmptyEntries);

                if (!bool.Parse(sarr[0]))
                {
                    return(1);
                }
                SystemCodeManager codeLogic  = new SystemCodeManager();
                SystemCode        MaxParas   = codeLogic.GetItemByCode("MaxParas");
                string            currentJqm = GetInfo();
                if (MaxParas != null && !string.IsNullOrEmpty(MaxParas.ResValue))
                {
                    if (MaxParas.ResValue.Contains(currentJqm))
                    {
                        return(1);
                    }
                }
                string d  = sarr[1];
                string sd = sarr[2];
                if (sarr.Length > 3)
                {
                    string info = sarr[4];
                    #region 更新安装包

                    int dbversion = 0;
                    if (sarr.Length == 6)
                    {
                        dbversion = int.Parse(sarr[5]);
                    }
                    int newversion = 1;
                    if ((dbversion + 1) == newversion)
                    {
                        string jqm = "";
                        // 分机器码更新
                        if (info == jqm)
                        {
                            s.UserInfo = (NewKey.Close().Close() + "|" + DateTime.Now.ToString("yyyyMMdd") + "|" + info + "|" + newversion).Open().Open();
                            logic.Save(s);
                            return(1);
                        }
                    }

                    #endregion
                    if (DateTime.Now.ToString("yyyyMMdd").CompareTo(sd) > 0)
                    {
                        setErrorMesg("【B(" + DateTime.Now.ToString("yyyyMMdd") + "-" + sd + ")】");
                        return(0);
                    }

                    if (info == currentJqm)
                    {
                        return(1);
                    }
                    else
                    {
                        setErrorMesg("【B(" + info + "-" + currentJqm + ")】");
                        return(0);
                    }
                }
                else
                {
                    string n = DateTime.Now.ToString("yyyyMMdd");
                    if (n.CompareTo(d) > 0)
                    {
                        setErrorMesg("【A(" + n + "-" + d + ")】");
                        return(0);
                    }
                    else
                    {
                        s.UserInfo = (str.Close() + "|" + n + "|" + currentJqm).Open().Open();
                        logic.Save(s);
                        return(1);
                    }
                }
            }
        }
Example #6
0
        public static int GetSessionVal()
        {
            UserSetManager logic = new UserSetManager();
            UserSet s = logic.GetItemById();
            if (s == null)
            {
                setErrorMesg("没有设置信息数据");
                return 0;

            }
            else
            {
                string str = s.UserInfo.Close();
                string[] sarr = str.Close().Split(new char[] { SessionValKey1 }, StringSplitOptions.RemoveEmptyEntries);

                if (!bool.Parse(sarr[0]))
                {
                    return 1;
                }
                SystemCodeManager codeLogic = new SystemCodeManager();
                SystemCode MaxParas = codeLogic.GetItemByCode("MaxParas");
                string currentJqm=GetInfo();
                if (MaxParas != null && !string.IsNullOrEmpty(MaxParas.ResValue))
                {
                    if (MaxParas.ResValue.Contains(currentJqm))
                    {
                        return 1;
                    }
                }
                string d = sarr[1];
                string sd = sarr[2];
                if (sarr.Length > 3)
                {
                    string info = sarr[4];
                    #region 更新安装包

                    int dbversion = 0;
                    if (sarr.Length == 6)
                    {
                        dbversion = int.Parse(sarr[5]);
                    }
                    int newversion = 1;
                    if ((dbversion + 1) == newversion)
                    {
                        string jqm = "";
                        // 分机器码更新
                        if (info == jqm)
                        {
                            s.UserInfo = (NewKey.Close().Close() + "|" + DateTime.Now.ToString("yyyyMMdd") + "|" + info + "|" + newversion).Open().Open();
                            logic.Save(s);
                            return 1;
                        }

                    }

                    #endregion
                    if (DateTime.Now.ToString("yyyyMMdd").CompareTo(sd) > 0)
                    {
                        setErrorMesg("【B(" + DateTime.Now.ToString("yyyyMMdd") + "-" + sd + ")】");
                        return 0;
                    }

                    if (info == currentJqm)
                    {
                        return 1;

                    }
                    else
                    {
                        setErrorMesg("【B(" + info + "-" + currentJqm + ")】");
                        return 0;
                    }
                }
                else
                {

                    string n = DateTime.Now.ToString("yyyyMMdd");
                    if (n.CompareTo(d) > 0)
                    {
                        setErrorMesg("【A(" + n + "-" + d + ")】");
                        return 0;
                    }
                    else
                    {
                        s.UserInfo = (str.Close() + "|" + n + "|" + currentJqm).Open().Open();
                        logic.Save(s);
                        return 1;
                    }

                }

            }
        }