예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     intProfile   = Int32.Parse(Request.Cookies["profileid"].Value);
     oPage        = new Pages(intProfile, dsn);
     oPlatform    = new Platforms(intProfile, dsn);
     oType        = new Types(intProfile, dsn);
     oLocation    = new Locations(intProfile, dsn);
     oAsset       = new Asset(intProfile, dsnAsset);
     oRacks       = new Racks(intProfile, dsn);
     oClasses     = new Classes(intProfile, dsn);
     oRooms       = new Rooms(intProfile, dsn);
     oFloor       = new Floor(intProfile, dsn);
     oEnvironment = new Environments(intProfile, dsn);
     oDepot       = new Depot(intProfile, dsn);
     oDepotRoom   = new DepotRoom(intProfile, dsn);
     oShelf       = new Shelf(intProfile, dsn);
     oUser        = new Users(intProfile, dsn);
     if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
     {
         intApplication = Int32.Parse(Request.QueryString["applicationid"]);
     }
     if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
     {
         intPage = Int32.Parse(Request.QueryString["pageid"]);
     }
     if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
     {
         intApplication = Int32.Parse(Request.Cookies["application"].Value);
     }
     if (!IsPostBack)
     {
         if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
         {
             LoadLists();
             Load(Int32.Parse(Request.QueryString["id"]));
             txtDate.Text = DateTime.Today.ToShortDateString();
             imgDate.Attributes.Add("onclick", "return ShowCalendar('" + txtDate.ClientID + "');");
             btnSubmit.Attributes.Add("onclick", "return ValidateText('" + txtAsset.ClientID + "','Please enter the asset tag')" +
                                      " && ValidateDropDown('" + ddlDepot.ClientID + "','Please make a selection for the location of the asset')" +
                                      " && ValidateText('" + txtDepotRoom.ClientID + "','Please enter the depot room')" +
                                      " && ValidateText('" + txtShelf.ClientID + "','Please enter the shelf')" +
                                      " && ValidateNumber0('" + txtPorts.ClientID + "','Please enter a valid number of available ports')" +
                                      " && ValidateHidden0('" + hdnLocation.ClientID + "','ddlState','Please select a location')" +
                                      " && ValidateText('" + txtRoom.ClientID + "','Please enter the room')" +
                                      " && ValidateText('" + txtRack.ClientID + "','Please enter the rack')" +
                                      " && ValidateText('" + txtRackPosition.ClientID + "','Please enter the rack position')" +
                                      " && ValidateDropDown('" + ddlEnvironment.ClientID + "','Please make a selection for the environment')" +
                                      " && ValidateDropDown('" + ddlClass.ClientID + "','Please make a selection for the current class')" +
                                      " && ValidateText('" + txtName.ClientID + "','Please enter the device name')" +
                                      " && ValidateNumber0('" + txtIP1.ClientID + "','Please enter a valid IP address')" +
                                      " && ValidateNumber0('" + txtIP2.ClientID + "','Please enter a valid IP address')" +
                                      " && ValidateNumber0('" + txtIP3.ClientID + "','Please enter a valid IP address')" +
                                      " && ValidateNumber0('" + txtIP4.ClientID + "','Please enter a valid IP address')" +
                                      " && ValidateDate('" + txtDate.ClientID + "','Please enter a valid date')" +
                                      ";");
             ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
             ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
         }
     }
 }
예제 #2
0
        public void LoadLists()
        {
            Depot oDepot = new Depot(intProfile, dsn);

            ddlLocation.DataValueField = "id";
            ddlLocation.DataTextField  = "name";
            ddlLocation.DataSource     = oDepot.Gets(1);
            ddlLocation.DataBind();
            DepotRoom oDepotRoom = new DepotRoom(intProfile, dsn);

            ddlRoom.DataValueField = "id";
            ddlRoom.DataTextField  = "name";
            ddlRoom.DataSource     = oDepotRoom.Gets(1);
            ddlRoom.DataBind();
            Shelf oShelf = new Shelf(intProfile, dsn);

            ddlShelf.DataValueField = "id";
            ddlShelf.DataTextField  = "name";
            ddlShelf.DataSource     = oShelf.Gets(1);
            ddlShelf.DataBind();
            Classes oClasses = new Classes(intProfile, dsn);

            ddlClass.DataValueField = "id";
            ddlClass.DataTextField  = "name";
            ddlClass.DataSource     = oClasses.Gets(1);
            ddlClass.DataBind();
            ddlClass.Items.Insert(0, new ListItem("-- SELECT --", "0"));
            Locations oLocation = new Locations(intProfile, dsn);

            ddlLocation.DataValueField = "id";
            ddlLocation.DataTextField  = "fullname";
            if (Request.QueryString["address"] != null)
            {
                ddlLocation.DataSource = oLocation.GetAddresss(1);
            }
            else
            {
                ddlLocation.DataSource = oLocation.GetAddressCommon();
            }
            ddlLocation.DataBind();
            ddlLocation.Items.Insert(0, new ListItem("-- SELECT --", "0"));
            Rooms oRooms = new Rooms(intProfile, dsn);

            ddlRoom.DataValueField = "id";
            ddlRoom.DataTextField  = "name";
            ddlRoom.DataSource     = oRooms.Gets(1);
            ddlRoom.DataBind();
            ddlRoom.Items.Insert(0, new ListItem("-- SELECT --", "0"));
            Racks oRacks = new Racks(intProfile, dsn);

            ddlRack.DataValueField = "id";
            ddlRack.DataTextField  = "name";
            ddlRack.DataSource     = oRacks.Gets(1);
            ddlRack.DataBind();
            ddlRack.Items.Insert(0, new ListItem("-- SELECT --", "0"));
        }
예제 #3
0
        protected int GetRack(string _name)
        {
            DataSet ds = SqlHelper.ExecuteDataset(dsn, CommandType.Text, "SELECT * FROM cv_racks WHERE name = '" + _name + "' AND enabled = 1 AND deleted = 0");

            if (ds.Tables[0].Rows.Count == 0)
            {
                Racks oRack = new Racks(0, dsn);
                oRack.Add(_name, 1);
                return(GetRack(_name));
            }
            else
            {
                return(Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString()));
            }
        }
예제 #4
0
 public void OnSelectedRackArrivant(string rackArrivant)
 {
     if (!string.IsNullOrEmpty(rackArrivant))
     {
         Rack rackSelected = Racks.FirstOrDefault(x => x.GisementPos == rackArrivant);
         if (rackSelected != null)
         {
             TransfertRackValidation.IdRackArrivant       = rackSelected.IdRack;
             TransfertRackValidation.GisementRackArrivant = rackSelected.GisementPos;
         }
         else
         {
             TransfertRackValidation.IdRackArrivant       = 0;
             TransfertRackValidation.GisementRackArrivant = string.Empty;
         }
     }
 }
예제 #5
0
        private void SelectedRackEmpty <T>(string selected, T validator) where T : BaseValidation
        {
            if (!string.IsNullOrEmpty(selected))
            {
                Rack rackSelected = Racks.FirstOrDefault(x => x.GisementPos == selected);

                if (rackSelected != null)
                {
                    validator.IdRack       = rackSelected.IdRack;
                    validator.GisementRack = rackSelected.GisementPos;
                }
                else
                {
                    validator.GisementRack = string.Empty;
                    validator.IdRack       = 0;
                }
            }
        }
예제 #6
0
        public StockService()
        {
            StockEvents.Subscribe(x =>
            {
                switch (x)
                {
                case RestockEvent restock:
                    Racks = restock.Racks.ToList();
                    break;

                case RequestStockStatus request:
                    StockEvents.OnNext(new StockStatusResponse
                    {
                        AvailableDrinks = Racks.Where(r => r.Count > 0)
                                          .Select(r => r.Drink)
                                          .Distinct(new DrinkComparer())
                                          .ToArray()
                    });
                    break;

                case RequestDrinkEvent drinkRequest:
                    var drinkRack = Racks
                                    .Where(r => r.Drink.Name == drinkRequest.Drink.Name && r.Count > 0)
                                    .FirstOrDefault();
                    if (drinkRack != null)
                    {
                        drinkRack.Count -= 1;
                        StockEvents.OnNext(new DrinkDeliverySuccess {
                            Drink = drinkRequest.Drink
                        });
                    }
                    else
                    {
                        StockEvents.OnNext(new DrinkDeliveryFailure {
                            Reason = DrinkDeliveryFailureReasons.OutOfDrink
                        });
                    }
                    break;
                }
            });
        }
예제 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/asset/asset_racks.aspx";
            Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Response.Redirect("/admin/login.aspx");
            }
            oRacks            = new Racks(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            if (!IsPostBack)
            {
                LoadList();
                LoopRepeater();
                btnOrder.Attributes.Add("onclick", "return OpenWindow('SUPPORTORDER','" + hdnId.ClientID + "','" + hdnOrder.ClientID + "&type=A_RACK" + "',false,400,400);");
                btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
                btnCancel.Attributes.Add("onclick", "return Cancel();");

                btnLocation.Attributes.Add("onclick", "return OpenWindow('LOCATION_BROWSER','" + hdnLocationId.ClientID + "','&control=" + hdnLocationId.ClientID + "&controltext=" + lblLocation.ClientID + "',false,400,600);");

                btnRoom.Attributes.Add("onclick", "return ValidateHidden0('" + hdnLocationId.ClientID + "','btnLocation','Please select a location')" +
                                       " && OpenWindowBasedOnParentSelection('ROOM_BROWSER','" + hdnRoomId.ClientID + "','" + hdnLocationId.ClientID + "','&control=" + hdnRoomId.ClientID + "&controltext=" + lblRoom.ClientID + "',false,400,600)" +
                                       ";");

                btnAdd.Attributes.Add("onclick", "return ValidateText('" + txtName.ClientID + "','Please enter a rack name')" +
                                      " && ValidateText('" + txtAssetSerial.ClientID + "','Please enter asset serial #')" +
                                      " && ValidateText('" + txtAssetTag.ClientID + "','Please enter asset tag')" +
                                      " && ValidateDropDown('" + ddlModel.ClientID + "','Please select a model')" +
                                      " && ValidateHidden0('" + hdnLocationId.ClientID + "','btnLocation','Please select a location')" +
                                      " && ValidateHidden0('" + hdnRoomId.ClientID + "','btnRoom','Please select a room')" +
                                      ";");
            }
        }
예제 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile        = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage             = new Pages(intProfile, dsn);
            oUser             = new Users(intProfile, dsn);
            oClasses          = new Classes(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oPlatform         = new Platforms(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oModelsProperties = new ModelsProperties(intProfile, dsn);
            oRacks            = new Racks(intProfile, dsn);
            oRooms            = new Rooms(intProfile, dsn);
            oFloor            = new Floor(intProfile, dsn);
            oAsset            = new Asset(intProfile, dsnAsset);
            oLocation         = new Locations(intProfile, dsn);
            oDepot            = new Depot(intProfile, dsn);



            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            lblTitle.Text = oPage.Get(intPage, "title");
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                int intID = Int32.Parse(Request.QueryString["id"]);
                if (Request.QueryString["decommed"] != null && Request.QueryString["decommed"] != "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "decommed", "<script type=\"text/javascript\">alert('Asset Successfully Decommissioned');window.navigate('" + oPage.GetFullLink(intPage) + "?sid=" + Request.QueryString["sid"] + "');<" + "/" + "script>");
                }
                if (Request.QueryString["commed"] != null && Request.QueryString["commed"] != "")
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "commed", "<script type=\"text/javascript\">alert('Asset Successfully Commissioned');window.navigate('" + oPage.GetFullLink(intPage) + "?sid=" + Request.QueryString["sid"] + "');<" + "/" + "script>");
                }
                int intStatus = Int32.Parse(oAsset.Get(intID, "status"));
                int intModel  = Int32.Parse(oAsset.Get(intID, "modelid"));
                int intType   = 0;
                if (intModel > 0)
                {
                    intModel = Int32.Parse(oModelsProperties.Get(intModel, "modelid"));
                    intType  = Int32.Parse(oModel.Get(intModel, "typeid"));
                }

                string[] strProfile;
                char[]   strSplit = { ';' };
                strProfile = strAdmins.Split(strSplit);
                for (int ii = 0; ii < strProfile.Length; ii++)
                {
                    if (strProfile[ii].Trim() != "")
                    {
                    }
                }
                panPath.Visible = true;
                string strPath = "";
                switch (intStatus)
                {
                case 0:
                    strPath = oType.Get(intType, "asset_checkin_path");
                    break;

                case 1:
                    strPath = oType.Get(intType, "asset_commission_path");
                    break;

                case 10:
                    strPath = oType.Get(intType, "asset_update_path");
                    break;
                }
                if (strPath != "")
                {
                    PHControl.Controls.Add((Control)LoadControl(strPath));
                }
                else
                {
                    panNoPath.Visible = true;
                }
            }
            else if (Request.QueryString["sid"] != null && Request.QueryString["sid"] != "")
            {
                LoadSearch(Int32.Parse(Request.QueryString["sid"]));
            }
            else
            {
                lblCount.Text     = "Currently searching " + SqlHelper.ExecuteDataset(dsnAsset, CommandType.Text, "SELECT * FROM cva_assets WHERE deleted = 0").Tables[0].Rows.Count.ToString() + " devices";
                panSearch.Visible = true;
                LoadLists();
                btnSearch.Attributes.Add("onclick", "return ValidateSearch('" + hdnType.ClientID + "','" + txtName.ClientID + "','" + txtSerial.ClientID + "','" + txtAsset.ClientID + "','" + ddlPlatformClass.ClientID + "','" + ddlClass.ClientID + "','" + ddlPlatform.ClientID + "','" + ddlPlatformDepot.ClientID + "','" + ddlDepot.ClientID + "');");
            }
            ddlClass.Attributes.Add("onchange", "WaitDDL('" + divWaitClass.ClientID + "');");
            ddlPlatform.Attributes.Add("onchange", "WaitDDL('" + divWaitPlatform.ClientID + "');");
            ddlTypes.Attributes.Add("onchange", "WaitDDL('" + divWaitType.ClientID + "');");
            ddlPlatformDepot.Attributes.Add("onchange", "WaitDDL('" + divPlatformDepot.ClientID + "');");
            ddlPlatformClass.Attributes.Add("onchange", "WaitDDL('" + divPlatformClass.ClientID + "');");
            btnClose.Attributes.Add("onclick", "return CloseWindow();");
        }
예제 #9
0
 public void AddRack(Rack rack)
 {
     Racks.Add(rack);
 }
예제 #10
0
 public void UpgradeRack <TRackType>() where TRackType : IRack
 {
     Racks.Find(rack => rack is TRackType).
     Upgrade();
 }
예제 #11
0
 public void FillRack <TRackType>(int amount) where TRackType : IRack
 {
     Racks.Find(rack => rack is TRackType).
     Fill(amount);
 }
예제 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Reload();
            }
            oPlatform         = new Platforms(intProfile, dsn);
            oOrganization     = new Organizations(intProfile, dsn);
            oRequestItem      = new RequestItems(intProfile, dsn);
            oUserAt           = new Users_At(intProfile, dsn);
            oCost             = new Costs(intProfile, dsn);
            oService          = new Services(intProfile, dsn);
            oRequestField     = new RequestFields(intProfile, dsn);
            oReport           = new Reports(intProfile, dsn);
            oSites            = new Sites(intProfile, dsn);
            oType             = new Types(intProfile, dsn);
            oModel            = new Models(intProfile, dsn);
            oRacks            = new Racks(intProfile, dsn);
            oBanks            = new Banks(intProfile, dsn);
            oDepot            = new Depot(intProfile, dsn);
            oShelf            = new Shelf(intProfile, dsn);
            oClasses          = new Classes(intProfile, dsn);
            oRooms            = new Rooms(intProfile, dsn);
            oFloor            = new Floor(intProfile, dsn);
            oEnvironment      = new Environments(intProfile, dsn);
            oForecast         = new Forecast(intProfile, dsn);
            oSolution         = new Solution(intProfile, dsn);
            oConfidence       = new Confidence(intProfile, dsn);
            oLocation         = new Locations(intProfile, dsn);
            oField            = new Field(intProfile, dsn);
            oServiceDetail    = new ServiceDetails(intProfile, dsn);
            oDomainController = new DomainController(intProfile, dsn);
            oDomain           = new Domains(intProfile, dsn);
            oServerName       = new ServerName(intProfile, dsn);
            oOperatingSystems = new OperatingSystems(intProfile, dsn);
            oOnDemand         = new OnDemand(intProfile, dsn);
            oServicePack      = new ServicePacks(intProfile, dsn);
            oServer           = new Servers(intProfile, dsn);
            oHost             = new Host(intProfile, dsn);
            oVirtualHDD       = new VirtualHDD(intProfile, dsn);
            oVirtualRam       = new VirtualRam(intProfile, dsn);
            oRestart          = new Restart(intProfile, dsn);
            oSegment          = new Segment(intProfile, dsn);
            oServiceEditor    = new ServiceEditor(intProfile, dsnServiceEditor);
            oProjectRequest   = new ProjectRequest(intProfile, dsn);
            oVMWare           = new VMWare(intProfile, dsn);
            oWorkstation      = new Workstations(intProfile, dsn);
            //oNew = new New(intProfile, dsn);
            oWhatsNew          = new WhatsNew(intProfile, dsn);
            oMaintenanceWindow = new MaintenanceWindow(intProfile, dsn);
            //oRecoveryLocations = new RecoveryLocations(intProfile, dsn);
            oTSM         = new TSM(intProfile, dsn);
            oDNS         = new DNS(intProfile, dsn);
            oSolaris     = new Solaris(intProfile, dsn);
            oZeus        = new Zeus(intProfile, dsn);
            oError       = new Errors(intProfile, dsn);
            oDesign      = new Design(intProfile, dsn);
            oResiliency  = new Resiliency(intProfile, dsn);
            oEnhancement = new Enhancements(intProfile, dsn);

            if (Request.QueryString["type"] != null && Request.QueryString["type"] != "")
            {
                lblType.Text = Request.QueryString["type"];
            }
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                lblId.Text = Request.QueryString["id"];
            }
            string strControl = "";

            if (Request.QueryString["control"] != null)
            {
                strControl = Request.QueryString["control"];
            }
            btnSave.Attributes.Add("onclick", "return Update('hdnUpdateOrder','" + strControl + "');");
            btnClose.Attributes.Add("onclick", "return HidePanel();");
            imgOrderUp.Attributes.Add("onclick", "return MoveOrderUp(" + lstOrder.ClientID + ");");
            imgOrderDown.Attributes.Add("onclick", "return MoveOrderDown(" + lstOrder.ClientID + ");");
            LoadList();
        }