public static Boolean InsertUpdateSP_Contractor(clsSP_Contractor objSP_Contractor) { bool isAdded = false; string SpName = "usp_InsertUpdateSP_Contractor"; try { using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { db.Execute(SpName, objSP_Contractor, commandType: CommandType.StoredProcedure); } isAdded = true; } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } return(isAdded); }
public static clsSP_Contractor SelectSP_ContractorById(int?SPContractorID) { clsSP_Contractor objSP_Contractor = new clsSP_Contractor(); bool isnull = true; string SpName = "usp_SelectSP_Contractor"; var objPar = new DynamicParameters(); if (String.IsNullOrEmpty(SPContractorID.ToString())) { throw new ArgumentException("Function parameters cannot be blank!"); } else { try { objPar.Add("@SPContractorID", SPContractorID, dbType: DbType.Int32); using (IDbConnection db = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["databaseConnection"])) { objSP_Contractor = db.Query <clsSP_Contractor>(SpName, objPar, commandType: CommandType.StoredProcedure).SingleOrDefault(); isnull = false; } } catch (Exception ex) { ErrorHandler.ErrorLogging(ex, false); ErrorHandler.ReadError(); } } if (isnull) { return(null); } else { return(objSP_Contractor); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strSPContractorID = string.Empty; try { #region Dropdown Categories List <clsCategory> lstCategory = new List <clsCategory>(); lstCategory = CategoryDAL.SelectDynamicCategory("(ACRDCategory = 'Contractor Accreditations') AND (IsActive = 1)", "ACRDCatID"); if (lstCategory != null) { if (lstCategory.Count > 0) { dropCategory.Items.Clear(); for (int i = 0; i < lstCategory.Count; i++) { dropCategory.Items.Add(new ListItem( String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCategory[i].CatTitle.ToString())), String.Format("{0}", SQLHelper.TrimAndReplaceEOF(lstCategory[i].ACRDCatID.ToString())))); } } } #endregion strSPContractorID = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString(); if (GlobalMethods.ValueIsNull(strSPContractorID).Length > 0) { strSPContractorID = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString(); } clsSP_Contractor objSPCont = new clsSP_Contractor(); objSPCont = SP_ContractorDAL.SelectSP_ContractorById(Convert.ToInt32(strSPContractorID)); if (objSPCont != null) { lblContractorApp.Text = objSPCont.SPName; lblName.Text = objSPCont.SPName; lblSDATNum.Text = objSPCont.SDATDepartmentId; lblEIN.Text = objSPCont.SPTaxId; lblMHICNumber.Text = objSPCont.SPMHICNumber; dropCategory.SelectedValue = objSPCont.ACRDCatID.ToString(); lblCourseName.Text = "<b>" + dropCategory.SelectedItem.Text + "</b>"; // for heading lblACCID.Text = objSPCont.AccreditationID; lblAccreditationExpirationDate.Text = objSPCont.AccreditationExpirationDate.HasValue ? objSPCont.AccreditationExpirationDate.Value.ToShortDateString() : ""; //lblAddress_1.Text = objSPCont.SPAddress_Line_1; //lblAddress_2.Text = objSPCont.SPAddress_Line_2; //lblCity.Text = objSPCont.SPCity; //lblCounty.Text = objSPCont.SPCounty; //lblState.Text = objSPCont.SPState; //lblZipCode.Text = objSPCont.SPZipCode; lblPhone.Text = objSPCont.SPPhone; lblMobile.Text = objSPCont.SPMobile; lblWebSite.Text = objSPCont.SPWebSite; lblEmailAddress.Text = objSPCont.SPEmail; if (objSPCont.SPFeeStatus == "1") { chkFeeStatus.Checked = true; } if (objSPCont.PublishOnMDEWebsite == 1) { chkPublishOnMDEWebsite.Checked = true; } pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'>" + GlobalMethods.ContractorAppStatus(objSPCont.IsActive.HasValue ? objSPCont.IsActive.Value : -1, "bar", "") + "</div>")); } } catch (Exception ex) { ErrorHandler.ErrorPage(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string strTCSID = string.Empty; string strTCid = string.Empty; try { strTCSID = Request["cgi"].ToString() == null ? string.Empty : Request["cgi"].ToString(); if (GlobalMethods.ValueIsNull(strTCSID).Length > 0) { strTCSID = objcryptoJS.AES_decrypt(HttpUtility.UrlEncode(Request["cgi"].ToString()), AppConstants.secretKey, AppConstants.initVec).ToString(); } #region Getting Class Details clsCourse_Result objCS = new clsCourse_Result(); objCS = Course_ResultDAL.SelectCourse_ResultById(Convert.ToInt32(strTCSID)); if (objCS != null) { #region Getting Employer info clsSP_Contractor objCont = new clsSP_Contractor(); objCont = SP_ContractorDAL.SelectSP_ContractorById(objCS.SPContractorID); if (objCont != null) { lblEmployerName.Text = objCont.SPName; lblEmployerEmail.Text = objCont.SPEmail; lblEmployerPhone.Text = objCont.SPPhone + " / " + objCont.SPMobile; } #endregion lblYearFor.Text = objCS.Acct_Term.ToString(); clsUser objUser = new clsUser(); objUser = UserDAL.SelectUserById(objCS.AuthorisedUserId); if (objUser != null) { lblCrouseName.Text = objUser.FName + " " + objUser.LName; } if (objCS.IsActive == 1) { // this records already exsistes btnAddTManual.Enabled = false; dropEmpVerify.Enabled = false; dropPayment.Enabled = false; dropFinalStatus.Enabled = false; dropBackGround.Enabled = false; txtNotes.Enabled = false; //strTCid = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(strTCid.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString(); pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'><a class='btn btn-success download' title='Download as PDF' href='/" + objcryptoJS.AES_encrypt("Acct_Certificate", AppConstants.secretKey, AppConstants.initVec) + ".cert' target='_blank' >Generate Accreditation Certificate</a>" + GlobalMethods.ContractorAppStatus(1, "bar", "MDE_ApprCertApps.aspx?approvecertapp=active") + "</div>")); } else { btnAddTManual.Enabled = true; dropEmpVerify.Enabled = true; dropPayment.Enabled = true; dropFinalStatus.Enabled = true; dropBackGround.Enabled = true; txtNotes.Enabled = true; //strTCid = objcryptoJS.AES_encrypt(HttpUtility.UrlEncode(strTCid.ToString()), AppConstants.secretKey, AppConstants.initVec).ToString(); pnlAppStatus.Controls.Add(new LiteralControl("<div class='input-group'><div class='input-group-btn'>" + GlobalMethods.ContractorAppStatus(9, "bar", "MDE_ApprCertApps.aspx?approvecertapp=active") + "</div>")); } } #endregion } catch (Exception) { ErrorHandler.ErrorPage(); } } }