コード例 #1
0
ファイル: BookingAdmin.aspx.cs プロジェクト: bneuhold/pb-dev
    protected UltimateDC.Agency GetAgency()
    {
        if (_agency == null)
        {
            UltimateDataContext dc = new UltimateDataContext();

            int agencyId = 0;

            if (Int32.TryParse(Request.QueryString["agencyid"], out agencyId))
            {
                bool isAdmin = User.IsInRole("Administrators");

                _agency = (from p in dc.Agencies
                           where p.Id == agencyId && (isAdmin || p.PlaceberryUser.aspnet_User.UserName == User.Identity.Name)
                           select p).SingleOrDefault();
            }

            if (_agency == null)
            {
                //Ne postoji ili trenutni korisnik nema prava
                Response.Redirect("/manage/customer.aspx");
            }
        }

        return _agency;
    }
コード例 #2
0
ファイル: Agency.aspx.cs プロジェクト: bneuhold/pb-dev
    public static bool CheckAgencyExists(string agency)
    {
        bool exists = false;
        agency = agency == null ? string.Empty : agency.Trim().ToLower();

        using (UltimateDataContext dc = new UltimateDataContext())
        {
            exists = dc.Agencies.Any(i => i.Name.ToLower() == agency);
        }

        return exists;
    }
コード例 #3
0
ファイル: Agency.aspx.cs プロジェクト: bneuhold/pb-dev
    private void FetchAgency()
    {
        string agencyTag = Common.FixQueryStringUrlTag(Request.QueryString["agencytag"] ?? string.Empty);

        agency = (from p in dc.AgencyUrlTags
                  where p.UrlTag == agencyTag
                  select p.Agency).SingleOrDefault();

        if (agency == null)
        {
            //Ne postoji
            Response.Redirect("/", true);
        }
    }
コード例 #4
0
ファイル: Accommodation.aspx.cs プロジェクト: bneuhold/pb-dev
    private void FetchAgency()
    {
        int agencyId = 0;
        int.TryParse(Request["agencyId"] == null ? string.Empty : Request["agencyId"], out agencyId);
        bool admin = User.IsInRole("Administrators");

        agency = (from p in dc.Agencies
                  where p.Id == agencyId && (admin || p.PlaceberryUser.aspnet_User.UserName == User.Identity.Name)
                  select p).SingleOrDefault();

        if (agency == null)
        {
            //Ne postoji ili trenutni korisnik nema prava
            Response.Redirect("/manage/customer.aspx");
        }

        aBackToAgency.HRef = String.Format("/manage/Agency.aspx?agencyid={0}", agency.Id);
    }
コード例 #5
0
ファイル: Agency.aspx.cs プロジェクト: bneuhold/pb-dev
    protected void NewAgency()
    {
        mvwContainer.ActiveViewIndex = 1;

        hAgency.InnerText = "Unos agencije";
        imgLogoE.Visible = false;

        agency = new UltimateDC.Agency();
        agency.ManagerId = (Guid)Membership.GetUser().ProviderUserKey;

        dc.Agencies.InsertOnSubmit(agency);

        btnSave.CommandName = "new";

        if (!IsPostBack)
            ddlLanguage.SelectedValue = Common.GetLanguageId().ToString();
    }