コード例 #1
0
 public AccountLoginB(string nAccountName,
                      uint nAccountMgrId)
 {
     mAccountId    = GenerateId._runNameId(nAccountName);
     mAccountName  = nAccountName;
     mAccountMgrId = nAccountMgrId;
 }
コード例 #2
0
        /*revisar!!*/
        public JsonResult PostMessage(Comment comment, string url, string id)
        {
            var userId   = User.Identity.GetUserId();
            var userName = us.Users.Where(x => x.Id == userId).Select(x => x.Nombre).SingleOrDefault();

            GenerateId generator = new GenerateId();

            comment.CommentId = generator.generateID();
            comment.Fk_Post   = id;
            comment.Fk_User   = userId;
            comment.Date      = DateTime.Now;
            if (comment.CommentMessage != null)
            {
                db.Comments.Add(comment);
                db.SaveChanges();
            }
            var mail = us.Users.Where(x => x.Id == userId).Select(x => x.Email).SingleOrDefault();
            var foto = us.Users.Where(x => x.Id == userId).Select(x => x.Foto).SingleOrDefault();
            var obj  = new
            {
                date    = comment.Date,
                message = comment.CommentMessage,
                user    = userName,
                mail    = mail,
                foto    = foto,
                url     = url
            };

            return(Json(new { data = obj, postId = comment.CommentId }, JsonRequestBehavior.AllowGet));
        }
コード例 #3
0
ファイル: Account.cs プロジェクト: TheMrViper/www.wanmei.com
        public void _addDeviceType(uint nDeviceType)
        {
            long         id_           = GenerateId._runId(@"account");
            DeviceStatus deviceStatus_ =
                new DeviceStatus(id_, nDeviceType);

            mDeviceStatus[nDeviceType] = deviceStatus_;
        }
コード例 #4
0
        public Account _getAccount(string nAccountName)
        {
            uint       hashName_        = GenerateId._runTableId(nAccountName);
            uint       accountMgrIndex_ = hashName_ % mAccountMgrCount;
            AccountMgr accountMgr_      = mAccountMgrs[accountMgrIndex_];

            return(accountMgr_._getAccount(nAccountName));
        }
コード例 #5
0
        public void _getAccountInfo(out uint nAccountMgrId,
                                    out uint nAccountId, string nAccountName)
        {
            uint hashName_ = GenerateId._runTableId(nAccountName);

            nAccountMgrId = hashName_ % mAccountMgrCount;
            nAccountId    = GenerateId._runNameId(nAccountName);
        }
コード例 #6
0
        public AccountLoginC _loginAccount(string nAccountName,
                                           string nPassward, uint nDeviceType)
        {
            uint       hashName_        = GenerateId._runTableId(nAccountName);
            uint       accountMgrIndex_ = hashName_ % mAccountMgrCount;
            AccountMgr accountMgr_      = mAccountMgrs[accountMgrIndex_];

            return(accountMgr_._loginAccount(nAccountName,
                                             nPassward, nDeviceType));
        }
コード例 #7
0
        public void RemoveStudentFromCourse_shouldThrow_ifPassedStudentIsNotFound()
        {
            var      id               = new GenerateId(0, 100).Generate();
            var      name             = "student name";
            IStudent testInputStudent = new Student(name, id);

            ICourse testCourse = new Course(courseName, courseMaximumCapacity);

            testCourse.RemoveStudentFromCourse(testInputStudent);
        }
コード例 #8
0
        public int _createAccount(int nPlatform, string nAccountName,
                                  string nNickname, string nPassward, string nGetPassward)
        {
            uint       hashName_        = GenerateId._runTableId(nAccountName);
            uint       accountMgrIndex_ = hashName_ % mAccountMgrCount;
            AccountMgr accountMgr_      = mAccountMgrs[accountMgrIndex_];

            return(accountMgr_._createAccount(nPlatform, nAccountName,
                                              nNickname, nPassward, nGetPassward));
        }
コード例 #9
0
        public Account _getAccount(string nAccountName)
        {
            Account result_    = null;
            uint    accountId_ = GenerateId._runNameId(nAccountName);

            if (mAccounts.ContainsKey(accountId_))
            {
                result_ = mAccounts[accountId_];
            }
            return(result_);
        }
コード例 #10
0
 public StatusCreateB(Account nAccount, uint nTableId, uint nAccountMgrId, StatusCreateS nStatusCreateS)
 {
     mAccountMgrId = nAccountMgrId;
     mTableId      = nTableId;
     mAccountId    = nAccount._getId();
     mText         = nStatusCreateS.m_tText;
     mType         = (uint)nStatusCreateS.m_tStatusType;
     mAttachments  = nStatusCreateS.m_tAttachments;
     mTicks        = DateTime.Now.Ticks;
     mStatusId     = GenerateId._runId(mAccountId);
 }
コード例 #11
0
        public void AddStudentToCourse_shouldThrow_ifPassedADuplicateStudent()
        {
            var      id               = new GenerateId(0, 100).Generate();
            var      name             = "student name";
            IStudent testInputStudent = new Student(name, id);

            ICourse testCourse = new Course(courseName, courseMaximumCapacity);

            testCourse.AddStudentToCourse(testInputStudent);
            testCourse.AddStudentToCourse(testInputStudent);
        }
コード例 #12
0
        public void AddStudentToCourse_shouldReturnTrue_ifPassedAValidArgument()
        {
            var      id               = new GenerateId(0, 100).Generate();
            var      name             = "student name";
            IStudent testInputStudent = new Student(name, id);

            ICourse testCourse = new Course(courseName, courseMaximumCapacity);

            var actual = testCourse.AddStudentToCourse(testInputStudent);

            Assert.IsTrue(actual);
        }
コード例 #13
0
 public AccountCreateB(int nPlatform, string nAccountName, string nNickname,
                       string nPassward, string nGetPassward, uint nAccountMgrId)
 {
     mAccountId    = GenerateId._runNameId(nAccountName);
     mPlatform     = nPlatform;
     mAccountName  = nAccountName;
     mAccountMgrId = nAccountMgrId;
     mNickName     = nNickname;
     mPassward     = nPassward;
     mGetPassward  = nGetPassward;
     mTicks        = DateTime.Now.Ticks;
 }
コード例 #14
0
        public void AddStudentToCourse_shouldThrow_ifCourseHasMaximumAllowedStudentsEnrolled()
        {
            ICourse testCourse = new Course(courseName, courseMaximumCapacity);

            for (int i = 0; i < courseMaximumCapacity + 1; i++)
            {
                var      studentId        = new GenerateId(0, 100).Generate();
                var      studentName      = "student name";
                IStudent testInputStudent = new Student(studentName, studentId);

                testCourse.AddStudentToCourse(testInputStudent);
            }
        }
コード例 #15
0
        public object createTag()
        {
            IGeneratorId igenId = new GenerateId();

            DB_repository.Tag tag = new DB_repository.Tag()
            {
                Id        = ObjectId.GenerateNewId().ToString(),
                Tag_id    = igenId.generateTagId(),
                Tag_label = igenId.generateLabel(),
                Tag_time  = DateTime.Now.ToUniversalTime()
            };
            return(tag);
        }
コード例 #16
0
        public int _logoutAccount(int nPlatformId, string nAccountName,
                                  uint nStamp, uint nDeviceId, int nServerId)
        {
            int result_ = this._checkServerId(nServerId);

            if (AccountError_.mSucess_ == result_)
            {
                uint       hashName_        = GenerateId._runTableId(nAccountName);
                uint       accountMgrIndex_ = hashName_ % mAccountMgrCount;
                AccountMgr accountMgr_      = mAccountMgrs[accountMgrIndex_];
                result_ = accountMgr_._logoutAccount(nAccountName,
                                                     nStamp, nDeviceId);
            }
            return(result_);
        }
コード例 #17
0
        public JsonResult Create([Bind(Include = "TypeId,TypeName")] WarehouseType warehouseClassification)
        {
            GenerateId generator = new GenerateId();

            warehouseClassification.TypeId = generator.generateID();
            db.WarehouseTypes.Add(warehouseClassification);
            db.SaveChanges();

            var tipo = new
            {
                TypeId   = warehouseClassification.TypeId,
                TypeName = warehouseClassification.TypeName
            };

            return(Json(new { data = tipo }, JsonRequestBehavior.AllowGet));
        }
コード例 #18
0
        public JsonResult Create([Bind(Include = "ConditionID,ConditionName")] Condition condition)
        {
            GenerateId generator = new GenerateId();

            condition.ConditionID = generator.generateID();
            db.Conditions.Add(condition);
            db.SaveChanges();

            var condicion = new
            {
                ConditionID   = condition.ConditionID,
                ConditionName = condition.ConditionName
            };

            return(Json(new { data = condicion }, JsonRequestBehavior.AllowGet));
        }
コード例 #19
0
    // Called during instantiation
    public void Awake()
    {
        if (CompareTag("ActiveItem"))
        {
            if (_transistorEntity == null)
            {
                _transistorEntity = new TransistorPNPEntity();
            }
            SetAndInitializeConnectors();

            GameObject componentIdManager = GameObject.Find("_ComponentIdManager");
            GenerateId script             = componentIdManager.GetComponent <GenerateId>();
            script.generatedIds[10]++;
            _name += script.generatedIds[10].ToString();
        }
    }
コード例 #20
0
        public JsonResult Create([Bind(Include = "DestinationId,DestinationName")] Destination destination)
        {
            GenerateId generator = new GenerateId();

            destination.DestinationId = generator.generateID();
            db.Destinations.Add(destination);
            db.SaveChanges();

            var destino = new
            {
                DestinationId   = destination.DestinationId,
                DestinationName = destination.DestinationName
            };

            return(Json(new { data = destino }, JsonRequestBehavior.AllowGet));
        }
コード例 #21
0
        public JsonResult Create([Bind(Include = "CompanyID,CompanyName")] DeliveryCompany deliveryCompany)
        {
            GenerateId generator = new GenerateId();

            deliveryCompany.CompanyID = generator.generateID();
            db.DeliveryCompanies.Add(deliveryCompany);
            db.SaveChanges();

            var delivery = new
            {
                Id          = deliveryCompany.CompanyID,
                CompanyName = deliveryCompany.CompanyName
            };

            return(Json(new { data = delivery }, JsonRequestBehavior.AllowGet));
        }
コード例 #22
0
        public JsonResult Create([Bind(Include = "AccountClasificationID,ClasificationName")] AccountClasification classification)
        {
            GenerateId generator = new GenerateId();

            classification.AccountClasificationID = generator.generateID();
            db.AccountClasifications.Add(classification);
            db.SaveChanges();

            var clasificacion = new
            {
                Id             = classification.AccountClasificationID,
                Classification = classification.ClasificationName
            };

            return(Json(new { data = clasificacion }, JsonRequestBehavior.AllowGet));
        }
コード例 #23
0
ファイル: GUINode.cs プロジェクト: mjartanm/NEWTON---EDUSIM
    // Called during instantiation
    public void Awake()
    {
        if (CompareTag("ActiveNode"))
        {
            if (_nodeEntity == null)
            {
                _nodeEntity = new NodeEntity();
            }

            SetAndInitializeConnectors();

            GameObject componentIdManager = GameObject.Find("_ComponentIdManager");
            GenerateId script             = componentIdManager.GetComponent <GenerateId>();
            script.generatedIds[5]++;
            _name += script.generatedIds[5].ToString();
        }
    }
コード例 #24
0
ファイル: FileApp.cs プロジェクト: yubaolee/OpenAuth.Core
        /// <summary>
        /// 存储文件,如果是图片文件则生成缩略图
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="fileBuffers"></param>
        /// <exception cref="Exception"></exception>
        private void SaveFile(string fileName, byte[] fileBuffers)
        {
            string folder = DateTime.Now.ToString("yyyyMMdd");

            //判断文件是否为空
            if (string.IsNullOrEmpty(fileName))
            {
                throw new Exception("文件名不能为空");
            }

            //判断文件是否为空
            if (fileBuffers.Length < 1)
            {
                throw new Exception("文件不能为空");
            }

            var uploadPath = Path.Combine(_filePath, folder);

            _logger.LogInformation("文件写入:" + uploadPath);
            if (!Directory.Exists(uploadPath))
            {
                Directory.CreateDirectory(uploadPath);
            }

            var    ext     = Path.GetExtension(fileName).ToLower();
            string newName = GenerateId.GenerateOrderNumber() + ext;

            using (var fs = new FileStream(Path.Combine(uploadPath, newName), FileMode.Create))
            {
                fs.Write(fileBuffers, 0, fileBuffers.Length);
                fs.Close();

                //生成缩略图
                if (ext.Contains(".jpg") || ext.Contains(".jpeg") || ext.Contains(".png") || ext.Contains(".bmp") ||
                    ext.Contains(".gif"))
                {
                    string thumbnailName = GenerateId.GenerateOrderNumber() + ext;
                    ImgHelper.MakeThumbnail(Path.Combine(uploadPath, newName), Path.Combine(uploadPath, thumbnailName));
                    _dbThumbnail = Path.Combine(folder, thumbnailName);
                }


                _dbFilePath = Path.Combine(folder, newName);
            }
        }
コード例 #25
0
    // Called during instantiation
    public void Awake()
    {
        if (CompareTag("ActiveItem"))
        {
            if (_zenerEntity == null)
            {
                _zenerEntity = new ZenerDiodeEntity();
            }
            diodeComponent = new ZenerElm();

            SetAndInitializeConnectors();

            GameObject componentIdManager = GameObject.Find("_ComponentIdManager");
            GenerateId script             = componentIdManager.GetComponent <GenerateId>();
            script.generatedIds[9]++;
            _name += script.generatedIds[9].ToString();
        }
    }
コード例 #26
0
        public void CreateUserPost(String PostId, String UserId)
        {
            // First is needed to check if the relation alredy exist
            var Relation = db.PostUsers.Where(x => x.Fk_Post == PostId && x.Fk_User == UserId).Select(x => x.PostUserID);

            if (Relation.Count() == 0 && PostId != null && UserId != null)
            {
                GenerateId generator = new GenerateId();

                PostUser postRelation = new PostUser();

                postRelation.PostUserID = generator.generateID();
                postRelation.Fk_Post    = PostId;
                postRelation.Fk_User    = UserId;
                db.PostUsers.Add(postRelation);
                db.SaveChanges();
            }
        }
コード例 #27
0
 // Called during instantiation
 public override void Awake()
 {
     if (CompareTag("ActiveItem"))
     {
         id = idCounter++;
         if (_analogSwitchEntity == null)
         {
             _analogSwitchEntity = new AnalogSwitchEntity {TurnedOff = DefaultState};
         }
         _analogSwitchComponent = new SwitchSPST();
         SetAndInitializeConnectors();
         
         GameObject componentIdManager = GameObject.Find("_ComponentIdManager");
         GenerateId script = componentIdManager.GetComponent<GenerateId>();
         script.generatedIds[7]++;
         _name += script.generatedIds[7].ToString();
     }
 }
コード例 #28
0
    // Called during instantiation
    public override void Awake()
    {
        if (CompareTag("ActiveItem"))
        {
            id = idCounter++;
            if (_lampEntity == null)
            {
                _lampEntity = new LampEntity();
            }

            SetAndInitializeConnectors();

            GameObject componentIdManager = GameObject.Find("_ComponentIdManager");
            GenerateId script             = componentIdManager.GetComponent <GenerateId>();
            script.generatedIds[2]++;
            _name += script.generatedIds[2].ToString();
        }
    }
コード例 #29
0
    // Called during instantiation
    public override void Awake()
    {
        if (CompareTag("ActiveItem"))
        {
            id = idCounter++;
            if (_inductorEntity == null)
            {
                _inductorEntity = new InductorEntity {
                    IsTrapezoidal = DefaultIsTrapezoidal, Inductance = DefaultInductance
                };
            }
            SetAndInitializeConnectors();

            GameObject componentIdManager = GameObject.Find("_ComponentIdManager");
            GenerateId script             = componentIdManager.GetComponent <GenerateId>();
            script.generatedIds[4]++;
            _name += script.generatedIds[4].ToString();
        }
    }
コード例 #30
0
    // Called during instantiation
    public override void Awake()
    {
        if (CompareTag("ActiveItem"))
        {
            id = idCounter++;
            if (_ampermeterEntity == null)
            {
                _ampermeterEntity = new AmpermeterEntity();
            }
            //just for handling null references before we start the simulation
            ResistorComponent = new Resistor();

            SetAndInitializeConnectors();

            GameObject componentIdManager = GameObject.Find("_ComponentIdManager");
            GenerateId script             = componentIdManager.GetComponent <GenerateId>();
            script.generatedIds[1]++;
            _name += script.generatedIds[1].ToString();
        }
    }