Ejemplo n.º 1
0
        /// <summary>
        /// Save location
        /// </summary>
        private int SaveBooking()
        {
            Generic <PNK_Booking> genericBLL = new Generic <PNK_Booking>();
            Generic2C <PNK_Booking, PNK_BookingDesc> generic2CBLL = new Generic2C <PNK_Booking, PNK_BookingDesc>();
            PNK_Booking     bookingObj   = new PNK_Booking();
            PNK_BookingDesc bookingObjVn = new PNK_BookingDesc();
            PNK_BookingDesc bookingObjEn = new PNK_BookingDesc();

            //if (this.productcategoryId == int.MinValue)
            //{
            //get data insert
            bookingObj          = this.GetDataObjectParent(bookingObj);
            bookingObj.Ordering = genericBLL.getOrdering();
            bookingObjVn        = this.GetDataObjectChild(bookingObjVn, Constant.DB.LangId);
            bookingObjEn        = this.GetDataObjectChild(bookingObjEn, Constant.DB.LangId_En);

            List <PNK_BookingDesc> lst = new List <PNK_BookingDesc>();

            lst.Add(bookingObjVn);
            lst.Add(bookingObjEn);

            //excute
            bookingId = generic2CBLL.Insert(bookingObj, lst);

            return(bookingId);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// saveOrder
 /// </summary>
 private void SaveOrder()
 {
     foreach (RepeaterItem item in rptResult.Items)
     {
         if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
         {
             HtmlInputButton btId       = (HtmlInputButton)item.FindControl("btId");
             PNK_Booking     productCat = new PNK_Booking();
             productCat.Id = DBConvert.ParseInt(btId.Value);
             productCat    = genericBLL.Load(productCat, new string[] { "Id" });
             HtmlInputText txtOrder = (HtmlInputText)item.FindControl("txtOrder");
             if (txtOrder != null)
             {
                 try
                 {
                     productCat.Ordering = DBConvert.ParseInt(txtOrder.Value);
                     if (productCat.Ordering > 0)
                     {
                         genericBLL.Update(productCat, productCat, new string[] { "Id" });
                     }
                 }
                 catch { }
             }
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Save location
        /// </summary>
        private int SaveBooking()
        {
            Generic <PNK_Booking> genericBLL = new Generic <PNK_Booking>();
            Generic2C <PNK_Booking, PNK_BookingDesc> generic2CBLL = new Generic2C <PNK_Booking, PNK_BookingDesc>();
            PNK_Booking     objBooking   = new PNK_Booking();
            PNK_BookingDesc bookingObjVn = new PNK_BookingDesc();
            PNK_BookingDesc bookingObjEn = new PNK_BookingDesc();

            //if (this.productcategoryId == int.MinValue)
            //{
            //get data insert
            objBooking          = this.GetDataObjectParent(objBooking);
            objBooking.Ordering = genericBLL.getOrdering();
            bookingObjVn        = this.GetDataObjectChild(bookingObjVn, Constant.DB.LangId);
            bookingObjEn        = this.GetDataObjectChild(bookingObjEn, Constant.DB.LangId_En);

            List <PNK_BookingDesc> lst = new List <PNK_BookingDesc>();

            lst.Add(bookingObjVn);
            lst.Add(bookingObjEn);

            //Giữ lại để chuyển qua form bookingresult
            Session["objBooking"]     = objBooking;
            Session["lstBookingDesc"] = lst;

            //excute
            //bookingId = generic2CBLL.Insert(objBooking, lst);

            //Send email đến KH
            //if (bookingId != int.MinValue)
            //{
            //    SendEmailTempate(objBooking);
            //}
            return(bookingId);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// get data for insert update
 /// </summary>
 /// <param name="userObj"></param>
 /// <returns></returns>
 private PNK_Booking GetDataObjectParent(PNK_Booking productcatObj)
 {
     //productcatObj.CategoryId = 1;
     //productcatObj.Phone = this.txtPhone.Value;
     productcatObj.Published  = chkPublished.Checked ? "1" : "0";
     productcatObj.UpdateDate = DateTime.Now;
     return(productcatObj);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// get data for insert update
        /// </summary>
        /// <param name="userObj"></param>
        /// <returns></returns>
        private PNK_Booking GetDataObjectParent(PNK_Booking obj)
        {
            obj.ParentId              = 1;
            obj.FirstName             = txtFirstName.Value.Trim();
            obj.LastName              = txtLastName.Value.Trim();
            obj.PhoneNumber           = txtPhoneNumber.Text.Trim();
            obj.RequestTour           = txtRequestTour.Value.Trim();
            obj.ExpectedDepartureDate = txtExpectedDepartureDate.Value;
            obj.NumberOfAduts         = txtNumberAduts.Value.Trim();
            obj.NumberOfChildren      = txtNumberChild.Value.Trim();
            obj.NumberOfInfant        = txtNumberInfant.Value.Trim();
            obj.Published             = "1";
            obj.Email       = txtEmail.Text.Trim();
            obj.RequestTour = txtRequestTour.Value.Trim();

            obj.HotelType   = drpHotel.Items[drpHotel.SelectedIndex].Text;
            obj.ArrivalPort = drpArrival.Items[drpArrival.SelectedIndex].Text;
            obj.RoomType    = drpRoomType.Items[drpRoomType.SelectedIndex].Text;
            obj.RoomOther   = txtRoomOther.Value.Trim();
            obj.BedType     = drpBedType.Items[drpBedType.SelectedIndex].Text;
            obj.BedOther    = txtBedOther.Value.Trim();
            obj.VisaOfNeed  = rdVisaYes.Checked == true ? "Yes" : "No";
            //obj.KnowThrough = drpKnow.Items[drpKnow.SelectedIndex].Text;
            //obj.PaymentMethod = drpPayment.Items[drpPayment.SelectedIndex].Text;
            obj.Distance            = drpDistance.Items[drpDistance.SelectedIndex].Text;
            obj.FlightArrivalNo     = txtFlightArrivalNo.Text.Trim();
            obj.FlightArrivaTime    = txtFlightArrialTime.Text.Trim();
            obj.FlightDepartureTime = txtFlightDepartureTime.Text.Trim();
            obj.FlightArrivalDate   = txtFlightArrivalDate.Text.Trim();
            obj.FlightDepartureDate = txtFlightDepartureDate.Text.Trim();

            obj.CustomerHeight = txtCustomerHeight.Text.Trim();
            obj.HotelName      = txtHotelName.Text.Trim();
            obj.CustomerAge    = txtCustomerAge.Text.Trim();
            obj.HotelAddress   = txtHotelAddress.Text.Trim();
            obj.Country        = drpCountry.Items[drpCountry.SelectedIndex].Text;
            obj.City           = hddDrpCityValue.Value;
            obj.SpecialRequest = txtSpecialRequest.Text;
            obj.PickUpLocation = txtPickUpLocation.Text;

            obj.UpdateDate    = DateTime.Now;
            obj.PostDate      = DateTime.Now;
            obj.Total         = hddPriceSumValue.Value;
            obj.PaymentMethod = drpPaymentType.Items[drpPaymentType.SelectedIndex].Text;

            return(obj);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Save location
        /// </summary>
        private void SaveBookingCategory()
        {
            PNK_Booking     productcatObj   = new PNK_Booking();
            PNK_BookingDesc productcatObjVn = new PNK_BookingDesc();
            PNK_BookingDesc productcatObjEn = new PNK_BookingDesc();

            if (this.productcategoryId == int.MinValue)
            {
                //get data insert
                productcatObj          = this.GetDataObjectParent(productcatObj);
                productcatObj.PostDate = DateTime.Now;
                productcatObj.Ordering = genericBLL.getOrdering();
                productcatObjVn        = this.GetDataObjectChild(productcatObjVn, Constant.DB.LangId);
                productcatObjEn        = this.GetDataObjectChild(productcatObjEn, Constant.DB.LangId_En);

                List <PNK_BookingDesc> lst = new List <PNK_BookingDesc>();
                lst.Add(productcatObjVn);
                lst.Add(productcatObjEn);
                //excute
                this.productcategoryId = generic2CBLL.Insert(productcatObj, lst);
            }
            else
            {
                string[] fields = { "Id" };
                productcatObj.Id = this.productcategoryId;

                productcatObj = genericBLL.Load(productcatObj, fields);
                //string publisheddOld = productcatObj.Published;
                //get data update
                productcatObj   = this.GetDataObjectParent(productcatObj);
                productcatObjVn = this.GetDataObjectChild(productcatObjVn, Constant.DB.LangId);
                productcatObjEn = this.GetDataObjectChild(productcatObjEn, Constant.DB.LangId_En);
                List <PNK_BookingDesc> lst = new List <PNK_BookingDesc>();
                lst.Add(productcatObjVn);
                lst.Add(productcatObjEn);
                //excute
                generic2CBLL.Update(productcatObj, lst, fields);
                //neu ve Published oo thay doi thi chay ham ChangeWithTransaction de doi Published cac con va cac product
                //if (publisheddOld != productcatObj.Published)
                //    PNK_Booking.ChangeWithTransaction(DBConvert.ParseString(this.productcategoryId), productcatObj.Published);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// get data for insert update
        /// </summary>
        /// <param name="userObj"></param>
        /// <returns></returns>
        private PNK_Booking GetDataObjectParent(PNK_Booking obj)
        {
            obj.ParentId              = 1;
            obj.FullName              = txtFullName.Value.Trim();
            obj.PhoneNumber           = txtPhone.Value.Trim();
            obj.RequestTour           = drpService.Items[drpService.SelectedIndex].Text;
            obj.ExpectedDepartureDate = drpConstructions.Items[drpConstructions.SelectedIndex].Text;
            obj.NumberOfAduts         = drpLocation.Items[drpLocation.SelectedIndex].Text;
            obj.NumberOfChildren      = txtArea.Value.Trim();
            obj.Published             = "1";
            obj.Email = txtEmail.Value.Trim();


            obj.HotelType   = txtSubject.Value.Trim();
            obj.ArrivalPort = txtMessage.Value.Trim();
            //obj.RoomType = drpRoomType.Items[drpRoomType.SelectedIndex].Text;
            //obj.RoomOther = txtRoomOther.Value.Trim();
            //obj.BedType = drpBedType.Items[drpBedType.SelectedIndex].Text;
            //obj.BedOther = txtBedOther.Value.Trim();
            //obj.VisaOfNeed = rdVisaYes.Checked == true ? "Yes" : "No";
            //obj.KnowThrough = drpKnow.Items[drpKnow.SelectedIndex].Text;
            //obj.PaymentMethod = drpPayment.Items[drpPayment.SelectedIndex].Text;
            //obj.Distance = drpDistance.Items[drpDistance.SelectedIndex].Text;
            //obj.FlightArrivalNo = txtFlightArrivalNo.Text.Trim();
            //obj.FlightArrivaTime = txtFlightArrialTime.Text.Trim();
            //obj.FlightDepartureTime = txtFlightDepartureTime.Text.Trim();
            //obj.FlightArrivalDate = txtFlightArrivalDate.Text.Trim();
            //obj.FlightDepartureDate = txtFlightDepartureDate.Text.Trim();

            //obj.CustomerHeight = txtCustomerHeight.Text.Trim();
            //obj.HotelName = txtHotelName.Text.Trim();
            //obj.CustomerAge = txtCustomerAge.Text.Trim();
            //obj.HotelAddress = txtHotelAddress.Text.Trim();


            obj.UpdateDate = DateTime.Now;
            obj.PostDate   = DateTime.Now;


            return(obj);
        }
Ejemplo n.º 8
0
        private int SaveBooking(string paymentStatus)
        {
            //Get obj từ form booking
            PNK_Booking objBooking = Session["objBooking"] != null ? (PNK_Booking)Session["objBooking"] : null;

            objBooking.PaymentStatus = paymentStatus != string.Empty ? paymentStatus : string.Empty;

            List <PNK_BookingDesc> lstBookingDesc = Session["objBooking"] != null ? (List <PNK_BookingDesc>)Session["lstBookingDesc"] : null;

            //excute
            Generic2C <PNK_Booking, PNK_BookingDesc> generic2CBLL = new Generic2C <PNK_Booking, PNK_BookingDesc>();

            bookingId = generic2CBLL.Insert(objBooking, lstBookingDesc);

            //Send email đến KH
            if (bookingId != int.MinValue)
            {
                SendEmailTempate(objBooking);
            }
            return(bookingId);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// ItemDataBound
        /// </summary>
        protected void rptResult_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                string        img, alt, publishedTask;
                HtmlTableRow  tr  = (HtmlTableRow)e.Item.FindControl("trList");
                HtmlInputText txt = null;
                if (e.Item.ItemIndex % 2 == 0)
                {
                    tr.Attributes.Add("class", "even");
                }
                else
                {
                    tr.Attributes.Add("class", "old");
                }

                try
                {
                    PNK_Booking data = (PNK_Booking)e.Item.DataItem;

                    //Role
                    Literal ltr = null;
                    ltr      = (Literal)e.Item.FindControl("ltrchk");
                    ltr.Text = string.Format(@"<INPUT class='txt' TYPE='checkbox' ID='cb{0}' NAME='cid[]' value='{1}' onclick='isChecked(this.checked);' >",
                                             e.Item.ItemIndex, data.Id);

                    //ltrNewsCategory
                    ltr = (Literal)e.Item.FindControl("ltrNewsCategory");

                    //image
                    if (data.Published == "1")
                    {
                        img           = "tick.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "unpublish";
                    }
                    else
                    {
                        img           = "publish_x.png";
                        alt           = LocalizationUtility.GetText(ltrAdminPublish.Text);
                        publishedTask = "publish";
                    }

                    //Order
                    txt       = (HtmlInputText)e.Item.FindControl("txtOrder");
                    txt.Value = DBConvert.ParseString(data.Ordering);

                    //Id
                    HtmlInputButton btId = (HtmlInputButton)e.Item.FindControl("btId");
                    btId.Value = DBConvert.ParseString(data.Id);

                    //set link
                    HyperLink hdflink = new HyperLink();
                    hdflink             = (HyperLink)e.Item.FindControl("hdflink");
                    hdflink.NavigateUrl = template_path + LinkHelper.GetAdminLink("edit_booking", data.Id);
                    ImageButton imgctr = (ImageButton)e.Item.FindControl("btnPublish");
                    imgctr.ImageUrl = string.Format("/Admin/images/{0}", img);
                    imgctr.Attributes.Add("alt", alt);
                    HtmlTableCell btn = (HtmlTableCell)e.Item.FindControl("tdbtn");
                    btn.Attributes.Add("onclick", string.Format(" return listItemTask('cb{0}', '{1}')", e.Item.ItemIndex, publishedTask));

                    //Name
                    ltr      = (Literal)e.Item.FindControl("ltrName");
                    ltr.Text = string.IsNullOrWhiteSpace(data.FirstName) || string.IsNullOrWhiteSpace(data.LastName) ? "[No name]" : string.Format("{0} {1}", data.FirstName, data.LastName);// data.FullName;

                    //Phone
                    ltr      = (Literal)e.Item.FindControl("txtPhone");
                    ltr.Text = data.PhoneNumber;
                }
                catch { }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Show location
        /// </summary>
        private void ShowProductcategory()
        {
            if (this.productcategoryId != int.MinValue)
            {
                PNK_Booking productcatObj = new PNK_Booking();
                string[]    fields        = { "Id" };
                productcatObj.Id          = this.productcategoryId;
                productcatObj             = generic2CBLL.Load(productcatObj, fields, Constant.DB.LangId);
                this.chkPublished.Checked = productcatObj.Published == "1" ? true : false;
                txtFistName.Value         = productcatObj.FirstName;
                txtLastName.Value         = productcatObj.LastName;
                txtPhoneNumber.Value      = productcatObj.PhoneNumber;
                txtEmail.Value            = productcatObj.Email;
                txtRequestTour.Value      = productcatObj.RequestTour;

                txtExpectedDepartureDate.Value = productcatObj.ExpectedDepartureDate;
                txtNumberOfAdults.Value        = productcatObj.NumberOfAduts;
                txtNumberOfChildren.Value      = productcatObj.NumberOfChildren;
                txtNumberOfInfant.Value        = productcatObj.NumberOfInfant;
                txtTypeOfHotels.Value          = productcatObj.HotelType;
                txtArrivalPort.Value           = productcatObj.ArrivalPort;
                txtRoomType.Value   = productcatObj.RoomType;
                txtOthersRoom.Value = productcatObj.RoomOther;
                txtBedType.Value    = productcatObj.BedType;
                txtOtherBed.Value   = productcatObj.BedOther;

                txtNeedVisaService.Value = productcatObj.VisaOfNeed;
                txtKnowThrought.Value    = productcatObj.KnowThrough;
                txtPaymentMethod.Value   = productcatObj.PaymentMethod;
                txtPaymentStatus.Value   = productcatObj.PaymentStatus;

                txtDistance.Value = productcatObj.Distance;

                txtFlightArrivalNo.Text     = productcatObj.FlightArrivalNo;
                txtFlightArrialTime.Text    = productcatObj.FlightArrivaTime;
                txtFlightDepartureTime.Text = productcatObj.FlightDepartureTime;
                txtFlightArrivalDate.Text   = productcatObj.FlightArrivalDate;
                txtFlightDepartureDate.Text = productcatObj.FlightDepartureDate;
                txtCustomerHeight.Text      = productcatObj.CustomerHeight;

                txtHotelName.Text    = productcatObj.HotelName;
                txtCustomerAge.Text  = productcatObj.CustomerAge;
                txtHotelAddress.Text = productcatObj.HotelAddress;

                txtPickUp.Value  = productcatObj.PickUpLocation;
                txtCity.Value    = productcatObj.City;
                txtCountry.Value = productcatObj.Country;

                IList <PNK_BookingDesc> lst = genericDescBLL.GetAllBy(new PNK_BookingDesc(), string.Format(" where mainid = {0}", this.productcategoryId), null);
                foreach (PNK_BookingDesc item in lst)
                {
                    switch (item.LangId)
                    {
                    case 1:
                        //productcatObj.MainId = 1;
                        //productcatObj.LangId = Constant.DB.LangId;
                        //productcatObj.Name = SanitizeHtml.Sanitize(txtFullName.Value);
                        break;

                    case 2:
                        //productcatObj.MainId = 1;
                        //productcatObj.LangId = Constant.DB.LangId_En;
                        //productcatObj.Name = SanitizeHtml.Sanitize(txtFullName.Value);
                        break;
                    }
                }
            }
        }
Ejemplo n.º 11
0
        private void SendEmailTempate(PNK_Booking obj)
        {
            try
            {
                string companyName = string.Empty, companyEmail = string.Empty, companyPhone = string.Empty, companyAddress = string.Empty
                , companyWebsite = string.Empty, companyFax = string.Empty;

                ConfigurationBLL          pcBll = new ConfigurationBLL();
                IList <PNK_Configuration> lst   = pcBll.GetList();
                if (lst != null && lst.Count > 0)
                {
                    foreach (PNK_Configuration item in lst)
                    {
                        if (item.Key_name == Constant.Configuration.config_company_name_vi)
                        {
                            companyName = item.Value_name;
                        }
                        if (item.Key_name == Constant.Configuration.email)
                        {
                            companyEmail = item.Value_name;
                        }
                        if (item.Key_name == Constant.Configuration.phone)
                        {
                            companyPhone = item.Value_name;
                        }
                        if (item.Key_name == Constant.Configuration.config_address_vi)
                        {
                            companyAddress = item.Value_name;
                        }
                        if (item.Key_name == Constant.Configuration.sitename)
                        {
                            companyWebsite = item.Value_name;
                        }
                        if (item.Key_name == Constant.Configuration.fax)
                        {
                            companyFax = item.Value_name;
                        }
                    }
                }

                string path    = Request.PhysicalApplicationPath;
                string strHtml = WebUtils.GetMailTemplate(Path.Combine(path, "TemplateMail/Booking.html"));
                string body    = string.Format(strHtml,
                                               companyName,               //0
                                               obj.FirstName,             //1
                                               obj.LastName,              //2
                                               obj.Country,               //3
                                               obj.City,                  //4
                                               obj.PhoneNumber,           //5
                                               obj.Email,                 //6
                                               obj.PickUpLocation,        //7
                                               DateTime.Now,              //8
                                               obj.RequestTour,           //9
                                               obj.ExpectedDepartureDate, //10
                                               obj.NumberOfAduts,         //11
                                               obj.NumberOfChildren,      //12
                                               obj.NumberOfInfant,        //13
                                               obj.Total,                 //14
                                               obj.PaymentMethod,         //15
                                               companyAddress,            //16
                                               companyEmail,              //17
                                               companyWebsite,            //18
                                               companyPhone,              //19
                                               companyFax,                //20
                                               obj.PaymentStatus          //21
                                               );

                WebUtils.SendEmail("Contact", obj.Email, string.Empty, body);
            }
            catch (Exception ex)
            {
                Write2Log.WriteLogs("BookingResutl", "SendEmailTempate", ex.Message);
            }
        }
Ejemplo n.º 12
0
        private void SendEmailTempate(PNK_Booking obj)
        {
            string companyName = string.Empty, companyEmail = string.Empty, companyPhone = string.Empty;;

            ConfigurationBLL          pcBll = new ConfigurationBLL();
            IList <PNK_Configuration> lst   = pcBll.GetList();

            if (lst != null && lst.Count > 0)
            {
                foreach (PNK_Configuration item in lst)
                {
                    if (item.Key_name == Constant.Configuration.config_company_name_vi)
                    {
                        companyName = item.Value_name;
                    }
                    if (item.Key_name == Constant.Configuration.email)
                    {
                        companyEmail = item.Value_name;
                    }
                    if (item.Key_name == Constant.Configuration.phone)
                    {
                        companyPhone = item.Value_name;
                    }
                }
            }

            string path    = Request.PhysicalApplicationPath;
            string strHtml = WebUtils.GetMailTemplate(Path.Combine(path, "TemplateMail/Booking.txt"));
            string body    = string.Format(strHtml,
                                           companyName,               //0
                                           obj.FullName,              //1
                                           obj.Email,                 //2
                                           obj.PhoneNumber,           //3
                                           obj.RequestTour,           //4
                                           obj.ExpectedDepartureDate, //5
                                           obj.NumberOfAduts,         //6
                                           obj.NumberOfChildren,      //7
                                           obj.HotelType,             //8
                                           obj.RoomType,              //9
                                           obj.RoomOther,             //10
                                           obj.BedType,               //11
                                           obj.BedOther,              //12
                                           obj.ArrivalPort,           //13
                                           obj.VisaOfNeed,            //14
                                           obj.PaymentMethod,         //15
                                           obj.Distance,              //16
                                           obj.FlightArrivalNo,       //17
                                           obj.FlightArrivaTime,      //18
                                           obj.FlightArrivalDate,     //19
                                           obj.FlightDepartureTime,   //20
                                           obj.FlightDepartureDate,   //21
                                           obj.CustomerHeight,        //22
                                           obj.CustomerAge,           //23
                                           obj.HotelName,             //24
                                           obj.HotelAddress,          //25
                                           companyEmail,              //26
                                           companyPhone,              //27


                                           "fasfasf");

            WebUtils.SendEmail("LienHe", string.Empty, string.Empty, body);
        }