protected void AssignButton_Click(object sender, EventArgs e) { //try //{ Object ReturnValue; Servers ServersObject; DominoServerTasks DSTaskObject; ServerTaskSettings STSettings; DataTable dt; DataTable dt2; DataTable dtsrv = new DataTable(); DataTable dtsrvtask = new DataTable(); string serverid = ""; string taskid = ""; if (SrvTaskCheckBoxList.SelectedItems.Count > 0) { dtsrvtask.Columns.Add("TaskID"); dtsrvtask.Columns.Add("TaskName"); dtsrvtask.Columns.Add("ServerID"); dtsrvtask.Columns.Add("Enabled"); dtsrvtask.Columns.Add("SendLoadCommand"); dtsrvtask.Columns.Add("SendRestartCommand"); dtsrvtask.Columns.Add("SendExitCommand"); dtsrvtask.Columns.Add("RestartOffHours"); dtsrv.Columns.Add("ID"); dtsrv.Columns.Add("ServerName"); dtsrv.Columns.Add("IPAddress"); dtsrv.Columns.Add("Description"); dtsrv.Columns.Add("ServerType"); dtsrv.Columns.Add("Location"); dtsrv.Columns.Add("LocationID"); for (int j = 0; j < SrvTaskCheckBoxList.Items.Count; j++) { if (SrvTaskCheckBoxList.Items[j].Selected) { SrvCheckBoxList.SelectAll(); if (SrvCheckBoxList.SelectedItems.Count > 0) { for (int i = 0; i < SrvCheckBoxList.SelectedItems.Count; i++) { DataRow drtask = dtsrvtask.NewRow(); drtask["TaskID"] = SrvTaskIDCheckBoxList.Items[j].Text; drtask["TaskName"] = SrvTaskCheckBoxList.Items[j].Text; drtask["ServerID"] = ""; drtask["Enabled"] = "true"; drtask["SendLoadCommand"] = "false"; drtask["SendRestartCommand"] = "false"; drtask["SendExitCommand"] = "false"; drtask["RestartOffHours"] = "false"; DataRow dr = dtsrv.NewRow(); dr["ID"] = ""; dr["ServerName"] = SrvCheckBoxList.SelectedItems[i].ToString(); dr["IPAddress"] = ""; dr["Description"] = "Production"; dr["ServerType"] = "Domino"; dr["Location"] = ""; dr["LocationID"] = 0; DSTaskObject = new DominoServerTasks(); DSTaskObject.TaskName = SrvTaskCheckBoxList.Items[j].Text; try { DSTaskObjectRet = VSWebBL.ConfiguratorBL.DominoServerTasksBL.Ins.GetDataForTaskName(DSTaskObject); } catch (Exception ex) { throw ex; } ServersObject = CollectDataForServers("Insert", dr); try { dt = VSWebBL.SecurityBL.ServersBL.Ins.GetDataByName(ServersObject); } catch (Exception ex) { throw ex; } if (dt.Rows.Count > 0) { drtask["ServerID"] = dt.Rows[0]["ID"].ToString(); serverid = dt.Rows[0]["ID"].ToString(); taskid = SrvTaskIDCheckBoxList.Items[j].Text; try { dt2 = VSWebBL.ConfiguratorBL.ServerTaskSettingsBL.Ins.SelectData(serverid, taskid); } catch (Exception ex) { throw ex; } if (dt2.Rows.Count == 0) { STSettings = CollectDataForServerTaskSettings("Insert", drtask); try { ReturnValue = VSWebBL.ConfiguratorBL.ServerTaskSettingsBL.Ins.InsertData(STSettings); } catch (Exception ex) { Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); throw ex; } } } } } } } } //10/3/2013 NS moved the code below outside of the task selection check to allow to proceed to the next page without any selection SrvTaskCheckBoxList.UnselectAll(); SrvCheckBoxList.UnselectAll(); Response.Redirect("~/Security/ImportServers4.aspx", false); //Mukund, 05Aug14, VSPLUS-844:Page redirect on callback Context.ApplicationInstance.CompleteRequest(); //} //catch (Exception ex) //{ // throw ex; //} }
protected void DeselectAllTasksButton_Click(object sender, EventArgs e) { SrvTaskCheckBoxList.UnselectAll(); }