示例#1
0
    private void Save()
    {
        if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Add))
        {
            return;
        }

        bool bActionCompleted = false;

        AccomodationTypeMaster oAccomTypeMaster = new AccomodationTypeMaster();
        AccomTypeDTO           oAccomTypeData   = MapControlsToObject();

        bActionCompleted = oAccomTypeMaster.Insert(oAccomTypeData);

        if (bActionCompleted == true)
        {
            txtAccomType.Text = "";
            base.DisplayAlert("The record has been inserted successfully");
        }
        else if (bActionCompleted == false)
        {
            base.DisplayAlert("The record has been not been inserted successfully");
            lblStatus.Text = "Error in saving.";
        }

        oAccomTypeData   = null;
        oAccomTypeMaster = null;
    }
示例#2
0
    protected void dgAccomodationType_SelectedIndexChanged(object sender, EventArgs e)
    {
        int iAccomTypeID = Convert.ToInt32(dgAccomodationType.DataKeys[dgAccomodationType.SelectedIndex]);

        hfId.Value = iAccomTypeID.ToString();
        //SessionHandler"AccomTypeID"] = iAccomTypeID;
        AccomodationTypeMaster oAccomTypeMaster = new AccomodationTypeMaster();

        AccomTypeDTO[] oAccomTypeData = oAccomTypeMaster.GetData(iAccomTypeID);
        if (oAccomTypeData.Length > 0)
        {
            txtAccomType.Text = oAccomTypeData[0].AccomodationType;
        }
        oAccomTypeMaster = null;
        oAccomTypeData   = null;

        //btnAddNew.Enabled = false;
        //btnCancel.Enabled = true;
        btnDelete.Enabled = true;
        btnEdit.Enabled   = true;
        btnCancel.Visible = true;
        btnEdit.Text      = "Update";
        //btnSave.Enabled = false;
        lblStatus.Text = "";
    }
示例#3
0
    private void Delete()
    {
        if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Delete))
        {
            return;
        }

        int Id = 0;

        int.TryParse(hfId.Value, out Id);
        if (Id == 0)
        {
            lblStatus.Text = "Please click on edit again.";
            return;
        }
        if (txtAccomType.Text.Trim() == "")
        {
            lblStatus.Text = "Please enter the Accomodation Type.";
            return;
        }

        AccomTypeDTO           oAccomTypeData   = MapControlsToObject();
        AccomodationTypeMaster oAccomTypeMaster = new AccomodationTypeMaster();

        /*
         *
         * CHECK IF THE ACCOMODATION TYPE WHICH IS TO BE DELETED HAS ANY ASSOCIATED RECORDS...IF YES, MOVE OUT OF THE FUNCTION ELSE PROCEED
         * IF THE OUTPUT OF sMessage IS "", THEN RECORD CAN BE DELETED, ELSE NOT
         *
         */
        string sMessage = "";

        GF.HasRecords(Convert.ToString(Id), "accomodationtype", out sMessage);
        if (sMessage != "")
        {
            base.DisplayAlert(sMessage);
            btnDelete.Enabled = true;
        }
        else
        {
            bool bActionCompleted = oAccomTypeMaster.Delete(oAccomTypeData);
            if (bActionCompleted == true)
            {
                base.DisplayAlert("The record has been deleted successfully");
                txtAccomType.Text = "";
                //lblStatus.Text = "Deleted";
            }
            else
            {
                base.DisplayAlert("Error Occured while deletion: Please refer to the error log.");
            }
        }

        oAccomTypeData   = null;
        oAccomTypeMaster = null;
    }
    private void SetAccomodationTypeDetails()
    {
        //Filling the Object which contains the Accomodation type and also all the respective accomodations
        //This is saved in the session and then the Drop downs are filled.
        AccomTypeDTO[]         oAccomTypeData;
        AccomodationTypeMaster objATM;

        objATM         = new AccomodationTypeMaster();
        oAccomTypeData = objATM.GetAccomTypeWithAccomDetails(0);
        SessionServices.Booking_AccomodationData = oAccomTypeData;
        objATM = null;
    }
示例#5
0
    private AccomTypeDTO[] GetAccomodationTypeDetails()
    {
        //Filling the Object which contains the Accomodation type and also all the respective accomodations
        //This is saved in the session and then the Drop downs are filled.
        AccomodationTypeMaster accomodationTypeMaster;

        accomodationTypeMaster = new AccomodationTypeMaster();
        AccomTypeDTO[] oAccomTypeData = null;
        //following line has been commented by vijay to get the acomodations user wise
        //oAccomTypeData = objATM.GetAccomTypeWithAccomDetails(0);

        oAccomTypeData = accomodationTypeMaster.GetAccomTypeWithAccomDetails();
        return(oAccomTypeData);
    }
示例#6
0
    private void Update()
    {
        bool bActionCompleted = false;

        if (!base.ValidateIfCommandAllowed(Request.Url.AbsoluteUri, ENums.PageCommand.Update))
        {
            return;
        }

        int Id = 0;

        int.TryParse(hfId.Value, out Id);
        if (Id == 0)
        {
            lblStatus.Text = "Please click on edit again.";
            return;
        }
        if (txtAccomType.Text.Trim() == "")
        {
            lblStatus.Text = "Please enter the Accomodation Type.";
            return;
        }


        AccomodationTypeMaster oAccomTypeMaster = new AccomodationTypeMaster();
        AccomTypeDTO           oAccomTypeData   = MapControlsToObject();

        bActionCompleted = oAccomTypeMaster.Update(oAccomTypeData);
        if (bActionCompleted == true)
        {
            txtAccomType.Text = "";
            base.DisplayAlert("The record has been updated successfully");
        }
        else if (bActionCompleted == false)
        {
            base.DisplayAlert("The record has been not been updated successfully");
            lblStatus.Text = "Error in saving.";
        }

        txtAccomType.Text = "";
        lblStatus.Text    = "Updated";
        oAccomTypeData    = null;
        oAccomTypeMaster  = null;
    }
示例#7
0
    private void RefreshGrid()
    {
        AccomodationTypeMaster oAccomTypeMaster;

        AccomTypeDTO[] oAccomTypeData;
        oAccomTypeMaster = new AccomodationTypeMaster();
        oAccomTypeData   = oAccomTypeMaster.GetData();
        dgAccomodationType.DataSource = null;
        dgAccomodationType.DataBind();
        if (oAccomTypeData != null)
        {
            if (oAccomTypeData.Length > 0)
            {
                dgAccomodationType.DataSource = oAccomTypeData;
                dgAccomodationType.DataBind();
            }
        }
        txtAccomType.Text = "";
        oAccomTypeMaster  = null;
        oAccomTypeData    = null;
    }
示例#8
0
    private void FillAccomodationType()
    {
        AccomodationTypeMaster oAccomTypeMaster = new AccomodationTypeMaster();

        AccomTypeDTO[] oAccomTypeData = oAccomTypeMaster.GetData();
        ddlAccomTypeId.Items.Clear();
        SortedList slAccomMaster = new SortedList();

        slAccomMaster.Add("0", "Choose Accomodation Type");
        if (oAccomTypeData != null)
        {
            for (int i = 0; i < oAccomTypeData.Length; i++)
            {
                slAccomMaster.Add(Convert.ToString(oAccomTypeData[i].AccomodationTypeId), Convert.ToString(oAccomTypeData[i].AccomodationType));
            }
        }
        ddlAccomTypeId.DataSource     = slAccomMaster;
        ddlAccomTypeId.DataTextField  = "value";
        ddlAccomTypeId.DataValueField = "key";
        ddlAccomTypeId.DataBind();
        oAccomTypeData   = null;
        oAccomTypeMaster = null;
    }
示例#9
0
        private AccomTypeDTO[] GetRoomDetails(int RegionId, int AccomodationTypeId, int AccomodationId)
        {
            AccomTypeDTO[]         objAccomodationTypeData;
            AccomodationTypeMaster oAccomTypeMaster;
            AccomodationMaster     oAccomMaster;
            RoomMaster             oRoomMaster;

            try
            {
                oAccomTypeMaster = new AccomodationTypeMaster();
                oAccomMaster     = new AccomodationMaster();
                oRoomMaster      = new RoomMaster();

                objAccomodationTypeData = oAccomTypeMaster.GetData(AccomodationTypeId);

                if (objAccomodationTypeData != null)
                {
                    for (int i = 0; i < objAccomodationTypeData.Length; i++)
                    {
                        objAccomodationTypeData[i].Accomodations = oAccomMaster.GetData(RegionId, objAccomodationTypeData[i].AccomodationTypeId, AccomodationId);
                        if (objAccomodationTypeData[i].Accomodations != null)
                        {
                            for (int j = 0; j < objAccomodationTypeData[i].Accomodations.Length; j++)
                            {
                                objAccomodationTypeData[i].Accomodations[j].RoomData = oRoomMaster.GetData(objAccomodationTypeData[i].Accomodations[j].AccomodationId);
                            }
                        }
                    }
                }
            }
            catch (Exception exp)
            {
                throw exp;
            }
            return(objAccomodationTypeData);
        }