public Schema()
     : base()
 {
     InstanceType = typeof(__CoCorporat__);
     Properties.ClearExposed();
     CorpName = Add <__TString__>("CorpName");
     CorpName.DefaultValue = "";
     CorpName.SetCustomAccessors((_p_) => { return(((__CoCorporat__)_p_).__bf__CorpName__); }, (_p_, _v_) => { ((__CoCorporat__)_p_).__bf__CorpName__ = (System.String)_v_; }, false);
     FranchisesCount = Add <__TLong__>("FranchisesCount");
     FranchisesCount.DefaultValue = 0L;
     FranchisesCount.SetCustomAccessors((_p_) => { return(((__CoCorporat__)_p_).__bf__FranchisesCount__); }, (_p_, _v_) => { ((__CoCorporat__)_p_).__bf__FranchisesCount__ = (System.Int64)_v_; }, false);
     AllFranchisesSorted = Add <__TArray__>("AllFranchisesSorted", bind: "AllFranchisesSorted");
     AllFranchisesSorted.SetCustomGetElementType((arr) => { return(__CCoAllFranc__.DefaultTemplate); });
     AllFranchisesSorted.SetCustomAccessors((_p_) => { return(((__CoCorporat__)_p_).__bf__AllFranchisesSorted__); }, (_p_, _v_) => { ((__CoCorporat__)_p_).__bf__AllFranchisesSorted__ = (__Arr__)_v_; }, false);
     FranchiseName = Add <__TString__>("FranchiseName$");
     FranchiseName.DefaultValue = "";
     FranchiseName.Editable     = true;
     FranchiseName.SetCustomAccessors((_p_) => { return(((__CoCorporat__)_p_).__bf__FranchiseName__); }, (_p_, _v_) => { ((__CoCorporat__)_p_).__bf__FranchiseName__ = (System.String)_v_; }, false);
     CreateFranchiseTrigger = Add <__TLong__>("CreateFranchiseTrigger$");
     CreateFranchiseTrigger.DefaultValue = 0L;
     CreateFranchiseTrigger.Editable     = true;
     CreateFranchiseTrigger.SetCustomAccessors((_p_) => { return(((__CoCorporat__)_p_).__bf__CreateFranchiseTrigger__); }, (_p_, _v_) => { ((__CoCorporat__)_p_).__bf__CreateFranchiseTrigger__ = (System.Int64)_v_; }, false);
     CreateFranchiseTrigger.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.CreateFranchiseTrigger()
         {
             App = (CorporationJsonFranchise)pup, Template = (TLong)prop, Value = value
         }); }, (Json pup, Starcounter.Input <Int64> input) => { ((CorporationJsonFranchise)pup).Handle((Input.CreateFranchiseTrigger)input); });
     SortOnTrigger = Add <__TLong__>("SortOnTrigger$");
     SortOnTrigger.DefaultValue = 0L;
     SortOnTrigger.Editable     = true;
     SortOnTrigger.SetCustomAccessors((_p_) => { return(((__CoCorporat__)_p_).__bf__SortOnTrigger__); }, (_p_, _v_) => { ((__CoCorporat__)_p_).__bf__SortOnTrigger__ = (System.Int64)_v_; }, false);
     SortOnTrigger.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.SortOnTrigger()
         {
             App = (CorporationJsonFranchise)pup, Template = (TLong)prop, Value = value
         }); }, (Json pup, Starcounter.Input <Int64> input) => { ((CorporationJsonFranchise)pup).Handle((Input.SortOnTrigger)input); });
 }
 public Schema()
     : base()
 {
     InstanceType = typeof(__Corporat__);
     Properties.ClearExposed();
     Html = Add <__TString__>("Html");
     Html.DefaultValue = "/Haseeb/CorporationJson.html";
     Html.SetCustomAccessors((_p_) => { return(((__Corporat__)_p_).__bf__Html__); }, (_p_, _v_) => { ((__Corporat__)_p_).__bf__Html__ = (System.String)_v_; }, false);
     CorpName = Add <__TString__>("CorpName$");
     CorpName.DefaultValue = "";
     CorpName.Editable     = true;
     CorpName.SetCustomAccessors((_p_) => { return(((__Corporat__)_p_).__bf__CorpName__); }, (_p_, _v_) => { ((__Corporat__)_p_).__bf__CorpName__ = (System.String)_v_; }, false);
     CreateCorpTrigger = Add <__TLong__>("CreateCorpTrigger$");
     CreateCorpTrigger.DefaultValue = 0L;
     CreateCorpTrigger.Editable     = true;
     CreateCorpTrigger.SetCustomAccessors((_p_) => { return(((__Corporat__)_p_).__bf__CreateCorpTrigger__); }, (_p_, _v_) => { ((__Corporat__)_p_).__bf__CreateCorpTrigger__ = (System.Int64)_v_; }, false);
     CreateCorpTrigger.AddHandler((Json pup, Property <Int64> prop, Int64 value) => { return(new Input.CreateCorpTrigger()
         {
             App = (CorporationJson)pup, Template = (TLong)prop, Value = value
         }); }, (Json pup, Starcounter.Input <Int64> input) => { ((CorporationJson)pup).Handle((Input.CreateCorpTrigger)input); });
     AllCorporation = Add <__TArray1__>("AllCorporation", bind: "AllCorporation");
     AllCorporation.SetCustomGetElementType((arr) => { return(__CoCorporat__.DefaultTemplate); });
     AllCorporation.SetCustomAccessors((_p_) => { return(((__Corporat__)_p_).__bf__AllCorporation__); }, (_p_, _v_) => { ((__Corporat__)_p_).__bf__AllCorporation__ = (__Arr1__)_v_; }, false);
 }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoginButton.Style.Add(HtmlTextWriterStyle.Visibility, "hidden");

            if (EveTrusted)
            {
                using (PlexingFleetDataContext context = new PlexingFleetDataContext(WebConfigurationManager.ConnectionStrings["PlexManagerConnectionString"].ConnectionString))
                {
                    var user = context.PlexUsers.FirstOrDefault(x => x.CharacterId == CharacterId);

                    if (user != null)
                    {
                        UsernameTextBox.Text = CharacterName;

                        if (user.AllianceId != AllianceId || user.CorpId != CorpId)
                        {
                            Corp corp = context.Corps.FirstOrDefault(x => x.CorpId == CorpId);

                            if (corp == null)
                            {
                                Response.Redirect(PageReferrer.Page_Anonymous_AccessRequest);
                            }

                            //If the user have switched alliance and/or corporation update the database with the new information.
                            user.AllianceId   = AllianceId;
                            user.AllianceName = AllianceName;
                            user.CorpId       = CorpId;
                            user.CorpName     = CorpName;

                            //corp = context.Corps.FirstOrDefault(x => x.CorpId == CorpId);

                            //The user have switched to a new corp that have not been registered yet
                            if (corp == null)
                            {
                                corp              = new Corp();
                                corp.CorpId       = CorpId;
                                corp.CorpName     = CorpName;
                                corp.AllianceId   = AllianceId;
                                corp.AllianceName = AllianceName;
                                corp.CorpTag      = CorpName.Length > 5 ? CorpName.Substring(0, 5) : CorpName;
                                corp.AllianceTag  = AllianceName.Length > 5 ? AllianceName.Substring(0, 5) : AllianceName;

                                context.Corps.InsertOnSubmit(corp);
                            }


                            context.SubmitChanges();
                        }

                        ShowLogin(true);
                        return;
                    }
                    else
                    {
                        Response.Redirect(PageReferrer.Page_Register);
                    }
                }
            }
            else
            {
                RememberMeCheckBox.Visible = false;
                RememberMeCheckBox.Checked = false;
                //ShowLogin(false);
            }
        }
    }