Exemplo n.º 1
0
 public Candidatefrm()
 {
     InitializeComponent();
     _candidate = new CandidateDetail()
     {
         ProcessedDate = DateTime.Now,
         DateOfBirth = DateTime.Now.AddYears(-15),
         Gender = "Male",
         MarritalStatus = "Unmarried",
         AdditionalQualification = string.Empty
     };
 }
Exemplo n.º 2
0
        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.CandidateCode = string.IsNullOrEmpty(txtCandidateCode.Text) ? 0 : Convert.ToInt32(txtCandidateCode.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.Remarks = txtRemark.Text;
                //_candidate.ExecutiveName = HomePage.UserDetail.UserId;
                _candidate.ModifiedDateTime = DateTime.Now;

                SaveAttachCV(_candidate);

                var addQulifications = new List<string>();
                foreach (var item in lbAddQualification.SelectedItems)
                {
                    addQulifications.Add(item.ToString());
                }
                _candidate.AdditionalQualification = string.Join(",", addQulifications.ToArray());

                var response = MethodHelper.GetServiceResponse<CandidateDetail>("api/CandidateApi/Save", _candidate);
                if (!response.IsSuccess)
                {

                }

                // if new candidate
                if (_candidate.SrNo < 1)
                {
                    _candidate = new CandidateDetail()
                    {
                        ProcessedDate = DateTime.Now,
                        DateOfBirth = DateTime.Now.AddYears(-15),
                        Gender = "Male",
                        MarritalStatus = "Unmarried",
                        AdditionalQualification = string.Empty
                    };

                    ResetCandidate();
                    return;
                }

                ResetCandidate();
                this.Close();
            }
            catch (FileNotFoundException ex)
            {
                MessageBox.Show(ex.Message, @"Message", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), @"Message", MessageBoxButtons.OK);
            }
        }
Exemplo n.º 3
0
 public Candidatefrm(CandidateDetail candidateDetail)
 {
     InitializeComponent();
     _candidate = candidateDetail;
 }
Exemplo n.º 4
0
        private void SaveAttachCV(CandidateDetail candidate)
        {
            if (string.IsNullOrEmpty(txtAttachCV.Text))
                return;

            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;
        }