コード例 #1
0
ファイル: DUser.cs プロジェクト: ARKVN33/visitor
        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
            };

            _dbVisitorEntities.tblUser.Add(tblUser);
            _dbVisitorEntities.SaveChanges();
            var tblSundry = new tblSundry
            {
                Id = 1,
                RegisteredAdminPassword = true
            };

            _dbVisitorEntities.tblSundry.Add(tblSundry);
            _dbVisitorEntities.SaveChanges();
        }
コード例 #2
0
        public static void SetSecurityAccess()
        {
            var dbVisitorEntities = new dbVisitorEntities();
            var result            = dbVisitorEntities.tblSecurityAccess.FirstOrDefault(x => x.Id == 1);

            if (result == null)
            {
                var tblSecurityAccess = new tblSecurityAccess
                {
                    Id      = 1,
                    Time    = PersianDateTime.Now.AddMinutes(-10).ToString(),
                    Counter = "0"
                };
                dbVisitorEntities.tblSecurityAccess.Add(tblSecurityAccess);
                dbVisitorEntities.SaveChanges();
            }
            else if (result.Time == null)
            {
                var tblSecurityAccess = new tblSecurityAccess
                {
                    Id   = 1,
                    Time = PersianDateTime.Now.AddMinutes(-10).ToString()
                };
                using (dbVisitorEntities)
                {
                    dbVisitorEntities.tblSecurityAccess.Attach(tblSecurityAccess);
                    dbVisitorEntities.Entry(tblSecurityAccess).Property(x => x.Time).IsModified = true;
                    dbVisitorEntities.SaveChanges();
                }
            }
        }
コード例 #3
0
        public void Add()
        {
            var addSpecialty = new tblSpecialty()
            {
                Name = DSpecialtyName
            };

            _dbVisitorEntities.tblSpecialty.Add(addSpecialty);
            _dbVisitorEntities.SaveChanges();
        }
コード例 #4
0
        public void Add()
        {
            var tblLicense = new tblLicense
            {
                Id         = 1,
                AppLicense = DAppLicense,
                AppVersion = DAppVersion
            };

            _dbVisitorEntities.tblLicense.Add(tblLicense);
            _dbVisitorEntities.SaveChanges();
        }
コード例 #5
0
        public void Add()
        {
            var tblVisitDoctorAdd = new tblVisitDoctor
            {
                Doctor_Id   = DDoctorId,
                Date        = DDate,
                Time        = DTime,
                Description = DDescription
            };

            _dbVisitorEntities.tblVisitDoctor.Add(tblVisitDoctorAdd);
            _dbVisitorEntities.SaveChanges();
        }
コード例 #6
0
ファイル: DDoctorPatient.cs プロジェクト: ARKVN33/visitor
        public void Add()
        {
            var addDoctorPatient = new tblDoctorPatient
            {
                Doctor_Id     = DDoctorId,
                Patient_Id    = DPatientId,
                MedicalRecord = DMedicalRecord,
                Date          = DDate,
                Time          = DTime,
                Description   = DDescription
            };

            _dbVisitorEntities.tblDoctorPatient.Add(addDoctorPatient);
            _dbVisitorEntities.SaveChanges();
        }
コード例 #7
0
        public void Add()
        {
            var tblPatient = new tblPatient
            {
                Patient_Id   = DPatientId,
                Name         = DName,
                Family       = DFamily,
                Sex          = DSex,
                Address      = DAddress,
                PhoneNumber  = DPhoneNumber,
                MobileNumber = DMobileNumber,
                Description  = DDescription
            };

            _dbVisitorEntities.tblPatient.Add(tblPatient);
            _dbVisitorEntities.SaveChanges();
        }
コード例 #8
0
ファイル: DDoctor.cs プロジェクト: ARKVN33/visitor
        public void Add()
        {
            var tblDoctor = new tblDoctor
            {
                Specialty_Id = DSpecialtyId,
                County_Id    = DCountyId,
                Doctor_Id    = DDoctorId,
                Name         = DDoctorName,
                Family       = DDoctorFamily,
                Sex          = DSex,
                Address      = DAddress,
                PhoneNumber  = DPhoneNumber,
                MobileNumber = DMobileNumber,
                Description  = DDescription
            };

            _dbVisitorEntities.tblDoctor.Add(tblDoctor);
            _dbVisitorEntities.SaveChanges();
        }
コード例 #9
0
        public void StartSecurityTimeAccess()//taeen zaman vorod eshtebah
        {
            var tblSecurityAccess = new tblSecurityAccess
            {
                Id   = 1,
                Time = PersianDateTime.Now.ToString()
            };

            using (var dbVisitorEntities = new dbVisitorEntities())
            {
                dbVisitorEntities.tblSecurityAccess.Attach(tblSecurityAccess);
                dbVisitorEntities.Entry(tblSecurityAccess).Property(x => x.Time).IsModified = true;
                dbVisitorEntities.SaveChanges();
            }
        }
コード例 #10
0
        public static void SaveCounter(int num)//zakhire tedad mavared vorod eshtebah
        {
            var tblSecurityAccess = new tblSecurityAccess
            {
                Id      = 1,
                Counter = num.ToString()
            };

            using (var dbVisitorEntities = new dbVisitorEntities())
            {
                dbVisitorEntities.tblSecurityAccess.Attach(tblSecurityAccess);
                dbVisitorEntities.Entry(tblSecurityAccess).Property(x => x.Counter).IsModified = true;
                dbVisitorEntities.SaveChanges();
            }
        }
コード例 #11
0
ファイル: DUser.cs プロジェクト: ARKVN33/visitor
        public void ChangePassword()
        {
            var tblUser = new tblUser
            {
                Id           = 1,
                UserName     = DUserName,
                UserPassword = BCrypt.Net.BCrypt.HashPassword(DPassword)
            };

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