protected void btnSave_Click(Object Sender, EventArgs e) { oVariables = new Variables(intEnvironment); string strVirtualPath = ""; if (fileUpload.FileName != "" && fileUpload.PostedFile != null) { string strExtension = fileUpload.FileName; string strType = strExtension.Substring(0, 3); strExtension = strExtension.Substring(strExtension.LastIndexOf(".")); string strFile = DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Year.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + "_" + intProfile.ToString() + strExtension; strVirtualPath = oVariables.UploadsFolder() + strFile; string strPath = oVariables.UploadsFolder() + strFile; fileUpload.PostedFile.SaveAs(strPath); } intRequest = oRequest.AddTask(0, intProfile, txtDescription.Text, DateTime.Now, DateTime.Now); intItemID = oService.GetItemId(intService); int intResource = oServiceRequest.AddRequest(intRequest, intItemID, intService, 0, 0.00, 2, 2, dsnServiceEditor); oServiceRequest.Update(intRequest, txtTitle.Text); oResourceRequest.UpdateName(intResource, txtTitle.Text); oServiceRequest.Add(intRequest, 1, 1); oCustomized.AddIssue(intRequest, txtTitle.Text, txtDescription.Text, Int32.Parse(drpModules.SelectedValue), Int32.Parse(txtNumUsers.Text == "" ? "0" : txtNumUsers.Text), txtURL.Text, strVirtualPath, intProfile, 0); if (oServiceRequest.NotifyApproval(intResource, intResourceRequestApprove, intEnvironment, "", dsnServiceEditor) == false) { oServiceRequest.NotifyTeamLead(intItemID, intResource, intAssignPage, intViewPage, intEnvironment, "", dsnServiceEditor, dsnAsset, dsnIP, 0); } Response.Redirect(oPage.GetFullLinkRelated(intPage)); }
protected void btnSubmit_Click(Object Sender, EventArgs e) { int intRequest = oRequest.AddTask(0, intProfile, txtDescription.Text, DateTime.Parse(txtStart.Text), DateTime.Parse(txtEnd.Text)); int intWorkflowParent = oResourceRequest.Add(intRequest, -1, 0, 0, txtName.Text, 0, double.Parse(txtHours.Text), 2, 1, 1, 1); int intWorkflowResource = oResourceRequest.AddWorkflow(intWorkflowParent, 0, txtName.Text, Int32.Parse(ddlUser.SelectedItem.Value), 0, double.Parse(txtHours.Text), 2, 0); Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString()); }
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(); } } }
protected void btnSave_Click(Object Sender, EventArgs e) { // Vijay Code - Start Response.Write(hdnResponseID.Value + "<br>"); string[] strSplit = hdnResponseID.Value.Split('&'); // Vijay Code - End string strPlatforms = Request.Form[hdnPlatforms.UniqueID]; int intProject = 0; if (lblProject.Text == "") { if (txtClarityNumber.Text.Trim() != "") { ds = oProject.Get(txtClarityNumber.Text); if (ds.Tables[0].Rows.Count > 0) { intProject = Int32.Parse(ds.Tables[0].Rows[0]["projectid"].ToString()); } } if (intProject == 0) { ds = oProject.GetName(txtProjectTask.Text); if (ds.Tables[0].Rows.Count > 0) { intProject = Int32.Parse(ds.Tables[0].Rows[0]["projectid"].ToString()); } } if (intProject == 0) { int intSegment = 0; if (Request.Form[hdnSegment.UniqueID] != "") { intSegment = Int32.Parse(Request.Form[hdnSegment.UniqueID]); } intProject = oProject.Add(txtProjectTask.Text, ddlBaseDisc.SelectedItem.Text, txtClarityNumber.Text, intProfile, Int32.Parse(ddlOrganization.SelectedItem.Value), intSegment, 0); } } else { intProject = Int32.Parse(lblProject.Text); oProject.Update(intProject, 0); } int intRequest = oRequest.AddTask(intProject, intProfile, txtInitiative.Text, DateTime.Parse(txtStart.Text), DateTime.Parse(txtCompletion.Text)); oProject.Update(intProject, 0, Int32.Parse(Request.Form[hdnExecutive.UniqueID]), Int32.Parse(Request.Form[hdnWorking.UniqueID]), 0, 0, 0); // Vijay Code - Start ds = oProjectRequest.GetClasses(1); int intClassCount = ds.Tables[0].Rows.Count; double dblOverall = 0.00; foreach (DataRow dr in ds.Tables[0].Rows) { double dblYY = 0.00; double dblTotal = 0.00; double dblWt = 0.00; DataSet dsQ = oProjectRequest.GetQuestionsByClass(Int32.Parse(dr["id"].ToString())); int intQuestionCount = dsQ.Tables[0].Rows.Count; if (intQuestionCount > 0) { dblYY = (1.0 / intQuestionCount); } foreach (DataRow drQ in dsQ.Tables[0].Rows) { foreach (string str in strSplit) { string strTemp = str; intIndex = str.IndexOf(":"); if (intIndex >= 1) { intQuestionId = Int32.Parse(strTemp.Substring(0, intIndex)); strTemp = strTemp.Substring(intIndex + 1); intResponseId = Int32.Parse(strTemp); intClassId = Int32.Parse(dr["id"].ToString()); if (drQ["questionid"].ToString() == intQuestionId.ToString()) { dblWt = Double.Parse(oProjectRequest.GetResponseWeight(intResponseId, intQuestionId)); dblTotal += (dblYY * dblWt); break; } } } // Response.Write("# Questions: " + intQuestionCount + " Qid: " + intQuestionId + " RespId: " + intResponseId + " Class: " + intClassId + " " + " Wt: " + dblWt + " YY: " + dblYY + "<br>"); } dblTotal = dblTotal / 5; dblOverall += dblTotal; oProjectRequest.AddWeightPriority(intRequest, Int32.Parse(dr["id"].ToString()), dblTotal); // Response.Write("Total_Wt: " + Double.Parse(dblTotal.ToString()).ToString("P") + "<br><br>"); } dblOverall = dblOverall / intClassCount; oProjectRequest.AddWeightPriority(intRequest, 0, dblOverall); // Vijay Code - End while (strPlatforms != "") { string strField = strPlatforms.Substring(0, strPlatforms.IndexOf("&")); strPlatforms = strPlatforms.Substring(strPlatforms.IndexOf("&") + 1); int intOrder = Int32.Parse(strField.Substring(strField.IndexOf("_") + 1)); strField = strField.Substring(0, strField.IndexOf("_")); oProjectRequest.AddPlatform(intRequest, Int32.Parse(strField)); } oApprove.NewRequest(intRequest, intProfile, false, intWorkflowPage, boolDirector); // Vijay Code - Start foreach (string str in strSplit) { string strTemp = str; intIndex = str.IndexOf(":"); if (intIndex >= 1) { intQuestionId = Int32.Parse(strTemp.Substring(0, intIndex)); strTemp = strTemp.Substring(intIndex + 1); intResponseId = Int32.Parse(strTemp); oProjectRequest.AddSubmission(intRequest, intQuestionId, intResponseId); } } // Vijay Code - End Response.Redirect(oPage.GetFullLink(intPage) + "?rid=" + intRequest.ToString()); }