Ejemplo n.º 1
0
 public void btnCreateBuilding_Clicked(object sender, EventArgs e)
 {
     MonkData db = new MonkData();
     Guid hamletId = new Guid(dlHamlets.SelectedValue);
     Monks.jkp_Building building = new Monks.jkp_Building();
     building.Bld_EnglishName = txtBuildingEnglishName.Text;
     building.Bld_LocalName = txtBuildingLocalName.Text;
     building.Bld_VietnameseName = txtBuildingVietnameseName.Text;
     building.Bld_Ham_ID = hamletId;
     building.Bld_ID = Guid.NewGuid();
     db.jkp_Buildings.InsertOnSubmit(building);
     db.SubmitChanges();
     RedrawBuildingsList(db);
     txtBuildingEnglishName.Text = "";
     txtBuildingLocalName.Text = "";
     txtBuildingVietnameseName.Text = "";
 }
Ejemplo n.º 2
0
    public void lbtnCopyRooms_Clicked(object sender, EventArgs e)
    {
        LinkButton lbtnCopyRooms = (LinkButton)sender;
        Guid retreatId = new Guid(lbtnCopyRooms.Attributes["retreatid"]);
        Monks.jkp_Retreat retreat = db.jkp_Retreats.First(p => p.Ret_ID == retreatId);

        List<Monks.jkp_Hamlet> newHamlets = new List<Monks.jkp_Hamlet>();
        List<Monks.jkp_Building> newBuildings = new List<Monks.jkp_Building>();
        List<Monks.jkp_Room> newRooms = new List<Monks.jkp_Room>();
        List<Monks.jkp_RoomRate> newRoomRates = new List<Monks.jkp_RoomRate>();
        foreach (Monks.jkp_Hamlet hamletInRetreat in retreat.jkp_Site.jkp_Hamlets)
        {
            Monks.jkp_Hamlet newHamlet = new Monks.jkp_Hamlet();
            newHamlet.Ham_Add_ID = hamletInRetreat.Ham_Add_ID;
            newHamlet.Ham_Comment = hamletInRetreat.Ham_Comment;
            newHamlet.Ham_Description = hamletInRetreat.Ham_Description;
            newHamlet.Ham_ID = Guid.NewGuid();
            newHamlet.Ham_LocalName = hamletInRetreat.Ham_LocalName;

            newHamlet.Ham_Site_ID = retreat.Ret_Site_ID;
            newHamlet.Ham_VietnameseName = hamletInRetreat.Ham_VietnameseName;
            newHamlet.Ham_EnglishName = hamletInRetreat.Ham_EnglishName;
            newHamlets.Add(newHamlet);

            foreach (Monks.jkp_Building building in hamletInRetreat.jkp_Buildings)
            {
                Monks.jkp_Building newBuilding = new Monks.jkp_Building();
                newBuilding.Bld_Comment = building.Bld_Comment;
                newBuilding.Bld_Description = building.Bld_Description;
                newBuilding.Bld_Directions = building.Bld_Directions;
                newBuilding.Bld_EnglishName = building.Bld_EnglishName;
                newBuilding.Bld_Ham_ID = newHamlet.Ham_ID;
                newBuilding.Bld_ID = Guid.NewGuid();
                newBuilding.Bld_LocalName = building.Bld_LocalName;
                newBuilding.Bld_VietnameseName = building.Bld_VietnameseName;
                newBuildings.Add(newBuilding);

                foreach (Monks.jkp_Room room in building.jkp_Rooms)
                {
                    Monks.jkp_Room newRoom = new Monks.jkp_Room();
                    newRoom.Rm_Bld_ID = newBuilding.Bld_ID;
                    newRoom.Rm_Comment = room.Rm_Comment;
                    newRoom.Rm_ID = Guid.NewGuid();
                    newRoom.Rm_Level = room.Rm_Level;
                    newRoom.Rm_Name = room.Rm_Name;
                    newRoom.Rm_RmType_ID = room.Rm_RmType_ID;
                    newRoom.Rm_TotalCapacity = room.Rm_TotalCapacity;
                    newRooms.Add(newRoom);

                    foreach (Monks.jkp_RoomRate roomRate in room.jkp_RoomRates)
                    {
                        Monks.jkp_RoomRate newRoomRate = new Monks.jkp_RoomRate();
                        newRoomRate.RR_EndDate = roomRate.RR_EndDate;
                        newRoomRate.RR_StartDate = roomRate.RR_StartDate;
                        newRoomRate.RR_Rm_ID = newRoom.Rm_ID;
                        newRoomRate.RR_Rt_ID = roomRate.RR_Rt_ID;
                        newRoomRates.Add(newRoomRate);
                    }

                }
            }
        }

        db.jkp_Hamlets.InsertAllOnSubmit(newHamlets);
        db.jkp_Buildings.InsertAllOnSubmit(newBuildings);
        db.jkp_Rooms.InsertAllOnSubmit(newRooms);
        db.jkp_RoomRates.InsertAllOnSubmit(newRoomRates);
        db.SubmitChanges();
        db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues);
        LoadRetreatsFromSelectedSite();

        mvCopy.ActiveViewIndex = 1;
    }
Ejemplo n.º 3
0
		private void detach_jkp_Buildings(jkp_Building entity)
		{
			this.SendPropertyChanging();
			entity.jkp_Hamlet = null;
		}