コード例 #1
0
        //internal vwProduct EditWarehouseItem(vwProduct item)
        //{
        //    try
        //    {
        //        using (WarehouseDataBaseEntities context = new WarehouseDataBaseEntities())
        //        {
        //            tblProduct itemToEdit = (from i in context.tblProducts where i.ID == item.ID select i).First();
        //            itemToEdit.ProductName = item.ProductName;
        //            itemToEdit.ProductNumber = item.ProductNumber;
        //            itemToEdit.Amount = item.Amount;
        //            itemToEdit.Price = item.Price;
        //            context.SaveChanges();
        //            return item;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
        //        return null;
        //    }
        //}

        internal tblPatient FindPatientCredentials(string userName, string password)
        {
            try
            {
                using (MedicalServiceEntities context = new MedicalServiceEntities())
                {
                    string     encryptedPassword = EncryptionHelper.Encrypt(password);
                    tblPatient patientToFind     = (from d in context.tblPatients where d.UserName == userName && d.Password == encryptedPassword select d).First();
                    return(patientToFind);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Doctor not found!" + ex.Message.ToString());
                return(null);
            }
        }