Exemplo n.º 1
0
        public void AddAdmin()
        {
            var tblUser = new tblUser
            {
                User_PostType_Id         = DPostTypeId,
                User_SecurityQuestion_Id = DSecurityQuestionId,
                UserFirstName            = DFirstName,
                UserLastName             = DLastName,
                UserName             = DUserName,
                UserPassword         = BCrypt.Net.BCrypt.HashPassword(DPassword),
                UserMobileNumber     = DMobile,
                UserEmail            = DEmail,
                UserAnswer           = BCrypt.Net.BCrypt.HashPassword(DAnswer),
                UserRegistrationDate = DRegistrationDate,
                UserImage            = DImage,
                UserDescription      = DDescription
            };

            _dbMunicipalArchiveEntities.tblUser.Add(tblUser);
            _dbMunicipalArchiveEntities.SaveChanges();
            var sundry = _dbMunicipalArchiveEntities.tblSundry.ToList();

            if (sundry.Count != 0)
            {
                return;
            }
            var tblSundry = new tblSundry
            {
                Id = 1,
                RegisteredAdminPassword = true
            };

            _dbMunicipalArchiveEntities.tblSundry.Add(tblSundry);
            _dbMunicipalArchiveEntities.SaveChanges();
        }
Exemplo n.º 2
0
        public static void SetSecurityAccess()
        {
            var dbMunicipalArchiveEntities = new dbMunicipalArchiveEntities();
            var result = dbMunicipalArchiveEntities.tblSecurityAccess.FirstOrDefault(x => x.Id == 1);

            if (result == null)
            {
                var tblSecurityAccess = new tblSecurityAccess
                {
                    Id      = 1,
                    Time    = PersianDateTime.Now.AddMinutes(-10).ToString(),
                    Counter = "0"
                };
                dbMunicipalArchiveEntities.tblSecurityAccess.Add(tblSecurityAccess);
                dbMunicipalArchiveEntities.SaveChanges();
            }
            else if (result.Time == null)
            {
                var tblSecurityAccess = new tblSecurityAccess
                {
                    Id   = 1,
                    Time = PersianDateTime.Now.AddMinutes(-10).ToString()
                };
                using (dbMunicipalArchiveEntities)
                {
                    dbMunicipalArchiveEntities.tblSecurityAccess.Attach(tblSecurityAccess);
                    dbMunicipalArchiveEntities.Entry(tblSecurityAccess).Property(x => x.Time).IsModified = true;
                    dbMunicipalArchiveEntities.SaveChanges();
                }
            }
        }
Exemplo n.º 3
0
        public Task <int> Add()
        {
            var addFile = new tblFile
            {
                MainId       = DMainId,
                Marlik       = DMarlik,
                FileType_Id  = DFileTypeId,
                Violation_Id = DViolationId,
                FileNum      = DFileNum,
                FileYear     = DFileYear,
                PermitNum    = DPermitNum,
                PermitYear   = DPermitYear,
                Mantaghe     = DMantaghe,
                Nahie        = DNahie,
                Mahaleh      = DMahaleh,
                Block        = DBlock,
                Melk         = DMelk,
                Radif        = DRadif,
                Address      = DAddress,
                PostalCode   = DPostalCode,
                VoteNum      = DVoteNum,
                InArchives   = DInArchives,
                Separation   = DSeparation,
                Aggregation  = DAggregation,
                DateInsert   = DDateInsert,
                Description  = DDescription
            };

            _dbMunicipalArchiveEntities.tblFile.Add(addFile);
            _dbMunicipalArchiveEntities.SaveChanges();
            return(Task.Run(() => addFile.Id));
        }
Exemplo n.º 4
0
        public void Add()
        {
            var addViolation = new tblViolation
            {
                Violation = DViolationName
            };

            _dbMunicipalArchiveEntities.tblViolation.Add(addViolation);
            _dbMunicipalArchiveEntities.SaveChanges();
        }
Exemplo n.º 5
0
        public void Add()
        {
            var addFileType = new tblFileType
            {
                FileType = DFileTypeName
            };

            _dbMunicipalArchiveEntities.tblFileType.Add(addFileType);
            _dbMunicipalArchiveEntities.SaveChanges();
        }
Exemplo n.º 6
0
        public void Add()
        {
            var tblFilePlaque = new tblFilePlaque
            {
                File_Id   = DFileId,
                Plaque_Id = DPlaqueId
            };

            _dbMunicipalArchiveEntities.tblFilePlaque.Add(tblFilePlaque);
            _dbMunicipalArchiveEntities.SaveChanges();
        }
Exemplo n.º 7
0
        public void Add()
        {
            var tblFilePerson = new tblFilePerson
            {
                File_Id   = DFileId,
                Person_Id = DPersonId
            };

            _dbMunicipalArchiveEntities.tblFilePerson.Add(tblFilePerson);
            _dbMunicipalArchiveEntities.SaveChanges();
        }
Exemplo n.º 8
0
        public void Add()
        {
            var addPlaque = new tblPlaque
            {
                Main        = DMain,
                Secondary   = DSecondary,
                Part        = DPart,
                Description = DDescription
            };

            _dbMunicipalArchiveEntities.tblPlaque.Add(addPlaque);
            _dbMunicipalArchiveEntities.SaveChanges();
        }
Exemplo n.º 9
0
        public void Add()
        {
            var tblPerson = new tblPerson
            {
                Name        = DName,
                Family      = DFamily,
                FatherName  = DFatherName,
                Code        = DCode,
                Birthday    = DBirthday,
                Sex         = DSex,
                Mobile      = DMobile,
                Description = DDescription
            };

            _dbMunicipalArchiveEntities.tblPerson.Add(tblPerson);
            _dbMunicipalArchiveEntities.SaveChanges();
        }
Exemplo n.º 10
0
        public void Add()
        {
            var tblLicense = new tblLicense
            {
                AppLicense = DAppLicense
            };

            _dbMunicipalArchiveEntities.tblLicense.Add(tblLicense);
            _dbMunicipalArchiveEntities.SaveChanges();
        }
Exemplo n.º 11
0
        public void Edit()
        {
            var result = _dbMunicipalArchiveEntities.tblAppVersion.SingleOrDefault(x => x.Id == 1);

            if (result == null)
            {
                return;
            }
            result.AppVersion = DAppVersion;
            _dbMunicipalArchiveEntities.SaveChanges();
        }
Exemplo n.º 12
0
        public void StartSecurityTimeAccess()//taeen zaman vorod eshtebah
        {
            var tblSecurityAccess = new tblSecurityAccess
            {
                Id   = 1,
                Time = PersianDateTime.Now.ToString()
            };

            using (var dbMunicipalArchiveEntities = new dbMunicipalArchiveEntities())
            {
                dbMunicipalArchiveEntities.tblSecurityAccess.Attach(tblSecurityAccess);
                dbMunicipalArchiveEntities.Entry(tblSecurityAccess).Property(x => x.Time).IsModified = true;
                dbMunicipalArchiveEntities.SaveChanges();
            }
        }
Exemplo n.º 13
0
        public static void SaveCounter(int num)//zakhire tedad mavared vorod eshtebah
        {
            var tblSecurityAccess = new tblSecurityAccess
            {
                Id      = 1,
                Counter = num.ToString()
            };

            using (var dbMunicipalArchiveEntities = new dbMunicipalArchiveEntities())
            {
                dbMunicipalArchiveEntities.tblSecurityAccess.Attach(tblSecurityAccess);
                dbMunicipalArchiveEntities.Entry(tblSecurityAccess).Property(x => x.Counter).IsModified = true;
                dbMunicipalArchiveEntities.SaveChanges();
            }
        }
Exemplo n.º 14
0
        public void ChangePassword()
        {
            var tblUser = new tblUser
            {
                Id           = 1,
                UserName     = DUserName,
                UserPassword = BCrypt.Net.BCrypt.HashPassword(DPassword)
            };

            using (var dbMunicipalArchiveEntities = new dbMunicipalArchiveEntities())
            {
                dbMunicipalArchiveEntities.tblUser.Attach(tblUser);
                dbMunicipalArchiveEntities.Entry(tblUser).Property(x => x.UserName).IsModified     = true;
                dbMunicipalArchiveEntities.Entry(tblUser).Property(x => x.UserPassword).IsModified = true;
                dbMunicipalArchiveEntities.SaveChanges();
            }
        }