Exemplo n.º 1
0
        public bool DeactivateHotel(Guid Acco_Id, string Remark)
        {
            bool ret = false;

            MDMSVC.DC_Accomodation_UpdateStatus_RQ obj = new MDMSVC.DC_Accomodation_UpdateStatus_RQ();
            obj.Accommodation_Id = Acco_Id;
            obj.Status           = false;
            obj.Edit_Date        = DateTime.Now;
            obj.Edit_User        = System.Web.HttpContext.Current.User.Identity.Name;
            if (AccSvc.UpdateHotelDetailStatus(obj))
            {
                MDMSVC.DC_Accommodation_Status AS = new MDMSVC.DC_Accommodation_Status();
                AS.Accommodation_Status_Id = Guid.NewGuid();
                AS.Accommodation_Id        = Acco_Id;
                AS.CompanyMarket           = "All";
                AS.DeactivationReason      = Remark;
                AS.From      = DateTime.ParseExact(DateTime.Now.ToString("dd/MM/yyyy"), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
                AS.To        = DateTime.ParseExact("31/12/2099", "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture);
                AS.Status    = "INACTIVE";
                AS.IsActive  = true;
                AS.Edit_Date = DateTime.Now;
                AS.Edit_User = System.Web.HttpContext.Current.User.Identity.Name;

                if (AccSvc.AddHotelStatus(AS))
                {
                    ret = true;
                }
            }

            return(ret);
        }
Exemplo n.º 2
0
        // handles the activity on the formview containing the status detail record
        protected void frmAccommodationStatus_ItemCommand(object sender, FormViewCommandEventArgs e)
        {
            DropDownList ddlCompanyMarket      = (DropDownList)frmAccommodationStatus.FindControl("ddlCompanyMarket");
            DropDownList ddlStatus             = (DropDownList)frmAccommodationStatus.FindControl("ddlStatus");
            TextBox      txtDeactivationReason = (TextBox)frmAccommodationStatus.FindControl("txtDeactivationReason");
            TextBox      txtFrom = (TextBox)frmAccommodationStatus.FindControl("txtFrom");
            TextBox      txtTo   = (TextBox)frmAccommodationStatus.FindControl("txtTo");

            if (e.CommandName.ToString() == "Add")
            {
                TLGX_Consumer.MDMSVC.DC_Accommodation_Status newObj = new MDMSVC.DC_Accommodation_Status
                {
                    Accommodation_Status_Id = Guid.NewGuid(),
                    Accommodation_Id        = Guid.Parse(Request.QueryString["Hotel_Id"]),
                    CompanyMarket           = ddlCompanyMarket.SelectedItem.Text.Trim(),
                    DeactivationReason      = txtDeactivationReason.Text.Trim(),
                    From        = DateTime.ParseExact(txtFrom.Text.Trim(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture),
                    To          = DateTime.ParseExact(txtTo.Text.Trim(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture),
                    Status      = ddlStatus.SelectedItem.Text.Trim(),
                    IsActive    = true,
                    Create_Date = DateTime.Now,
                    Create_User = System.Web.HttpContext.Current.User.Identity.Name
                };

                if (AccSvc.AddHotelStatus(newObj))
                {
                    frmAccommodationStatus.DataBind();
                    GetHotelStatusDetails();
                    BootstrapAlert.BootstrapAlertMessage(dvMsg, "Status 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(grdStatusList.SelectedDataKey.Value.ToString());

                var result = AccSvc.GetHotelStatusDetails(Accomodation_ID, myRow_Id);


                if (result.Count > 0)
                {
                    TLGX_Consumer.MDMSVC.DC_Accommodation_Status newObj = new MDMSVC.DC_Accommodation_Status
                    {
                        Accommodation_Id        = Accomodation_ID,
                        Accommodation_Status_Id = myRow_Id,
                        CompanyMarket           = ddlCompanyMarket.SelectedItem.Text.Trim(),
                        DeactivationReason      = txtDeactivationReason.Text.Trim(),
                        From      = DateTime.ParseExact(txtFrom.Text.Trim(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture),
                        To        = DateTime.ParseExact(txtTo.Text.Trim(), "dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture),
                        Status    = ddlStatus.SelectedItem.Text.Trim(),
                        IsActive  = true,
                        Edit_Date = DateTime.Now,
                        Edit_User = System.Web.HttpContext.Current.User.Identity.Name
                    };

                    if (AccSvc.UpdateHotelStatus(newObj))
                    {
                        Accomodation_ID = new Guid(Request.QueryString["Hotel_Id"]);
                        frmAccommodationStatus.ChangeMode(FormViewMode.Insert);
                        frmAccommodationStatus.DataBind();
                        GetHotelStatusDetails();
                        BootstrapAlert.BootstrapAlertMessage(dvMsg, "Status has been updated successfully", BootstrapAlertType.Success);
                    }
                    else
                    {
                        BootstrapAlert.BootstrapAlertMessage(dvMsg, "Error Occurred", BootstrapAlertType.Warning);
                    }
                }
            }
        }