Esempio n. 1
0
    protected void OkButton_Click(object sender, EventArgs e)
    {
        Unicast unicast = new Unicast();
        int     hostID  = Convert.ToInt32((string)(Session["hostID"]));

        Session.Remove("hostID");
        string direction = (string)(Session["direction"]);

        Session.Remove("direction");
        if (direction == "push")
        {
            Image image = new Image();
            unicast = unicast.Read(hostID, unicast);
            string imageID = image.GetImageID(unicast.ImageName);
            Session["imageID"] = imageID;
            if (image.Check_Checksum(imageID))
            {
                unicast.CreateUnicast(direction, hostID);
            }
            else
            {
                lblIncorrectChecksum.Text = "This Image Has Not Been Confirmed And Cannot Be Deployed.  <br>Confirm It Now?";
                ClientScript.RegisterStartupScript(this.GetType(), "modalscript", "$(function() {  var menuTop = document.getElementById('incorrectChecksum'),body = document.body;classie.toggle(menuTop, 'confirm-box-outer-open'); });", true);
            }
        }
        else
        {
            unicast.CreateUnicast(direction, hostID);
        }
        Master.Msgbox(Utility.Message);
    }
Esempio n. 2
0
    public void CreateUnicast(string direction, int hostID)
    {
        Task    task    = new Task();
        Unicast unicast = new Unicast();

        unicast = unicast.Read(hostID, unicast);
        if (unicast.HostName != null)
        {
            if (unicast.ImageName != null)
            {
                string taskID = unicast.Create(unicast);
                if (taskID != "0")
                {
                    if (CreatePxeBoot(unicast, direction, "false", taskID, hostID))
                    {
                        History history = new History();
                        history.Type   = "Host";
                        history.Notes  = unicast.HostMac;
                        history.TypeID = hostID.ToString();
                        if (direction == "push")
                        {
                            history.Event = "Deploy";
                        }
                        else
                        {
                            history.Event = "Upload";
                        }
                        history.CreateEvent(history);

                        Image image = new Image();
                        history.Type   = "Image";
                        history.Notes  = unicast.HostName;
                        history.TypeID = image.GetImageID(unicast.ImageName);
                        if (direction == "push")
                        {
                            history.Event = "Deploy";
                        }
                        else
                        {
                            history.Event = "Upload";
                        }

                        history.CreateEvent(history);

                        task.WakeUp(unicast.HostMac);
                    }
                    else
                    {
                        unicast.Rollback(unicast);
                    }
                }
            }
        }
    }
Esempio n. 3
0
    protected void OkButton_Click(object sender, EventArgs e)
    {
        string direction = (string)(Session["direction"]);

        Session.Remove("direction");
        if (direction == "delete")
        {
            List <int> delList = new List <int>();
            delList.Add(Convert.ToInt32(host.ID));
            host.Delete(delList);
            if (Utility.Message.Contains("Successfully"))
            {
                Response.Redirect("~/views/hosts/search.aspx");
            }
            else
            {
                Master.Msgbox(Utility.Message);
            }
        }
        else if (direction == "push")
        {
            Unicast unicast = new Unicast();
            Image   image   = new Image();
            unicast = unicast.Read(Convert.ToInt32(host.ID), unicast);
            string imageID = image.GetImageID(unicast.ImageName);
            Session["imageID"] = imageID;
            if (image.Check_Checksum(imageID))
            {
                unicast.CreateUnicast(direction, Convert.ToInt32(host.ID));
                Master.Msgbox(Utility.Message);
            }
            else
            {
                lblIncorrectChecksum.Text = "This Image Has Not Been Confirmed And Cannot Be Deployed.  <br>Confirm It Now?";
                ClientScript.RegisterStartupScript(this.GetType(), "modalscript", "$(function() {  var menuTop = document.getElementById('incorrectChecksum'),body = document.body;classie.toggle(menuTop, 'confirm-box-outer-open'); });", true);
            }
        }
        else
        {
            Unicast unicast = new Unicast();
            unicast.CreateUnicast(direction, Convert.ToInt32(host.ID));
            Master.Msgbox(Utility.Message);
        }
    }
Esempio n. 4
0
    protected void OkButton_Click(object sender, EventArgs e)
    {
        Unicast unicast = new Unicast();
        int hostID = Convert.ToInt32((string)(Session["hostID"]));
        Session.Remove("hostID");
        string direction = (string)(Session["direction"]);
        Session.Remove("direction");
        if(direction == "push")
        {
            Image image = new Image();
            unicast = unicast.Read(hostID,unicast);
            string imageID = image.GetImageID(unicast.ImageName);
            Session["imageID"] = imageID;
            if (image.Check_Checksum(imageID))
                unicast.CreateUnicast(direction, hostID);
            else
            {
                lblIncorrectChecksum.Text = "This Image Has Not Been Confirmed And Cannot Be Deployed.  <br>Confirm It Now?";
                ClientScript.RegisterStartupScript(this.GetType(), "modalscript", "$(function() {  var menuTop = document.getElementById('incorrectChecksum'),body = document.body;classie.toggle(menuTop, 'confirm-box-outer-open'); });", true);

            }

        }
        else
            unicast.CreateUnicast(direction, hostID);
        Master.Msgbox(Utility.Message);
    }
Esempio n. 5
0
    protected void OkButton_Click(object sender, EventArgs e)
    {
        string direction = (string)(Session["direction"]);
        Session.Remove("direction");
        if (direction == "delete")
        {

            List<int> delList = new List<int>();
            delList.Add(Convert.ToInt32(host.ID));
            host.Delete(delList);
            if (Utility.Message.Contains("Successfully"))
                Response.Redirect("~/views/hosts/search.aspx");
            else
                Master.Msgbox(Utility.Message);
        }
        else if (direction == "push")
        {
            Unicast unicast = new Unicast();
            Image image = new Image();
            unicast = unicast.Read(Convert.ToInt32(host.ID), unicast);
            string imageID = image.GetImageID(unicast.ImageName);
            Session["imageID"] = imageID;
            if (image.Check_Checksum(imageID))
            {
                unicast.CreateUnicast(direction, Convert.ToInt32(host.ID));
                Master.Msgbox(Utility.Message);
            }
            else
            {
                lblIncorrectChecksum.Text = "This Image Has Not Been Confirmed And Cannot Be Deployed.  <br>Confirm It Now?";
                ClientScript.RegisterStartupScript(this.GetType(), "modalscript", "$(function() {  var menuTop = document.getElementById('incorrectChecksum'),body = document.body;classie.toggle(menuTop, 'confirm-box-outer-open'); });", true);

            }

        }
        else
        {
            Unicast unicast = new Unicast();
            unicast.CreateUnicast(direction, Convert.ToInt32(host.ID));
            Master.Msgbox(Utility.Message);
        }
    }
Esempio n. 6
0
    public void CreateUnicast(string direction, int hostID)
    {
        Task task = new Task();
        Unicast unicast = new Unicast();

        unicast = unicast.Read(hostID, unicast);
        if (unicast.HostName != null)
        {
            if (unicast.ImageName != null)
            {
                string taskID = unicast.Create(unicast);
                if (taskID != "0")
                {
                    if (CreatePxeBoot(unicast, direction, "false", taskID, hostID))
                    {
                        History history = new History();
                        history.Type = "Host";
                        history.Notes = unicast.HostMac;
                        history.TypeID = hostID.ToString();
                        if (direction == "push")
                            history.Event = "Deploy";
                        else
                            history.Event = "Upload";
                        history.CreateEvent(history);

                        Image image = new Image();
                        history.Type = "Image";
                        history.Notes = unicast.HostName;
                        history.TypeID = image.GetImageID(unicast.ImageName);
                        if (direction == "push")
                            history.Event = "Deploy";
                        else
                            history.Event = "Upload";

                        history.CreateEvent(history);

                        task.WakeUp(unicast.HostMac);

                    }
                    else
                        unicast.Rollback(unicast);
                }
            }
        }
    }