protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var pendingApps = _tpRepository.PendingApps(); foreach (var each in pendingApps) { showTable(pnlVideos, each); } var mdeApps = _tpRepository.AssignToMDEApps(int.Parse(HttpContext.Current.Session["UserAuthId"].ToString())); foreach (var each in mdeApps) { showTable(pnlMyContApps, each); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strtpId = string.Empty; phWriteComment.Visible = false; strtpId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString(); if (GlobalMethods.ValueIsNull(strtpId).Length > 0) { strtpId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString(); } #region Getting all the Comments by Application Id. StringBuilder strMessenger = new StringBuilder(""); List <clsTP_Comment> lstComments = new List <clsTP_Comment>(); lstComments = TP_CommentDAL.SelectDynamicTP_Comment("TPId = " + strtpId + "", "TPCommentId"); if (lstComments != null) { if (lstComments.Count > 0) { for (int i = 0; i < lstComments.Count; i++) { strMessenger.Append(GlobalMethods.Messenger(lstComments[i].CreatedBy.ToString(), Convert.ToDateTime(lstComments[i].CreatedDate).ToLongDateString(), lstComments[i].Comment.ToString()).ToString()); } } } pnlComments.Controls.Add(new LiteralControl(strMessenger.ToString())); #endregion #region Checking if this is AssignedToMe Action bool IsAssignedToMe = false; var pendingApps = _tpRepository.PendingApps(); if (pendingApps.Select(x => x.Id).Contains(Convert.ToInt32(strtpId))) { // Means this needs Assigned To Me button. IsAssignedToMe = true; phWriteComment.Visible = false; } #endregion var obj = _tpRepository.Get(int.Parse(strtpId)); if (obj != null) { txtName.Text = obj.TP_Name; txtSDATNum.Text = obj.TP_SDAT; txtAddress_1.Text = obj.TP_Address_Line_1; txtCity_1.Text = obj.TP_City; txtState_1.Text = obj.TP_State; txtZipCode_1.Text = obj.TP_ZipCode; txtAddress_2.Text = obj.TP_Address_Line_2; txtCity_2.Text = obj.TP_City_2; txtState_2.Text = obj.TP_State_2; txtZipcode_2.Text = obj.TP_Zipcode_2; txtPhone.Text = obj.TP_Telephone; txtFax.Text = obj.TP_Fax; txtEmailAddress.Text = obj.TP_Email; txtEIN.Text = obj.TP_TaxID.FromByteArray(); txtACCID.Text = obj.AccreditationID; txtAccreditationExpirationDate.Text = obj.AccreditationExpirationDate.HasValue ? obj.AccreditationExpirationDate.Value.ToShortDateString() : ""; chkChargeFee.Checked = obj.TP_Fee == 1; if (!string.IsNullOrWhiteSpace(obj.TP_TaxExempt)) { chkTaxExempt.Checked = true; } else { chkTaxExempt.Checked = false; } txtTaxExempt.Text = obj.TP_TaxExempt; if (obj.TPWebsiteURL.Length > 0) { chkTPwebsiteYES.Checked = true; chkTPwebsiteNO.Checked = false; } else { chkTPwebsiteYES.Checked = false; chkTPwebsiteNO.Checked = true; } txtTPwebsiteURL.Text = obj.TPWebsiteURL; chkCORiskAssessor.Checked = obj.RiskAssessor == 1; chkCOProjectDesigner.Checked = obj.ProjectDesign == 1; chkCOInspectorTech.Checked = obj.InspectorTech == 1; chkCOAbatWorkEnglish.Checked = obj.AbatWorkerEnglish == 1; chkCOVisualInspector.Checked = obj.VisualInspector == 1; chkCOAbatWorkSpanish.Checked = obj.AbatWorkerSpanish == 1; chkCOMainRepaintSup.Checked = obj.MainRepaint == 1; chkCOStructSteelSup.Checked = obj.StructSteelSupervisor == 1; chkCORemovalSup.Checked = obj.RemovalDemo == 1; chkStructSteelWork.Checked = obj.StructSteelWorker == 1; txtAuthRepContFName.Text = obj.TPContactFirstName; txtAuthRepContLName.Text = obj.TPContactLastName; txtAuthRepContTitle.Text = obj.TPContactTitle; lblContractorApp.Text = obj.TP_Name; lblSignedBy.Text = obj.TPContactFirstName + " " + obj.TPContactLastName; chkIAgree.Checked = obj.Agreed == 1; dropIsRenewal.SelectedValue = obj.IsRenewal.HasValue ? obj.IsRenewal.Value.ToString() : "-1"; if ((dropIsRenewal.SelectedValue == "0") || (dropIsRenewal.SelectedValue == "-1")) { divIsRenewal.Visible = false; } // dropPublicList.Text = obj; lblDateSigned.Text = obj.CreatedDate.ToLongDateString(); for (int i = 0; i < obj.Locations.Count; i++) { var element = obj.Locations.ElementAt(i); if (element != null) { var cIndex = i + 1; var address1 = (TextBox)Page.FindControl("ctl00$CPMain$txtLocation_Address_" + cIndex); var city = (TextBox)Page.FindControl("ctl00$CPMain$txtLocation_City_" + cIndex); var state = (TextBox)Page.FindControl("ctl00$CPMain$txtLocation_State_" + cIndex); var zipcode = (TextBox)Page.FindControl("ctl00$CPMain$txtLocation_ZipCode_" + cIndex); if (address1 != null) { address1.Text = element.TP_Address_Line_1; city.Text = element.TP_City; state.Text = element.TP_State; zipcode.Text = element.TP_ZipCode; } } } for (int i = 0; i < obj.Instructors.Count; i++) { var element = obj.Instructors.ElementAt(i); if (element != null) { var cIndex = i + 1; var fn = (TextBox)Page.FindControl("ctl00$CPMain$txtInstructorFN_" + cIndex); var ln = (TextBox)Page.FindControl("ctl00$CPMain$txtInstructorLN_" + cIndex); if (fn != null) { fn.Text = element.TP_InstructorFN; ln.Text = element.TP_InstructorLN; } } } #region Getting all the Case files. StringBuilder strMessengerUpload = new StringBuilder(""); foreach (var each in obj.Files.OrderByDescending(x => x.Id)) { strMessengerUpload.Append(GlobalMethods.UploadedFiles(each.CreatedBy.ToString(), Convert.ToDateTime(each.CreatedDate).ToLongDateString(), each.FileLocation.ToString()).ToString()); } pnlUploads.Controls.Add(new LiteralControl(strMessengerUpload.ToString())); #endregion } string strEnContractId = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(obj.Id.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString(); if (IsAssignedToMe) { GlobalMethods.DisableControls(this.Page); btnAddCourse.Visible = false; pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-primary2 open-AssignedToMe' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Assigned to Me</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>")); } else { phWriteComment.Visible = true; pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-success open-Approve' title='Approve Application' href='#' data-id='" + strEnContractId + "' data-toggle='modal' >Approve</a> <a class='btn btn-danger open-Disapprove' href='#' title='Reject Application' data-id='" + strEnContractId + "' data-toggle='modal' >Reject</a> <a class='btn btn-primary open-Hold' href='#' title='Put Application On Hold' data-id='" + strEnContractId + "' data-toggle='modal' >On Hold</a> <a class='btn btn-primary open-Deficient' href='#' title='Application status is Deficient' data-id='" + strEnContractId + "' data-toggle='modal' >Deficient</a>" + GlobalMethods.ContractorAppStatus(obj.IsActive.HasValue ? obj.IsActive.Value : 0, "bar", "") + "</div>")); } #region Making all the fields disabled. GlobalMethods.DisableControl_CheckBoxByID(chkIAgree); GlobalMethods.DisableControl_DropDownByID(dropPublicList); GlobalMethods.DisableControl_DropDownByID(dropIsRenewal); #endregion } }