protected void gvTraineeProfile_RowCommand(object sender, GridViewCommandEventArgs e) { TRNTrainee objTraineeProfile = new TRNTrainee(); if (e.CommandName.Equals("cmdDelete")) { int TraineeID = Convert.ToInt32(e.CommandArgument); objTraineeProfile.TraineeID = TraineeID; objTraineeProfile.Status = 0; int rowaffected = TRNTraineeBO.DeleteTrainee(objTraineeProfile); LoadTraineeList(); } }
TRNTrainee MapTrainee() { TRNTrainee objTrainee = new TRNTrainee(); objTrainee.TraineeID = TraineeID; if (!String.IsNullOrEmpty(ddlQualification.SelectedValue.ToString())) objTrainee.EducationLevelID = Convert.ToInt32(ddlQualification.SelectedValue); if (!String.IsNullOrEmpty(ddlInformationSource.SelectedValue.ToString())) objTrainee.InformationSourceID = Convert.ToInt32(ddlInformationSource.SelectedValue); //if (!String.IsNullOrEmpty(ddlTrainingEvent.SelectedValue.ToString())) // objTrainee.EventID = Convert.ToInt32(ddlTrainingEvent.SelectedValue); DataView dvTrainingInfo = TRNTraineeBO.GetTrainingInfoByID(TraineeID); objTrainee.EventID = Convert.ToInt32(dvTrainingInfo.Table.Rows[0]["TrainingEventID"]); if (!String.IsNullOrEmpty(ddlDistrict.SelectedValue.ToString())) objTrainee.DistrictID = Convert.ToInt32(ddlDistrict.SelectedValue); if (!String.IsNullOrEmpty(ddlVDC.SelectedValue.ToString())) objTrainee.VDCID = Convert.ToInt32(ddlVDC.SelectedValue); if (!String.IsNullOrEmpty(ddlCastEthinicity.SelectedValue.ToString())) objTrainee.EthnicityID = Convert.ToInt32(ddlCastEthinicity.SelectedValue); string ValidRegions = string.Empty; for (int j = 0; j < rbValidRegions.Items.Count; j++) { if (rbValidRegions.Items[j].Selected == true) { if (j == 0) ValidRegions = rbValidRegions.Items[j].Value; else ValidRegions = ValidRegions + "," + rbValidRegions.Items[j].Value; } } objTrainee.ValidRegions = ValidRegions; if (!String.IsNullOrEmpty(ddlCitizenshipIssuedDistict.SelectedValue.ToString())) objTrainee.CitizenshipIssueDistictID = Convert.ToInt32(ddlCitizenshipIssuedDistict.SelectedValue); objTrainee.FirstName = txtFirstName.Text; objTrainee.LastName = txtLastName.Text; objTrainee.Gender = ddlGender.SelectedValue; objTrainee.MaritalStatus = ddlMaritalStatus.SelectedValue; objTrainee.DateOfBirthAD = txtDateOfBirthAD.Text; objTrainee.DateOfBirthBS = txtDateOfBirthBS.Text; objTrainee.CurrentAge = txtAge.Text; objTrainee.SpecialCase = hfSpecialCase.Value; objTrainee.Tole = txtTol.Text; objTrainee.WardNumber = txtWardNumber.Text; objTrainee.PhoneNumber = txtPhoneNumberHouse.Text; objTrainee.MobileNumber = txtMobile.Text; objTrainee.CitizenshipNumber = txtCitizenshipNumber.Text; objTrainee.PassportNumber = txtPassportNumber.Text; objTrainee.FatherName = txtFathersName.Text; objTrainee.FatherTelephone = txtFathersContactNumber.Text; objTrainee.ContactPerson = txtContactPerson.Text; objTrainee.ContactPersonTelephone = txtContactPersonContactTelephone.Text; if (chkUnEmployment.Checked) objTrainee.Unemployment = 1; else { objTrainee.Unemployment = 0; if (!String.IsNullOrEmpty(txtSelfEmploymentIncome.Text)) objTrainee.SelfEmployment = Convert.ToDecimal(txtSelfEmploymentIncome.Text); else objTrainee.SelfEmployment = 0; if (!String.IsNullOrEmpty(txtWageIncome.Text)) objTrainee.Wage = Convert.ToDecimal(txtWageIncome.Text); else objTrainee.Wage = 0; if (!String.IsNullOrEmpty(txtAgricultureIncome.Text)) objTrainee.Agriculture = Convert.ToDecimal(txtAgricultureIncome.Text); else objTrainee.Agriculture = 0; if (!String.IsNullOrEmpty(txtForeignIncome.Text)) objTrainee.ForeignEmploymentIncome = Convert.ToDecimal(txtForeignIncome.Text); else objTrainee.ForeignEmploymentIncome = 0; if (!String.IsNullOrEmpty(txtOtherIncome.Text)) objTrainee.Other = Convert.ToDecimal(txtOtherIncome.Text); else objTrainee.Other = 0; if (!String.IsNullOrEmpty(ddlFeedDurationTypeID.SelectedValue.ToString())) objTrainee.FeedDurationTypeID = Convert.ToInt32(ddlFeedDurationTypeID.SelectedValue); } //if (!String.IsNullOrEmpty(txtTrainingRegistrationDate.Text)) // objTrainee.RegisteredDate = Convert.ToDateTime(txtTrainingRegistrationDate.Text); if (!String.IsNullOrEmpty(txtFamilyMember.Text)) objTrainee.NoOfFamilyMember = Convert.ToInt32(txtFamilyMember.Text); objTrainee.CreatedBy = UserAuthentication.GetUserId(this.Page); if (fuPhoto.HasFile) { string path = "~/Training/Photos/"; objTrainee.Photo = UploadImage(fuPhoto, path); } objTrainee.Status = 1; objTrainee.ReferredBy = txtReferredBy.Text; return objTrainee; }