// main repeater room categories item command protected void roomcategoryGroup_ItemCommand(object source, RepeaterCommandEventArgs e) { HiddenField addNewCatHidden = e.Item.FindControl("IDforRoomRateLSID") as HiddenField; switch (e.CommandName) { case "InsertSeason": // insert new season InsertNewSeason(e); break; case "DoneRates": //Page.Validate("seasonRmCatVal"); Page.Validate("DatesinRates_Blank"); Page.Validate("DatesinRatesEndDate_Blank"); Page.Validate("DatesinRatesCompare"); if (Page.IsValid) { Ovationscriptmgr.SetFocus(percentageRecieveOffRate.ClientID); } break; case "AddNewRMCategory": // add new room category and rate AddAnotherRoomAndRate(e); break; } }
protected void RMCatStDte_Start_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e) { RadDatePicker senderPickerStart = sender as RadDatePicker; RepeaterItem ParentRepeater = ((RepeaterItem)(senderPickerStart.NamingContainer)); HiddenField SeasonHiddenID = ParentRepeater.FindControl("seaonNumber") as HiddenField; RadDatePicker EndDatePicker = ParentRepeater.FindControl("RMCatEndDte_Start") as RadDatePicker; Page.Validate("DatesinRates_Blank"); if (Page.IsValid == true) { // script manager set focus //Control ContainerforScrptMgr = this.FindControl("OvationRFPGlobalScrptMgr1"); //RadScriptManager OvationControls = (RadScriptManager)ContainerforScrptMgr.FindControl("Ovationscriptmgr"); senderPickerStart.DateInput.CssClass = string.Empty; // uncomment this for testing //HttpContext.Current.Response.Write("start date " + e.NewDate.Value.Date.ToShortDateString() + " " + SeasonHiddenID.Value.ToString()); using (SqlConnection update_Hotel_room_Rate_currency_Conn = new SqlConnection(RFPDBconnStr)) { using (SqlCommand update_Hotel_room_Rate_currency_cmd = new SqlCommand("UPDATE Tbl_Hotel_PHC_AmmenRmSeasons SET dtSTdate = @dtSTdate WHERE(LID = @LID) AND (LRFPID = @LRFPID)", update_Hotel_room_Rate_currency_Conn)) { update_Hotel_room_Rate_currency_cmd.CommandType = CommandType.Text; update_Hotel_room_Rate_currency_cmd.CommandTimeout = 0; update_Hotel_room_Rate_currency_Conn.Open(); update_Hotel_room_Rate_currency_cmd.Parameters.AddWithValue("@LID", SeasonHiddenID.Value.ToString()); update_Hotel_room_Rate_currency_cmd.Parameters.AddWithValue("@LRFPID", Decrypt(HttpContext.Current.Request.QueryString["ORFP"], "trappOvation")); update_Hotel_room_Rate_currency_cmd.Parameters.AddWithValue("@dtSTdate", e.NewDate.Value.Date.ToShortDateString()); update_Hotel_room_Rate_currency_cmd.ExecuteNonQuery(); Ovationscriptmgr.SetFocus(EndDatePicker.DateInput.ClientID); } } } else { senderPickerStart.DateInput.CssClass = "enddateError"; } }
protected void Hotel_room_category_Rate_TextChanged(object sender, EventArgs e) { // Page.Validate("seasonRmRateVal"); //Page.Validate("DatesinRates"); //if (Page.IsValid == true) // { // declare our varibales TextBox senderBoxRate = sender as TextBox; RepeaterItem innerRepeaterTwo = ((RepeaterItem)(senderBoxRate.NamingContainer)); HiddenField CatIDRate = innerRepeaterTwo.FindControl("roomRateID") as HiddenField; //TextBox RoomCat = innerRepeaterTwo.FindControl("Hotel_room_category") as TextBox; DropDownList Curencyddl = innerRepeaterTwo.FindControl("currencyCodes") as DropDownList; // Control ContainerforScrptMgr = this.FindControl("OvationRFPGlobalScrptMgr1"); // RadScriptManager OvationControls = (RadScriptManager)ContainerforScrptMgr.FindControl("Ovationscriptmgr"); // uncomment for testing //HttpContext.Current.Response.Write(senderBoxRate.Text.ToString() + " " + senderBoxRate.ID + " " + CatIDRate.Value + " " + MyIDTwo.Value.ToString()); //return; if (senderBoxRate.Text != string.Empty) { using (SqlConnection update_Hotel_room_Rate_Conn = new SqlConnection(RFPDBconnStr)) { using (SqlCommand update_Hotel_room_Rat_cmd = new SqlCommand("dbo.sp_RFP_updateRMRate", update_Hotel_room_Rate_Conn)) { update_Hotel_room_Rat_cmd.CommandText = "dbo.sp_RFP_updateRMRate"; update_Hotel_room_Rat_cmd.CommandType = CommandType.StoredProcedure; update_Hotel_room_Rat_cmd.CommandTimeout = 0; // first paraemter SqlParameter update_Hotel_room_Rat_cmd_Param = update_Hotel_room_Rat_cmd.CreateParameter(); update_Hotel_room_Rat_cmd_Param.ParameterName = "@LID"; update_Hotel_room_Rat_cmd_Param.Direction = ParameterDirection.Input; update_Hotel_room_Rat_cmd_Param.SqlDbType = SqlDbType.Int; update_Hotel_room_Rat_cmd_Param.Value = CatIDRate.Value; update_Hotel_room_Rat_cmd.Parameters.Add(update_Hotel_room_Rat_cmd_Param); // second paraemter update_Hotel_room_Rat_cmd_Param = update_Hotel_room_Rat_cmd.CreateParameter(); update_Hotel_room_Rat_cmd_Param.ParameterName = "@LRFPID"; update_Hotel_room_Rat_cmd_Param.Direction = ParameterDirection.Input; update_Hotel_room_Rat_cmd_Param.SqlDbType = SqlDbType.Int; update_Hotel_room_Rat_cmd_Param.Value = Decrypt(HttpContext.Current.Request.QueryString["ORFP"], "trappOvation"); update_Hotel_room_Rat_cmd.Parameters.Add(update_Hotel_room_Rat_cmd_Param); // third paraemter update_Hotel_room_Rat_cmd_Param = update_Hotel_room_Rat_cmd.CreateParameter(); update_Hotel_room_Rat_cmd_Param.ParameterName = "@nRmRate"; update_Hotel_room_Rat_cmd_Param.Direction = ParameterDirection.Input; update_Hotel_room_Rat_cmd_Param.SqlDbType = SqlDbType.Decimal; update_Hotel_room_Rat_cmd_Param.Value = senderBoxRate.Text; update_Hotel_room_Rat_cmd.Parameters.Add(update_Hotel_room_Rat_cmd_Param); //Open db coonection update_Hotel_room_Rate_Conn.Open(); // execute entry update_Hotel_room_Rat_cmd.ExecuteNonQuery(); Ovationscriptmgr.SetFocus(Curencyddl.ClientID); // bind main repeater to get inner repeater to bind too RadAjaxPanel1.ResponseScripts.Add("document.getElementById('" + Curencyddl.ClientID + "').focus();"); roomcategoryGroup.DataBind(); } } } else { //senderBoxRate.Text = "0.00"; // may want to update db } }
protected void Hotel_room_category_TextChanged(object sender, EventArgs e) { TextBox senderBoxCat = sender as TextBox; RepeaterItem innerRepeater = ((RepeaterItem)(senderBoxCat.NamingContainer)); HiddenField CatID = innerRepeater.FindControl("roomCatID") as HiddenField; TextBox RateTexBox = innerRepeater.FindControl("Hotel_room_category_Rate") as TextBox; // Control ContainerforScrptMgr = this.FindControl("OvationRFPGlobalScrptMgr1"); //RadScriptManager OvationControls = (RadScriptManager)ContainerforScrptMgr.FindControl("Ovationscriptmgr"); ////Page.Validate("AmmenValGroup"); //if (innerRepeater.ItemIndex == 0) //{ // if (senderBoxCat.Text == string.Empty) // { // Page.Validate("seasonRmCatVal"); // Page.Validate("seasonRmRateVal"); // } //} //else if (innerRepeater.ItemIndex > 0) //{ // if (senderBoxCat.Text == string.Empty) // { // Page.Validate("seasonRmCatVal"); // Page.Validate("seasonRmRateVal"); // } //} //if (Page.IsValid == true) //{ //if (innerRepeater.ItemIndex == 0) //{ // senderBoxCat.CssClass = string.Empty; //} //else if (innerRepeater.ItemIndex > 0) //{ // senderBoxCat.CssClass = string.Empty; //} using (SqlConnection update_Hotel_room_category_Conn = new SqlConnection(RFPDBconnStr)) { using (SqlCommand update_Hotel_room_category_cmd = new SqlCommand("dbo.sp_RFP_UpdateRMCat", update_Hotel_room_category_Conn)) { update_Hotel_room_category_cmd.CommandText = "dbo.sp_RFP_UpdateRMCat"; update_Hotel_room_category_cmd.CommandType = CommandType.StoredProcedure; update_Hotel_room_category_cmd.CommandTimeout = 0; // first paraemter SqlParameter update_Hotel_room_category_Param = update_Hotel_room_category_cmd.CreateParameter(); update_Hotel_room_category_Param.ParameterName = "@LID"; update_Hotel_room_category_Param.Direction = ParameterDirection.Input; update_Hotel_room_category_Param.SqlDbType = SqlDbType.Int; update_Hotel_room_category_Param.Value = CatID.Value; update_Hotel_room_category_cmd.Parameters.Add(update_Hotel_room_category_Param); // second paraemter update_Hotel_room_category_Param = update_Hotel_room_category_cmd.CreateParameter(); update_Hotel_room_category_Param.ParameterName = "@LRFPID"; update_Hotel_room_category_Param.Direction = ParameterDirection.Input; update_Hotel_room_category_Param.SqlDbType = SqlDbType.Int; update_Hotel_room_category_Param.Value = Decrypt(HttpContext.Current.Request.QueryString["ORFP"], "trappOvation"); update_Hotel_room_category_cmd.Parameters.Add(update_Hotel_room_category_Param); // third paraemter update_Hotel_room_category_Param = update_Hotel_room_category_cmd.CreateParameter(); update_Hotel_room_category_Param.ParameterName = "@szRmTypeCat"; update_Hotel_room_category_Param.Direction = ParameterDirection.Input; update_Hotel_room_category_Param.SqlDbType = SqlDbType.NVarChar; update_Hotel_room_category_Param.Value = senderBoxCat.Text.ToString(); update_Hotel_room_category_cmd.Parameters.Add(update_Hotel_room_category_Param); //Open db coonection update_Hotel_room_category_Conn.Open(); // execute entry update_Hotel_room_category_cmd.ExecuteNonQuery(); // set focus on rate text box now RadAjaxPanel1.ResponseScripts.Add("document.getElementById('" + RateTexBox.ClientID + "').focus();"); Ovationscriptmgr.SetFocus(RateTexBox.ClientID); // bind main repeater to get inner repeater to bind too roomcategoryGroup.DataBind(); } } CatID.Value = string.Empty; //} //else //{ // //HttpContext.Current.Response.Write("Not valid cat"); // if (innerRepeater.ItemIndex == 0) // { // senderBoxCat.CssClass = "enddateError"; // OvationControls.SetFocus(senderBoxCat.ClientID); // } // else if (innerRepeater.ItemIndex > 0) // { // senderBoxCat.CssClass = "enddateError"; // OvationControls.SetFocus(senderBoxCat.ClientID); // } //} }