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()); }