Esempio n. 1
0
        public void DeleteByPrimaryKey(int primaryKey)
        {
            var d = new DataCode();

            d.Pk_Code_Id = primaryKey;
            dataCodeDAO.DeleteByPrimaryKey(d);
        }
Esempio n. 2
0
        private string CollectionClass(DataCode dataCode)
        {
            string str = Temples[(int)TempleType.CollectionClass];

            return(str.Replace("{class}", ClassName)
                   .Replace("{parents}", ParentClassName));
        }
Esempio n. 3
0
        private string GetFileComment(DataCode dataCode)
        {
            string str = Temples[(int)TempleType.FileComment];

            return(str.Replace("{copyright}", dataCode.FileComment[0])
                   .Replace("{lastedit}", dataCode.FileComment[1])
                   .Replace("{version}", dataCode.FileComment[2]));
        }
Esempio n. 4
0
        public void UpdateDataCode(DataCode dataCode)
        {
            dataCodeDAO.UpdateByPrimaryKey(dataCode);
            //插入至上传表
            UploadManagementDAO uploadManagementDao = new UploadManagementDAO();

            uploadManagementDao.Insert(new UploadManagement(dataCode.Pk_Code_Id, "bdl_datacode", 1));
        }
Esempio n. 5
0
        private string GetDataClass(DataCode dataCode)
        {
            string str = Temples[(int)TempleType.DataClass];

            return(str.Replace("{class}", ClassName)
                   .Replace("{parents}", ParentClassName)
                   .Replace("{properties}", GetProperties(dataCode)));
        }
Esempio n. 6
0
 public DataCodeDTO(DataCode dataCode, string mac)
 {
     this.clientId   = mac;
     this.pkCodeId   = dataCode.Pk_Code_Id.ToString();
     this.codeXh     = dataCode.Code_Xh.ToString();
     this.codeTypeId = dataCode.Code_Type_Id;
     this.codeSValue = dataCode.Code_S_Value;
     this.codeCValue = dataCode.Code_E_Value;
     this.codeState  = dataCode.Code_State.ToString();
 }
    private void OnNewDataState(string userId, DataCode code, string data)
    {
        var user = _usersOnMap.SingleOrDefault(u => u.UserPresence.UserId.Equals(userId));

        if (user == null)
        {
            return;
        }
        user.OnReceiveData(code, data);
    }
        //PUBLIC METHODS

        public void SendDataToMatch(string data, DataCode code)
        {
            if (_currMatch == null)
            {
                return;
            }

            _socket.SendMatchStateAsync(_currMatch.Id, code.ToInt(), data);
            BoxTextController.WriteText("Sending data to players: " + data, Color.yellow);
        }
Esempio n. 9
0
        private string Join(DataCode dataCode)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append(GetFileComment(dataCode));
            stringBuilder.Append(GetNameSpace(dataCode));
            stringBuilder.Append(GetDataClass(dataCode));
            stringBuilder.Append(CollectionClass(dataCode));

            return(stringBuilder.ToString());
        }
Esempio n. 10
0
        private string GetProperties(DataCode dataCode)
        {
            StringBuilder stringBuilder = new StringBuilder();
            string        str           = Temples[(int)TempleType.Property];

            for (int i = 0; i < dataCode.Property.Length; i++)
            {
                stringBuilder.Append(GetProperty(str, dataCode.Property[i], dataCode.PropertyType[i], dataCode.PropertyComment[i]));
            }
            return(stringBuilder.ToString());
        }
Esempio n. 11
0
 private void OnNewDataState(string userId, DataCode code, string data)
 {
     try
     {
         var user = _usersOnMap.SingleOrDefault(u => u.UserPresence.UserId.Equals(userId));
         user?.OnReceiveData(code, data);
     }
     catch (InvalidOperationException e)
     {
         Debug.LogWarning("The input sequence contains more than one element. " + e);
     }
 }
Esempio n. 12
0
        /// <summary>
        /// 新增编码
        /// </summary>
        /// <param name="typeId"></param>
        /// <param name="dValue"></param>
        /// <param name="sValue"></param>
        /// <param name="state"></param>
        public void AddDataCode(DataCodeTypeEnum typeId, string dValue, string sValue, Boolean state)
        {
            DataCode dataCode = new DataCode();

            //
            dataCode.Code_Xh      = dataCodeDAO.GetMaxXh(typeId.ToString()) + 1;
            dataCode.Code_D_Value = dValue;
            dataCode.Code_S_Value = sValue;
            dataCodeDAO.Insert(dataCode);
            //插入至上传表
            UploadManagementDAO uploadManagementDao = new UploadManagementDAO();

            uploadManagementDao.Insert(new UploadManagement(dataCode.Pk_Code_Id, "bdl_datacode", 0));
        }
Esempio n. 13
0
    public void OnReceiveData(DataCode code, string data)
    {
        switch (code)
        {
        case DataCode.POSITION:
            var pos = JsonConvert.DeserializeObject <Vector3>(data);
            characterMovement.MovePlayer(pos);

            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(code), code, null);
        }
    }
Esempio n. 14
0
 public static int ToInt(this DataCode code)
 {
     return((int)code);
 }
Esempio n. 15
0
 private void HandleFileInfo(DataCode dataCode)
 {
     Path      = dataCode.FileInfo[(int)FileInfo.Path] + dataCode.FileInfo[(int)FileInfo.FileName];
     ClassName = Regex.Replace(dataCode.FileInfo[(int)FileInfo.FileName], @"\.\w+$", "");
 }
Esempio n. 16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="uploadManagement">传入上传管理者实体</param>
        /// <returns>返回可以用来上传的辅助对象</returns>
        public ServiceResult GetServiceResult(UploadManagement uploadManagement)
        {
            //service返回结果对象
            ServiceResult serviceResult = new ServiceResult();
            //提前载入唯一Setter
            SetterDAO setterDAO = new SetterDAO();
            Setter    setter    = setterDAO.getSetter();
            //需要加入解密逻辑 TODO
            string mac = "";

            //try
            //{
            //    byte[] deBytes = AesUtil.Decrypt(Encoding.GetEncoding("GBK").GetBytes(setter.Set_Unique_Id),
            //        ProtocolConstant.USB_DOG_PASSWORD);
            //    mac = Encoding.GetEncoding("GBK").GetString(deBytes);
            //}
            //catch (Exception ex)
            //{
            //    mac = setter.Set_Unique_Id.Replace(":", "");
            //}
            byte[] a = ProtocolUtil.StringToBcd(setter.Set_Unique_Id);
            byte[] b = AesUtil.Decrypt(a, ProtocolConstant.USB_DOG_PASSWORD);
            mac = Encoding.GetEncoding("GBK").GetString(b).Replace(":", "-");

            ///if识别出表,设置发送路径,select出实体,转化至DTO,json打成string,返回
            //识别是否是权限用户添加
            if (uploadManagement.UM_DataTable == "bdl_auth")
            {
                AuthDAO authDAO = new AuthDAO();
                Auther  auther  = authDAO.Load(uploadManagement.UM_DataId);
                if (auther == null)
                {
                    return(null);
                }
                AutherDTO autherDTO = new AutherDTO(setter, auther, mac);


                //serviceResult.URL = "clientController/addClient.action";
                serviceResult.Data = JsonTools.Obj2JSONStrNew <AutherDTO>(autherDTO);
            }
            //bdl_customdata表
            else if (uploadManagement.UM_DataTable == "bdl_customdata")
            {
                CustomDataDAO customDataDAO = new CustomDataDAO();
                CustomData    customData    = customDataDAO.Load(uploadManagement.UM_DataId);
                if (customData == null)
                {
                    return(null);
                }
                CustomDataDTO customDataDTO = new CustomDataDTO(customData, mac);
                serviceResult.Data = JsonTools.Obj2JSONStrNew <CustomDataDTO>(customDataDTO);
            }
            //bdl_datacode表
            else if (uploadManagement.UM_DataTable == "bdl_datacode")
            {
                DataCodeDAO dataCodedao = new DataCodeDAO();
                DataCode    dataCode    = dataCodedao.Load(uploadManagement.UM_DataId);

                if (dataCode == null)
                {
                    return(null);
                }
                DataCodeDTO dataCodeDTO = new DataCodeDTO(dataCode, mac);
                serviceResult.Data = JsonTools.Obj2JSONStrNew <DataCodeDTO>(dataCodeDTO);
            }
            //bdl_deviceset表
            else if (uploadManagement.UM_DataTable == "bdl_deviceset")
            {
                DeviceSetDAO deviceSetDAO = new DeviceSetDAO();
                DeviceSet    deviceSet    = deviceSetDAO.Load(uploadManagement.UM_DataId);
                if (deviceSet == null)
                {
                    return(null);
                }
                DeviceSetDTO deviceSetDTO = new DeviceSetDTO(deviceSet, mac);

                serviceResult.Data = JsonTools.Obj2JSONStrNew <DeviceSetDTO>(deviceSetDTO);
            }
            //bdl_devicesort表
            else if (uploadManagement.UM_DataTable == "bdl_devicesort")
            {
                DeviceSortDAO deviceSortDAO = new DeviceSortDAO();
                DeviceSort    deviceSort    = deviceSortDAO.Load(uploadManagement.UM_DataId);
                if (deviceSort == null)
                {
                    return(null);
                }
                DeviceSortDTO deviceSortDTO = new DeviceSortDTO(deviceSort, mac);


                serviceResult.Data = JsonTools.Obj2JSONStrNew <DeviceSortDTO>(deviceSortDTO);
            }
            //bdl_onlinedevice表
            else if (uploadManagement.UM_DataTable == "bdl_onlinedevice")
            {
                OnlineDeviceDAO onlineDeviceDAO = new OnlineDeviceDAO();
                OnlineDevice    onlineDevice    = onlineDeviceDAO.Load(uploadManagement.UM_DataId);

                if (onlineDevice == null)
                {
                    return(null);
                }
                OnlineDeviceDTO onlineDeviceDTO = new OnlineDeviceDTO(onlineDevice, mac);

                serviceResult.Data = JsonTools.Obj2JSONStrNew <OnlineDeviceDTO>(onlineDeviceDTO);
            }
            //bdl_set表
            else if (uploadManagement.UM_DataTable == "bdl_set")
            {
                SetterDAO setterDAO1 = new SetterDAO();
                Setter    setter1    = setterDAO1.Load(uploadManagement.UM_DataId);

                if (setter1 == null)
                {
                    return(null);
                }

                SetterDTO setterDTO = new SetterDTO(setter1, mac);

                serviceResult.Data = JsonTools.Obj2JSONStrNew <SetterDTO>(setterDTO);
            }
            //病人表
            else if (uploadManagement.UM_DataTable == "bdl_user")
            {
                UserDAO userDAO = new UserDAO();
                User    user    = userDAO.Load(uploadManagement.UM_DataId);
                if (user == null)
                {
                    return(null);
                }


                UserDTO userDTO = new UserDTO(user, mac);
                //serviceResult.URL = "bigData/bodyStrongUser";
                serviceResult.Data = JsonTools.Obj2JSONStrNew <UserDTO>(userDTO);
            }

            //症状表
            else if (uploadManagement.UM_DataTable == "bdl_symptominfo")
            {
                SymptomInfoDao symptomInfoDao = new SymptomInfoDao();
                var            result         = symptomInfoDao.Load(uploadManagement.UM_DataId);
                if (result == null)
                {
                    return(null);
                }


                SymptomInfoDTO symptomInfoDTO = new SymptomInfoDTO(result, mac);
                //serviceResult.URL = "bigData/symptomInfo";
                serviceResult.Data = JsonTools.Obj2JSONStrNew <SymptomInfoDTO>(symptomInfoDTO);
            }

            //训练处方总表
            else if (uploadManagement.UM_DataTable == "bdl_traininfo")
            {
                TrainInfoDAO trainInfoDAO = new TrainInfoDAO();
                var          result       = trainInfoDAO.Load(uploadManagement.UM_DataId);
                if (result == null)
                {
                    return(null);
                }


                TrainInfoDTO trainInfoDTO = new TrainInfoDTO(result, mac);
                //serviceResult.URL = "bigData/trainInfo";
                serviceResult.Data = JsonTools.Obj2JSONStrNew <TrainInfoDTO>(trainInfoDTO);
            }

            //总表中的一条数据对某台设备的具体处方
            else if (uploadManagement.UM_DataTable == "bdl_deviceprescription")
            {
                DevicePrescriptionDAO devicePrescriptionDAO = new DevicePrescriptionDAO();
                var result = devicePrescriptionDAO.Load(uploadManagement.UM_DataId);
                if (result == null)
                {
                    return(null);
                }


                DevicePrescriptionDTO devicePrescriptionDTO = new DevicePrescriptionDTO(result, mac);
                //serviceResult.URL = "bigData/devicePrescription";
                serviceResult.Data = JsonTools.Obj2JSONStrNew <DevicePrescriptionDTO>(devicePrescriptionDTO);
            }
            //具体处方的具体反馈
            else if (uploadManagement.UM_DataTable == "bdl_prescriptionresult")
            {
                PrescriptionResultDAO prescriptionResultDAO = new PrescriptionResultDAO();
                var result = prescriptionResultDAO.Load(uploadManagement.UM_DataId);
                if (result == null)
                {
                    return(null);
                }


                PrescriptionResultDTO prescriptionResultDTO = new PrescriptionResultDTO(result, mac);
                //serviceResult.URL = "bigData/prescriptionResult";
                serviceResult.Data = JsonTools.Obj2JSONStrNew <PrescriptionResultDTO>(prescriptionResultDTO);
            }
            else if (uploadManagement.UM_DataTable == "bdl_physicalpower")
            {
                PhysicalPowerDAO physicalPowerDAO = new PhysicalPowerDAO();
                var result = physicalPowerDAO.Load(uploadManagement.UM_DataId);
                if (result == null)
                {
                    return(null);
                }

                PhysicalPowerDTO physicalPowerDTO = new PhysicalPowerDTO(result, mac);
                //serviceResult.URL = "bigData/physicalPower";
                serviceResult.Data = JsonTools.Obj2JSONStrNew <PhysicalPowerDTO>(physicalPowerDTO);
            }
            else if (uploadManagement.UM_DataTable == "bdl_error")
            {
                ErrorDao errorDao = new ErrorDao();
                var      result   = errorDao.Load(uploadManagement.UM_DataId);
                if (result == null)
                {
                    return(null);
                }

                ErrorDTO errorDTO = new ErrorDTO(result, mac);
                //serviceResult.URL = "bigData/physicalPower";
                serviceResult.Data = JsonTools.Obj2JSONStrNew <ErrorDTO>(errorDTO);
            }

            return(serviceResult);
        }
Esempio n. 17
0
 private string GetNameSpace(DataCode dataCode)
 {
     return(Temples[(int)TempleType.NameSpace]);
 }
Esempio n. 18
0
        /// <summary>
        /// 邮箱绑定
        /// </summary>
        /// <param name="validateCode"></param>
        /// <param name="nweEmail"></param>
        /// <param name="userName"></param>
        /// <returns></returns>
        public OperationResult ChangeEmail(string validateCode, string nweEmail, string userName)
        {
            var severCode = GetValidateCode(userName, CodeType.找回密码);

            if (severCode == null || severCode.Code != validateCode)
            {
                return(new OperationResult(OperationResultType.ValidError, "验证码错误", 0));
            }
            var userInfo  = UserInfoRepo.GetByPredicate(x => x.SysUser.UserName == userName);
            var userInfos = userInfo as UserInfo[] ?? userInfo.ToArray();

            if (!userInfos.Any())
            {
                return(new OperationResult(OperationResultType.ValidError, "身份信息错误", 0));
            }
            //smtp.163.com
            string senderServerIp = "123.125.50.133";
            //string senderServerIp = "smtp.163.com";
            //smtp.gmail.com
            //string senderServerIp = "74.125.127.109";
            //string senderServerIp = "smtp.qq.com";
            //string senderServerIp = "58.251.149.147";
            //string senderServerIp = "smtp.sina.com";
            string url = ConfigurationManager.AppSettings["ServerHost"] + "Web/Home/EmailBack?e=" + DataCode.Base64Encrypt(nweEmail, Encoding.UTF8) + "&u=" + userInfos.Single().Id + "&p=" + userInfos.Single().SysUser.PasswordHash + "";

            url = url.Replace("+", "%2B");
            string fromMailAddress = ConfigurationManager.AppSettings["Email"];//"*****@*****.**";
            string subjectInfo     = "邮箱绑定【西部鞋都】";
            string bodyInfo        = "你正在进行邮箱绑定操作,如果是你本人操作,请点击下面的链接完成邮箱绑定。【西部鞋都】<br/> <a href=\"" + url + "\">" + url + "</a>";
            string mailUsername    = "******";
            string mailPassword    = ConfigurationManager.AppSettings["EmailPwd"]; //发送邮箱的密码
            string mailPort        = "25";

            MailSender emailSender = new MailSender(senderServerIp, nweEmail, fromMailAddress, subjectInfo, bodyInfo, mailUsername, mailPassword, mailPort, false, false);

            emailSender.Send();
            return(new OperationResult(OperationResultType.Success, "请到邮箱完成验证", 0));
        }
Esempio n. 19
0
 public string GenerateCode(DataCode dataCode)
 {
     HandleFileInfo(dataCode);
     return(Join(dataCode));
 }