//许可证
        public JsonResult LicenseGet()
        {
            var item = dbhelper.GetAll(u => u.id).FirstOrDefault();

            if (item != null)
            {
            }
            else
            {
                item                     = new Models.a_systeminfo();
                item.system_id           = Guid.NewGuid().ToString().ToUpper();
                item.system_name         = "";
                item.system_worksitename = "";
                item.company_name        = "";
                item.company_linkman     = "";
                item.company_tel         = "";
                item.company_address     = "";

                item.system_licenseno = "未授权";
                item.system_effdate_e = "未授权";
                item.system_effdate_s = "未授权";
            }

            string    directoryPath = Server.MapPath("~/LicenseFile/");
            string    filepath      = directoryPath + "License.lic";
            MyLicense license       = MyLicenseHelper.Get(filepath);

            if (license.licenseno == "")
            {
                item.system_licenseno = "未授权";
                item.system_effdate_e = "未授权";
                item.system_effdate_s = "未授权";
            }
            else
            {
                item.system_licenseno = license.licenseno;
                item.system_effdate_s = license.licensedatestart.ToString("yyyy-MM-dd");
                item.system_effdate_e = license.licensedateend.ToString("yyyy-MM-dd");
            }
            LinenceMap linenceMap = new LinenceMap();

            linenceMap.system_licenseno = item.system_licenseno;
            linenceMap.system_effdate_s = item.system_effdate_s;
            linenceMap.system_effdate_e = item.system_effdate_e;


            string hardcode = Computer.GetBIOSInfo().ToUpper();

            hardcode = DESEncrypt.md5(hardcode, 32).ToUpper();
            linenceMap.system_hardwarecode = hardcode;

            return(Json(linenceMap, JsonRequestBehavior.AllowGet));
        }
        //
        // GET: /Admin/Systemlicense/

        public ActionResult Index()
        {
            var item = new Models.a_systeminfo();
            var list = dbhelper.GetAll(u => u.id);

            if (list.Count > 0)
            {
                item = list.FirstOrDefault();
            }
            else
            {
                item                     = new Models.a_systeminfo();
                item.system_id           = Guid.NewGuid().ToString().ToUpper();
                item.system_name         = "";
                item.system_worksitename = "";
                item.company_name        = "";
                item.company_linkman     = "";
                item.company_tel         = "";
                item.company_address     = "";

                item.system_licenseno = "未授权";
                item.system_effdate_e = "未授权";
                item.system_effdate_s = "未授权";
            }

            string    directoryPath = Server.MapPath("~/LicenseFile/");
            string    filepath      = directoryPath + "License.lic";
            MyLicense license       = MyLicenseHelper.Get(filepath);

            if (license.licenseno == "")
            {
                item.system_licenseno = "未授权";
                item.system_effdate_e = "未授权";
                item.system_effdate_s = "未授权";
            }
            else
            {
                item.system_licenseno = license.licenseno;
                item.system_effdate_s = license.licensedatestart.ToString("yyyy-MM-dd");
                item.system_effdate_e = license.licensedateend.ToString("yyyy-MM-dd");
            }

            ViewBag.entity = item;

            string hardcode = Computer.GetBIOSInfo().ToUpper();

            hardcode = DESEncrypt.md5(hardcode, 32).ToUpper();

            ViewBag.system_hardwarecode = hardcode;

            return(View());
        }
        public JsonResult GetLicense()
        {
            string directoryPath = Server.MapPath("~/LicenseFile/");
            string filepath      = directoryPath + "/" + "License.lic";

            MyLicense license = MyLicenseHelper.Get(filepath);

            return(Json(new
            {
                LicenseNo = license.licenseno,
                LicenseEffdateStart = license.licensedatestart.ToString("yyyy-MM-dd"),
                LicenseEffdateEnd = license.licensedateend.ToString("yyyy-MM-dd")
            },
                        JsonRequestBehavior.AllowGet));
        }
        //系统信息
        public JsonResult SystemInfoData()
        {
            var item = new Models.a_systeminfo();
            var list = dbhelper.GetAll(u => u.id);

            if (list.Count > 0)
            {
                item = list.FirstOrDefault();
            }
            else
            {
                item           = new Models.a_systeminfo();
                item.system_id = Guid.NewGuid().ToString().ToUpper();

                item.system_name         = "";
                item.system_worksitename = "";

                item.company_name    = "";
                item.company_linkman = "";
                item.company_tel     = "";
                item.company_address = "";

                item.system_licenseno = "未授权";
                item.system_effdate_e = "未授权";
                item.system_effdate_s = "未授权";
            }

            string    directoryPath = Server.MapPath("~/LicenseFile/");
            string    filepath      = directoryPath + "/" + "License.lic";
            MyLicense license       = MyLicenseHelper.Get(filepath);

            if (license.licenseno == "")
            {
                item.system_licenseno = "未授权";
                item.system_effdate_e = "未授权";
                item.system_effdate_s = "未授权";
            }
            else
            {
                item.system_licenseno = license.licenseno;
                item.system_effdate_s = license.licensedatestart.ToString("yyyy-MM-dd");
                item.system_effdate_e = license.licensedateend.ToString("yyyy-MM-dd");
            }
            return(Json(item, JsonRequestBehavior.AllowGet));
        }
Exemple #5
0
        public void ProcessRequest(HttpContext context)
        {
            string directoryPath = context.Server.MapPath("~/LicenseFile/");
            string filepath      = directoryPath + "/" + "License.lic";

            MyLicense license = MyLicenseHelper.Get(filepath);

            if (license.licenseno == "")
            {
                //item.system_licenseno = "未授权";
                //item.system_effdate_e = "未授权";
                //item.system_effdate_s = "未授权";
            }
            else
            {
                //item.system_licenseno = license.licenseno;
                //item.system_effdate_s = license.licensedatestart.ToString("yyyy-MM-dd");
                //item.system_effdate_e = license.licensedateend.ToString("yyyy-MM-dd");
            }

            string strXml = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>";

            strXml += "<License>";

            //
            strXml += "<hardwarecode><![CDATA[" + license.hardwarecode + "]]></hardwarecode>";
            strXml += "<licenseno><![CDATA[" + license.licenseno + "]]></licenseno>";
            strXml += "<licensedatestart><![CDATA[" + license.licensedatestart.ToString("yyyy-MM-dd") + "]]></licensedatestart>";
            strXml += "<licensedateend><![CDATA[" + license.licensedateend.ToString("yyyy-MM-dd") + "]]></licensedateend>";
            //
            strXml += "</License>";

            context.Response.ContentType     = "text/plain";
            context.Response.ContentEncoding = System.Text.Encoding.UTF8;
            context.Response.Write(strXml);
        }