protected void uiLinkButtonCancel_Click(object sender, EventArgs e) { CurrentActivityLog = null; uiPanelViewAll.Visible = true; uiPanelEdit.Visible = false; ClearFields(); }
protected void uiButtonSave_Click(object sender, EventArgs e) { ActivitiesLog objdata = new ActivitiesLog(); objdata.AddNew(); for (int i = 0; i <= uiRadDatePickerTo.SelectedDate.Value.Day - uiRadDatePickerFrom.SelectedDate.Value.Day; i++) { objdata.AddNew(); objdata.CrewID = Convert.ToInt32(uiRadComboBoxCabin.SelectedValue); objdata.ActivityID = Convert.ToInt32(uiRadComboBoxActivity.SelectedValue); objdata.FromDate = uiRadDatePickerFrom.SelectedDate.Value; objdata.TODate = uiRadDatePickerTo.SelectedDate.Value; objdata.Date = uiRadDatePickerFrom.SelectedDate.Value.AddDays(i); } objdata.Save(); BindData(); uiPanelViewAll.Visible = true; uiPanelEdit.Visible = false; ClearFields(); }
protected void uiRadGridActivityLog_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e) { if (e.CommandName == "EditActivityLog") { ActivitiesLog objData = new ActivitiesLog(); objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())); uiRadComboBoxCabin.SelectedValue = objData.CrewID.ToString(); uiRadComboBoxActivity.SelectedValue = objData.ActivityID.ToString(); uiRadDatePickerFrom.SelectedDate = objData.FromDate; uiRadDatePickerTo.SelectedDate = objData.TODate; CurrentActivityLog = objData; uiPanelEdit.Visible = true; uiPanelViewAll.Visible = false; } else if (e.CommandName == "DeleteActivityLog") { ActivitiesLog objData = new ActivitiesLog(); string[] param = e.CommandArgument.ToString().Split(new Char[] { '#' }); objData.GetAllActivityLogForDelete(Convert.ToDateTime(param[0]), Convert.ToDateTime(param[1]), Convert.ToInt32(param[3]), Convert.ToInt32(param[2])); objData.DeleteAll(); objData.Save(); BindData(); } }
private void BindData() { ActivitiesLog objdata = new ActivitiesLog(); objdata.GetAllActivityLog((uiRadDatePickerFromSearch.SelectedDate != null) ? uiRadDatePickerFromSearch.SelectedDate.Value : DateTime.ParseExact("01/01/1900", "dd/MM/yyyy", null), (uiRadDatePickerToSearch.SelectedDate != null) ? uiRadDatePickerToSearch.SelectedDate.Value : DateTime.ParseExact("01/01/2500", "dd/MM/yyyy", null), Convert.ToInt32(uiRadComboBoxActSearch.SelectedValue), Convert.ToInt32(uiRadComboBoxCrewSearch.SelectedValue)); uiRadGridActivityLog.DataSource = objdata.DefaultView; uiRadGridActivityLog.DataBind(); }