Пример #1
0
    ///api/Values/5 nights 6 days MV Mahabaahu Upstream Cruise/2018-10-16/2018-10-21/4/rabiul/102,208/7/2/online/248

    public string Get1(string pakackagename, DateTime chekindate, DateTime checkoutdate, int total, string refrence, string roomno, int accomid, int roomcatid, string paymentmethod, int agentid)
    {
        string      value       = "";
        DataSet     ds          = new DataSet();
        HttpContext httpContext = HttpContext.Current;
        string      authHeader  = httpContext.Request.Headers["Authorization"];

        if (authHeader != null && authHeader.StartsWith("Basic"))
        {
            string encodedUsernamePassword = authHeader.Substring("Basic ".Length).Trim();

            AgentMaster oAgentMaster = new AgentMaster();

            AgentDTO[] oAgentData = oAgentMaster.GetApiAuth(agentid);
            string     TokenNo    = oAgentData[0].TokenNo.ToString();
            if (TokenNo != "" && TokenNo == encodedUsernamePassword)
            {
                DataTable dt1 = dlsr.getpackaageid(pakackagename, chekindate);
                if (dt1 != null && dt1.Rows.Count > 0)
                {
                    pakackageid = dt1.Rows[0]["PackageId"].ToString();
                    departureId = Convert.ToInt32(dt1.Rows[0]["Id"].ToString());
                }
                DataTable dt = cab.bindroomddl(pakackageid, departureId);
                dv = new DataView();

                string[] strArray = roomno.Split(',');


                //foreach (object obj in strArray)
                //{
                //    roomno = obj.ToString();
                //}
                //var values = Request.GetQueryNameValuePairs()
                //      .Where(kvp => kvp.Key == "roomno")
                //      .Select(kvp => int.Parse(kvp.Value))
                //      .ToArray();
                int n = cab.InsertParentTableData(pakackageid, chekindate, checkoutdate, total, refrence, agentid);
                foreach (var lockRoom in strArray)
                {
                    roomno = lockRoom.ToString();
                    dv     = new DataView(dt, "RoomNo='" + roomno + "'", "RoomNo", DataViewRowState.CurrentRows);
                    DataTable dtcheck = dv.ToTable();
                    dv = new DataView(dtcheck, "BookedStatus='" + "Available" + "'", "BookedStatus", DataViewRowState.CurrentRows);

                    if (dv.Count > 0)
                    {
                        //var values = Request.GetQueryNameValuePairs()
                        //   .Where(kvp => kvp.Key == "roomno")
                        //   .Select(kvp => int.Parse(kvp.Value))
                        //   .ToArray();
                        //foreach (var lockRoom in strArray)
                        //{
                        //roomno = lockRoom.ToString();
                        cab.InsertChildTableData(n, total, roomno, paymentmethod, chekindate, pakackageid, total, roomcatid);
                        cab.LockTheBooking(roomno, accomid, roomcatid);
                        blsr.action      = "fetchbybookingId";
                        blsr._iBookingId = n;
                        DataTable dtfetch = dlsr.fetchbybookingid(blsr);
                        DataTable dtvalue = cab.loadbookingDetails(pakackagename, n, total, roomno, paymentmethod, chekindate, checkoutdate, pakackageid, total, roomcatid, Convert.ToInt32(dtfetch.Rows[0]["NoOFNights"].ToString()));
                        //DataSet ds = new DataSet();
                        ds.Tables.Add(dtvalue);
                        //value = ds.GetXml();
                        //// }
                        //return value;
                    }
                    //else
                    //{
                    //    return "Room is already booked";
                    //}
                }
            }
            value = ds.GetXml();
            // }
            if (value != "<NewDataSet />")
            {
                return(value);
            }
            else
            {
                return("Room is already booked");
            }
        }
        else
        {
            return(value);
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)

    {
        // txtPassportNo.Text = "VDIzaDQ1aXMxMjRJNTRz";
        //string PassportNo = DataSecurityManager.Decrypt(txtPassportNo.Text.ToString());
        //string t = "VDIzaDQ1aXMxMjRJNTRz";
        //string PassportNo = DataSecurityManager.Decrypt(t.ToString());

        if (Session["CustName"] != null)
        {
            navlogin.Visible = false;
            lblUsername.Text = Session["CustName"].ToString();
        }
        else
        {
            // Response.Redirect("http://test1.adventureresortscruises.in/Cruise/Booking/searchproperty1.aspx");
        }
        TouristServices touristServices = null;

        //AddAttributes();


        SessionServices.TouristDetails_BookingNo = BookingId;


        if (!IsPostBack)
        {
            if (Request.QueryString["bid"] != null)
            {
                BookingId = Convert.ToInt32(Request.QueryString["bid"]);
            }
            if (Request.QueryString["tno"] != null)
            {
                TouristNo = Convert.ToInt32(Request.QueryString["tno"]);
            }
            RefreshGrid(BookingId);
            if (Request.QueryString["bid"] != null)
            {
                BookingId = Convert.ToInt32(Request.QueryString["bid"]);
            }
            blsr._iBookingId = BookingId;
            blsr.action      = "fetchbybookingId";
            DataTable dt = dlsr.fetchbybookingid(blsr);
            if (dt != null && dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    paxcount = paxcount + Convert.ToInt32(dt.Rows[i]["NoOfPersons"].ToString());
                }
                Session["getpaxcount"] = paxcount;
            }
            FillNationality();
            radEmpNo.Checked = true;
            if (Request.QueryString["op"] == "edit")
            {
                btnSubmit.Text = "Update";
                if (touristServices == null)
                {
                    touristServices = new TouristServices();
                }
                BookingTouristDTO oBTData = touristServices.GetBookingTouristDetails(BookingId, TouristNo);
                if (oBTData != null)
                {
                    FillTouristDetails(oBTData);
                }
                touristServices = null;
                oBTData         = null;
            }
            else
            {
                //btnDelete.Visible = false;
            }
            //System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(this.ddlSuffix);
            //Response.Redirect("http://test.adventureresortscruises.in/Cruise/Booking/NewRegister.aspx?bid=" + BookingId);
        }
    }