protected void btn_Submit_Click(object sender, EventArgs e) { try { _obj_Rec_JobOffers = new RECRUITMENT_JOBOFFERS(); _obj_Rec_JobOffers.JOBOFFRS_REQCODE = Convert.ToInt32(RCMB_JobRequistion.SelectedItem.Value); // _obj_Rec_JobOffers.JOBOFFRS_APPLICANT_ID = Convert.ToInt32(RCMB_Applicant.SelectedItem.Value); _obj_Rec_JobOffers.JOBOFFRS_JOINDATE = Convert.ToDateTime(RDP_JoinDate.SelectedDate); _obj_Rec_JobOffers.JOBOFFRS_OFFERDATE = Convert.ToDateTime(RDP_Offerdate.SelectedDate); if (RCMB_leavestructure.SelectedIndex > 0) { _obj_Rec_JobOffers.JOBOFFRS_LEAVESTRUCT = Convert.ToInt32(RCMB_leavestructure.SelectedItem.Value); } if (RCB_SalaryStructure.SelectedIndex > 0) { _obj_Rec_JobOffers.JOBOFFRS_SALSTRUCT = Convert.ToInt32(RCB_SalaryStructure.SelectedItem.Value); } _obj_Rec_JobOffers.JOBOFFRS_OFFERSAL = Convert.ToDecimal(RTB_OfferSalary.Text); _obj_Rec_JobOffers.JOBOFFRS_CREATEDBY = Convert.ToInt32(Session["USER_ID"]); _obj_Rec_JobOffers.JOBOFFRS_CREATEDATE = DateTime.Now; _obj_Rec_JobOffers.JOBOFFRS_LASTMDFBY = Convert.ToInt32(Session["USER_ID"]); _obj_Rec_JobOffers.JOBOFFRS_LASTMDFDATE = DateTime.Now; _obj_Rec_JobOffers.ORGANISATION_ID = Convert.ToInt32(Session["ORG_ID"]); Session["JOBOFFRS_REQCODE"] = Convert.ToInt32(RCMB_JobRequistion.SelectedItem.Value); Session["JOBOFFRS_APPLICANT_ID"] = Convert.ToInt32(RCMB_Applicant.SelectedItem.Value); switch (((Button)sender).ID.ToUpper()) { case "BTN_UPDATE": _obj_Rec_JobOffers.OPERATION = operation.Check; _obj_Rec_JobOffers.JOBOFFRS_ID = Convert.ToInt32(lbl_id.Text); _obj_Rec_JobOffers.JOBOFFRS_APPLICANT_ID = Convert.ToInt32(RCMB_Applicant.SelectedItem.Value); if (Convert.ToString(Recruitment_BLL.get_Applicant(_obj_Rec_JobOffers).Rows[0]["Count"]) != "1") { BLL.ShowMessage(this, "Applicant Already Selected"); return; } _obj_Rec_JobOffers.OPERATION = operation.Update; if (Recruitment_BLL.set_joboffers(_obj_Rec_JobOffers)) { BLL.ShowMessage(this, "Information Updated Successfully"); //loadgrid(); //clearfields(); //RM_Joboffers.SelectedIndex = 0; //Response.Redirect("~/Reports/JobofferReport.aspx"); Session["JOBOFFRS_REQCODE"] = Convert.ToInt32(RCMB_JobRequistion.SelectedItem.Value); Session["JOBOFFRS_APPLICANT_ID"] = Convert.ToInt32(RCMB_Applicant.SelectedItem.Value); ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "ShowPop('" + Convert.ToInt32(RCMB_JobRequistion.SelectedItem.Value) + "','" + Convert.ToInt32(RCMB_Applicant.SelectedItem.Value) + "');", true); // Response.Redirect("~/Reports/JobofferReport.aspx"); return; } else { BLL.ShowMessage(this, "Information Not Updated"); } loadgrid(); RG_Joboffers.DataBind(); RM_Joboffers.SelectedIndex = 0; break; case "BTN_SUBMIT": _obj_Rec_JobOffers.OPERATION = operation.Check; _obj_Rec_JobOffers.JOBOFFRS_APPLICANT_ID = Convert.ToInt32(RCMB_Applicant.SelectedItem.Value); if (Convert.ToString(Recruitment_BLL.get_Applicant(_obj_Rec_JobOffers).Rows[0]["Count"]) != "0") { BLL.ShowMessage(this, "Applicant Already Selected"); return; } _obj_Rec_JobOffers.OPERATION = operation.Insert; if (Recruitment_BLL.set_joboffers(_obj_Rec_JobOffers)) { BLL.ShowMessage(this, "Information Saved Successfully"); //loadgrid(); //clearfields(); //RM_Joboffers.SelectedIndex = 0; //Response.Redirect("~/Reports/JobofferReport.aspx"); Session["JOBOFFRS_REQCODE"] = Convert.ToInt32(RCMB_JobRequistion.SelectedItem.Value); Session["JOBOFFRS_APPLICANT_ID"] = Convert.ToInt32(RCMB_Applicant.SelectedItem.Value); // Response.Redirect("~/Reports/JobofferReport.aspx"); ScriptManager.RegisterStartupScript(this, this.GetType(), Guid.NewGuid().ToString(), "ShowPop('" + Convert.ToInt32(RCMB_JobRequistion.SelectedItem.Value) + "','" + Convert.ToInt32(RCMB_Applicant.SelectedItem.Value) + "');", true); return; } else { BLL.ShowMessage(this, "Information Not Saved"); } loadgrid(); RG_Joboffers.DataBind(); RM_Joboffers.SelectedIndex = 0; break; default: break; // break; // bool status = BLL.set_joboffers(_obj_Rec_JobOffers); // if (status == true) // { // BLL.ShowMessage(this, "Information Inserted Succesfully"); // //loadgrid(); // //clearfields(); // //RM_Joboffers.SelectedIndex = 0; // //Response.Redirect("~/Reports/JobofferReport.aspx"); // Session["JOBOFFRS_REQCODE"] = Convert.ToInt32(RCMB_JobRequistion.SelectedItem.Value); // Session["JOBOFFRS_APPLICANT_ID"] = Convert.ToInt32(RCMB_Applicant.SelectedItem.Value); // Response.Redirect("~/Reports/JobofferReport.aspx"); // return; //} //else //{ // BLL.ShowMessage(this, "Unable to Update the record,Execption Occured"); // return; //} } } catch (Exception ex) { SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_JobOffers", ex.StackTrace, DateTime.Now); Response.Redirect("~/Frm_ErrorPage.aspx"); return; } }