示例#1
0
 protected void JqgridUser_RowAdding(object sender, JQGridRowAddEventArgs e)
 {
     var status = e.RowData["StatusLabel"];
     var mainCompany = e.RowData["PropertyCode"];
     var accessProperties = e.RowData["AccessProperties"];
     var permissionId = e.RowData["PermissionName"];
     var position = e.RowData["Position"];
     var username = e.RowData["Username"];
     if (!(string.IsNullOrEmpty(status) || string.IsNullOrEmpty(mainCompany) || string.IsNullOrEmpty(permissionId)))
     {
         var user = new HotelDataEntryLib.User()
         {
             PropertyId = Convert.ToInt32(mainCompany),
             FirstName = e.RowData["FirstName"],
             LastName = e.RowData["LastName"],
             Email = e.RowData["Email"],
             Status = Convert.ToInt32(status),
             UpdateDateTime = DateTime.Now,
             AccessProperties = accessProperties,
             PermissionId = Convert.ToInt32(permissionId),
             Username = username,
             Position = position
         };
         if (UserHelper.IsUserExist(user.Username)) return;
         UserHelper.AddUserProfile(user);
     }
 }
 protected void JqgridMatch1_RowAdding(object sender, JQGridRowAddEventArgs e)
 {
     var teamWin = "<b style='color: red'>ยังไม่มีผลการแข่งขัน</b>";
     var hasResult = 0;
     var homeScore = String.IsNullOrEmpty(e.RowData["TeamHomeScore"])
                         ? 0
                         : Convert.ToInt32(e.RowData["TeamHomeScore"]);
     var awayScore = String.IsNullOrEmpty(e.RowData["TeamAwayScore"])
                         ? 0
                         : Convert.ToInt32(e.RowData["TeamAwayScore"]);
     var date = String.IsNullOrEmpty(e.RowData["FAMatchDate"])
                    ? DateTime.Now
                    : Convert.ToDateTime(e.RowData["FAMatchDate"]);
     if (homeScore > awayScore)
     {
         teamWin = "<b style='color: blue'>" + e.RowData["TeamHomeName"] + "</b>";
         hasResult = 1;
     }
     else if (homeScore < awayScore)
     {
         teamWin = "<b style='color: blue'>" + e.RowData["TeamAwayName"] + "</b>";
         hasResult = 1;
     }
     var faMatch = new FAMatch
                       {
                           FAMatchDate = date,
                           TeamHomeName = e.RowData["TeamHomeName"],
                           TeamHomeScore = homeScore,
                           TeamAwayScore = awayScore,
                           TeamAwayName = e.RowData["TeamAwayName"],
                           TeamWin = teamWin,
                           HasResult = hasResult
                       };
     using (var dc = ThaitaeDataDataContext.Create())
     {
         dc.FAMatches.InsertOnSubmit(faMatch);
         dc.SubmitChanges();
     }
 }
        protected void JqgridMatch1_RowAdding(object sender, JQGridRowAddEventArgs e)
        {
            var homeId = String.IsNullOrEmpty(e.RowData["TeamHomeIdNameExtend"])
                                ? 0
                                : Convert.ToInt32(e.RowData["TeamHomeIdNameExtend"]);
            var awayId = String.IsNullOrEmpty(e.RowData["TeamAwayIdNameExtend"])
                                ? 0
                                : Convert.ToInt32(e.RowData["TeamAwayIdNameExtend"]);
            var date = String.IsNullOrEmpty(e.RowData["MatchDate"])
                           ? DateTime.Now
                           : Convert.ToDateTime(e.RowData["MatchDate"]);
            if (homeId == 0 || awayId == 0 || Convert.ToInt32(Session["seasonid"]) == 0) return;
            using (var dc = ThaitaeDataDataContext.Create())
            {
                var match1 = new Match
                {
                    MatchDate = date,
                    SeasonId = Convert.ToInt32(Session["seasonid"]),
                    TeamHomeId = homeId,
                    TeamAwayId = awayId
                };
                var match2 = new Match
                {
                    MatchDate = date,
                    SeasonId = Convert.ToInt32(Session["seasonid"]),
                    TeamHomeId = awayId,
                    TeamAwayId = homeId
                };
                dc.Matches.InsertOnSubmit(match2);
                dc.Matches.InsertOnSubmit(match1);
                dc.SubmitChanges();
                var teamHome1 = new TeamMatch
                {
                    TeamId = homeId,
                    TeamGoalFor = 0,
                    TeamGoalPenalty = 0,
                    TeamHome = 1,
                    SeasonId = Convert.ToInt32(Session["seasonid"]),
                    MatchId = match1.MatchId
                };

                var teamAway1 = new TeamMatch
                {
                    TeamId = awayId,
                    TeamGoalFor = 0,
                    TeamGoalPenalty = 0,
                    TeamHome = 0,
                    SeasonId = Convert.ToInt32(Session["seasonid"]),
                    MatchId = match1.MatchId
                };

                var teamHome2 = new TeamMatch
                {
                    TeamId = awayId,
                    TeamGoalFor = 0,
                    TeamGoalPenalty = 0,
                    TeamHome = 1,
                    SeasonId = Convert.ToInt32(Session["seasonid"]),
                    MatchId = match2.MatchId
                };

                var teamAway2 = new TeamMatch
                {
                    TeamId = homeId,
                    TeamGoalFor = 0,
                    TeamGoalPenalty = 0,
                    TeamHome = 0,
                    SeasonId = Convert.ToInt32(Session["seasonid"]),
                    MatchId = match2.MatchId
                };
                dc.TeamMatches.InsertOnSubmit(teamHome1);
                dc.TeamMatches.InsertOnSubmit(teamHome2);
                dc.TeamMatches.InsertOnSubmit(teamAway1);
                dc.TeamMatches.InsertOnSubmit(teamAway2);
                dc.SubmitChanges();
            }
        }
示例#4
0
 private void PerformRowAdd()
 {
     NameValueCollection nameValueCollection = new NameValueCollection();
     foreach (string name in HttpContext.Current.Request.Form.Keys)
     {
         nameValueCollection[name] = HttpContext.Current.Request.Form[name];
     }
     JQGridRowAddEventArgs jQGridRowAddEventArgs = new JQGridRowAddEventArgs();
     jQGridRowAddEventArgs.RowData = nameValueCollection;
     string text = this.QueryString["parentRowID"];
     if (!string.IsNullOrEmpty(text))
     {
         jQGridRowAddEventArgs.ParentRowKey = text;
     }
     this.OnRowAdding(jQGridRowAddEventArgs);
     if (!jQGridRowAddEventArgs.Cancel)
     {
         this.HandleInsert(jQGridRowAddEventArgs);
     }
     this.OnRowAdded(new EventArgs());
 }
示例#5
0
 private void HandleInsert(JQGridRowAddEventArgs e)
 {
     if (base.IsBoundUsingDataSourceID)
     {
         OrderedDictionary orderedDictionary = new OrderedDictionary();
         DataSourceView data = this.GetData();
         if (data == null)
         {
             throw new HttpException("DataSource is null in edit mode (on update)");
         }
         foreach (string text in e.RowData.Keys)
         {
             orderedDictionary.Add(text, e.RowData[text]);
         }
         data.Insert(orderedDictionary, new DataSourceViewOperationCallback(this.HandleInsertCallback));
     }
 }
示例#6
0
 protected internal virtual void OnRowAdding(JQGridRowAddEventArgs e)
 {
     JQGrid.JQGridRowAddEventHandler jQGridRowAddEventHandler = (JQGrid.JQGridRowAddEventHandler)base.Events[JQGrid.EventRowAdding];
     if (jQGridRowAddEventHandler != null)
     {
         jQGridRowAddEventHandler(this, e);
     }
 }