コード例 #1
0
        public bool TypeExist(string type, string customer)
        {
            //CHANGE!!
            switch (customer)
            {
                case "RegionH":
                    //
                    try
                    {
                        using (var db = new RegionHEntities())
                        {
                            if (db.Dim_Unit_TypeSet.Any(o => o.Type.Equals(type)))
                            {
                                return true;
                            }
                            else
                            {
                                return false;
                            }
                        }

                    }
                    catch
                    {
                        return false;
                    }

                case "Lundbeck":

                    try
                    {
                        using (var db = new LundbeckEntities())
                        {
                            if (db.Bridge_Event_LSet.Any(o => o.Dim_Unit_Type_LSet.Type.Equals(type)))
                            {
                                return true;
                            }
                            else
                            {
                                return false;
                            }
                        }

                    }
                    catch
                    {
                        return false;
                    }

                default:
                    return false;

            }
        }
コード例 #2
0
        public bool UnitExist(string ID, string customer)
        {
            //string customer = "RegionH";

            switch (customer)
            {
                case "RegionH":
                    try
                    {
                        using (var db = new RegionHEntities())
                        {
                            if (db.Bridge_UnitSet.Any(o => o.Dim_UnitSet.Unitname.Equals(ID)))
                            {
                                return true;
                            }
                            else
                            {
                                return false;
                            }
                        }
                    }
                    catch
                    {
                        return false;
                    }

                case "Lundbeck":
                    try
                    {
                        using (var db = new LundbeckEntities())
                        {
                            if (db.Bridge_Unit_LSet.Any(o => o.Dim_Unit_LSet.Unitname.Equals(ID)))
                            {
                                return true;
                            }
                            else
                            {
                                return false;
                            }
                        }
                    }
                    catch
                    {
                        return false;
                    }

                default:

                    return false;
            }
        }
コード例 #3
0
        public bool AddUnit(string UnitID, string Room, string type, string customer)
        {
            switch (customer)
            {
                case "RegionH":
                    try
                    {
                        using (var db = new RegionHEntities())
                        {

                            var newUnit = db.Bridge_UnitSet.Create();
                            var unit1 = db.Dim_UnitSet.Create();
                            var type1 = db.Dim_Unit_TypeSet.Where(o => o.Type.Equals(type)).First();
                            var location1 = db.Dim_LocationSet.Where(o => o.Room.Equals(Room)).First();

                            unit1.Unitname = UnitID;

                            newUnit.Dim_LocationSet = location1;
                            newUnit.Dim_UnitSet = unit1;
                            newUnit.Dim_Unit_TypeSet = type1;

                            db.Bridge_UnitSet.Add(newUnit);
                            db.SaveChanges();
                        }
                        return true;
                    }
                    catch (Exception ex)
                    {
                        return false;
                    }

                case "Lundbeck":
                    try
                    {
                        using (var db = new LundbeckEntities())
                        {
                            //CHANGE!!
                        }
                        return true;
                    }
                    catch (Exception ex)
                    {
                        return false;
                    }

                default:
                    return false;
            }
        }