Beispiel #1
0
    public void btnSave_Clicked(object sender, EventArgs e)
    {
        MonkData db = new MonkData();
        Monks.jkp_Retreat retreat;
        if(RetreatId != null)
        {
            retreat = db.jkp_Retreats.First(p=>p.Ret_ID == RetreatId);
        }
        else
        {
            retreat = new Monks.jkp_Retreat();
            retreat.Ret_ID = Guid.NewGuid();
        }

        //if(!String.IsNullOrEmpty(txtArrivalTime.Text))
        //    retreat.Ret_ArrivalTime = DateTime.Parse(txtArrivalTime.Text);
        //if(!String.IsNullOrEmpty(txtDepartureTime.Text))
        //    retreat.Ret_DepartureTime = DateTime.Parse(txtDepartureTime.Text);
        if(!String.IsNullOrEmpty(txtEndDate.Text))
            retreat.Ret_EndDate = DateTime.Parse(txtEndDate.Text);
        if(!String.IsNullOrEmpty(txtStartDate.Text))
            retreat.Ret_StartDate = DateTime.Parse(txtStartDate.Text);
        retreat.Ret_Name = txtName.Text.Trim();
        retreat.Ret_Description = txtDescription.Text;
        if(!String.IsNullOrEmpty(dlSite.SelectedValue))
            retreat.Ret_Site_ID = new Guid( dlSite.SelectedValue);

        var selectedLanguage = db.jkp_Languages.SingleOrDefault(p => p.Lang_ID.ToString() == dlLanguage.SelectedValue);
        retreat.Ret_LanguageId = selectedLanguage.Lang_ID;
        Request.QueryString.Add("retreatid", retreat.Ret_ID.ToString());

        if(RetreatId == null)
            db.jkp_Retreats.InsertOnSubmit(retreat);
        db.SubmitChanges();
        mvAddEdit.ActiveViewIndex = 1;
    }
Beispiel #2
0
		private void detach_jkp_Retreats(jkp_Retreat entity)
		{
			this.SendPropertyChanging();
			entity.jkp_Site = null;
		}
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
        if (!Page.IsPostBack)
        {
            MonkData db = new MonkData();
            retreat = db.jkp_Retreats.First(p => p.Ret_ID == RetreatId);
            litRetreatName.Text = retreat.Ret_Name;
            if (retreat.Ret_StartDate != null)
                litStartDate.Text = ((DateTime)retreat.Ret_StartDate).ToString("d");

            if(retreat.jkp_Site != null)
                litSite.Text = retreat.jkp_Site.GetName;

            var roomRates = db.jkp_Rates;
            if(roomRates.Count() < 1)
            {
                Response.Redirect("GridView.aspx?typename=jkp_Rate");
                return;
            }

            RedrawRoomTypes(db);
            RedrawHamletList(db);
            RedrawBuildingsList(db);
            RedrawRoomsForRetreat(db);

            txtCreateRoomConstructionDate.Text = retreat.Ret_StartDate.ToShortDateString() + " 12:00:00 AM";
            txtCreateRoomDestructionDate.Text = retreat.Ret_EndDate.ToShortDateString() + " 11:59:00 PM";

        }
    }
Beispiel #4
0
		private void attach_jkp_Retreats(jkp_Retreat entity)
		{
			this.SendPropertyChanging();
			entity.jkp_Language = this;
		}