示例#1
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        int campYearID = Int32.Parse(ddlCampYear.SelectedValue);

        using (var ctx = new CIPMSEntities1())
        {
            var list = from grantrow in ctx.tblFedCampGrants
                       where grantrow.CampYearID == campYearID - 1
                       orderby grantrow.FederationID, grantrow.CampID
            select grantrow;

            foreach (var row in list)
            {
                // create new FedCampGrant
                ctx.AddTotblFedCampGrants(new tblFedCampGrant
                {
                    CampYearID   = campYearID,
                    CampID       = row.CampID == 0 ? 0 : row.CampID + 1000,
                    FederationID = row.FederationID,
                    TimeInCamp   = row.TimeInCamp,
                    DaysAtLeast  = row.DaysAtLeast,
                    GrantAmount  = row.GrantAmount
                });
            }

            ctx.SaveChanges();
        }
        lblMsg.Text = "Data generated successfully.";
    }
示例#2
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        int campYearID = Int32.Parse(ddlCampYear.SelectedValue);

        using (CIPMSEntities1 ctx = new CIPMSEntities1())
        {
            var list = from row in ctx.tblUserCamps
                       where row.CampYearid == campYearID - 1
                       orderby row.UserId, row.CampId
            select row;

            foreach (var row in list)
            {
                // create new detail rows.  EF will insert entities automatically because referecing to the existing camps
                ctx.AddTotblUserCamps(new tblUserCamp
                {
                    CampYearid = campYearID,
                    UserId     = row.UserId,
                    CampId     = row.CampId + 1000
                });
            }
            ctx.SaveChanges();
        }
        lblMsg.Text = "Data generated successfully.";
    }
示例#3
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        int campYearID = Int32.Parse(ddlCampYear.SelectedValue);

        using (var ctx = new CIPMSEntities1())
        {
            var list = from camp in ctx.tblCamps
                       where camp.CampYearID == campYearID - 1
                       select camp;

            foreach (var newCamp in list)
            {
                ctx.AddTotblCamps(new tblCamp
                {
                    CampYearID   = campYearID,
                    ID           = newCamp.ID + 1000,
                    Inactive     = false,
                    Name         = newCamp.Name,
                    IsManual     = false,
                    State        = newCamp.State,
                    JDataID      = newCamp.JDataID,
                    IsWestCamp   = newCamp.IsWestCamp,
                    IsAdamahCamp = newCamp.IsAdamahCamp,
                    IsURJCamp    = newCamp.IsURJCamp
                });
            }

            ctx.SaveChanges();
        }
        lblMsg.Text = "Data generated successfully.";
    }
示例#4
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        int campYearID = Int32.Parse(ddlCampYear.SelectedValue);

        using (CIPMSEntities1 ctx = new CIPMSEntities1())
        {
            var list = from row in ctx.tblNationalCamps
                       where row.CampYearID == campYearID - 1
                       orderby row.FederationID, row.CampID
            select row;

            foreach (var row in list)
            {
                // create new FedCampGrant
                ctx.AddTotblNationalCamps(new tblNationalCamp
                {
                    CampYearID   = campYearID,
                    CampID       = row.CampID + 1000,
                    FederationID = row.FederationID
                });
            }

            ctx.SaveChanges();
        }
        lblMsg.Text = "Data generated successfully.";
    }
示例#5
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        int campYearID = Int32.Parse(ddlCampYear.SelectedValue);

        using (var ctx = new CIPMSEntities1())
        {
            var list = from row in ctx.tblFederationCamps.Include("tblCamp")
                       where row.CampYearID == campYearID - 1
                       orderby row.FederationID, row.tblCamp.ID
            select row;

            foreach (var row in list)
            {
                if (row.tblCamp != null)
                {
                    var camp = ctx.tblCamps.Where(x => x.ID == row.tblCamp.ID + 1000).FirstOrDefault();

                    if (camp != null)
                    {
                        var p = new tblFederationCamp
                        {
                            ID           = row.ID + 1000,
                            CampYearID   = campYearID,
                            tblCamp      = camp,
                            FederationID = row.FederationID,
                            isJDS        = row.isJDS,
                            Inactive     = false
                        };
                    }
                }
            }
            ctx.SaveChanges();
        }
        lblMsg.Text = "Data generated successfully.";
    }
示例#6
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        int campYearID = Int32.Parse(ddlCampYear.SelectedValue);

        using (CIPMSEntities1 ctx = new CIPMSEntities1())
        {
            var list = from row in ctx.tblFederationGrades
                       where row.CampYearID == campYearID - 1
                       orderby row.FederationID, row.EligibleGrade
            select row;

            foreach (var row in list)
            {
                // create new detail rows.  EF will insert entities automatically because referecing to the existing camps
                if (row.FederationID != 89)
                {
                    ctx.AddTotblFederationGrades(new tblFederationGrade
                    {
                        CampYearID    = campYearID,
                        FederationID  = row.FederationID,
                        EligibleGrade = row.EligibleGrade,
                        TimeInCamp    = row.TimeInCamp
                    });
                }
            }
            ctx.SaveChanges();
        }
        lblMsg.Text = "Data generated successfully.";
    }
示例#7
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        int campYearID = Int32.Parse(ddlCampYear.SelectedValue);

        using (var ctx = new CIPMSEntities1())
        {
            var list = from row in ctx.tblFederationCampsContactDetails.Include("tblCamp")
                       where row.CampYearID == campYearID - 1
                       orderby row.FederationID, row.tblCamp.ID
            select row;

            foreach (var row in list)
            {
                // create new detail rows.  EF will insert entities automatically because referecing to the existing camps
                var p = new tblFederationCampsContactDetail
                {
                    CampYearID    = campYearID,
                    tblCamp       = ctx.tblCamps.Where(x => x.ID == row.tblCamp.ID + 1000).First(),
                    FederationID  = row.FederationID,
                    Contact       = row.Contact,
                    Phone         = row.Phone,
                    Email         = row.Email,
                    NavigationURL = row.NavigationURL,
                    ParentInfoPreviousClickURL = row.ParentInfoPreviousClickURL
                };
            }
            ctx.SaveChanges();
        }
        lblMsg.Text = "Data generated successfully.";
    }