protected void JqgridTeam_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e)
 {
     if (Session["seasonid"] == null)
     {
         return;
     }
     if (Convert.ToInt32(Session["seasonid"]) == 0)
     {
         return;
     }
     using (var dc = ThaitaeDataDataContext.Create())
     {
         var objTeam = new Team
         {
             TeamName = e.RowData["TeamName"].Trim(),
             TeamDesc = e.RowData["TeamDesc"].Trim(),
             Active   = Convert.ToByte(e.RowData["ActiveName"]),
             Guid     = Guid.NewGuid()
         };
         dc.Teams.InsertOnSubmit(objTeam);
         dc.SubmitChanges();
         dc.TeamSeasons.InsertOnSubmit(new TeamSeason
         {
             SeasonId = Convert.ToInt32(Session["seasonid"]),
             TeamId   = objTeam.TeamId
         });
         dc.SubmitChanges();
     }
 }
Example #2
0
        protected void JqgridSeason_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e)
        {
            if (Session["leagueid"] == null)
            {
                return;
            }
            if (Convert.ToInt32(Session["leagueid"]) == 0)
            {
                return;
            }
            var league = LeagueHelper.GetLeague(Convert.ToInt32(Session["leagueid"]));

            using (var dc = ThaitaeDataDataContext.Create())
            {
                if (league.LeagueType == 1)
                {
                    var season = new thaitae.lib.Season
                    {
                        LeagueId   = Convert.ToInt32(Session["leagueid"]),
                        SeasonName = e.RowData["SeasonName"],
                        SeasonDesc = e.RowData["SeasonDesc"]
                    };
                    dc.Seasons.InsertOnSubmit(season);
                    dc.SubmitChanges();
                    var leagueList = LeagueHelper.GetChampionsLeagueGroupList();
                    foreach (var championGroup in leagueList)
                    {
                        var seasonGroup = new thaitae.lib.Season
                        {
                            LeagueId               = championGroup.LeagueId,
                            SeasonName             = e.RowData["SeasonName"],
                            SeasonDesc             = e.RowData["SeasonDesc"],
                            ChampionLeagueSeasonId = championGroup.LeagueType == 2 ? (int?)null : season.SeasonId
                        };
                        dc.Seasons.InsertOnSubmit(seasonGroup);
                    }
                    dc.SubmitChanges();
                }
                else
                {
                    dc.Seasons.InsertOnSubmit(new thaitae.lib.Season
                    {
                        LeagueId   = Convert.ToInt32(Session["leagueid"]),
                        SeasonName = e.RowData["SeasonName"],
                        SeasonDesc = e.RowData["SeasonDesc"]
                    });
                    dc.SubmitChanges();
                }
            }
        }
Example #3
0
 protected void JqgridNews_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e)
 {
     using (var dc = ThaitaeDataDataContext.Create())
     {
         var news = new New
         {
             newsContent = e.RowData["newsContent"],
             newsTopic   = e.RowData["newsTopic"],
             newsType    = Convert.ToInt32(e.RowData["NewsTypeName"])
         };
         dc.News.InsertOnSubmit(news);
         dc.SubmitChanges();
     }
 }
Example #4
0
 protected void JqgridLeague1_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e)
 {
     using (var dc = ThaitaeDataDataContext.Create())
     {
         var league = new thaitae.lib.League
         {
             LeagueName = e.RowData["LeagueName"],
             LeagueType = Convert.ToInt32(e.RowData["LeagueTypeName"]),
             LeagueDesc = e.RowData["LeagueDesc"],
             Active     = Convert.ToByte(e.RowData["ActiveName"])
         };
         dc.Leagues.InsertOnSubmit(league);
         dc.SubmitChanges();
     }
 }
Example #5
0
        protected void JqgridCompany_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e)
        {
            var status   = e.RowData["StatusLabel"];
            var currency = e.RowData["CurrencyCode"];

            if (!(string.IsNullOrEmpty(status) || string.IsNullOrEmpty(currency)))
            {
                var property = new HotelDataEntryLib.Property()
                {
                    PropertyCode   = e.RowData["PropertyCode"],
                    PropertyName   = e.RowData["PropertyName"],
                    Status         = Convert.ToInt32(status),
                    UpdateDateTime = DateTime.Now,
                    CurrencyId     = Convert.ToInt32(currency)
                };
                PropertyHelper.AddProperty(property);
            }
        }
Example #6
0
        protected void JqgridCurrency_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e)
        {
            var status = e.RowData["StatusLabel"];
            var isBase = e.RowData["IsBaseLabel"];
            var rate   = e.RowData["ConversionRate"];

            if (!(string.IsNullOrEmpty(status) || string.IsNullOrEmpty(isBase) || string.IsNullOrEmpty(rate)))
            {
                var currency = new HotelDataEntryLib.Currency()
                {
                    CurrencyName   = e.RowData["CurrencyName"],
                    CurrencyCode   = e.RowData["CurrencyCode"],
                    Status         = Convert.ToInt32(status),
                    ConversionRate = Convert.ToDouble(rate),
                    IsBase         = Convert.ToInt32(isBase)
                };
                CurrencyHelper.AddCurrency(currency);
            }
        }
        protected void JqgridService_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e)
        {
            var serviceName = e.RowData["ServiceName"];
            var url         = e.RowData["ServiceUrl"];
            var desc        = e.RowData["Description"];
            var admin       = Session["UserSession"].ToString();

            if (!(string.IsNullOrEmpty(url) || string.IsNullOrEmpty(serviceName) || string.IsNullOrEmpty(desc)))
            {
                var service = new DataModelLib.Service()
                {
                    ServiceName = serviceName,
                    ServiceURL  = url,
                    UpdateUser  = admin,
                    Description = desc
                };
                ServiceHelper.AddService(service);
            }
        }
Example #8
0
        protected void JqgridUserService_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e)
        {
            var user    = e.RowData["Username"];
            var service = e.RowData["Description"];
            var ips     = e.RowData["Ips"];
            var status  = e.RowData["StatusLabel"];
            var admin   = Session["UserSession"].ToString();

            if (!(string.IsNullOrEmpty(user) || string.IsNullOrEmpty(status) || string.IsNullOrEmpty(service)))
            {
                var userService = new DataModelLib.UserService()
                {
                    UserId     = Convert.ToInt32(user),
                    ServiceId  = Convert.ToInt32(service),
                    Ips        = ips,
                    Status     = Convert.ToInt32(status),
                    UpdateUser = admin
                };
                UserServiceHelper.AddUserService(userService);
            }
        }
Example #9
0
        protected void JqgridUser_RowAdding(object sender, Trirand.Web.UI.WebControls.JQGridRowAddEventArgs e)
        {
            var password    = e.RowData["Password"];
            var username    = e.RowData["Username"];
            var description = e.RowData["Description"];
            var admin       = Session["UserSession"].ToString();

            if (!(string.IsNullOrEmpty(password) || string.IsNullOrEmpty(username)))
            {
                var user = new DataModelLib.User()
                {
                    Username    = username,
                    Password    = password,
                    Description = description,
                    UpdateUser  = admin
                };
                if (UserHelper.IsUserExist(user.Username))
                {
                    return;
                }
                UserHelper.AddUser(user);
            }
        }