protected void SaveTask() { Task task = new Task(); TaskDL objTaskDL = new TaskDL(); ProcessResponse objResponse = new ProcessResponse(); if (Convert.ToInt64(hdActionId.Value) > 0) { objResponse.Command = "UPDATE"; task.ActionId = Convert.ToInt64(hdActionId.Value); } else { objResponse.Command = "INSERT"; } task.Action = action.Value; task.Remarks = remarks.Value; task.ToDoDateTime = temp; task.ActionStatus = ddlStatus.SelectedValue; task.SendAlert = false; //task.AlertDatetime = DateTime.Now; task.AlertMailTo = ""; task.AlertSent = false; task.EntryDate = DateTime.Now; task.UpdateDate = DateTime.Now; objResponse.IsDebugMode = false; objResponse.IsDebugStop = false; objResponse = objTaskDL.SaveTask(objResponse, task); msg.InnerText = objResponse.CustomMessage; msg.Attributes.Add("class", (objResponse.IsSuccess ? "alert alert-success" : "alert alert-danger")); }
protected void gvTask_RowCommand(object sender, GridViewCommandEventArgs e) { // var current = gvTask.CurrentRow; if ((e.CommandName.ToLower() != "sort")) // Means that you've not clicked the column header { btnReset_Click(sender, e); Task task = new Task(); TaskDL objTaskDL = new TaskDL(); ProcessResponse objResponse = new ProcessResponse(); task.ActionId = Convert.ToInt64(e.CommandArgument); hdActionId.Value = Convert.ToString(task.ActionId); if (e.CommandName == "EditTask") { objResponse.Command = "Select"; task = objTaskDL.GetTask(objResponse, task); if (task != null) { action.Focus(); action.Value = task.Action; remarks.Value = task.Remarks; date.Value = task.ToDoDateTime.ToShortDateString(); time.Value = task.ToDoDateTime.ToShortTimeString(); ddlStatus.SelectedIndex = -1; ddlStatus.Items.FindByValue(task.ActionStatus).Selected = true; } } else if (e.CommandName == "DeleteTask") { objResponse.Command = "Delete"; objResponse = objTaskDL.DeleteTask(objResponse, task); msg.InnerText = objResponse.CustomMessage; msg.Attributes.Add("class", (objResponse.IsSuccess ? "alert alert-success" : "alert alert-danger")); } LoadTasks(); } }
protected void LoadTasks(string SortExpression = null, string sortingDirection = null) { Task task = new Task(); TaskDL objTaskDL = new TaskDL(); ProcessResponse objResponse = new ProcessResponse(); objResponse.Command = "SELECTALL"; if (keyword.Value.Trim() != "") { task.Action = keyword.Value.Trim(); } if (fromdate.Value.Trim() != "") { objResponse.FromDate = fromdate.Value; } if (todate.Value.Trim() != "") { objResponse.ToDate = todate.Value; } task.ActionStatus = ddlSearchStatus.SelectedValue; if (SortExpression == null) { SortExpression = "EntryDate"; } if (sortingDirection == null) { sortingDirection = "Asc"; } objResponse.SortBy = SortExpression; // "EntryDate"; objResponse.SortOrder = sortingDirection; //"Asc"; objResponse.IsDebugMode = false; objResponse.IsDebugStop = false; gvTask.DataSource = objTaskDL.GetAllTask(objResponse, task); gvTask.DataBind(); }