private static string SaveCallLatter(CandidateDetail candidate, string sourceFileName) { if (string.IsNullOrEmpty(sourceFileName)) return string.Empty; var targetPath = string.Format("{0}/{1}/{2}/{3}", ConfigurationSettings.AppSettings["CvUploadLocation"], candidate.JobTitle, candidate.Experience, candidate.Name); var targetDir = new DirectoryInfo(targetPath); if (!targetDir.Exists) { targetDir.Create(); } var selFile = new FileInfo(sourceFileName); if (!selFile.Exists) { throw new FileNotFoundException(string.Format("Selected File {0} is not Found In location {0}", selFile.Name, selFile.DirectoryName)); } var fileName = System.IO.Path.GetFileName(selFile.FullName); var destFile = System.IO.Path.Combine(targetDir.FullName, fileName); if (selFile.FullName == destFile) { return destFile; } System.IO.File.Copy(selFile.FullName, destFile, true); return destFile; }
public Candidatefrm() { InitializeComponent(); _candidate = new CandidateDetail() { ProcessedDate = DateTime.Now, DateOfBirth = DateTime.Now, Gender = "Male", MarritalStatus = "Unmarried", AdditionalQualification = string.Empty, Placed = false, Registered = false }; }
private string GetMessage(SMSType smsType, CandidateDetail candidate) { switch (smsType) { case SMSType.SelectType: return string.Empty; case SMSType.SMS_1: return string.Format("Dear Candidate this is sms 1"); case SMSType.SMS_2: return string.Format("Dear Candidate this is sms 2"); case SMSType.SMS_3: return string.Format("Dear Candidate this is sms 3"); case SMSType.SMS_4: return string.Format("Dear {0} this is sms 4", candidate.Name); default: MessageBox.Show("Selected message type is not correct"); return string.Empty; } }
partial void DeleteCandidateDetail(CandidateDetail instance);
partial void UpdateCandidateDetail(CandidateDetail instance);
partial void InsertCandidateDetail(CandidateDetail instance);
private void buttonSave_Click(object sender, EventArgs e) { try { if (!ValidateForm()) return; _candidate.Link = cmbLink.Text; _candidate.ProcessedDate = dtpProcessedDate.Value; _candidate.Name = txtName.Text; _candidate.Gender = (rbMale.Checked) ? "Male" : "Female"; _candidate.DateOfBirth = dtpDateOfBirth.Value; _candidate.Age = string.IsNullOrEmpty(txtAge.Text) ? 0 : Convert.ToInt32(txtAge.Text); _candidate.MarritalStatus = (rbUnmarried.Checked) ? "Unmarried" : "Married"; _candidate.MobileNo = txtMobileNo.Text; _candidate.LandLineNo = txtLandLineNo.Text; _candidate.Email = txtEmail.Text; _candidate.CurrentLocation = cmbCurrentLocation.Text; _candidate.PreferedLocation = cmbPreferedLocation.Text; _candidate.Qualification = cmbQualification.Text; _candidate.Experience = string.IsNullOrEmpty(txtExperience.Text) ? 0 : Convert.ToInt32(txtExperience.Text); _candidate.ExpSlap = cmbExpSlab.Text; _candidate.JobTitle = cmbJobTitle.Text; _candidate.CurrentIndustry = cmbCurrentIndustry.Text; _candidate.PreferredIndustry = cmbPreferredIndustry.Text; _candidate.NoticePeriod = cmbNoticePeriod.Text; _candidate.CurrentCTC = txtCurrentCTC.Text; _candidate.ExpectedCTC = txtExpectedCTC.Text; _candidate.NoOfCalls = string.IsNullOrEmpty(txtNoOfCalls.Text) ? 0 : Convert.ToInt32(txtNoOfCalls.Text); _candidate.Remarks = txtRemark.Text; _candidate.Registered = cbRegistered.Checked; _candidate.Placed = cbPlaced.Checked; _candidate.ExecutiveName = HomePage.ExecutiveName; SaveAttachCV(_candidate); _candidate.CallLatter1 = SaveCallLatter(_candidate, txtCallLatter1.Text); _candidate.CallLatter2 = SaveCallLatter(_candidate, txtCallLatter2.Text); _candidate.CallLatter3 = SaveCallLatter(_candidate, txtCallLatter3.Text); _candidate.CallLatter4 = SaveCallLatter(_candidate, txtCallLatter4.Text); _candidate.CallLatter5 = SaveCallLatter(_candidate, txtCallLatter5.Text); var addQulifications = new List<string>(); foreach (var item in lbAddQualification.SelectedItems) { addQulifications.Add(item.ToString()); } _candidate.AdditionalQualification = string.Join(",", addQulifications.ToArray()); // if new candidate if (_candidate.SrNo < 1) { var maxID = db.CandidateDetails.Count() > 0 ? db.CandidateDetails.Select(c => c.SrNo).Max() : 0; _candidate.SrNo = maxID + 1; db.CandidateDetails.InsertOnSubmit(_candidate); db.SubmitChanges(); _candidate = new CandidateDetail() { ProcessedDate = DateTime.Now, DateOfBirth = DateTime.Now.AddYears(-15), Gender = "Male", MarritalStatus = "Unmarried", AdditionalQualification = string.Empty, Placed = false, Registered = false }; ResetCandidate(); return; } // if existing candidate db.SubmitChanges(); ResetCandidate(); this.Close(); } catch (FileNotFoundException ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Message", MessageBoxButtons.OK); } }
public Candidatefrm(long srNo) { InitializeComponent(); _candidate = db.CandidateDetails.Single(x => x.SrNo == srNo); isNewCandidate = false; }
private void SaveAttachCV(CandidateDetail candidate) { var targetPath = string.Format("{0}/{1}/{2}", ConfigurationSettings.AppSettings["CvUploadLocation"], candidate.JobTitle, candidate.Experience); var targetDir = new DirectoryInfo(targetPath); if (!targetDir.Exists) { targetDir.Create(); } var selFile = new FileInfo(txtAttachCV.Text); if (!selFile.Exists) { throw new FileNotFoundException(string.Format("Selected File {0} is not Found In location {0}", selFile.Name, selFile.DirectoryName)); } var fileName = System.IO.Path.GetFileName(selFile.FullName); var destFile = System.IO.Path.Combine(targetDir.FullName, fileName); if (selFile.FullName == destFile) return; System.IO.File.Copy(selFile.FullName, destFile, true); candidate.CVPath = destFile; }
public SendSMSfrm(CandidateDetail candidate) { InitializeComponent(); _candidate = candidate; }