コード例 #1
0
    protected void btn_Cancel_Click(object sender, EventArgs e)
    {
        try
        {
            clearControls();
            Rm_CY_page.SelectedIndex     = 0;
            Rg_RecordIncident.DataSource = LoadIncidentGrid();
            Rg_RecordIncident.DataBind();
            ViewState["GRIEVANCE_ID"] = null;
            comlainton_empid.Text     = string.Empty;
            DataTable dtMember = new DataTable();
            dtMember.Columns.Add("COMMITTEEMEMBERID");
            dtMember.Columns.Add("COMMITTEEMEMBER");
            dtMember.Columns.Add("POSITIONS_CODE");

            rg_OtherMembers.DataSource = null;
            rg_OtherMembers.DataBind();
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "RecordIncident", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
コード例 #2
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        try
        {
            SMHR_GRIEVANCE _obj_Smhr_Grievance = new SMHR_GRIEVANCE();
            _obj_Smhr_Grievance.GRIEVANCE_INCIDENT            = rcmb_Incident.SelectedItem.Text;
            _obj_Smhr_Grievance.GRIEVANCE_INCIDENTID          = rtxt_IncidentID.Text;
            _obj_Smhr_Grievance.GRIEVANCE_INCIDENTTYPE_ID     = Convert.ToInt32(rcmb_IncidentType.SelectedValue);
            _obj_Smhr_Grievance.GRIEVANCE_REPORTEDDATE        = rdp_ReportedDate.SelectedDate;
            _obj_Smhr_Grievance.GRIEVANCE_INCIDENTDESCRIPTION = rtxt_Description.Text;
            if (Convert.ToString(rcmb_ReportedByEmployee.SelectedValue) == string.Empty)
            {
                BLL.ShowMessage(this, "Plrase select Complaint By clearly"); return;
            }
            else
            {
                _obj_Smhr_Grievance.GRIEVANCE_REPORTEDBY = Convert.ToInt32(rcmb_ReportedByEmployee.SelectedValue);
            }
            if (Convert.ToString(rcmb_ReportedOnEmployee.SelectedValue) == string.Empty)
            {
                BLL.ShowMessage(this, "Plrase select Complaint On clearly"); return;
            }
            else
            {
                _obj_Smhr_Grievance.GRIEVANCE_REPORTEDON = Convert.ToInt32(rcmb_ReportedOnEmployee.SelectedValue);
            }
            if ((Convert.ToString(rcmb_ReportedByEmployee.SelectedValue) != string.Empty) && (Convert.ToString(rcmb_ReportedOnEmployee.SelectedValue) != string.Empty))
            {
                if ((Convert.ToString(rcmb_ReportedByEmployee.SelectedValue)) == (Convert.ToString(rcmb_ReportedOnEmployee.SelectedValue)))
                {
                    BLL.ShowMessage(this, "Complaint By and Complaint On cannot be same");
                    return;
                }
            }
            _obj_Smhr_Grievance.GRIEVANCE_COMMITTEEID = Convert.ToInt32(rcmb_Committee.SelectedValue);
            _obj_Smhr_Grievance.ORGANISATION_ID       = Convert.ToInt32(Session["ORG_ID"]);
            _obj_Smhr_Grievance.CREATEDBY             = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
            _obj_Smhr_Grievance.CREATEDDATE           = DateTime.Now;
            _obj_Smhr_Grievance.LASTMDFBY             = Convert.ToInt32(Session["USER_ID"]); // ### Need to Get the Session
            _obj_Smhr_Grievance.LASTMDFDATE           = DateTime.Now;

            SMHR_EMPLOYEE _obj_employee = new SMHR_EMPLOYEE();
            _obj_employee.EMP_ID    = Convert.ToInt32(rcmb_ReportedOnEmployee.SelectedValue);
            _obj_employee.OPERATION = operation.Select;
            DataTable dt_employee = BLL.get_Employeedetail(_obj_employee);
            if (rdp_ReportedDate.SelectedDate < Convert.ToDateTime(dt_employee.Rows[0]["EMP_DOJ"]))
            {
                BLL.ShowMessage(this, "Report Date Should not be less than complaint On employee join date"); return;
            }
            switch (((Button)sender).ID.ToUpper())
            {
            case "BTN_UPDATE":
                _obj_Smhr_Grievance.GRIEVANCE_ID = Convert.ToInt32(ViewState["GRIEVANCE_ID"]);
                _obj_Smhr_Grievance.GRIEVANCE_INCIDENTDESCRIPTION = rtxt_Description.Text;
                _obj_Smhr_Grievance.OPERATION = operation.Update;
                if (BLL.record_Incident(_obj_Smhr_Grievance))
                {
                    BLL.ShowMessage(this, "Record Complaint Updated Successfully");
                }
                else
                {
                    BLL.ShowMessage(this, "Record Complaint Not Updated");
                }

                break;

            case "BTN_SAVE":

                _obj_Smhr_Grievance.OPERATION = operation.Insert;
                if (BLL.record_Incident(_obj_Smhr_Grievance))
                {
                    BLL.ShowMessage(this, "Record Complaint Saved Successfully");
                }
                else
                {
                    BLL.ShowMessage(this, "Record Complaint Not Saved");
                }
                break;

            default:
                break;
            }
            Rm_CY_page.SelectedIndex     = 0;
            Rg_RecordIncident.DataSource = LoadIncidentGrid();

            Rg_RecordIncident.DataBind();
            ViewState["GRIEVANCE_ID"] = null;
            Rm_CY_page.SelectedIndex  = 0;

            // Response.Redirect("RecordIncident.aspx");
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "RecordIncident", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }