protected void SaveRequest(int intStatus) { //Set Default Values For Request , Item , Number int intServiceId = 0; string strServerTitle = ""; if (hdnRequestId.Value == "") { hdnRequestId.Value = "0"; } if (hdnItemId.Value == "") { hdnItemId.Value = "0"; } if (hdnNumber.Value == "") { hdnNumber.Value = "0"; } if (Int32.Parse(rblOrderType.SelectedValue) == (int)AssetOrderType.Dispose) { hdnRackId.Value = "0"; ddlEnclosure.SelectedValue = "0"; txtEnclosureSlot.Text = "0"; ddlClass.SelectedValue = "0"; ddlEnvironment.SelectedValue = "0"; hdnEnvironment.Value = "0"; } if (intStatus == (int)AssestOrderReqStatus.Active) { //Create new request int intRequest = oRequest.AddTask(0, intProfile, txtDescription.Text, DateTime.Now, DateTime.Now); hdnRequestId.Value = intRequest.ToString(); } //Add / Update Order Request if (hdnOrderId.Value == "") { int intOrderId = oAssetOrder.AddOrderId(intProfile); hdnOrderId.Value = intOrderId.ToString(); oAssetOrder.AddOrder(Int32.Parse(hdnOrderId.Value), Int32.Parse(hdnRequestId.Value), Int32.Parse(hdnItemId.Value), Int32.Parse(hdnNumber.Value), Int32.Parse(rblOrderType.SelectedValue), txtDescription.Text.Trim(), Int32.Parse(ddlModel.SelectedValue), 0, 0, (hdnAssetCategoryId.Value == "4"?Int32.Parse(hdnZoneId.Value):0), (hdnAssetCategoryId.Value != "4" ? Int32.Parse(hdnRackId.Value) : 0), txtRackPos.Text, Int32.Parse(ddlResiliency.SelectedItem.Value), Int32.Parse(ddlOperatingSystemGroup.SelectedItem.Value), Int32.Parse(ddlClass.SelectedValue), Int32.Parse((hdnEnvironment.Value != "" ? hdnEnvironment.Value : "0")), Int32.Parse(ddlEnclosure.SelectedValue), (txtEnclosureSlot.Text.Trim() != "" ? Int32.Parse(txtEnclosureSlot.Text.Trim()) : 0), Int32.Parse(txtQuantity.Text.Trim()), (rblOrderType.SelectedValue == "1" ? Int32.Parse(txtQuantity.Text.Trim()) : 0), (rblOrderType.SelectedValue == "2" ? Int32.Parse(txtQuantity.Text.Trim()) : 0), 0, DateTime.Parse(txtRequestedByDate.Text.Trim()), (chkClustered.Checked ? 1 : 0), (chkSanAttached.Checked ? 1 : 0), (chkBootLuns.Checked ? 1 : 0), Int32.Parse(ddlSwitch1.SelectedItem.Value), txtPort1.Text, Int32.Parse(ddlSwitch2.SelectedItem.Value), txtPort2.Text, intStatus, intProfile); } else { if (intStatus == (int)AssestOrderReqStatus.UpdateOnly) { // Get old status intStatus = Int32.Parse(btnUpdate.CommandArgument); } oAssetOrder.UpdateOrder(Int32.Parse(hdnOrderId.Value), Int32.Parse(hdnRequestId.Value), Int32.Parse(hdnItemId.Value), Int32.Parse(hdnNumber.Value), Int32.Parse(rblOrderType.SelectedValue), txtDescription.Text.Trim(), Int32.Parse(ddlModel.SelectedValue), 0, 0, (hdnAssetCategoryId.Value == "4" ? Int32.Parse(hdnZoneId.Value) : 0), (hdnAssetCategoryId.Value != "4" ? Int32.Parse(hdnRackId.Value) : 0), txtRackPos.Text, Int32.Parse(ddlResiliency.SelectedItem.Value), Int32.Parse(ddlOperatingSystemGroup.SelectedItem.Value), Int32.Parse(ddlClass.SelectedValue), Int32.Parse((hdnEnvironment.Value != "" ? hdnEnvironment.Value : "0")), Int32.Parse(ddlEnclosure.SelectedValue), (txtEnclosureSlot.Text.Trim() != "" ? Int32.Parse(txtEnclosureSlot.Text.Trim()) : 0), Int32.Parse(txtQuantity.Text.Trim()), (rblOrderType.SelectedValue == "1" ? Int32.Parse(txtQuantity.Text.Trim()) : 0), (rblOrderType.SelectedValue == "2" ? Int32.Parse(txtQuantity.Text.Trim()) : 0), 0, DateTime.Parse(txtRequestedByDate.Text.Trim()), (chkClustered.Checked ? 1 : 0), (chkSanAttached.Checked ? 1 : 0), (chkBootLuns.Checked ? 1 : 0), Int32.Parse(ddlSwitch1.SelectedItem.Value), txtPort1.Text, Int32.Parse(ddlSwitch2.SelectedItem.Value), txtPort2.Text, intStatus, intProfile); } //Added or deleted the assets to cv_asset_order_asset selection SaveAssetSelection(intStatus); //Add Commetns SaveReqComment(); /* While finally submitting the request - * 1. For selected assets set NewOrderId=RequestID * 2. If it's Re-Deployment clear the asset configuration * 3. If it's Asset Movement set Asset Attribute =Moving * */ if (intStatus == (int)AssestOrderReqStatus.Active) { oAssetOrder.InitiateNextServiceRequestOrCompleteRequest(Int32.Parse(hdnOrderId.Value), 0, 0, true, dsnServiceEditor, intAssignPage, intViewPage, dsnAsset, dsnIP); } }
protected void SaveRequest(int intStatus) { intOrderType = Int32.Parse(rblASEOrderType.SelectedValue); int intClusterType = 0; if (hdnRequestId.Value == "") { hdnRequestId.Value = "0"; } if (hdnItemId.Value == "") { hdnItemId.Value = "0"; } if (hdnNumber.Value == "") { hdnNumber.Value = "0"; } if (rblClusterTypes.SelectedValue == "1") { intClusterType = Int32.Parse(rblClusterTypes.SelectedValue); } if (txtStorageAmt.Text == "") { txtStorageAmt.Text = "0.00"; } intModel = Int32.Parse(ddlModel.SelectedValue); foreach (TreeNode oNode in tvParent.Nodes) { if (oNode.ChildNodes.Count > 0) { resursiveChildNode(oNode); } else { if (oNode.Checked == true) { hdnParentId.Value = oNode.Value; } } } intParent = Int32.Parse(hdnParentId.Value); if (intStatus == (int)AssestOrderReqStatus.Active) { int intNewRequest = oRequest.AddTask(0, intProfile, txtDescription.Text, DateTime.Now, DateTime.Now); hdnRequestId.Value = intNewRequest.ToString(); int intServiceId = 0; int intItemID = 0; if (intOrderType == (int)AssetSharedEnvOrderType.AddCluster) { intServiceId = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_ASSET_SHARED_ENV_ADD_CLUSTER"]); } else if (intOrderType == (int)AssetSharedEnvOrderType.AddHost) { intServiceId = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_ASSET_SHARED_ENV_ADD_HOST"]); } else if (intOrderType == (int)AssetSharedEnvOrderType.AddStorage) { intServiceId = Int32.Parse(ConfigurationManager.AppSettings["SERVICEID_ASSET_SHARED_ENV_ADD_STORAGE"]); } intItemID = oService.GetItemId(intServiceId); hdnItemId.Value = intItemID.ToString(); hdnNumber.Value = "1"; } if (hdnOrderId.Value == "" || hdnOrderId.Value == "0") //New Order { int intOrderId = intOrderId = oAssetOrder.AddOrderId(intProfile); hdnOrderId.Value = intOrderId.ToString(); oAssetSharedEnvOrder.AddOrder(Int32.Parse(hdnOrderId.Value), Int32.Parse(hdnRequestId.Value), Int32.Parse(hdnItemId.Value), Int32.Parse(hdnNumber.Value), intOrderType, txtDescription.Text.Trim(), Int32.Parse(ddlModel.SelectedValue), Int32.Parse(hdnLocation.Value), Int32.Parse(ddlClass.SelectedValue), Int32.Parse((hdnEnvironment.Value != "" ? hdnEnvironment.Value : "0")), intParent, DateTime.Parse(txtRequestedByDate.Text.Trim()), intClusterType, 0, 0, 0, 0, //(chkFunctionWorkstation.Checked == true ? 1 : 0), //(chkFunctionServer.Checked == true ? 1 : 0), //(chkFunctionWindows.Checked == true ? 1 : 0), //(chkFunctionLinux.Checked == true ? 1 : 0), (chkFunctionContainer.Checked == true ? 1 : 0), (chkFunctionLDOM.Checked == true ? 1 : 0), float.Parse(txtStorageAmt.Text), intStatus, intProfile); } else //In Process Order { oAssetSharedEnvOrder.UpdateOrder(Int32.Parse(hdnOrderId.Value), Int32.Parse(hdnRequestId.Value), Int32.Parse(hdnItemId.Value), Int32.Parse(hdnNumber.Value), intOrderType, txtDescription.Text.Trim(), Int32.Parse(ddlModel.SelectedValue), Int32.Parse(hdnLocation.Value), Int32.Parse(ddlClass.SelectedValue), Int32.Parse((hdnEnvironment.Value != "" ? hdnEnvironment.Value : "0")), intParent, DateTime.Parse(txtRequestedByDate.Text.Trim()), intClusterType, 0, 0, 0, 0, //(chkFunctionWorkstation.Checked == true ? 1 : 0), //(chkFunctionServer.Checked == true ? 1 : 0), //(chkFunctionWindows.Checked == true ? 1 : 0), //(chkFunctionLinux.Checked == true ? 1 : 0), (chkFunctionContainer.Checked == true ? 1 : 0), (chkFunctionLDOM.Checked == true ? 1 : 0), float.Parse(txtStorageAmt.Text), intStatus, intProfile); } //1. Remove Previous Host Asset selection - In case of selection changes oAssetOrder.DeleteAssetOrderAssetSelection(Int32.Parse(hdnOrderId.Value)); //2. Add Host Asset Selection for Cluster Or Host if (intOrderType == (int)AssetSharedEnvOrderType.AddCluster || intOrderType == (int)AssetSharedEnvOrderType.AddHost) { foreach (DataListItem dlItem in dlAssetsSelection.Items) { HiddenField hdnAssetId = (HiddenField)dlItem.FindControl("hdnAssetId"); CheckBox chkSelectAsset = (CheckBox)dlItem.FindControl("chkSelectAsset"); if (chkSelectAsset.Checked == true) { oAssetOrder.AddRemoveAssetOrderAssetSelection( Int32.Parse(hdnOrderId.Value), Int32.Parse(hdnAssetId.Value), intProfile, 1); } } } if (intStatus == (int)AssestOrderReqStatus.Active) { //1. For selected assets set NewOrderId=RequestID if (intOrderType == (int)AssetSharedEnvOrderType.AddCluster || intOrderType == (int)AssetSharedEnvOrderType.AddHost) { DataSet dsAssetSelected = oAssetOrder.GetAssetOrderAssetSelection(Int32.Parse(hdnOrderId.Value)); foreach (DataRow dr in dsAssetSelected.Tables[0].Rows) { oAsset.updateNewOrderId(Int32.Parse(hdnOrderId.Value), Int32.Parse(dr["AssetId"].ToString())); } } //2. for Cluster -Add record in Cluster /Server Table if (intOrderType == (int)AssetSharedEnvOrderType.AddCluster || intOrderType == (int)AssetSharedEnvOrderType.AddHost) { CreateClusterAndAddHostsToServer(); } //For Storage Create the Service Requests if (intOrderType == (int)AssetSharedEnvOrderType.AddStorage) { InitiateAddStorageWorkOrder(); } } }