コード例 #1
0
        private void WriteSheetByTrip(string tripName, int tripDay, QQuotation quotation, ref int rowQ, ref ExcelWorksheet sheet)
        {
            sheet.Cells[rowQ, 0].Value = tripName;
            rowQ += 2;
            //sheet.Cells[rowQ, 0].Value = quotation.GroupCruise.Name;
            //rowQ++;
            // display price room
            // display room type header
            var roomPrices = Module.GetGroupRoomPrice(quotation.GroupCruise.Id, ddlAgentLevel.SelectedValue, tripDay, quotation);

            sheet.Cells[rowQ, 0].Value = "LOẠI PHÒNG";
            sheet.Cells[rowQ, 1].Value = "Phòng đôi";
            sheet.Cells[rowQ, 2].Value = "Phòng đơn";
            sheet.Cells[rowQ, 3].Value = "Giường/Đệm phụ";
            sheet.Cells[rowQ, 4].Value = "Trẻ em";

            // display rooom class
            rowQ++;
            foreach (QGroupRomPrice roomPrice in roomPrices)
            {
                sheet.Cells[rowQ, 0].Value = roomPrice.RoomType;
                sheet.Cells[rowQ, 1].Value = string.Format("USD: {0:#,0.#} {2}VND: {1:#,0.#}", roomPrice.PriceDoubleUsd, roomPrice.PriceDoubleVnd, Environment.NewLine);
                sheet.Cells[rowQ, 2].Value = string.Format("USD: {0:#,0.#} {2}VND: {1:#,0.#}", roomPrice.PriceTwinUsd, roomPrice.PriceTwinVnd, Environment.NewLine);
                sheet.Cells[rowQ, 3].Value = string.Format("USD: {0:#,0.#} {2}VND: {1:#,0.#}", roomPrice.PriceExtraUsd, roomPrice.PriceExtraVnd, Environment.NewLine);
                sheet.Cells[rowQ, 4].Value = string.Format("USD: {0:#,0.#} {2}VND: {1:#,0.#}", roomPrice.PriceChildUsd, roomPrice.PriceChildVnd, Environment.NewLine);
                rowQ++;
            }
            rowQ++;
            // display price charter
            sheet.Cells[rowQ, 1].Value = "THUÊ TRỌN TÀU";
            rowQ++;

            var cruises = Module.CruiseGetAllByGroup(quotation.GroupCruise.Id);


            foreach (Cruise cruise in cruises)
            {
                // write cruise name
                //sheet.Cells[rowQ, 0].Value = string.Format("{0} {1} cabins", cruise.Name, cruise.Rooms.Count);
                var charterPrices = Module.GetCruiseCharterPrice(quotation.GroupCruise.Id, cruise, ddlAgentLevel.SelectedValue, tripDay, quotation);
                if (charterPrices.Count > 0)
                {
                    rowQ++;
                    var mergedRange = sheet.Cells.GetSubrange(string.Format("A{0}:A{1}", rowQ, rowQ + 1));
                    mergedRange.Merged = true;
                    mergedRange.Style.VerticalAlignment   = VerticalAlignmentStyle.Center;
                    mergedRange.Style.HorizontalAlignment = HorizontalAlignmentStyle.Center;
                    mergedRange.Value = string.Format("{0} {1} cabins", cruise.Name, cruise.Rooms.Count);
                    var idexRange = 1;
                    foreach (QCharterPrice charterPrice in charterPrices)
                    {
                        sheet.Cells[rowQ - 1, idexRange].Value = string.Format("{0}-{1} khách", charterPrice.Validfrom, charterPrice.Validto);
                        sheet.Cells[rowQ, idexRange].Value     = string.Format("USD: {0:#,0.#} {2}VND: {1:#,0.#}", charterPrice.Priceusd, charterPrice.Priceusd, Environment.NewLine);
                    }
                    rowQ++;
                }
            }
            rowQ += 2;
        }
コード例 #2
0
 public void DisplayDataConfig(SailsModule module, Cruise cruise, QCruiseGroup group, string agentLvCode, int trip, QQuotation qQuotation)
 {
     litCruiseName.Text = cruise.Name;
     _module            = module;
     _qQuotation        = qQuotation;
     _trip        = trip;
     _agentLvCode = agentLvCode;
     rptCharterRanger.DataSource = module.GetCruiseCharterPrice(group.Id, cruise, agentLvCode, trip, qQuotation);
     rptCharterRanger.DataBind();
 }
コード例 #3
0
        public void SaveDataConfig(SailsModule module, Cruise cruise, QCruiseGroup group, string agentLvCode, int trip, QQuotation qQuotation)
        {
            litCruiseName.Text = cruise.Name;
            _module            = module;
            _qQuotation        = qQuotation;
            _trip        = trip;
            _agentLvCode = agentLvCode;
            foreach (RepeaterItem item in rptCharterRanger.Items)
            {
                var         charterPrice      = new QCharterPrice();
                HiddenField hidCharterPriceId = item.FindControl("hidCharterPriceId") as HiddenField;

                TextBox  txtValidFrom  = item.FindControl("txtValidFrom") as TextBox;
                TextBox  txtValidTo    = item.FindControl("txtValidTo") as TextBox;
                TextBox  txtPriceUSD   = item.FindControl("txtPriceUSD") as TextBox;
                TextBox  txtPriceVND   = item.FindControl("txtPriceVND") as TextBox;
                CheckBox checkIsDelete = item.FindControl("checkIsDelete") as CheckBox;


                if (hidCharterPriceId != null && (!string.IsNullOrEmpty(hidCharterPriceId.Value) && hidCharterPriceId.Value != "0"))
                {
                    charterPrice = _module.GetById <QCharterPrice>(Convert.ToInt32(hidCharterPriceId.Value));
                }
                if (txtValidFrom != null && !string.IsNullOrEmpty(txtValidFrom.Text))
                {
                    charterPrice.Validfrom = Convert.ToInt32(txtValidFrom.Text);
                }
                if (txtValidTo != null && !string.IsNullOrEmpty(txtValidTo.Text))
                {
                    charterPrice.Validto = Convert.ToInt32(txtValidTo.Text);
                }

                if (txtPriceUSD != null && !string.IsNullOrEmpty(txtPriceUSD.Text))
                {
                    charterPrice.Priceusd = Convert.ToDecimal(txtPriceUSD.Text);
                }
                if (txtPriceVND != null && !string.IsNullOrEmpty(txtPriceVND.Text))
                {
                    charterPrice.Pricevnd = Convert.ToDecimal(txtPriceVND.Text);
                }
                charterPrice.QQuotation     = qQuotation;
                charterPrice.Trip           = trip;
                charterPrice.AgentLevelCode = agentLvCode;
                charterPrice.Cruise         = cruise;
                charterPrice.GroupCruise    = group;
                if (checkIsDelete.Checked)
                {
                    module.Delete(charterPrice);
                }
                else
                {
                    module.SaveOrUpdate(charterPrice);
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// lấy giá theo phòng
        /// </summary>
        /// <param name="quotation">bảng giá</param>
        /// <param name="group">nhóm tàu</param>
        /// <param name="roomClass">loại phòng</param>
        /// <param name="roomType">kiểu phòng</param>
        /// <param name="trip">số ngày trip</param>
        /// <returns></returns>
        public QRoomPrice GetRoomPrice(QQuotation quotation, QCruiseGroup group, QRoomClass roomClass, QRoomType roomType, int trip)
        {
            var queryOver = _commonDao.OpenSession().QueryOver <QRoomPrice>();

            queryOver.Where(p => p.QQuotation == quotation);
            queryOver.Where(p => p.Group == group);
            queryOver.Where(p => p.QRoomClass == roomClass);
            queryOver.Where(p => p.QRoomType == roomType);
            queryOver.Where(p => p.Trip == trip);
            return(queryOver.SingleOrDefault());
        }
コード例 #5
0
        /// <summary>
        /// lay bang gia theo số lượng khách charter
        /// </summary>
        /// <param name="quotation"></param>
        /// <param name="cruiseCharterRange">tàu</param>
        /// <param name="trip"></param>
        /// <returns></returns>
        public QCharterRangePrice GetCharterRangePrice(QQuotation quotation, QCruiseCharterRange cruiseCharterRange, int trip)
        {
            var queryOver = _commonDao.OpenSession().QueryOver <QCharterRangePrice>();

            queryOver.Where(p => p.QQuotation == quotation);
            queryOver.Where(p => p.Group == cruiseCharterRange.Group);
            queryOver.Where(p => p.Cruise == cruiseCharterRange.Cruise);
            queryOver.Where(p => p.QCruiseCharterRange == cruiseCharterRange);
            queryOver.Where(p => p.Trip == trip);
            return(queryOver.SingleOrDefault());
        }
コード例 #6
0
        public void NewQuotationPriceConfig(SailsModule module, string agentLvCode, int trip, QCruiseGroup group, QQuotation quotation)
        {
            _module                 = module;
            _trip                   = trip;
            _group                  = group;
            _qQuotation             = quotation;
            _agentLvCode            = agentLvCode;
            hidTrip.Value           = trip.ToString();
            rptRoomPrice.DataSource = module.GetGroupRoomPrice(group.Id, agentLvCode, trip, quotation);
            rptRoomPrice.DataBind();

            // load cruise charter price config
            rptCruise.DataSource = module.CruiseGetAllByGroup(group.Id);
            rptCruise.DataBind();
        }
コード例 #7
0
        private void ExportQuotation(QQuotation quotation)
        {
            ExcelFile      excelFile = ExcelFile.Load(Server.MapPath("/Modules/Sails/Admin/ExportTemplates/quotation.xlsx"));
            ExcelWorksheet sheet     = excelFile.Worksheets[0];

            //sheet.Cells["A3"].Value = quotation.QAgentlevel.Name;
            sheet.Cells["B3"].Value = String.Format("FROM: {0}", quotation.Validfrom.ToString("dd/MM/yyyy"));
            sheet.Cells["C3"].Value = String.Format("TO: {0}", quotation.Validto.ToString("dd/MM/yyyy"));

            int rowQ = 6;

            WriteSheetByTrip("2 NGÀY / 1 ĐÊM", 2, quotation, ref rowQ, ref sheet);
            WriteSheetByTrip("3 NGÀY / 2 ĐÊM", 3, quotation, ref rowQ, ref sheet);
            //excelFile.Save(Response, string.Format("quotation_{0}_{1:dd-MM-yyyy}_{2:dd-MM-yyyy}.xlsx", quotation.QAgentlevel.Name, quotation.Fromdate, quotation.Todate));
        }
コード例 #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(Request["qid"]))
     {
         _qQuotation = Module.GetById <QQuotation>(Convert.ToInt32(Request["qid"]));
     }
     if (!IsPostBack)
     {
         GetGroupCruise();
         if (_qQuotation.Id > 0)
         {
             FillInfoQuotation();
         }
         SetAgentLevel();
     }
 }
コード例 #9
0
        protected void rptQuotation_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.DataItem is QQuotation)
            {
                QQuotation quotation = (QQuotation)e.Item.DataItem;
                HtmlAnchor aName     = e.Item.FindControl("aName") as HtmlAnchor;
                if (aName != null)
                {
                    var name = string.Format("{0:dd/mm/yyyy}-{1:dd/mm/yyyy} {2}", quotation.Validfrom, quotation.Validto, quotation.GroupCruise.Name);
                    aName.InnerHtml = name;
                    aName.Attributes.CssStyle.Add("cursor", "pointer");

                    string script = string.Format("Done('{0}','{1}')", name.Replace("'", @"\'"), quotation.Id);
                    aName.Attributes.Add("onclick", script);
                }
            }
        }
コード例 #10
0
        public void SaveQuotationPriceConfig(SailsModule module, string agentLvCode, int trip, int groupId, QQuotation quotation)
        {
            QCruiseGroup group = module.GetById <QCruiseGroup>(groupId);

            // save room price
            foreach (RepeaterItem item in rptRoomPrice.Items)
            {
                var         roomPrice         = new QGroupRomPrice();
                HiddenField hidRoomPriceId    = item.FindControl("hidRoomPriceId") as HiddenField;
                TextBox     txtRoomType       = item.FindControl("txtRoomType") as TextBox;
                TextBox     txtPriceDoubleUsd = item.FindControl("txtPriceDoubleUsd") as TextBox;
                TextBox     txtPriceDoubleVnd = item.FindControl("txtPriceDoubleVnd") as TextBox;
                TextBox     txtPriceTwinUsd   = item.FindControl("txtPriceTwinUsd") as TextBox;
                TextBox     txtPriceTwinVnd   = item.FindControl("txtPriceTwinVnd") as TextBox;
                TextBox     txtPriceExtraUsd  = item.FindControl("txtPriceExtraUsd") as TextBox;
                TextBox     txtPriceExtraVnd  = item.FindControl("txtPriceExtraVnd") as TextBox;
                TextBox     txtPriceChildUsd  = item.FindControl("txtPriceChildUsd") as TextBox;
                TextBox     txtPriceChildVnd  = item.FindControl("txtPriceChildVnd") as TextBox;
                CheckBox    checkIsDelete     = item.FindControl("checkIsDelete") as CheckBox;


                if (!string.IsNullOrEmpty(hidRoomPriceId.Value) && hidRoomPriceId.Value != "0")
                {
                    roomPrice = module.GetById <QGroupRomPrice>(Convert.ToInt32(hidRoomPriceId.Value));
                }
                if (!string.IsNullOrEmpty(txtRoomType.Text))
                {
                    roomPrice.RoomType = txtRoomType.Text;
                }
                if (!string.IsNullOrEmpty(txtPriceDoubleUsd.Text))
                {
                    roomPrice.PriceDoubleUsd = Convert.ToDecimal(txtPriceDoubleUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceDoubleVnd.Text))
                {
                    roomPrice.PriceDoubleVnd = Convert.ToDecimal(txtPriceDoubleVnd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceTwinUsd.Text))
                {
                    roomPrice.PriceTwinUsd = Convert.ToDecimal(txtPriceTwinUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceTwinVnd.Text))
                {
                    roomPrice.PriceTwinVnd = Convert.ToDecimal(txtPriceTwinVnd.Text);
                }

                if (!string.IsNullOrEmpty(txtPriceExtraUsd.Text))
                {
                    roomPrice.PriceExtraUsd = Convert.ToDecimal(txtPriceExtraUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceExtraVnd.Text))
                {
                    roomPrice.PriceExtraVnd = Convert.ToDecimal(txtPriceExtraVnd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceChildUsd.Text))
                {
                    roomPrice.PriceChildUsd = Convert.ToDecimal(txtPriceChildUsd.Text);
                }
                if (!string.IsNullOrEmpty(txtPriceChildVnd.Text))
                {
                    roomPrice.PriceChildVnd = Convert.ToDecimal(txtPriceChildVnd.Text);
                }
                roomPrice.GroupCruise    = group;
                roomPrice.AgentLevelCode = agentLvCode;
                roomPrice.QQuotation     = quotation;
                roomPrice.Trip           = trip;
                if (checkIsDelete.Checked)
                {
                    module.Delete(roomPrice);
                }
                else
                {
                    module.SaveOrUpdate(roomPrice);
                }
            }
            //save charter range

            foreach (RepeaterItem cruiseItem in rptCruise.Items)
            {
                var hidCruise   = cruiseItem.FindControl("hidCruise") as HiddenField;
                var cruiseprice = cruiseItem.FindControl("cruiseprice") as CruiseCharterConfigPrice;
                if (cruiseprice != null)
                {
                    if (hidCruise != null && !string.IsNullOrWhiteSpace(hidCruise.Value))
                    {
                        var cruise = module.GetById <Cruise>(Convert.ToInt32(hidCruise.Value));
                        cruiseprice.SaveDataConfig(module, cruise, group, agentLvCode, trip, quotation);
                    }
                }
            }
        }
コード例 #11
0
 public void SaveAgentLevelPriceConfig(string agentLvCode, SailsModule module, int groupId, QQuotation qQuotation)
 {
     quotationPrice2Day.SaveQuotationPriceConfig(module, agentLvCode, 2, groupId, qQuotation);
     quotationPrice3Day.SaveQuotationPriceConfig(module, agentLvCode, 3, groupId, qQuotation);
 }
コード例 #12
0
        public void SetGroupCruise(string agentLvCode, SailsModule module, int groupId, QQuotation quotation)
        {
            var group = module.GetById <QCruiseGroup>(groupId);

            litGroupName.Text = group.Name;
            AgentLevelCode    = agentLvCode;
            quotationPrice2Day.NewQuotationPriceConfig(module, agentLvCode, 2, group, quotation);
            quotationPrice3Day.NewQuotationPriceConfig(module, agentLvCode, 3, group, quotation);
        }
コード例 #13
0
        public IList <QGroupRomPrice> GetGroupRoomPrice(int groupId, string agentLvCode, int trip, QQuotation quotation)
        {
            var queryOver = _commonDao.OpenSession().QueryOver <QGroupRomPrice>();

            queryOver.Where(x => x.GroupCruise.Id == groupId && x.AgentLevelCode == agentLvCode && x.Trip == trip);
            if (quotation != null && quotation.Id > 0)
            {
                queryOver.Where(x => x.QQuotation.Id == quotation.Id);
            }
            return(queryOver.List <QGroupRomPrice>());
        }
コード例 #14
0
        private void WriteSheetByTrip(string tripName, int tripDay, QQuotation quotation, ref int rowQ, ref ExcelWorksheet sheet)
        {
            sheet.Cells[rowQ, 0].Value = tripName;
            rowQ += 2;
            var groups = Module.GetCruiseGroup();

            foreach (QCruiseGroup group in groups)
            {
                sheet.Cells[rowQ, 0].Value = group.Name;
                rowQ++;
                // display price room
                // display room type header
                var roomTypes = Module.GetRoomType(group);
                sheet.Cells[rowQ, 0].Value = "LOẠI PHÒNG";
                for (int i = 0; i < roomTypes.Count; i++)
                {
                    sheet.Cells[rowQ, i + 1].Value = roomTypes[i].Name;
                }
                // display rooom class
                rowQ++;
                var roomClasses = Module.GetRoomClass(group);
                foreach (QRoomClass roomClass in roomClasses)
                {
                    sheet.Cells[rowQ, 0].Value = roomClass.Roomclass;
                    var idextype = 1;
                    foreach (QRoomType roomType in roomTypes)
                    {
                        var roomPrice = Module.GetRoomPrice(quotation, roomType.Group, roomClass, roomType, tripDay);
                        if (roomPrice != null)
                        {
                            sheet.Cells[rowQ, idextype].Value = string.Format("USD: {0:#,0.#} {2}VND: {1:#,0.#}", roomPrice.Priceusd, roomPrice.Pricevnd, Environment.NewLine);
                        }
                        idextype++;
                    }
                    rowQ++;
                }
                rowQ++;
                // display price charter
                sheet.Cells[rowQ, 1].Value = "THUÊ TRỌN TÀU";
                rowQ++;

                var cruiseCharterRanges = Module.GetCruiseCharterRange(group);
                var cruises             = new List <QCruiseCharterRange>();
                foreach (var charterRange in cruiseCharterRanges)
                {
                    if (cruises.All(c => c.Cruise != charterRange.Cruise))
                    {
                        cruises.Add(charterRange);
                    }
                }

                foreach (QCruiseCharterRange cruseCharter in cruises)
                {
                    // write cruise name
                    sheet.Cells[rowQ, 0].Value = string.Format("{0} {1} cabins", cruseCharter.Cruise.Name, cruseCharter.Cruise.Rooms.Count);
                    var rowQ0      = rowQ;
                    var listRanges = Module.GetCruiseCharterRange(cruseCharter.Group).Where(c => c.Cruise == cruseCharter.Cruise).ToList();
                    // write header
                    if (cruseCharter.CharterRangeConfig != null)
                    {
                        for (int j = 0; j < listRanges.Count; j++)
                        {
                            sheet.Cells[rowQ, j + 1].Value = listRanges[j].CharterRangeConfig.Name;
                        }
                        rowQ++;

                        var mergedRange = sheet.Cells.GetSubrange(string.Format("A{0}:A{1}", rowQ0 + 1, rowQ + 1));
                        mergedRange.Merged = true;
                        mergedRange.Style.VerticalAlignment   = VerticalAlignmentStyle.Center;
                        mergedRange.Style.HorizontalAlignment = HorizontalAlignmentStyle.Center;
                    }
                    var idexRange = 1;
                    foreach (QCruiseCharterRange charterRange in listRanges)
                    {
                        var rangePrice = Module.GetCharterRangePrice(quotation, charterRange, tripDay);
                        if (rangePrice != null)
                        {
                            sheet.Cells[rowQ, idexRange].Value = string.Format("USD: {0:#,0.#} {2}VND: {1:#,0.#}", rangePrice.Priceusd, rangePrice.Pricevnd, Environment.NewLine);
                        }
                        idexRange++;
                    }
                    rowQ++;
                }
                rowQ += 2;
            }
            rowQ += 2;
        }