예제 #1
0
        public ICComposite iccrete(ICComposite icVM)
        {
            try
            {

                using (var db = new CDTEntities())
                {

                    IC ic = new IC()
                    {
                        BOM_Number = icVM.ICMain.BOM_Number,
                        BU = icVM.ICMain.BU,
                        Product_line = icVM.ICMain.Product_line,
                        Site = icVM.ICMain.Site,
                        Thermo_Number = icVM.ICMain.Thermo_Number,
                        Item_Description = icVM.ICMain.Item_Description,
                        Category = icVM.ICMain.Category,
                        Part = icVM.ICMain.Part,
                        Part_Type = icVM.ICMain.Part_Type,
                        Technology = icVM.ICMain.Technology,
                        Supply_Voltage = icVM.ICMain.Supply_Voltage,
                        Memory___organisation = icVM.ICMain.Memory___organisation,
                        Memory___access_Time = icVM.ICMain.Memory___access_Time,
                        Mouting = icVM.ICMain.Mouting,
                        Package = icVM.ICMain.Package,
                        Lead_Spacing_Inch_ = icVM.ICMain.Lead_Spacing_Inch_,
                        No___of_pins = icVM.ICMain.No___of_pins,
                        Operating__Temperature = icVM.ICMain.Operating__Temperature,
                        ICMnfs = GetICMnfs(icVM)
                    };
                    db.ICs.Add(ic);
                    db.SaveChanges();

                    return icVM;
                };
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                        eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                            ve.PropertyName, ve.ErrorMessage);
                    }
                }
                return icVM;
            }
        }
예제 #2
0
        public List<ComponentVM> GetComponentList()
        {
            List<ComponentVM> components = new List<ComponentVM>();

            using (var db = new CDTEntities())
            {
                components = (from c in db.Components
                              select new ComponentVM
                              {
                                  Id = c.Id,
                                  Component1 = c.Component1
                              }).ToList();
            }

            return components;
        }
예제 #3
0
        public User GetUserByEmailOrPhone(string emailOrPhone)
        {
            User user = new User();

            try
            {
                using (var db = new CDTEntities())
                {
                    user = db.Users.Where(u => u.Email == emailOrPhone).FirstOrDefault();
                }
                return user;
            }
            catch (Exception ex)
            {
                return user;
            }
        }
예제 #4
0
        public bool ValidateUser(string email, string password)
        {
            try
            {
                bool isFound = true;
                User user = new User();

                using (var db = new CDTEntities())
                {
                    user = db.Users.Where
                        (u => u.Email == email && u.Password == password).FirstOrDefault();
                    isFound = user != null ? true : false;
                }

                return isFound;
            }
            catch (Exception)
            {
                return false;
            }
        }