private void SaveRackInfo() { DataSet dsAsset = oAsset.GetRackByAsset(Int32.Parse(hdnAssetId.Value)); if (dsAsset.Tables[0].Rows.Count == 0) { oRack.Add(txtDeviceName.Text.Trim(), Int32.Parse(hdnAssetId.Value), Int32.Parse(hdnZoneId.Value), "", 1); oAsset.AddStatus(Int32.Parse(hdnAssetId.Value), txtDeviceName.Text.Trim(), (int)AssetStatus.InStock, intProfile, DateTime.Now); //VerifyIsAssetStagedAndConfiguredAndSetStatusToAvailable(Int32.Parse(hdnAssetId.Value)); } else { oRack.Update(Int32.Parse(dsAsset.Tables[0].Rows[0]["rackid"].ToString()), txtDeviceName.Text.Trim(), Int32.Parse(hdnAssetId.Value), Int32.Parse(hdnZoneId.Value), "", 1); oAsset.UpdateStatus(Int32.Parse(hdnAssetId.Value), txtDeviceName.Text.Trim(), (int)AssetStatus.InStock, intProfile, DateTime.Now); //VerifyIsAssetStagedAndConfiguredAndSetStatusToAvailable(Int32.Parse(hdnAssetId.Value)); } }
protected void btnAdd_Click(Object Sender, EventArgs e) { if (hdnZoneId.Value == "") { hdnZoneId.Value = "0"; } if (Request.Form[hdnId.UniqueID] == "0") { DataSet dsRack = oRacks.Gets(Int32.Parse(hdnZoneId.Value), txtName.Text.Trim()); if (dsRack.Tables[0].Rows.Count > 0) { Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "DuplicateRack", "<script type=\"text/javascript\">alert('Rack " + txtName.Text + " already exists for selected zone.');<" + "/" + "script>"); } else { 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, intAsset, Int32.Parse(hdnZoneId.Value), txtDescription.Text.Trim(), (chkEnabled.Checked ? 1 : 0)); } } else { Boolean blDuplicate = false; DataSet dsRack = oRacks.Gets(Int32.Parse(hdnZoneId.Value), txtName.Text.Trim()); if (dsRack.Tables[0].Rows.Count > 0) { foreach (DataRow drRack in dsRack.Tables[0].Rows) { if (drRack["RackId"].ToString() != Request.Form[hdnId.UniqueID].ToString() && blDuplicate == false) { blDuplicate = true; Page.ClientScript.RegisterClientScriptBlock(typeof(Page), "DuplicateRack", "<script type=\"text/javascript\">alert('Rack " + txtName.Text + " already exists for selected zone.');<" + "/" + "script>"); } } } if (blDuplicate == false) { if (hdnAssetId.Value == "" || hdnAssetId.Value == "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, ""); } 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]), txtName.Text.Trim(), Int32.Parse(hdnAssetId.Value), Int32.Parse(hdnZoneId.Value), txtDescription.Text.Trim(), (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); //oRacks.UpdateOrder(intId, intCount); } } LoopRepeater(); //Response.Redirect(Request.Path); }
protected void btnRackAdd_Click(object sender, EventArgs e) { int id = oRacksNew.Add(txtRackName.Text, 0, Int32.Parse(lblRackZone.ToolTip), txtRackDescription.Text, chkRackAvailable.Checked ? 1 : 0); Response.Redirect(FormURL("z=" + lblRackZone.ToolTip)); }