private void ShowData(int propertyId, string y)
        {
            if (string.IsNullOrEmpty(y) || propertyId <= 0)
            {
                lbError.Visible    = true;
                lbCalendar.Visible = true;
                lbCompany.Visible  = true;
            }
            else
            {
                lbError.Visible               = false;
                lbCalendar.Visible            = false;
                lbCompany.Visible             = false;
                divJqgrid.Attributes["style"] = "";

                var username = Session["UserSession"].ToString();
                var user     = UserHelper.GetUser(username);

                if (user.PropertyId == 15)//OHG ID
                {
                    divExportAllData.Attributes["style"] = "";
                }

                var hotelEntry = new HotelDataEntryLib.HotelBudget()
                {
                    PropertyId = propertyId,
                    Year       = Convert.ToInt32(y)
                };

                if (HotelBudgetHelper.ExistYear(hotelEntry))
                {
                    var exsitEntry = HotelBudgetHelper.GetHotelEntry(hotelEntry);
                    BindBudgetEntryJqgrid(exsitEntry);
                }
                else
                {
                    var newEntry = HotelBudgetHelper.AddHotelEntryListByYear(hotelEntry);
                    BudgetHelper.AddBudgetEntryListByYear(newEntry, Session["UserSession"].ToString());
                    BindBudgetEntryJqgrid(newEntry);
                }
            }
        }
Exemple #2
0
        private void ShowData(int propertyId, string my)
        {
            if (string.IsNullOrEmpty(my) || propertyId <= 0)
            {
                lbError.Visible               = true;
                lbCalendar.Visible            = true;
                lbCompany.Visible             = true;
                divReport.Attributes["style"] = "display:none";
            }
            else
            {
                lbError.Visible               = false;
                lbCalendar.Visible            = false;
                lbCompany.Visible             = false;
                divReport.Attributes["style"] = "";
                divJqgrid.Attributes["style"] = "";

                var username = Session["UserSession"].ToString();
                var user     = UserHelper.GetUser(username);

                if (user.PropertyId == 15)//OHG ID
                {
                    divExportAllData.Attributes["style"] = "";
                }

                var str = my.Split('/');
                if (!string.IsNullOrEmpty(str[0]) && !string.IsNullOrEmpty(str[1]))
                {
                    Session["PropertyIdReport"] = propertyId;              //for reports.aspx property
                    Session["YearReport"]       = Convert.ToInt32(str[1]); //for reports.aspx year
                    var hotelEntry = new HotelDataEntryLib.HotelRevenue()
                    {
                        PropertyId = propertyId,
                        Month      = Convert.ToInt32(str[0]),
                        Year       = Convert.ToInt32(str[1])
                    };

                    if (HotelRevenueHelper.ExistMothYear(hotelEntry))
                    {
                        var exsitEntry = HotelRevenueHelper.GetHotelEntry(hotelEntry);
                        BindDataEntryJqgrid(exsitEntry);
                    }
                    else
                    {
                        var budgetEntry = new HotelBudget()
                        {
                            PropertyId = hotelEntry.PropertyId,
                            Year       = hotelEntry.Year
                        };
                        if (!HotelBudgetHelper.ExistYear(budgetEntry))
                        {
                            var newBudgetEntry = HotelBudgetHelper.AddHotelEntryListByYear(budgetEntry);
                            BudgetHelper.AddBudgetEntryListByYear(newBudgetEntry, Session["UserSession"].ToString());
                        }
                        var newEntry = HotelRevenueHelper.AddHotelEntryListByMonthYear(hotelEntry);
                        RevenueHelper.AddRevenueEntryListByMonthYear(newEntry, Session["UserSession"].ToString());
                        BindDataEntryJqgrid(newEntry);
                    }
                }
            }
        }