protected void btnUpdateList_Click(object sender, EventArgs e) { foreach (GridViewRow row in gViewReferences.Rows) { if (row.RowType == DataControlRowType.DataRow) { //Get the unsolicited check box and then current reference CheckBox cboxUnsolicited = (CheckBox)row.FindControl("chkUnsolicited"); int referenceID = (int)gViewReferences.DataKeys[row.RowIndex]["id"]; Reference currentReference = ReferenceBLL.GetByID(referenceID); //Only save the information if it has changed if (currentReference.UnsolicitedReference != cboxUnsolicited.Checked) { using (var ts = new TransactionScope()) { currentReference.UnsolicitedReference = cboxUnsolicited.Checked; ReferenceBLL.EnsurePersistent(currentReference); ts.CommitTransaction(); } } } } //Notify the user that the update was successful lblResult.Text = "Unsolicited List Updated"; }
/// <summary> /// Initializes a new instance of the <see cref="DifferentDatabaseScope"/> class. /// </summary> /// <param name="connection">The connection.</param> /// <param name="flushAction">The flush action.</param> public DifferentDatabaseScope(IDbConnection connection, FlushAction flushAction) : base(flushAction, SessionScopeType.Custom) { if (connection == null) throw new ArgumentNullException("connection"); this.connection = connection; ISessionScope parentScope = ScopeUtil.FindPreviousScope(this, true); if (parentScope != null) { if (parentScope.ScopeType == SessionScopeType.Simple) { parentSimpleScope = (SessionScope) parentScope; } else if (parentScope.ScopeType == SessionScopeType.Transactional) { parentTransactionScope = (TransactionScope) parentScope; parentTransactionScope.OnTransactionCompleted += OnTransactionCompleted; } else { // Not supported? } } }
public TransactionScope BeginTransaction() { var connectionScope = BeginConnection(); var transaction = CreateTransaction(connectionScope); var transactionScope = new TransactionScope(this, transaction, connectionScope); _liveTransactionScopes.Add(transactionScope); return transactionScope; }
protected void btnSearchPlanReplace_Click(object sender, EventArgs e) { Position position = currentPosition; File searchPlan = FileBLL.SavePDF(fileSearchPlanReplace, SearchPlanFileType); if (searchPlan != null) { //Delete the old file FileBLL.DeletePDF(position.SearchPlanFile); //Save the new reference using (var ts = new TransactionScope()) { position.SearchPlanFile = searchPlan; PositionBLL.EnsurePersistent(position); ts.CommitTransaction(); } } else { lblInvalidSearchPlanFileType.Text = " *Job Description Must Be a PDF File"; } }
// 只适合更新日志状态 public static int UpdateMQLog(Guid guid, string error, MsgLogState state, out string exception) { exception = ""; try { TTRD_SET_MSG_LOG log = new TTRD_SET_MSG_LOG(); log.GUID = guid.ToString(); log.STATE = (int)state; if (!string.IsNullOrEmpty(error)) { log.ERRINFO = error; } int count = 0; using (TransactionScope trans = new TransactionScope(TransactionScopeOption.RequiresNew)) { TTRD_SET_MSG_LOG_Manager manager = new TTRD_SET_MSG_LOG_Manager(); count = manager.LogUpdate(log); trans.Complete(); } return count; } catch (Exception ex) { exception = ex.Message; xQuant.Log4.LogHelper.Write(xQuant.Log4.LogLevel.Error, string.Format("<MQMsgCommonHelper-UpdateMQLog> Exception:{0}; StatkTrace:{1}.", ex.Message, ex.StackTrace)); return 0; //throw ex; } }
public static int AddMQLog(MessageData msgdata, byte[] senddata, MsgLogState state, out string exception) { exception = ""; try { TTRD_SET_MSG_LOG log = new TTRD_SET_MSG_LOG(); log.GUID = msgdata.MessageID.ToString(); log.FLOW_NO = msgdata.BizMsgID??""; log.USER_CODE = msgdata.TellerNO; log.INS_ID = msgdata.OrgNO; log.IS_MUL_PKG = msgdata.IsMultiPackage ? "1" : "0"; log.MSGTYPE = msgdata.MsgBizType; log.PLATFORMTYPE = (int)msgdata.TragetPlatform; log.SEND_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); log.SEND_CONTENT = senddata; log.STATE = (int)state; int count = 0; using (TransactionScope trans = new TransactionScope(TransactionScopeOption.RequiresNew)) { TTRD_SET_MSG_LOG_Manager manager = new TTRD_SET_MSG_LOG_Manager(); count = manager.LogInsert(log); trans.Complete(); } return count; } catch(Exception ex) { exception = ex.Message; xQuant.Log4.LogHelper.Write(xQuant.Log4.LogLevel.Error, string.Format("<MQMsgCommonHelper-AddMQLog> Exception:{0}; StatkTrace:{1}.", ex.Message, ex.StackTrace)); return 0; } }
public void Transaction() { using (TransactionScope scope = new TransactionScope(Book.ConnectionStringSettings.Key)) { var bookContext = Book.CreateContext(false); Book obj = new Book(); obj.Author = "123"; bookContext.Add(obj); obj = new Book(); obj.Author = "456"; bookContext.Add(obj); bookContext.SubmitChanges(true); var libraryContext = Library.CreateContext(false); Library obj2 = new Library(); obj2.Floor = "123"; libraryContext.Add(obj2); libraryContext.SubmitChanges(); scope.Complete(); } Assert.AreEqual((from q in Library.CreateContext(false) where q.Floor == "123" select q).Count(), 1); }
protected void ibtnPublicationsRemoveFile_Click(object sender, EventArgs e) { int fileID = 0; bool success = false; success = int.TryParse(((ImageButton)sender).CommandArgument, out fileID); if (success) { File fileToDelete = FileBLL.GetByID(fileID); Application application = currentApplication; using (var ts = new TransactionScope()) { FileBLL.DeletePDF(fileToDelete); application.LastUpdated = DateTime.Now; application.Files.Remove(fileToDelete); //Update the current application ApplicationBLL.EnsurePersistent(application); ts.CommitTransaction(); } } DataBindPublications(); }
protected void chkReferencesComplete_CheckedChanged(object sender, EventArgs e) { //Update the complete status using (var ts = new TransactionScope()) { currentApplication.ReferencesComplete = chkReferencesComplete.Checked; ts.CommitTransaction(); } ReloadStepListAndSelectHome(STR_References, true); }
protected void chkCoverLetterOption_CheckedChanged(object sender, EventArgs e) { using (var ts = new TransactionScope()) { currentApplication.CoverLetterComplete = chkCoverLetterOption.Checked; ts.CommitTransaction(); } ReloadStepListAndSelectHome(STR_CoverLetter, true); }
/// <summary> /// 核心钆账 /// </summary> /// <param name="tellerno"></param> /// <param name="orgno"></param> /// <param name="tradedate"></param> /// <param name="querydate"></param> /// <param name="flowNO"></param> /// <param name="queryOrgNO"></param> /// <param name="outmsg"></param> /// <returns></returns> public static bool CoreRollingAcct(String tellerno, String orgno, DateTime tradedate, DateTime querydate, String flowNO, String queryOrgNO, out String outmsg) { List<CoreCheckAcctInfo> outData; if (!CoreAcctChecking(tellerno, orgno, tradedate, querydate, flowNO, queryOrgNO, out outData, out outmsg)) { //outmsg = string.Format("{0}{1}", MsgHandlerEntry.Info_Return_Core, outmsg); return false; } try { if (string.IsNullOrEmpty(queryOrgNO)) { queryOrgNO = orgno; } using (TransactionScope trans = new TransactionScope()) { TTRD_ZJAA_Controller.Delete(queryOrgNO, querydate.ToString("yyyyMMdd")); //TTRD_ZJAA_Controller.Clear(); if (outData != null) { TTRD_ZJAA_Controller.Insert(outData); } trans.Complete(); } return true; } catch (Exception ex) { outmsg = ex.Message; return false; } }
/// <summary> /// 支付平台钆账 /// </summary> /// <param name="queryDate"></param> /// <param name="outmsg"></param> /// <returns></returns> public static bool PayRollingAcct(DateTime queryDate, out string outmsg) { List<PayCheckAcct> outData; if (!PayCheckAccount(queryDate, out outData, out outmsg)) { //outmsg = string.Format("{0}{1}", MsgHandlerEntry.Info_Return_Core, outmsg); return false; } try { using (TransactionScope trans = new TransactionScope()) { TTRD_PAY_Controller.Delete(queryDate.ToString("yyyyMMdd")); if (outData != null) { TTRD_PAY_Controller.Insert(outData); } trans.Complete(); } return true; } catch (Exception ex) { outmsg = ex.Message; return false; } }
public void EndTransaction(TransactionScope transactionScope) { _liveTransactionScopes.Remove(transactionScope); EndConnection(transactionScope.ConnectionScope); if (_liveTransactionScopes.IsEmpty()) { transactionScope.DisposeTransaction(); } }
/// <summary> /// Sends a unsolicited letter to the selected reference /// </summary> protected void sendEmail_Click(object sender, EventArgs e) { Button btnSender = (Button)sender; int referenceID = int.Parse(btnSender.CommandArgument); Reference currentReference = ReferenceBLL.GetByID(referenceID); SmtpClient client = new SmtpClient(); MailMessage message = new MailMessage(WebConfigurationManager.AppSettings["emailFromEmail"], currentReference.Email, "UC Davis Recruitment Unsolicited Letter Response", new TemplateProcessing().ProcessTemplate(currentReference, currentReference.AssociatedApplication, UnsolicitedTemplate.TemplateText, false) ); message.IsBodyHtml = true; client.Send(message); //Record when the unsolicited email was sent out using (var ts = new TransactionScope()) { currentReference.UnsolicitedEmailDate = DateTime.Now; ReferenceBLL.EnsurePersistent(currentReference); ts.CommitTransaction(); } lblResult.Text = "Email sent successfully"; }
protected void btnPublicationsUpload_Click(object sender, EventArgs e) { FileType publicationsFileType = FileTypeBLL.GetByName(STR_FileType_Publication); File uploadedFile = null; using (var ts = new TransactionScope()) { uploadedFile = FileBLL.SavePDF(filePublications, publicationsFileType); ts.CommitTransaction(); } if (uploadedFile != null) { Application application = currentApplication; using (var ts = new TransactionScope()) { application.Files.Add(uploadedFile); application.LastUpdated = DateTime.Now; ApplicationBLL.EnsurePersistent(application); ts.CommitTransaction(); } } else { litPublicationsFileTypeWarning.Text = string.Format("Error occurred saving the publication. Please ensure that the file is of the proper type and size and try uploading again."); } DataBindPublications(); }
protected void btnReferencesAddUpdate_Click(object sender, EventArgs e) { Button referenceButton = sender as Button; //Grab the referenceID from the command argument (0 if it doesn't parse) int referenceID = 0; int.TryParse(referenceButton.CommandArgument, out referenceID); Reference currentReference = new Reference(); //If we have a positive int, get the associated reference if (referenceID > 0) currentReference = ReferenceBLL.GetByID(referenceID); //Now fill in the current reference with the form fields currentReference.Title = txtReferencesTitle.Text; currentReference.FirstName = txtReferencesFirstName.Text; currentReference.LastName = txtReferencesLastName.Text; currentReference.AcadTitle = txtReferencesAcadTitle.Text; currentReference.Expertise = txtReferencesExpertise.Text; currentReference.Dept = txtReferencesDepartment.Text; currentReference.Institution = txtReferencesInstitute.Text; currentReference.Address1 = txtReferencesAddress1.Text; currentReference.Address2 = txtReferencesAddress2.Text; currentReference.City = txtReferencesCity.Text; currentReference.State = txtReferencesState.Text; currentReference.Zip = txtReferencesZip.Text; currentReference.Country = txtReferencesCountry.Text; currentReference.Phone = txtReferencesPhone.Text; currentReference.Email = txtReferencesEmail.Text; currentReference.Complete = true; //Now save this reference by adding it to the current application if it is new, or by replacing the old copy if it exists currentReference.AssociatedApplication = currentApplication; using (var ts = new TransactionScope()) { currentApplication.LastUpdated = DateTime.Now; ReferenceBLL.EnsurePersistent(currentReference); ts.CommitTransaction(); } //Set the button text back to 'Add Reference' and the Command Argument to 0 btnReferencesAddUpdate.Text = "Add Reference"; btnReferencesAddUpdate.CommandArgument = "0"; //Clear out any iformation entered in ClearTextBoxesInPanel(pnlReferencesEntry); //Now DataBind the step to show any changes DataBindReferences(); }
/// <summary> /// Reloads the step list and then makes the home step active /// </summary> private void ReloadStepListAndSelectHome(string fromStepName, bool success) { //Set the home status for user feedback if (success) { lblApplicationStepStatus.ForeColor = System.Drawing.Color.Green; lblApplicationStepStatus.Text = string.Format("{0} successfully completed", fromStepName); //Update the lastupdated timestamp using (var ts = new TransactionScope()) { currentApplication.LastUpdated = DateTime.Now; ts.CommitTransaction(); } } else { lblApplicationStepStatus.ForeColor = System.Drawing.Color.Red; lblApplicationStepStatus.Text = string.Format("Error occurred saving {0}. Please return to the {0} tab and try again. If you were uploading a file, please ensure it is a PDF document. If the problem persists, please contact support", fromStepName); } //Reload the steps list ApplicationSteps = null; LoadSteps(); //Once you save the profile, set the active view back to the Home screen MakeStepActive(STR_HomeStep); }
protected void chkPublicationsFinalize_CheckedChanged(object sender, EventArgs e) { using (var ts = new TransactionScope()) { currentApplication.PublicationsComplete = chkPublicationsFinalize.Checked; ts.CommitTransaction(); } ReloadStepListAndSelectHome(STR_Publications, true); }
/// <summary> /// Removes all files of the given type from the current applicaiton. This removes the files themselves, /// the file info entry and the application files link /// </summary> private void RemoveAllFilesOfType(string fileTypeName) { List<File> existingFiles = GetFilesOfType(fileTypeName); if (existingFiles.Count != 0) { using (var ts = new TransactionScope()) { Application application = currentApplication; foreach (File existingFile in existingFiles) { application.Files.Remove(existingFile); FileBLL.DeletePDF(existingFile); } ApplicationBLL.EnsurePersistent(application); ts.CommitTransaction(); } } }
protected void gviewReferences_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridView referenceGrid = sender as GridView; //Grab the reference from the dataKey ID int currentReferenceID = (int)referenceGrid.DataKeys[e.RowIndex]["ID"]; Reference currentReference = ReferenceBLL.GetByID(currentReferenceID); //Remove the reference from the currentApplication using (var ts = new TransactionScope()) { currentApplication.LastUpdated = DateTime.Now; ReferenceBLL.Remove(currentReference); ts.CommitTransaction(); } DataBindReferences(); }
/// <summary> /// Loop through all defined rules for this application's position and make sure they are all met. /// After verification, mark the application as submitted /// </summary> protected void btnApplicationFinalize_Click(object sender, EventArgs e) { //Place all of the errors into this error string, and mark isComplete false if we fail a step List<string> incompleteSteps = new List<string>(); //Make sure they updated their profile at some point if (currentApplication.AssociatedProfile.LastUpdated == null) incompleteSteps.Add(STR_ContactInformation); //Loop through each required step and make sure it is completed foreach (ApplicationStepType step in currentApplication.AppliedPosition.Steps) { switch (step) { case ApplicationStepType.CurrentPosition: if (!currentApplication.isComplete(ApplicationStepType.CurrentPosition)) incompleteSteps.Add(STR_CurrentPosition); break; case ApplicationStepType.Education: if (!currentApplication.isComplete(ApplicationStepType.Education)) incompleteSteps.Add(STR_EducationInformation); break; case ApplicationStepType.Survey: //if (!currentApplication.isComplete(ApplicationStepType.Survey)) // incompleteSteps.Add(STR_ConfidentialSurvey); break; case ApplicationStepType.References: //if (!currentApplication.ReferencesComplete) // incompleteSteps.Add(STR_References); break; default: break; } } //Always check references and the confidential survey if (!currentApplication.isComplete(ApplicationStepType.Survey)) incompleteSteps.Add(STR_ConfidentialSurvey); if (!currentApplication.ReferencesComplete) incompleteSteps.Add(STR_References); //Loop through each requested file type and make sure a file of the given type exists foreach (FileType type in currentApplication.AppliedPosition.FileTypes) { switch (type.FileTypeName) { case STR_FileType_CoverLetter: //Cover letter is incomplete only if the "coverletter complete" bool is not true AND there are no cover letters if (!currentApplication.CoverLetterComplete && !existsFileOfType(STR_FileType_CoverLetter)) incompleteSteps.Add(STR_CoverLetter); break; case STR_FileType_ExtensionInterests: if (!existsFileOfType(STR_FileType_ExtensionInterests)) incompleteSteps.Add(STR_ExtensionInterests); break; case STR_FileType_Publication: if (!currentApplication.PublicationsComplete) incompleteSteps.Add(STR_Publications); break; case STR_FileType_ResearchInterests: if (!existsFileOfType(STR_FileType_ResearchInterests)) incompleteSteps.Add(STR_ResearchInterests); break; case STR_FileType_TeachingInterests: if (!existsFileOfType(STR_FileType_TeachingInterests)) incompleteSteps.Add(STR_TeachingInterests); break; case STR_FileType_Transcript: if (!existsFileOfType(STR_FileType_Transcript)) incompleteSteps.Add(STR_Transcripts); break; case STR_Resume: if (!existsFileOfType(STR_Resume)) incompleteSteps.Add(STR_Resume); break; case STR_CV: if (!existsFileOfType(STR_CV)) incompleteSteps.Add(STR_CV); break; case STR_Dissertation: if (!existsFileOfType(STR_Dissertation)) incompleteSteps.Add(STR_Dissertation); break; default: break; } } //If there are any incompleteSteps, alert the user, else complete the application and redirect if (incompleteSteps.Count > 0) { StringBuilder finalizeErrorString = new StringBuilder("You must complete the following step(s) before finalizing your application: "); finalizeErrorString.Append("<br />"); finalizeErrorString.Append("<span style=\"color:Red\">"); incompleteSteps.Sort(); foreach (string s in incompleteSteps) { finalizeErrorString.Append(s); finalizeErrorString.Append("<br />"); } finalizeErrorString.Append("</span>"); litApplicationFinalizeStatus.Text = finalizeErrorString.ToString(); } else { using (var ts = new TransactionScope()) { currentApplication.SubmitDate = DateTime.Now; currentApplication.Submitted = true; ts.CommitTransaction(); } //Application was successfully submitted, so send a confirmation email System.Net.Mail.SmtpClient mail = new System.Net.Mail.SmtpClient(); //Try to send the email -- if there are errors, ignore (we'd rather have the application completed then fail on the emailing) try { string subject = "Application submission confirmation"; StringBuilder bodyText = new StringBuilder(); bodyText.AppendFormat("Your application for the {0} position at the University of California, Davis, has been successfully received.", currentApplication.AppliedPosition.PositionTitle); bodyText.Append(" We appreciate your interest in our position."); MailMessage message = new MailMessage(currentApplication.AppliedPosition.HREmail, currentApplication.Email, subject, bodyText.ToString()); message.IsBodyHtml = true; mail.Send(message); //Send the message } catch (Exception) { } //Continue on failure Response.Redirect(STR_URL_ApplicationSubmitted); } }
/// <summary> /// Function which will upload the file in the fileUpload control into the current application /// as the given fileType. Note that this will remove all other files of the fileType from the application /// </summary> /// <param name="fileUpload">The file upload control containing the file</param> /// <param name="fileTypeName">The fileType to upload as</param> /// <returns>True on success, else false</returns> private bool AddUniqueFileToApplication(FileUpload fileUpload, string fileTypeName) { FileType FileType = FileTypeBLL.GetByName(fileTypeName); RemoveAllFilesOfType(fileTypeName); using (var ts = new TransactionScope()) { File savedFile = FileBLL.SavePDF(fileUpload, FileType); if (savedFile != null) { Application application = currentApplication; application.Files.Add(savedFile); ApplicationBLL.EnsurePersistent(application); ts.CommitTransaction(); return true; } else { return false; } } }
protected void btnConfidentialSurveyAccept_Click(object sender, EventArgs e) { int genderID = 0; string ethnicity = null; List<SurveyXRecruitmentSrc> RecruitmentSources = new List<SurveyXRecruitmentSrc>(); foreach (ListItem item in rbtnConfidentialSurveySex.Items) { if (item.Selected) //Find the selected gender and set the genderID to that value genderID = int.Parse(item.Value); } //Instead of grabbing each radio button individually, loop through the control tree of the current view and look for radio buttons foreach (Control c in viewConfidentialSurvey.Controls) { if (c is RadioButton) { RadioButton ethnicityButton = (RadioButton)c; if (ethnicityButton.Checked && ethnicityButton.GroupName == "Ethnicity") { ethnicity = ethnicityButton.Text; break; } } } //Look through each item in the recruitment source repeater foreach (RepeaterItem item in rptRecruitmentSource.Items) { CheckBox cbox = item.FindControl("chkRecruitmentSource") as CheckBox; if (cbox != null && cbox.Checked) //if we found a checked checkbox { SurveyXRecruitmentSrc recruitmentSource = new SurveyXRecruitmentSrc(); RecruitmentSrc example = new RecruitmentSrc(); Label source = item.FindControl("lblRecruitmentSource") as Label; TextBox specific = item.FindControl("txtSpecify") as TextBox; if (source != null) //Make sure we have a valid source { example.RecruitmentSource = source.Text; //Grab the matching recruitment source out (ignore the allow specify field) recruitmentSource.RecruitmentSrc = RecruitmentSrcBLL.GetUniqueByExample(example, "AllowSpecify"); recruitmentSource.RecruitmentSrcOther = string.IsNullOrEmpty(specific.Text) ? null : specific.Text; RecruitmentSources.Add(recruitmentSource); } } } //Save ethnicity, gender, and all of the recruitment sources Application application = currentApplication; using (var ts = new TransactionScope()) { //First make sure we have a survey if (application.Surveys.Count == 0) { Survey newSurvey = new Survey(); newSurvey.AssociatedApplication = application; application.Surveys.Add(newSurvey); } Survey currentSurvey = application.Surveys[0]; //Save the gender if the ID was set (non-zero), else save that is was null if (genderID > 0) { currentSurvey.Gender = GenderBLL.GetByID(genderID); } else { currentSurvey.Gender = null; } //Save the ethnicity if (ethnicity != null) { Ethnicity chosenEthnicity = new Ethnicity(); chosenEthnicity.EthnicityValue = ethnicity; currentSurvey.Ethnicity = EthnicityBLL.GetUniqueByExample(chosenEthnicity); currentSurvey.TribalAffiliation = string.IsNullOrEmpty(txtAmericanIndian.Text) ? null : txtAmericanIndian.Text; } else { currentSurvey.Ethnicity = null; currentSurvey.TribalAffiliation = null; } //Save each recruitment source & clear out existing sources if (currentSurvey.RecruitmentSources == null) currentSurvey.RecruitmentSources = new List<SurveyXRecruitmentSrc>(); currentSurvey.RecruitmentSources.Clear(); foreach (SurveyXRecruitmentSrc chosenRecruitmentSource in RecruitmentSources) { chosenRecruitmentSource.AssociatedSurvey = currentSurvey; currentSurvey.RecruitmentSources.Add(chosenRecruitmentSource); //Trace.Write(string.Format("Checked the source {0} with additional info {1}", s.RecruitmentSrc.RecruitmentSource, s.RecruitmentSrcOther) + Environment.NewLine); } //Finally, set this step to complete currentSurvey.Complete = true; currentSurvey.AssociatedApplication = application; ApplicationBLL.EnsurePersistent(application); ts.CommitTransaction(); } ReloadStepListAndSelectHome(STR_ConfidentialSurvey, true); }
/// <summary> /// Creates an application on behalf of the currently logged in user, then /// redirects to that application /// </summary> /// <remarks>Checks to make sure the logged in user has an applicant account</remarks> protected void btnPositionApply_Click(object sender, EventArgs e) { Applicant loggedInUser = ApplicantBLL.GetCurrent(); //Make sure the loggedInUser has an Applicant account if (loggedInUser == null) { Trace.Warn("Not Logged Is As Member"); FormsAuthentication.SignOut(); //Causes the user to sign out and redirect FormsAuthentication.RedirectToLoginPage(Request.Url.AbsolutePath); //Make the user log in return; } //If the applicant already has an application for this position, redirect to the app page foreach (Application app in loggedInUser.MainProfile.Applications) { if (app.AppliedPosition == currentPosition) { Response.Redirect(string.Format("{0}?ApplicationID={1}", "Applicant/App.aspx", app.ID)); } } //Now we have a valid applicant, so create the application Application newApplication = new Application(); newApplication.AppliedPosition = currentPosition; newApplication.AssociatedProfile = loggedInUser.MainProfile; newApplication.Email = loggedInUser.Email; newApplication.LastUpdated = DateTime.Now; using (var ts = new TransactionScope()) { //Now save the new application get get back the ID ApplicationBLL.EnsurePersistent(newApplication); ts.CommitTransaction(); } //Redirect to the newly created application Response.Redirect(string.Format("{0}?ApplicationID={1}", "Applicant/App.aspx", newApplication.ID.ToString())); }
/// <summary> /// Saves the contact information entered into the form and then changes back to the home screen /// </summary> protected void btnContactSave_Click(object sender, EventArgs e) { if (!Page.IsValid) return; //Error message //Grab the user's profile and update the fields Profile currentProfile = currentApplication.AssociatedProfile; Application application = currentApplication; currentProfile.FirstName = txtContactFirstName.Text; currentProfile.MiddleName = txtContactMiddleName.Text; currentProfile.LastName = txtContactLastName.Text; currentProfile.Address1 = txtContactAddress1.Text; currentProfile.Address2 = txtContactAddress2.Text; currentProfile.City = txtContactCity.Text; currentProfile.Zip = txtContactZip.Text; currentProfile.Country = txtContactCountry.Text; currentProfile.State = txtContactState.Text; currentProfile.Phone = txtContactPhone.Text; //currentProfile.Country = null; //currentProfile.CountryCode = null; //Update the LastUpdated property (this is how we know a profile has been updated/completed) currentProfile.LastUpdated = DateTime.Now; //Update the email of the current application application.LastUpdated = DateTime.Now; application.Email = txtContactEmail.Text; using (var ts = new TransactionScope()) { ProfileBLL.EnsurePersistent(currentProfile); ApplicationBLL.EnsurePersistent(application); ts.CommitTransaction(); } ReloadStepListAndSelectHome(STR_ContactInformation, true); }
/// <summary> /// 把支付交易序号更新为资金流水号,只适用来账销账 /// </summary> /// <param name="msgdata"></param> /// <param name="paysn"></param> /// <param name="hostflow"></param> /// <param name="error"></param> /// <param name="state"></param> /// <param name="exception"></param> /// <returns></returns> public static int UpdateMQLog(MessageData msgdata, string paysn, string hostflow, string error, MsgLogState state, out string exception) { exception = ""; try { TTRD_SET_MSG_LOG log = new TTRD_SET_MSG_LOG(); log.GUID = msgdata.MessageID.ToString(); log.FLOW_NO = paysn; log.USER_CODE = msgdata.TellerNO; log.INS_ID = msgdata.OrgNO; //log.IS_MUL_PKG = msgdata.IsMultiPackage ? "1" : "0"; log.HOSTFLOW_NO = hostflow; log.MSGTYPE = msgdata.MsgBizType; log.PLATFORMTYPE = (int)msgdata.TragetPlatform; log.RESP_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); log.RECV_CONTENT = msgdata.CurrentRespPackage.PackageMessage; log.STATE = (int)state; if (!string.IsNullOrEmpty(error)) { log.ERRINFO = error; } int count = 0; using (TransactionScope trans = new TransactionScope(TransactionScopeOption.RequiresNew)) { TTRD_SET_MSG_LOG_Manager manager = new TTRD_SET_MSG_LOG_Manager(); count = manager.LogUpdate(log); trans.Complete(); } return count; } catch (Exception ex) { exception = ex.Message; xQuant.Log4.LogHelper.Write(xQuant.Log4.LogLevel.Error, string.Format("<MQMsgCommonHelper-UpdateMQLog> Exception:{0}; StatkTrace:{1}.", ex.Message, ex.StackTrace)); return 0; //throw ex; } }
protected void btnCurrentPositionSave_Click(object sender, EventArgs e) { if (!Page.IsValid) return; //Error message //Grab the existing current position if available, else create a new one CurrentPosition currentPosition = new CurrentPosition(); if (currentApplication.CurrentPositions.Count != 0) //if there is an existing result currentPosition = currentApplication.CurrentPositions[0]; //Now set all of the fields currentPosition.Title = txtCurrentPositionTitle.Text; currentPosition.Department = txtCurrentPositionDepartment.Text; currentPosition.Institution = txtCurrentPositionInstitution.Text; currentPosition.Address1 = txtCurrentPositionAddress1.Text; currentPosition.Address2 = txtCurrentPositionAddress2.Text; currentPosition.City = txtCurrentPositionCity.Text; currentPosition.State = txtCurrentPositionState.Text; currentPosition.Zip = txtCurrentPositionZip.Text; currentPosition.Country = txtCurrentPositionCountry.Text; //Associate with the current application and set to complete currentPosition.AssociatedApplication = currentApplication; currentPosition.Complete = true; using (var ts = new TransactionScope()) { CurrentPositionBLL.EnsurePersistent(currentPosition); currentApplication.CurrentPositions.Add(currentPosition); ts.CommitTransaction(); } ReloadStepListAndSelectHome(STR_CurrentPosition, true); }
protected void btnEducationSave_Click(object sender, EventArgs e) { if (!Page.IsValid) return; //Error message //Grab the existing education if available, else create a new one Education currentEducation = new Education(); if (currentApplication.Education.Count != 0) //if there is an existing education result currentEducation = currentApplication.Education[0]; //Now set the fields currentEducation.Date = DateTime.Parse(txtEducationPHDDate.Text, englishCulture); //currentEducation.Date = DateTime.Parse(txtEducationPHDDate.Text); currentEducation.Institution = txtEducationInstitution.Text; currentEducation.Discipline = txtEducationDiscipline.Text; currentEducation.ResearchField = txtEducationResearch.Text; currentEducation.Advisor = txtEducationAdvisor.Text; //Associate this with the current application currentEducation.AssociatedApplication = currentApplication; currentEducation.Complete = true; //Make sure to complete on save using (var ts = new TransactionScope()) { EducationBLL.EnsurePersistent(currentEducation); currentApplication.Education.Add(currentEducation); ts.CommitTransaction(); } ReloadStepListAndSelectHome(STR_EducationInformation, true); }
protected void btnModifyPosition_Click(object sender, EventArgs e) { if (!Page.IsValid) return; Position newPosition = new Position(); if (currentPositionID.HasValue) newPosition = currentPosition; //Set the posted date to now newPosition.DatePosted = DateTime.Now; newPosition.Deadline = DateTime.Parse(txtDeadline.Text); newPosition.PositionTitle = txtPositionTitle.Text; newPosition.PositionNumber = txtPositionNumber.Text; newPosition.HRRep = string.IsNullOrEmpty(txtHRRep.Text) ? null : txtHRRep.Text; newPosition.HRPhone = string.IsNullOrEmpty(txtHRPhone.Text) ? null : txtHRPhone.Text; newPosition.HREmail = string.IsNullOrEmpty(txtHREmail.Text) ? null : txtHREmail.Text; if (!updatePrimaryDepartmentStatus()) { lblPrimaryDeptErrorMessage.Text = "You must select exactly one primary department for this position"; return; } addDepartmentsToPosition(newPosition); addFileTypesToPosition(newPosition); addStepsToPosition(newPosition); newPosition.ShortDescription = txtShortDescription.Text; if (newPosition.ReferenceTemplate == null) newPosition.ReferenceTemplate = new Template(); newPosition.ReferenceTemplate.TemplateType = ReferenceTemplateType; newPosition.ReferenceTemplate.TemplateText = txtReferenceTemplate.Text; newPosition.NumPublications = int.Parse(txtPublications.Text); newPosition.NumReferences = int.Parse(txtReferences.Text); newPosition.AllowApps = chkAllowApplications.Checked; newPosition.FacultyView = chkAllowFaculty.Checked; newPosition.Closed = chkPositionClosed.Checked; // Only try modifying the position descriptions if an upload file exists (should be a new position only). if (filePositionDescription.HasFile) { File jobDescriptionFile = null; using (var ts = new TransactionScope()) { jobDescriptionFile = FileBLL.SavePDF(filePositionDescription, JobDescriptionFileType); ts.CommitTransaction(); } if (jobDescriptionFile == null) { //Error message: Job Description Must Be a PDF File lblInvalidFileType.Text = " *Job Description Must Be a PDF File"; return; } else { newPosition.DescriptionFile = jobDescriptionFile; } } // Only try modifying the search plans if an upload file exists (new or legacy positions). if (fileSearchPlan.HasFile) { File searchPlanFile; using (var ts = new TransactionScope()) { searchPlanFile = FileBLL.SavePDF(fileSearchPlan, SearchPlanFileType); ts.CommitTransaction(); } if (searchPlanFile == null) { //Error: Job description must be a PDF file lblInvalidSearchPlanFileType.Text = "*Search Plan Must Be A PDF File"; return; } else { newPosition.SearchPlanFile = searchPlanFile; } } if (newPosition.IsTransient()) { //Since the position is new, send an email to the AppMailTo about the new pending position PositionBLL.SendNotificationEmail(newPosition, PendingPageURL); } using (var ts = new TransactionScope()) { PositionBLL.EnsurePersistent(newPosition); ts.CommitTransaction(); } //Redirect to the position modified page Response.Redirect("PositionModified.aspx"); }