protected void lnk_Edit_Command(object sender, CommandEventArgs e) { try { txt_Email.Enabled = false; btn_Save.Visible = false; LoadDropDowns(); SMHR_TRAINERPROFILE _obj_smhr_Trainerprofile = new SMHR_TRAINERPROFILE(); _obj_smhr_Trainerprofile.OPERATION = operation.Get; _obj_smhr_Trainerprofile.Trainer_TrainerProfile_ID = Convert.ToInt32(Convert.ToString(e.CommandArgument)); ld_ID.Text = Convert.ToString(Convert.ToString(e.CommandArgument)); _obj_smhr_Trainerprofile.TRAINER_ORGID = Convert.ToInt32(Session["ORG_ID"]); DataTable dt = BLL.get_TrainingProfile(_obj_smhr_Trainerprofile); if (dt.Rows.Count != 0) { txt_FirstName.Text = Convert.ToString(dt.Rows[0]["Trainer_FirstName"]); txt_MiddleName.Text = Convert.ToString(dt.Rows[0]["Trainer_MiddleName"]); txt_LastName.Text = Convert.ToString(dt.Rows[0]["Trainer_LastName"]); txt_Address1.Text = Convert.ToString(dt.Rows[0]["Trainer_Address1"]); txt_Address2.Text = Convert.ToString(dt.Rows[0]["Trainer_Address2"]); txt_Age.Text = Convert.ToString(dt.Rows[0]["Trainer_Age"]); txt_mobileNo.Text = Convert.ToString(dt.Rows[0]["Trainer_MoblieNo"]); txt_LandLineNo.Text = Convert.ToString(dt.Rows[0]["Trainer_LandlineNo"]); txt_Email.Text = Convert.ToString(dt.Rows[0]["Trainer_EmailID"]); rc_Country.SelectedIndex = rc_Country.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["Trainer_CountryID"])); rc_Country_SelectedIndexChanged(null, null); rc_County.SelectedIndex = rc_County.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["Trainer_CountyID"])); rc_County_SelectedIndexChanged(null, null); rc_Qualification.SelectedIndex = rc_Qualification.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["Trainer_Qualification"])); rc_Town.SelectedIndex = rc_Town.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["Trainer_TownID"])); rad_IsActive.Checked = Convert.ToBoolean(dt.Rows[0]["Trainer_Status"]); txt_DOB.SelectedDate = Convert.ToDateTime(dt.Rows[0]["Trainer_DOB"]); rc_CourseCategory.SelectedIndex = rc_CourseCategory.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["Trainer_CourseCategory"])); rc_ServiceProvider.SelectedIndex = rc_ServiceProvider.FindItemIndexByValue(Convert.ToString(dt.Rows[0]["Trainer_ServiceProvider"])); txt_YeaofPass.Text = Convert.ToString(dt.Rows[0]["Trainer_YearOfPass"]); txt_Institute.Text = Convert.ToString(dt.Rows[0]["Trainer_Institute"]); txt_Percentage.Text = Convert.ToString(dt.Rows[0]["Trainer_Percentage"]); txt_ZipCode.Text = Convert.ToString(dt.Rows[0]["Trainer_ZipCode"]); if (Convert.ToInt32(Session["WRITEFACILITY"]) == 2) { btn_Update.Visible = false; } else { btn_Update.Visible = true; } Rp_CY_ViewDetails.Selected = true; Rm_Course_page.SelectedIndex = 0; } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "TrainerProfile", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void radCourse_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e) { try { SMHR_TRAINERPROFILE _obj_smhr_Trainerprofile = new SMHR_TRAINERPROFILE(); _obj_smhr_Trainerprofile.TRAINER_ORGID = Convert.ToInt32(Session["ORG_ID"]); _obj_smhr_Trainerprofile.Trainer_CourseCategory = Convert.ToInt32(radCourse.SelectedValue); _obj_smhr_Trainerprofile.OPERATION = operation.Select2; radTrainers.DataSource = BLL.get_TrainingProfile(_obj_smhr_Trainerprofile); radTrainers.DataTextField = "Trainer_Name"; radTrainers.DataValueField = "Trainer_TrainerProfile_ID"; radTrainers.DataBind(); radTrainers.Items.Insert(0, new Telerik.Web.UI.RadComboBoxItem("Select", "0")); } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_CourseSchedule", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void LoadGrid() { try { SMHR_TRAINERPROFILE _obj_smhr_Trainerprofile = new SMHR_TRAINERPROFILE(); _obj_smhr_Trainerprofile.OPERATION = operation.Select; _obj_smhr_Trainerprofile.TRAINER_ORGID = Convert.ToInt32(Session["ORG_ID"]); DataTable dt = BLL.get_TrainingProfile(_obj_smhr_Trainerprofile); Rg_Countries.DataSource = dt; //SMHR_COUNTRY bh = new SMHR_COUNTRY(); //bh.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); //DataTable dt = BLL.get_Country(bh); //Rg_Countries.DataSource = dt; } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "TrainerProfile", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }
protected void btn_Save_Click(object sender, EventArgs e) { try { string ErrorMesage = string.Empty; if (ValiadteQualification(out ErrorMesage)) { SMHR_TRAINERPROFILE _obj_smhr_Trainerprofile = new SMHR_TRAINERPROFILE(); _obj_smhr_Trainerprofile.Trainer_ServiceProvider = Convert.ToInt32(rc_ServiceProvider.SelectedItem.Value); _obj_smhr_Trainerprofile.Trainer_CourseCategory = Convert.ToInt32(rc_CourseCategory.SelectedItem.Value); _obj_smhr_Trainerprofile.Trainer_FirstName = txt_FirstName.Text; _obj_smhr_Trainerprofile.Trainer_MiddleName = txt_MiddleName.Text; _obj_smhr_Trainerprofile.Trainer_LastName = txt_LastName.Text; _obj_smhr_Trainerprofile.Trainer_Address1 = txt_Address1.Text; _obj_smhr_Trainerprofile.Trainer_Address2 = txt_Address2.Text; _obj_smhr_Trainerprofile.Trainer_Age = Convert.ToInt32(txt_Age.Text); _obj_smhr_Trainerprofile.Trainer_CountryID = Convert.ToInt32(rc_Country.SelectedItem.Value); _obj_smhr_Trainerprofile.Trainer_CountyID = Convert.ToInt32(rc_County.SelectedItem.Value); _obj_smhr_Trainerprofile.Trainer_TownID = Convert.ToInt32(rc_Town.SelectedItem.Value); _obj_smhr_Trainerprofile.Trainer_MoblieNo = Convert.ToString(txt_mobileNo.Text); _obj_smhr_Trainerprofile.Trainer_LandlineNo = Convert.ToString(txt_LandLineNo.Text); _obj_smhr_Trainerprofile.Trainer_EmailID = Convert.ToString(txt_Email.Text); _obj_smhr_Trainerprofile.Trainer_DOB = txt_DOB.SelectedDate.Value; _obj_smhr_Trainerprofile.Trainer_Status = rad_IsActive.Checked; _obj_smhr_Trainerprofile.Trainer_Qualification = Convert.ToInt32(rc_Qualification.SelectedItem.Value); _obj_smhr_Trainerprofile.Trainer_Institute = Convert.ToString(txt_Institute.Text); _obj_smhr_Trainerprofile.Trainer_Percentage = Convert.ToString(txt_Percentage.Text); _obj_smhr_Trainerprofile.Trainer_YearOfPass = Convert.ToString(txt_YeaofPass.Text); _obj_smhr_Trainerprofile.TRAINER_CREATEDBY = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session _obj_smhr_Trainerprofile.TRAINER_CREATEDDATE = DateTime.Now; _obj_smhr_Trainerprofile.TRAINER_ORGID = Convert.ToInt32(Session["ORG_ID"]); _obj_smhr_Trainerprofile.TRAINER_MODIFYEDBY = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session _obj_smhr_Trainerprofile.TRAINER_MODIIFYEDDATE = DateTime.Now; _obj_smhr_Trainerprofile.Trainer_ZipCode = Convert.ToString(txt_ZipCode.Text); switch (((Button)sender).ID.ToUpper()) { case "BTN_UPDATE": if (Convert.ToBoolean(rad_IsActive.Checked) == false) { SMHR_COURSESCHEDULE _obj_CS = new SMHR_COURSESCHEDULE(); _obj_CS.OPERATION = operation.Offline; _obj_CS.COURSESCHEDULE_TRAINERID = Convert.ToInt32(ld_ID.Text); _obj_CS.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); DataTable dtc = BLL.get_CourseSchedule(_obj_CS); if (!Convert.ToBoolean(dtc.Rows[0]["Status"])) { BLL.ShowMessage(this, "Cannot make inactive"); rad_IsActive.Checked = true; return; } } _obj_smhr_Trainerprofile.Trainer_TrainerProfile_ID = Convert.ToInt32(ld_ID.Text); _obj_smhr_Trainerprofile.OPERATION = operation.Update; if (BLL.set_TrainingProfile(_obj_smhr_Trainerprofile)) { BLL.ShowMessage(this, "Information Updated Successfully"); } else { BLL.ShowMessage(this, "Information Not Saved"); } break; case "BTN_SAVE": _obj_smhr_Trainerprofile.OPERATION = operation.CountEmailID; if (Convert.ToInt32(BLL.get_TrainingProfile(_obj_smhr_Trainerprofile).Rows[0][0]) > 0) { BLL.ShowMessage(this, "Email ID Already Exists.Please Enter another Email ID"); return; } else { _obj_smhr_Trainerprofile.OPERATION = operation.Insert; if (BLL.set_TrainingProfile(_obj_smhr_Trainerprofile)) { BLL.ShowMessage(this, "Information Saved Successfully"); } else { BLL.ShowMessage(this, "Information Not Saved"); } break; } default: break; } LoadGrid(); Rm_CY_page.SelectedIndex = 0; Rg_Countries.DataBind(); } else { BLL.ShowMessage(this, ErrorMesage); return; } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "TrainerProfile", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); } }