Ejemplo n.º 1
0
        protected void CommentEnter(object sender, EventArgs e)
        {
            string strTrainingCourseAppId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();

            if (GlobalMethods.ValueIsNull(strTrainingCourseAppId).Length > 0)
            {
                strTrainingCourseAppId = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString();
            }
            else
            {
                ErrorHandler.ErrorPage();
            }

            clsTrainingCourse_Comment objComm = new clsTrainingCourse_Comment();

            objComm.TrainingCourseAppId = Convert.ToInt32(strTrainingCourseAppId);
            objComm.Comment             = GlobalMethods.KillChars(txtComment.Text);
            objComm.CreatedDate         = DateTime.Now;
            objComm.CreatedBy           = HttpContext.Current.Session["UserAuthId"].ToString();
            objComm.IsActive            = 1;
            if (!TrainingCourse_CommentDAL.InsertTrainingCourse_Comment(objComm))
            {
            }

            #region Getting all the Comments by Application Id.
            StringBuilder strMessenger = new StringBuilder("");
            List <clsTrainingCourse_Comment> lstComments = new List <clsTrainingCourse_Comment>();
            lstComments = TrainingCourse_CommentDAL.SelectDynamicTrainingCourse_Comment("TrainingCourseAppId = " + strTrainingCourseAppId + "", "TrainingCourseCommentId");
            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
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strTrainingCourseAppId = string.Empty;
                phWriteComment.Visible = false;

                strTrainingCourseAppId = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString();
                if (GlobalMethods.ValueIsNull(strTrainingCourseAppId).Length > 0)
                {
                    strTrainingCourseAppId = 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 <clsTrainingCourse_Comment> lstComments = new List <clsTrainingCourse_Comment>();
                lstComments = TrainingCourse_CommentDAL.SelectDynamicTrainingCourse_Comment("TrainingCourseAppId = " + strTrainingCourseAppId + "", "TrainingCourseCommentId");
                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 = _tcRepository.PendingApps();

                if (pendingApps.Select(x => x.Id).Contains(Convert.ToInt32(strTrainingCourseAppId)))
                {
                    // Means this needs Assigned To Me button.
                    IsAssignedToMe         = true;
                    phWriteComment.Visible = false;
                }

                #endregion

                var obj = _tcRepository.Get(int.Parse(strTrainingCourseAppId));
                if (obj != null)
                {
                    txtTPName.Text       = obj.TrainingProviderName;
                    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;
                    txtSSN.Text          = obj.TP_TaxID.FromByteArray();
                    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;
                    }
                    txtACCID.Text = obj.AccreditationID;
                    txtAccreditationExpirationDate.Text = obj.AccreditationExpirationDate.HasValue ? obj.AccreditationExpirationDate.Value.ToShortDateString() : "";
                    chkRiskAssessor.Checked             = obj.TC_RiskAssessor == 1;
                    chkInspectorTech.Checked            = obj.TC_InspectorTech == 1;
                    chkVisualInspector.Checked          = obj.TC_VisualInspector == 1;
                    chkMainRepaint.Checked       = obj.TC_Main_Repair == 1;
                    chkRemoval.Checked           = obj.TC_Removal == 1;
                    chkProjectDesign.Checked     = obj.TC_ProjectDesign == 1;
                    chkAbatmentEnglish.Checked   = obj.TC_AbatementWorkerEnglish == 1;
                    chkAbatmentSpanish.Checked   = obj.TC_AbatementWorkerSpanish == 1;
                    chkStructSteelSuper.Checked  = obj.TC_StructSteelSuper == 1;
                    chkStructSteelWorker.Checked = obj.TC_StructSteelWorker == 1;
                    hlnkUpload_1.NavigateUrl     = obj.DocURL_1;
                    hlnkUpload_2.NavigateUrl     = obj.DocURL_2;
                    hlnkUpload_3.NavigateUrl     = obj.DocURL_3;
                    hlnkUpload_4.NavigateUrl     = obj.DocURL_4;
                    hlnkUpload_5.NavigateUrl     = obj.DocURL_5;
                    txtAuthRepContFName.Text     = obj.TPContactFirstName;
                    txtAuthRepContLName.Text     = obj.TPContactLastName;
                    txtAuthRepContTitle.Text     = obj.TPContactTitle;
                    chkIAgree.Checked            = obj.Agreed == 1;
                    lblDateSigned.Text           = obj.CreatedDate.ToShortDateString();
                    lblSignedBy.Text             = obj.TPContactFirstName + " " + obj.TPContactLastName;

                    #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>&nbsp;<a class='btn btn-danger open-Disapprove' href='#' title='Reject Application' data-id='" + strEnContractId + "' data-toggle='modal' >Reject</a>&nbsp;<a class='btn btn-primary open-Hold' href='#' title='Put Application On Hold' data-id='" + strEnContractId + "' data-toggle='modal' >On Hold</a>&nbsp;<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(dropIsRenewal);
                #endregion
            }
        }