protected void drpYear_SelectedIndexChanged(object sender, EventArgs e) { if (drpYear.SelectedIndex > 0) { string evalDate = drpDate.SelectedItem.ToString() + drpYear.SelectedItem.ToString(); objEnt = consFrmEvalObj.readerConsultantEvaluationByEvalDate(evalDate, int.Parse(drpLoanNumber.SelectedValue), int.Parse(drpPackageName.SelectedValue), int.Parse(drpFirmName.SelectedValue), int.Parse(drpConsultantName.SelectedValue)); if (objEnt.EvalDate != null) { RatingParameterLoad(); string EvalDate = objEnt.EvalDate; if (evalDate != "") { evalDate = Convert.ToDateTime(evalDate).ToString(clsConstant.DATE_FORMAT); } ds = new DataSet(); ds.ReadXml(HostingEnvironment.ApplicationPhysicalPath + "XML\\EvaluationDate.xml"); drpDate.DataSource = ds.Tables[0]; drpDate.DataTextField = "value"; drpDate.DataValueField = "value"; drpDate.DataBind(); //YearLoad(); if (evalDate != "") { if (evalDate.Substring(0, evalDate.Length - 5) == "1 Jan") { drpDate.SelectedIndex = 0; } else { drpDate.SelectedIndex = 1; } drpYear.SelectedIndex = drpYear.Items.IndexOf(drpYear.Items.FindByText(evalDate.Substring(evalDate.Length - 4, 4))); } txtComments.Text = objEnt.Comments; lblMessage.Text = "Consultant Already Evaluated."; btnSubmit.Visible = false; btnUpdate.Visible = true; } else { lblMessage.Text = ""; btnSubmit.Visible = true; btnUpdate.Visible = false; } } }
protected void grdConsEvaluation_SelectedIndexChanged(object sender, EventArgs e) { try { ObjconsFrmEvalInd = new ConsultantEvaluation(); clsEntConsultantEvaluation ObjEntConsEvInd = new clsEntConsultantEvaluation(); // Function used to for downloading the files from database for (int i = 0; i < grdConsEvaluation.Rows.Count; i++) { //obtain selected index from GridView for the selected File if (grdConsEvaluation.SelectedIndex == i) { string firmEvalID = grdConsEvaluation.DataKeys[i].Value.ToString(); ObjEntConsEvInd = ObjconsFrmEvalInd.readerConsultantEvaluation(firmEvalID); if (ObjEntConsEvInd != null) { Byte[] programFile = ObjEntConsEvInd.ProgramFile; if (ObjEntConsEvInd.ConsEvalID.ToString() != null) { string contentType = ObjEntConsEvInd.Contenttype; string fileName = ObjEntConsEvInd.FileName; Response.ContentType = contentType; //The AddHeader method adds a new HTML header and value to the response sent to the client Response.AddHeader("content-disposition", "attachment;filename=" + fileName); //The Charset property appends the name of the character set (for example, ISO-8859-13) to the content-type header in the Response object //Here Blank is attached Response.Charset = ""; //Provides enumerated values that are used to set the Cache-Control HTTP header. Response.Cache.SetCacheability(HttpCacheability.NoCache); } //Provides enumerated values that are used to set the Cache-Control HTTP header. Response.BinaryWrite(programFile); //The End method causes the Web server to stop // processing the script and return the current result. Response.End(); } else { lblMessage.Text = "File DoesNot Exists"; } } } } catch (Exception ex) { logger.Error(ex); } }
/// <summary> /// Modified for the certificate attachment /// </summary> /// <param name="consEvalID"></param> /// <returns></returns> public clsEntConsultantEvaluation readerConsultantEvaluation(string consEvalID) { clsEntConsultantEvaluation objEnt = new clsEntConsultantEvaluation(); try { if (objConnection.Connection.State == ConnectionState.Closed) { objConnection.Connection.Open(); } SqlParameter[] param = new SqlParameter[] { new SqlParameter("@consEvalID", consEvalID) }; SqlDataReader reader = objConnection.ExecuteReaderQuery(clsConstant.SP_SELECT_CONSULTANT_EVALUATION_DETAILS_CHECK, CommandType.StoredProcedure, param); while (reader.Read()) { objEnt.ConsEvalID = Convert.ToInt32(reader.GetValue(0)); objEnt.AgencyID = Convert.ToInt32(reader.GetValue(1).ToString()); objEnt.LoanID = Convert.ToInt32(reader.GetValue(2)); objEnt.PackageID = Convert.ToInt32(reader.GetValue(3)); objEnt.FirmID = Convert.ToInt32(reader.GetValue(4)); objEnt.ConsID = Convert.ToInt32(reader.GetValue(5)); objEnt.EvalDate = reader.GetValue(6).ToString(); objEnt.CWWP = reader.GetValue(7).ToString(); objEnt.QOO = reader.GetValue(8).ToString(); objEnt.PStbl = reader.GetValue(9).ToString(); objEnt.TAvail = reader.GetValue(10).ToString(); objEnt.AR = reader.GetValue(11).ToString(); objEnt.Comments = reader.GetValue(12).ToString(); objEnt.btFinal = Convert.ToBoolean(reader.GetValue(13)); objEnt.FileName = reader.GetValue(14).ToString(); object objFile = reader.GetValue(16); if (DBNull.Value == objFile) { objEnt.ProgramFile = null; } else { objEnt.ProgramFile = (byte[])(objFile); } objEnt.Contenttype = reader.GetValue(15).ToString(); } return(objEnt); } catch (Exception ex) { throw ex; } }
public clsEntConsultantEvaluation readerConsultantEvaluationByConsultant(int loanID, int packageID, int firmID, int consultantID) { clsEntConsultantEvaluation objEnt = new clsEntConsultantEvaluation(); try { if (objConnection.Connection.State == ConnectionState.Closed) { objConnection.Connection.Open(); } SqlParameter[] param = new SqlParameter[] { new SqlParameter("@loanID", loanID), new SqlParameter("@packageID", packageID), new SqlParameter("@firmID", firmID), new SqlParameter("@consultantID", consultantID) }; SqlDataReader reader = objConnection.ExecuteReaderQuery(clsConstant.SP_SELECT_CONSULTANT_EVALUATION_DETAILS_CHECK_BY_CONSULTANT, CommandType.StoredProcedure, param); while (reader.Read()) { objEnt.ConsEvalID = Convert.ToInt32(reader.GetValue(0)); objEnt.AgencyID = Convert.ToInt32(reader.GetValue(1).ToString()); objEnt.LoanID = Convert.ToInt32(reader.GetValue(2)); objEnt.PackageID = Convert.ToInt32(reader.GetValue(3)); objEnt.FirmID = Convert.ToInt32(reader.GetValue(4)); objEnt.ConsID = Convert.ToInt32(reader.GetValue(5)); objEnt.EvalDate = reader.GetValue(6).ToString(); objEnt.CWWP = reader.GetValue(7).ToString(); objEnt.QOO = reader.GetValue(8).ToString(); objEnt.PStbl = reader.GetValue(9).ToString(); objEnt.TAvail = reader.GetValue(10).ToString(); objEnt.AR = reader.GetValue(11).ToString(); objEnt.Comments = reader.GetValue(12).ToString(); objEnt.btFinal = Convert.ToBoolean(reader.GetValue(13)); } reader.Close(); return(objEnt); } catch (Exception ex) { throw ex; } }
protected void btnUpdate_Click(object sender, EventArgs e) { if (isEdit == true) { consEvalID = Request.QueryString["consEvalID"]; } else { objEnt = consFrmEvalObj.readerConsultantEvaluationByConsultant(int.Parse(drpLoanNumber.SelectedValue), int.Parse(drpPackageName.SelectedValue), int.Parse(drpFirmName.SelectedValue), int.Parse(drpConsultantName.SelectedValue)); consEvalID = objEnt.ConsEvalID.ToString(); } int consID = int.Parse(drpConsultantName.SelectedValue); int eaID = int.Parse(drpEAName.SelectedValue); string averageRating = (drpAverageRating.SelectedItem).ToString(); //if (drpAverageRating.SelectedIndex == 1) //{ // averageRating = ""; //} string compWorkProgram = (drpComplanceWorkProgrm.SelectedItem).ToString(); //if (drpComplanceWorkProgrm.SelectedIndex == 1) //{ // compWorkProgram = ""; //} string qualityOutput = (drpQualityOutPut.SelectedItem).ToString(); //if (drpQualityOutPut.SelectedIndex ==1) //{ // qualityOutput = ""; //} string personalStabiltiy = (drpPersonalStability.SelectedItem).ToString(); //if (drpPersonalStability.SelectedIndex == 1) //{ // personalStabiltiy = ""; //} string timelyAvailabilty = (drpTimelyAvailability.SelectedItem).ToString(); //if (drpTimelyAvailability.SelectedIndex == 1) //{ // timelyAvailabilty = ""; //} string comments = txtComments.Text; string evalDate = drpDate.SelectedItem.ToString() + drpYear.SelectedItem.ToString(); string final; //condition to check for radio button if (optYes.Checked) { final = true.ToString(); } else { final = false.ToString(); } byte[] readByteFile = null; string fileName = string.Empty; string contentType = string.Empty; this.certificateUpload(out readByteFile, out fileName, out contentType); if (fileName != "") { if (consFrmEvalObj.EditConsultantEvaluation(int.Parse(consEvalID), averageRating, compWorkProgram, qualityOutput, personalStabiltiy, timelyAvailabilty, comments, evalDate, final, fileName, contentType, readByteFile)) { lblMessage.ForeColor = System.Drawing.Color.Blue; lblMessage.Text = "Information Updated successfully."; } else { lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "Error is there."; } UrlParameterPasser urlWrapper = new UrlParameterPasser("ConsultantEvaluationList.aspx"); urlWrapper.PassParameters(); } else { if (consFrmEvalObj.EditConsultantEvaluation(int.Parse(consEvalID), averageRating, compWorkProgram, qualityOutput, personalStabiltiy, timelyAvailabilty, comments, evalDate, final, null, null, null)) { lblMessage.ForeColor = System.Drawing.Color.Black; lblMessage.Text = "Information Updated Successfully."; } else { lblMessage.ForeColor = System.Drawing.Color.Red; lblMessage.Text = "Error is there."; } UrlParameterPasser urlWrapper = new UrlParameterPasser("ConsultantEvaluationList.aspx"); urlWrapper.PassParameters(); } }
protected void Page_Load(object sender, EventArgs e) { ScriptManager.GetCurrent(this).RegisterPostBackControl(this.btnRemove); ScriptManager.GetCurrent(this).RegisterPostBackControl(this.btnSubmit);// register event for btnSubmit try { ScriptManager.GetCurrent(this).RegisterPostBackControl(this.btnUpdate); consEvalID = Request.QueryString["consEvalID"]; #region While Editing if (consEvalID != null) { if (IsPostBack == false) { btnSubmit.Visible = false; objEnt = consFrmEvalObj.readerConsultantEvaluation(consEvalID); LoanLoad(); int loanID = objEnt.LoanID; drpLoanNumber.SelectedValue = loanID.ToString(); PackageLoad(); int packagename = objEnt.PackageID; drpPackageName.SelectedValue = packagename.ToString(); FirmNameLoad(); string firmname = objEnt.FirmID.ToString(); drpFirmName.SelectedValue = firmname; //Binding EA Name to the dropdown control. AgencyLoad(); string eaname = objEnt.AgencyID.ToString(); drpEAName.SelectedValue = eaname; //Binding Compliance Work Program ConsultantComplianceLoad(); string compl = objEnt.CWWP.ToString(); if (compl == "1" || compl == "2" || compl == "3") { drpComplanceWorkProgrm.Items.FindByValue(compl).Selected = true; } else { drpComplanceWorkProgrm.Items.FindByText(compl).Selected = true; //drpComplanceWorkProgrm.SelectedIndex = 0; } //Binding Quality Output OutputLoad(); string outp = objEnt.QOO.ToString(); if (outp == "1" || outp == "2" || outp == "3") { drpQualityOutPut.Items.FindByValue(outp).Selected = true; } else { drpQualityOutPut.Items.FindByText(outp).Selected = true; //drpQualityOutPut.SelectedIndex = 0; } //Binding Personal Stablity PersonalstabilityLoad(); string ps = objEnt.PStbl.ToString(); if (ps == "1" || ps == "2" || ps == "3") { drpPersonalStability.Items.FindByValue(ps).Selected = true; } else { drpPersonalStability.Items.FindByText(ps).Selected = true; //drpPersonalStability.SelectedIndex = 0; } //Binding Timely Availabilty TimelyAvailabilityLoad(); string tav = objEnt.TAvail.ToString(); if (tav == "1" || tav == "2" || tav == "3") { drpTimelyAvailability.Items.FindByValue(tav).Selected = true; } else { drpTimelyAvailability.Items.FindByText(tav).Selected = true; //drpTimelyAvailability.SelectedIndex = 0; } //Binding Average Rating ConsultantAverageratingLoad(); string ar = objEnt.AR.ToString(); if (ar == "1" || ar == "2" || ar == "3") { drpAverageRating.Items.FindByValue(ar).Selected = true; } else { drpAverageRating.Items.FindByText(ar).Selected = true; } //Binding Conusltant Name ConsultantLoad(); string cn = objEnt.ConsID.ToString(); drpConsultantName.SelectedValue = cn; txtComments.Text = objEnt.Comments; string evalDate = objEnt.EvalDate; if (evalDate != "") { evalDate = Convert.ToDateTime(evalDate).ToString(clsConstant.DATE_FORMAT); } ds = new DataSet(); ds.ReadXml(HostingEnvironment.ApplicationPhysicalPath + "XML\\EvaluationDate.xml"); drpDate.DataSource = ds.Tables[0]; drpDate.DataTextField = "value"; drpDate.DataValueField = "value"; drpDate.DataBind(); YearLoad(); if (evalDate != "") { if (evalDate.Substring(0, evalDate.Length - 5) == "01 Jan" || evalDate.Substring(0, evalDate.Length - 5) == "1 Jan") { drpDate.SelectedIndex = 0; } else { drpDate.SelectedIndex = 1; } drpYear.SelectedIndex = drpYear.Items.IndexOf(drpYear.Items.FindByText(evalDate.Substring(evalDate.Length - 4, 4))); } //drpDate.SelectedItem.Text = evalDate.Substring(0, evalDate.Length - 5); //drpYear.SelectedIndex = drpYear.Items.IndexOf(drpYear.Items.FindByText(evalDate.Substring(evalDate.Length - 4, 4))); if (objEnt.btFinal == true) { optYes.Checked = true; } else { optNo.Checked = true; } if (objEnt.FileName != "") { lblFileName.Text = objEnt.FileName; btnRemove.Visible = true; CertFileUpload.Visible = false; } else { lblFileName.Text = ""; btnRemove.Visible = false; CertFileUpload.Visible = true; } DisablePrimeData(); } isEdit = true; } #endregion #region While Do First Time //Add Function call else { //ScriptManager.GetCurrent(this).RegisterPostBackControl(this.btnSubmit);// register event for btnSubmit if (!IsPostBack) { if (Utility.CheckAccess("ConsultantEvaluationAddEdit") == false) { //UrlParameterPasser urlWrapper = new UrlParameterPasser(); ////urlWrapper.Url = "../Logout.aspx"; //urlWrapper.Url = "../DocumentLogSystem/DashBoard.aspx"; //urlWrapper.PassParameters(); //urlWrapper["pageaccesserr"] = "1"; pnlInvalid.Visible = true; MainDiv.Visible = false; } if (!Convert.ToBoolean(Session[clsConstant.SESS_VIEWTYPE])) { this.MakeReadOnly(this.Controls); } btnUpdate.Visible = false; //Binding Loan Number to the dropdown control. PackageLoad(); //Binding TA No to the dropdown control. FirmNameLoad(); //Binding EA Name to the dropdown control. //According to Login......................... if ((((UserDetails)Session[clsConstant.TOKEN]).SuperUser) == true) { drpEAName.DataSource = objCommon.getDropDownList(clsConstant.SP_GET_AGENCY, param); drpEAName.DataTextField = "DisplayFieldText"; drpEAName.DataValueField = "ValueFieldText"; drpEAName.DataBind(); } else { param = new SqlParameter[] { new SqlParameter("@iAgencyID", ((UserDetails)Session[clsConstant.TOKEN]).AgencyID) }; drpEAName.DataSource = objCommon.getDropDownList(clsConstant.SP_GET_AGENCY_USER, param); drpEAName.DataTextField = "DisplayFieldText"; drpEAName.DataValueField = "ValueFieldText"; drpEAName.DataBind(); } drpEAName.Items.FindByValue(((UserDetails)Session[clsConstant.TOKEN]).AgencyID.ToString()).Selected = true; //Accord To Agency Loan int SelectedIndex = int.Parse(drpEAName.SelectedValue); param = new SqlParameter[] { new SqlParameter("@selectedIndex", SelectedIndex) }; drpLoanNumber.DataSource = objCommon.getDropDownList(clsConstant.SP_GET_LOAN_BY_AGENCY, param); drpLoanNumber.DataTextField = "DisplayFieldText"; drpLoanNumber.DataValueField = "ValueFieldText"; drpLoanNumber.DataBind(); int count = drpLoanNumber.Items.Count; if (count == 1) { lblStatus.Text = "No Loan in" + " - " + drpEAName.SelectedItem; lblStatus.ForeColor = System.Drawing.Color.Blue; } else { lblStatus.Text = ""; } //Binding Compliance Work Program ConsultantComplianceLoad(); //Binding Quality Output OutputLoad(); //Binding Personal Stablity PersonalstabilityLoad(); //Binding Timely Availabilty TimelyAvailabilityLoad(); //Binding Average Rating ConsultantAverageratingLoad(); //Binding Conusltant Name ConsultantLoad(); //txtDateOfEvaluation.Text = DateTime.Now.Date.ToString("dd MMM yyyy"); ds = new DataSet(); ds.ReadXml(HostingEnvironment.ApplicationPhysicalPath + "XML\\EvaluationDate.xml"); drpDate.DataSource = ds.Tables[0]; drpDate.DataTextField = "value"; drpDate.DataValueField = "value"; drpDate.DataBind(); YearLoad(); optNo.Checked = true; } } #endregion } catch (Exception ex) { logger.Error(ex); } }