Пример #1
0
        protected void frmFacilityDetail_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            DropDownList ddlFacilityType        = (DropDownList)frmFacilityDetail.FindControl("ddlFacilityType");
            DropDownList ddlFacilityCategory    = (DropDownList)frmFacilityDetail.FindControl("ddlFacilityCategory");
            TextBox      txtFacilityDescription = (TextBox)frmFacilityDetail.FindControl("txtFacilityDescription");
            TextBox      txtFacilityName        = (TextBox)frmFacilityDetail.FindControl("txtFacilityName");

            if (e.CommandName.ToString() == "Add")
            {
                TLGX_Consumer.MDMSVC.DC_Accommodation_Facility newObj = new MDMSVC.DC_Accommodation_Facility
                {
                    Accommodation_Facility_Id = Guid.NewGuid(),
                    Accommodation_Id          = new Guid(Request.QueryString["Hotel_Id"]),
                    FacilityCategory          = ddlFacilityCategory.SelectedItem.Text.ToString(),
                    FacilityType = ddlFacilityType.SelectedItem.Text.ToString(),
                    Description  = txtFacilityDescription.Text.Trim(),
                    FacilityName = txtFacilityName.Text.Trim(),
                    Create_Date  = DateTime.Now,
                    Create_User  = System.Web.HttpContext.Current.User.Identity.Name,
                    IsActive     = true
                };

                if (AccSvc.AddHotelFacilityDetails(newObj))
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Facility has been added successfully", BootstrapAlertType.Success);
                }
                else
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning);
                }
                newObj = null;
            }

            else if (e.CommandName.ToString() == "Save")
            {
                Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]);
                Guid myRow_Id = Guid.Parse(grdFacilityList.SelectedDataKey.Value.ToString());

                TLGX_Consumer.MDMSVC.DC_Accommodation_Facility newObj = new MDMSVC.DC_Accommodation_Facility
                {
                    Accommodation_Facility_Id = myRow_Id,
                    Accommodation_Id          = Accomodation_ID,
                    FacilityCategory          = ddlFacilityCategory.SelectedItem.Text.ToString(),
                    FacilityType = ddlFacilityType.SelectedItem.Text.ToString(),
                    Description  = txtFacilityDescription.Text.Trim(),
                    FacilityName = txtFacilityName.Text.Trim(),
                    Edit_Date    = DateTime.Now,
                    Edit_User    = System.Web.HttpContext.Current.User.Identity.Name,
                    IsActive     = true
                };

                if (AccSvc.UpdateHotelFacilityDetails(newObj))
                {
                    frmFacilityDetail.ChangeMode(FormViewMode.Insert);
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Facility has been updated successfully", BootstrapAlertType.Success);
                }
                else
                {
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning);
                }
            }
            ;

            frmFacilityDetail.DataBind();
            GetFacilityCategory();
            GetFacilityDetails();
            GetFacilityType();
        }