コード例 #1
0
        public bool SoapAction(string ID)
        {
            try
            {
                using (var db = new RegionHEntities())
                {
                    var bridge_unit = db.Fact_Unit_DataSet.Where(x => x.Bridge_UnitSet.Dim_UnitSet.Unitname.Equals(ID)).First();
                    bridge_unit.Soap++;
                    bridge_unit.SoapLevel = bridge_unit.SoapLevel - 2;
                    db.SaveChanges();

                    return true;
                }
            }
            catch (Exception ex)
            {
                return false;
            }
        }
コード例 #2
0
        public bool AddEventForType(string type, string action, string description, string customer)
        {
            switch (customer)
            {
                case "RegionH":
                    try
                    {
                        using (var db = new RegionHEntities())
                        {
                            var newBridgeUnitEvent = db.Bridge_EventSet.Create();
                            var unitType = db.Dim_Unit_TypeSet.Where(o => o.Type.Equals(type)).First();
                            var newEvent = db.Dim_EventSet.Create();
                            newEvent.Event = action;
                            newEvent.EventDescription = description;

                            newBridgeUnitEvent.Dim_EventSet = newEvent;
                            newBridgeUnitEvent.Dim_Unit_TypeSet = unitType;

                            db.Bridge_EventSet.Add(newBridgeUnitEvent);
                            db.SaveChanges();
                        }
                        return true;
                    }
                    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;
            }
        }
コード例 #4
0
        public bool AddType(string type, string customer)
        {
            switch (customer)
            {
                case "RegionH":
                    try
                    {
                        using (var db = new RegionHEntities())
                        {
                            var newType = db.Dim_Unit_TypeSet.Create();
                            newType.Type = type;

                            db.Dim_Unit_TypeSet.Add(newType);
                            db.SaveChanges();
                        }
                        return true;
                    }
                    catch
                    {
                        return false;
                    }

                default:

                    return false;
            }
        }
コード例 #5
0
        public bool AddSoapDataSet(string UnitID)
        {
            try
            {
                using (var db = new RegionHEntities())
                {
                    //Add DataSet
                    var SoapData = db.Fact_Unit_DataSet.Create();
                    var soapUnit = db.Bridge_UnitSet.Where(x => x.Dim_UnitSet.Unitname.Equals(UnitID)).First();

                    SoapData.Bridge_UnitSet = soapUnit;
                    SoapData.Awake = 0;
                    SoapData.Flush = 0;
                    SoapData.Soap = 0;
                    SoapData.SoapLevel = 75;

                    db.Fact_Unit_DataSet.Add(SoapData);
                    db.SaveChanges();
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
コード例 #6
0
        public bool AddRoom(string Room, string customer)
        {
            switch (customer)
            {
                case "RegionH":
                    try
                    {
                        using (var db = new RegionHEntities())
                        {
                            var newRoom = db.Dim_LocationSet.Create();
                            newRoom.Room = Room;

                            db.Dim_LocationSet.Add(newRoom);
                            db.SaveChanges();
                        }
                        return true;
                    }
                    catch
                    {
                        return false;
                    }

                default:

                    return false;
            }
        }
コード例 #7
0
        public bool AddLog(string ID, DateTime timestamp, string action)
        {
            try
            {
                using (var db = new RegionHEntities())
                {
                    var newlog = db.Fact_Unit_LogSet.Create();
                    var bridge_unit = db.Bridge_UnitSet.Where(x => x.Dim_UnitSet.Unitname.Equals(ID)).First();
                    var bridge_event = db.Bridge_EventSet.Where(x => x.Dim_EventSet.Event.Equals(action)).First();

                    newlog.Bridge_UnitSet = bridge_unit;
                    newlog.Bridge_EventSet = bridge_event;
                    newlog.Timestamp = timestamp;

                    db.Fact_Unit_LogSet.Add(newlog);
                    db.SaveChanges();

                    return true;
                }
            }
            catch (Exception ex)
            {
                return false;
            }
        }