protected void btnSubmit_Click(Object Sender, EventArgs e) { int intRoom = GetID(txtDepotRoom.Text, "cv_depot_rooms"); if (intRoom == 0) { oDepotRoom.Add(txtDepotRoom.Text, 1); intRoom = 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 intModel = Int32.Parse(ddlModel.SelectedItem.Value); DataSet ds = oAsset.Get(txtSerial.Text, intModel); if (ds.Tables[0].Rows.Count > 0) { Response.Redirect(oPage.GetFullLink(intPage) + "?pid=" + Request.QueryString["pid"] + "&tid=" + Request.QueryString["tid"] + "&mid=" + ddlModel.SelectedItem.Value + "&duplicate=true"); } else { int intAsset = oAsset.Add("", intModel, txtSerial.Text, txtAsset.Text, (int)AssetStatus.Arrived, intProfile, DateTime.Now, 0, 1); oAsset.AddNetwork(intAsset, "", (int)AssetStatus.Available, intProfile, DateTime.Now, Int32.Parse(ddlDepot.SelectedItem.Value), intRoom, intShelf, Int32.Parse(txtPorts.Text), 0, 0, 0, 0, 0, ""); Response.Redirect(oPage.GetFullLink(intPage) + "?pid=" + Request.QueryString["pid"] + "&tid=" + Request.QueryString["tid"] + "&mid=" + ddlModel.SelectedItem.Value + "&save=true"); } }
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"); } }
protected int GetDepotRoom(string _name) { if (_name.Trim() == "") { return(0); } DataSet ds = SqlHelper.ExecuteDataset(dsn, CommandType.Text, "SELECT * FROM cv_depot_rooms WHERE name = '" + _name + "' AND enabled = 1 AND deleted = 0"); if (ds.Tables[0].Rows.Count == 0) { DepotRoom oDepotRoom = new DepotRoom(intProfile, dsn); oDepotRoom.Add(_name, 1); sb.Append("<tr><td>-</td><td>Add Depot Room "); sb.Append(_name); sb.Append("</td></tr>"); return(GetDepotRoom(_name)); } else { return(Int32.Parse(ds.Tables[0].Rows[0]["id"].ToString())); } }
protected void btnAdd_Click(Object Sender, EventArgs e) { if (Request.Form[hdnId.UniqueID] == "0") { oDepotRoom.Add(txtName.Text, (chkEnabled.Checked ? 1 : 0)); } else { oDepotRoom.Update(Int32.Parse(Request.Form[hdnId.UniqueID]), txtName.Text, (chkEnabled.Checked ? 1 : 0)); } 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); oDepotRoom.UpdateOrder(intId, intCount); } } Response.Redirect(Request.Path); }