예제 #1
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()));
            }
        }
예제 #2
0
        protected void btnSubmit_Click(Object Sender, EventArgs e)
        {
            int intAsset = Int32.Parse(Request.QueryString["id"]);

            oAsset.Update(intAsset, txtAsset.Text);
            IPAddresses oIPAddresses = new IPAddresses(intProfile, dsnIP, dsn);
            int         intIP        = oIPAddresses.Add(0, Int32.Parse(txtIP1.Text), Int32.Parse(txtIP2.Text), Int32.Parse(txtIP3.Text), Int32.Parse(txtIP4.Text), intProfile);
            int         intDepotRoom = GetID(txtDepotRoom.Text, "cv_depot_rooms");

            if (intDepotRoom == 0)
            {
                oDepotRoom.Add(txtDepotRoom.Text, 1);
                intDepotRoom = GetID(txtDepotRoom.Text, "cv_depot_rooms");
            }
            int intShelf = GetID(txtShelf.Text, "cv_shelfs");

            if (intShelf == 0)
            {
                oShelf.Add(txtShelf.Text, 1);
                intShelf = GetID(txtShelf.Text, "cv_shelfs");
            }
            int intRoom = GetID(txtRoom.Text, "cv_rooms");

            if (intRoom == 0)
            {
                oRooms.Add(txtRoom.Text, 1);
                intRoom = GetID(txtRoom.Text, "cv_rooms");
            }
            int intRack = GetID(txtRack.Text, "cv_racks");

            if (intRack == 0)
            {
                oRacks.Add(txtRack.Text, 1);
                intRack = GetID(txtRack.Text, "cv_racks");
            }
            oAsset.UpdateNetwork(intAsset, txtName.Text, (int)AssetStatus.InUse, intProfile, DateTime.Parse(txtDate.Text), Int32.Parse(ddlDepot.SelectedItem.Value), intDepotRoom, intShelf, Int32.Parse(txtPorts.Text), Int32.Parse(ddlClass.SelectedItem.Value), Int32.Parse(Request.Form[hdnEnvironment.UniqueID]), Int32.Parse(Request.Form[hdnLocation.UniqueID]), intRoom, intRack, txtRackPosition.Text);
            oAsset.DeleteIP(intAsset);
            oAsset.AddIP(intAsset, intIP);
            if (Request.QueryString["sid"] != null)
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?sid=" + Request.QueryString["sid"] + "&id=" + intAsset.ToString() + "&commed=true");
            }
            else
            {
                Response.Redirect(oPage.GetFullLink(intPage) + "?pid=" + Request.QueryString["pid"] + "&save=true");
            }
        }
예제 #3
0
        protected void btnAdd_Click(Object Sender, EventArgs e)
        {
            if (hdnLocationId.Value == "0")
            {
                hdnLocationId.Value = "0";
            }
            if (hdnRoomId.Value == "0")
            {
                hdnRoomId.Value = "0";
            }

            if (Request.Form[hdnId.UniqueID] == "0")
            {
                int intAsset = 0;
                intAsset = oAsset.Add(0, 0, Int32.Parse(ddlModel.SelectedValue), txtAssetSerial.Text.Trim(), txtAssetTag.Text.Trim(), (int)AssetStatus.Available, intProfile, DateTime.Now, 0, 1, 0, "");
                //oRacks.Add(txtName.Text, (chkEnabled.Checked ? 1 : 0));
                oRacks.Add(intAsset, txtName.Text, Int32.Parse(hdnRoomId.Value), (chkEnabled.Checked ? 1 : 0), intProfile);
            }
            else
            {
                oAsset.Update(Int32.Parse(hdnAssetId.Value), Int32.Parse(ddlModel.SelectedValue), txtAssetSerial.Text.Trim(), txtAssetTag.Text.Trim(), 0);
                oRacks.Update(Int32.Parse(Request.Form[hdnId.UniqueID]), Int32.Parse(hdnAssetId.Value), txtName.Text.Trim(), Int32.Parse(hdnRoomId.Value), (chkEnabled.Checked ? 1 : 0), intProfile);
            }
            if (Request.Form[hdnOrder.UniqueID] != "")
            {
                string strOrder = Request.Form[hdnOrder.UniqueID];
                int    intCount = 0;
                while (strOrder != "")
                {
                    intCount++;
                    int intId = Int32.Parse(strOrder.Substring(0, strOrder.IndexOf("&")));
                    strOrder = strOrder.Substring(strOrder.IndexOf("&") + 1);
                    oRacks.UpdateOrder(intId, intCount);
                }
            }
            Response.Redirect(Request.Path);
        }
예제 #4
0
 public void AddRack(Rack rack)
 {
     Racks.Add(rack);
 }