protected void btnConfirm_Click(object sender, EventArgs e) { tblRequisitionTableAdapter RequisitionTableAdapter = new tblRequisitionTableAdapter(); int new_RequestID = Convert.ToInt32(RequisitionTableAdapter.InsertRequisition(ddlToWarehouse.SelectedItem.Text, ddlToLocation.SelectedItem.Text.Trim(), 1, ddlFromWarehouse.SelectedItem.Text, ddlFromLocation.SelectedItem.Text, DateTime.Now, 10, Context.User.Identity.Name)); //Response.Write("new value :" + new_RequestID); tblRequestDetailsTableAdapter RequestItemAdapter = new tblRequestDetailsTableAdapter(); tblRequirementFileTableAdapter InsertRequirementAdapter = new tblRequirementFileTableAdapter(); foreach (GridViewRow RItem in gvTray.Rows) { //Response.Write(RItem.Cells[5].Text); //+ " : " + Convert.ToDecimal(RItem.Cells[1].Text)+ " : " + CommonFunctions.ConvertToUniversalDate(RItem.Cells[2].Text)+ " : " + RItem.Cells[3].Text+ " : " + Int32.Parse(RItem.Cells[4].Text))); if (RItem.Cells[5].Text == "0") { RequestItemAdapter.InsertNewRequestItem(new_RequestID, RItem.Cells[1].Text, Convert.ToDecimal(RItem.Cells[7].Text), CommonFunctions.ConvertToUniversalDate(RItem.Cells[8].Text), RItem.Cells[9].Text.Trim(), Int32.Parse(RItem.Cells[10].Text), 10, CommonFunctions.ConvertToUniversalDate(RItem.Cells[4].Text)); if (!InsertRequirementAdapter.CheckItemScalarQuery(ddlFromWarehouse.SelectedItem.Text, ddlToLocation.SelectedItem.Text.Trim(), CommonFunctions.ConvertToUniversalDate(RItem.Cells[8].Text), RItem.Cells[1].Text).HasValue) { InsertRequirementAdapter.InsertRequirement(1, RItem.Cells[1].Text, DateTime.Now, CommonFunctions.ConvertToUniversalDate(RItem.Cells[8].Text), 0, Int32.Parse(RItem.Cells[10].Text), ddlFromLocation.SelectedItem.Text, ddlFromWarehouse.SelectedItem.Text); } } else { RequestItemAdapter.InsertNewRequestItem(new_RequestID, RItem.Cells[1].Text, Convert.ToDecimal(RItem.Cells[7].Text), CommonFunctions.ConvertToUniversalDate(RItem.Cells[8].Text), RItem.Cells[9].Text.Trim(), Int32.Parse(RItem.Cells[10].Text), 10, CommonFunctions.ConvertToUniversalDate(RItem.Cells[4].Text)); } } // Show Message lblSuccessfulTransactionNumber.Text = " - " + String.Format("{0:0000000}", new_RequestID); // Generate Email bool EmailSentBool = CommonFunctions.SendNewRequisitionEmail(new_RequestID, ddlFromWarehouse.SelectedItem.Text, ddlFromLocation.SelectedItem.Text, ddlToWarehouse.SelectedItem.Text, ddlToLocation.SelectedItem.Text.Trim(), Server.HtmlEncode("PMS-II - New Requisition Alert"), Server.HtmlEncode(String.Format("{0:0000000}", new_RequestID))); // Set The View to next search and show the link for Requisition Note hlRequisitionNote.NavigateUrl = String.Format("javascript:window.open('RequisitionNote.aspx?RqNo=" + new_RequestID + "', null, 'height=500,width=750,status=yes,toolbar=no,menubar=no,location=no'); void('');");; FunctionClearNewItemEF(); //hlRequisitionNote.Attributes.Add("onclick", "window.open('" + HttpUtility.UrlEncode(hlRequisitionNote.NavigateUrl) + "',null,'height=250, width=800,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');"); MultiView1.SetActiveView(vwSuccess); Response.Cookies["requesttray"].Expires = DateTime.Now; }