Example #1
0
        public bool UpdateRoom(MDMSVC.DC_Accommodation_RoomInfo AF)
        {
            object result = null;

            ServiceConnection.MDMSvcProxy.PostData(ConfigurationManager.AppSettings["Accomodation_UpdateRoomURI"], AF, typeof(DC_Accommodation_RoomInfo), typeof(bool), out result);
            return((bool)result);
        }
Example #2
0
        protected void frmRoomInfo_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            // get form controls
            TextBox      txtRoomCategory        = (TextBox)frmRoomInfo.FindControl("txtRoomCategory");
            TextBox      txtRoomName            = (TextBox)frmRoomInfo.FindControl("txtRoomName");
            TextBox      txtNumberOfRooms       = (TextBox)frmRoomInfo.FindControl("txtNumberOfRooms");
            TextBox      txtRoomDescription     = (TextBox)frmRoomInfo.FindControl("txtRoomDescription");
            TextBox      txtFloorName           = (TextBox)frmRoomInfo.FindControl("txtFloorName");
            TextBox      txtFloorNumber         = (TextBox)frmRoomInfo.FindControl("txtFloorNumber");
            TextBox      txtRoomView            = (TextBox)frmRoomInfo.FindControl("txtRoomView");
            TextBox      txtRoomDecor           = (TextBox)frmRoomInfo.FindControl("txtRoomDecor");
            TextBox      txtInterconnectRooms   = (TextBox)frmRoomInfo.FindControl("txtInterconnectRooms");
            DropDownList ddlCompanyRoomCategory = (DropDownList)frmRoomInfo.FindControl("ddlCompanyRoomCategory");
            DropDownList ddlBedType             = (DropDownList)frmRoomInfo.FindControl("ddlBedType");
            DropDownList ddlBathRoomType        = (DropDownList)frmRoomInfo.FindControl("ddlBathRoomType");
            DropDownList ddlSmoking             = (DropDownList)frmRoomInfo.FindControl("ddlSmoking");
            TextBox      txtRoomSize            = (TextBox)frmRoomInfo.FindControl("txtRoomSize");
            TextBox      txtRoomInfo_Id         = (TextBox)frmRoomInfo.FindControl("txtRoomInfo_Id");

            bool bsmoking;

            if (ddlSmoking.SelectedItem.Text == "Yes")
            {
                bsmoking = true;
            }
            else
            {
                bsmoking = false;
            };


            if (e.CommandName.ToString() == "Add")
            {
                Accomodation_RoomInfo_ID = Guid.NewGuid();
                txtRoomInfo_Id.Text      = Accomodation_RoomInfo_ID.ToString();
                TLGX_Consumer.MDMSVC.DC_Accommodation_RoomInfo newObj = new MDMSVC.DC_Accommodation_RoomInfo
                {
                    Accommodation_Id          = Guid.Parse(Request.QueryString["Hotel_Id"]),
                    Accommodation_RoomInfo_Id = Accomodation_RoomInfo_ID,
                    BathRoomType        = ddlBathRoomType.SelectedIndex != 0 ? ddlBathRoomType.SelectedItem.Text.Trim() : string.Empty,
                    BedType             = ddlBedType.SelectedIndex != 0 ? ddlBedType.SelectedItem.Text.Trim() : string.Empty,
                    Category            = txtRoomCategory.Text.Trim(),
                    CompanyRoomCategory = ddlCompanyRoomCategory.SelectedIndex != 0 ? ddlCompanyRoomCategory.SelectedItem.Text.Trim() : string.Empty,
                    Create_Date         = DateTime.Now,
                    Create_User         = System.Web.HttpContext.Current.User.Identity.Name,
                    FloorName           = txtFloorName.Text.Trim(),
                    FloorNumber         = txtFloorNumber.Text.Trim(),
                    RoomCategory        = txtRoomCategory.Text.Trim(),
                    RoomDecor           = txtRoomDecor.Text.Trim(),
                    RoomName            = txtRoomName.Text.Trim(),
                    RoomSize            = txtRoomSize.Text.Trim(),
                    RoomView            = txtRoomView.Text.Trim(),
                    Smoking             = bsmoking,
                    Description         = txtRoomDescription.Text.Trim(),
                    IsActive            = true
                };

                if (!string.IsNullOrWhiteSpace(txtNumberOfRooms.Text.Trim()))
                {
                    newObj.NoOfRooms = int.Parse(txtNumberOfRooms.Text.Trim());
                }

                if (!string.IsNullOrWhiteSpace(txtInterconnectRooms.Text.Trim()))
                {
                    newObj.NoOfInterconnectingRooms = int.Parse(txtInterconnectRooms.Text.Trim());
                }

                if (AccSvc.AddRoom(newObj))
                {
                    frmRoomInfo.DataBind();
                    GetRoomInfoDetails(PageSize, intPageIndex);
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "RoomInfo has been added successfully", BootstrapAlertType.Success);
                }
                else
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning);
                }
            }

            else if (e.CommandName.ToString() == "Save")
            {
                Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]);
                Guid myRow_Id = Guid.Parse(grdRoomTypes.SelectedDataKey.Value.ToString());
                Accomodation_RoomInfo_ID = myRow_Id;
                var result = AccSvc.GetRoomDetails(Accomodation_ID, myRow_Id);
                txtRoomInfo_Id.Text = myRow_Id.ToString();

                if (result.Count > 0)
                {
                    TLGX_Consumer.MDMSVC.DC_Accommodation_RoomInfo newObj = new MDMSVC.DC_Accommodation_RoomInfo

                    {
                        Accommodation_Id          = Guid.Parse(Request.QueryString["Hotel_Id"]),
                        Accommodation_RoomInfo_Id = myRow_Id,
                        BathRoomType        = ddlBathRoomType.SelectedIndex != 0 ? ddlBathRoomType.SelectedItem.Text.Trim() : string.Empty,
                        BedType             = ddlBedType.SelectedIndex != 0 ? ddlBedType.SelectedItem.Text.Trim() : string.Empty,
                        Category            = txtRoomCategory.Text.Trim(),
                        CompanyRoomCategory = ddlCompanyRoomCategory.SelectedIndex != 0 ? ddlCompanyRoomCategory.SelectedItem.Text.Trim() : string.Empty,
                        Edit_Date           = DateTime.Now,
                        Edit_User           = System.Web.HttpContext.Current.User.Identity.Name,
                        FloorName           = txtFloorName.Text.Trim(),
                        FloorNumber         = txtFloorNumber.Text.Trim(),
                        RoomCategory        = txtRoomCategory.Text.Trim(),
                        RoomDecor           = txtRoomDecor.Text.Trim(),
                        RoomName            = txtRoomName.Text.Trim(),
                        RoomSize            = txtRoomSize.Text.Trim(),
                        RoomView            = txtRoomView.Text.Trim(),
                        Smoking             = bsmoking,
                        Description         = txtRoomDescription.Text.Trim(),
                        IsActive            = true
                    };

                    if (!string.IsNullOrWhiteSpace(txtNumberOfRooms.Text.Trim()))
                    {
                        newObj.NoOfRooms = int.Parse(txtNumberOfRooms.Text.Trim());
                    }

                    if (!string.IsNullOrWhiteSpace(txtInterconnectRooms.Text.Trim()))
                    {
                        newObj.NoOfInterconnectingRooms = int.Parse(txtInterconnectRooms.Text.Trim());
                    }

                    if (AccSvc.UpdateRoom(newObj))
                    {
                        Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]);
                        frmRoomInfo.ChangeMode(FormViewMode.Insert);
                        frmRoomInfo.DataBind();
                        GetRoomInfoDetails(PageSize, intPageIndex);
                        BootstrapAlert.BootstrapAlertMessage(dvMsg, "RoomInfo has been Updated successfully", BootstrapAlertType.Success);
                    }
                    else
                    {
                        BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning);
                    }
                }
            }
        }
Example #3
0
        protected void grdRoomTypes_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //int index = Convert.ToInt32(e.CommandArgument);



            if (e.CommandName.ToString() == "Select")
            {
                Guid myRow_Id = Guid.Parse(e.CommandArgument.ToString());
                Accomodation_RoomInfo_Static_ID = Guid.Empty;
                dvMsg.Style.Add("display", "none");
                //Guid myRow_Id = Guid.Parse(grdRoomTypes.DataKeys[index]["Accommodation_RoomInfo_Id"].ToString());
                Accomodation_ID                 = Guid.Parse(Request.QueryString["Hotel_Id"]);
                Accomodation_RoomInfo_ID        = myRow_Id;
                Accomodation_RoomInfo_Static_ID = myRow_Id;
                frmRoomInfo.ChangeMode(FormViewMode.Edit);
                frmRoomInfo.DataSource = AccSvc.GetRoomDetails(Accomodation_ID, myRow_Id);
                frmRoomInfo.DataBind();

                GetLookupValues();

                MDMSVC.DC_Accommodation_RoomInfo rowView = (MDMSVC.DC_Accommodation_RoomInfo)frmRoomInfo.DataItem;

                DropDownList ddlCompanyRoomCategory = (DropDownList)frmRoomInfo.FindControl("ddlCompanyRoomCategory");
                DropDownList ddlBedType             = (DropDownList)frmRoomInfo.FindControl("ddlBedType");
                DropDownList ddlBathRoomType        = (DropDownList)frmRoomInfo.FindControl("ddlBathRoomType");
                DropDownList ddlSmoking             = (DropDownList)frmRoomInfo.FindControl("ddlSmoking");

                if (ddlCompanyRoomCategory.Items.Count > 1) // needs to be 1 to handle the "Select" value
                {
                    if (Convert.ToString(rowView.CompanyRoomCategory) != null)
                    {
                        ddlCompanyRoomCategory.SelectedIndex = ddlCompanyRoomCategory.Items.IndexOf(ddlCompanyRoomCategory.Items.FindByText(rowView.CompanyRoomCategory.ToString()));
                    }
                }

                if (ddlBedType.Items.Count > 1) // needs to be 1 to handle the "Select" value
                {
                    if (Convert.ToString(rowView.BedType) != null)
                    {
                        ddlBedType.SelectedIndex = ddlBedType.Items.IndexOf(ddlBedType.Items.FindByText(rowView.BedType.ToString()));
                    }
                }

                if (ddlBathRoomType.Items.Count > 1) // needs to be 1 to handle the "Select" value
                {
                    if (Convert.ToString(rowView.BathRoomType) != null)
                    {
                        ddlBathRoomType.SelectedIndex = ddlBathRoomType.Items.IndexOf(ddlBathRoomType.Items.FindByText(rowView.BathRoomType.ToString()));
                    }
                }

                if (ddlSmoking.Items.Count > 1) // needs to be 1 to handle the "Select" value
                {
                    if (Convert.ToString(rowView.Smoking) != null)
                    {
                        ddlSmoking.SelectedIndex = ddlSmoking.Items.IndexOf(ddlSmoking.Items.FindByText(rowView.Smoking.ToString()));
                    }
                }
            }

            else if (e.CommandName.ToString() == "SoftDelete")
            {
                Guid myRow_Id = Guid.Parse(e.CommandArgument.ToString());
                TLGX_Consumer.MDMSVC.DC_Accommodation_RoomInfo newObj = new MDMSVC.DC_Accommodation_RoomInfo
                {
                    Accommodation_RoomInfo_Id = myRow_Id,
                    IsActive  = false,
                    Edit_Date = DateTime.Now,
                    Edit_User = System.Web.HttpContext.Current.User.Identity.Name
                };

                if (AccSvc.UpdateRoom(newObj))
                {
                    GetRoomInfoDetails(PageSize, intPageIndex);
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "RoomInfo has been deleted successfully", BootstrapAlertType.Success);
                }
                ;
            }

            else if (e.CommandName.ToString() == "UnDelete")
            {
                Guid myRow_Id = Guid.Parse(e.CommandArgument.ToString());
                TLGX_Consumer.MDMSVC.DC_Accommodation_RoomInfo newObj = new MDMSVC.DC_Accommodation_RoomInfo
                {
                    Accommodation_RoomInfo_Id = myRow_Id,
                    IsActive  = true,
                    Edit_Date = DateTime.Now,
                    Edit_User = System.Web.HttpContext.Current.User.Identity.Name
                };

                if (AccSvc.UpdateRoom(newObj))
                {
                    GetRoomInfoDetails(PageSize, intPageIndex);
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "RoomInfo has been retrived successfully", BootstrapAlertType.Success);
                }
                ;
            }
            else if (e.CommandName.ToString() == "CopyRoomTypes")
            {
                Guid myRow_Id = Guid.Parse(e.CommandArgument.ToString());
                dvmsgCopyStatus.Style.Add(HtmlTextWriterStyle.Display, "none");
                hdnAccommodation_RoomInfo_Id.Value = Convert.ToString(myRow_Id);
                hdnFlagCopyRoomInfo.Value          = "false";
            }
        }