Example #1
0
    public static ReturnObject GetManagerData(string filters)
    {
        masters_change_manager page_object   = new masters_change_manager();
        DBConnection           db_connection = new DBConnection();
        ReturnObject           return_object = new ReturnObject();
        DataTable manager_data = new DataTable();
        string    query        = string.Empty;

        try
        {
            query = "select DISTINCT emp_code as employee_code, (emp_name +' [' + emp_code + ']') as employee_name from employeemaster e left join companymaster c on e.emp_company = c.companycode left join branchmaster b on e.emp_branch = b.branchcode left join deptmaster d on e.emp_department = d.deptcode left join desigmaster de on e.emp_designation = de.desigcode where e.emp_status = 1 and e.IsManager = 1 ";

            query = page_object.GetFilterQuery(query, filters);

            manager_data = db_connection.ReturnDataTable(query);

            return_object.status      = "success";
            return_object.return_data = JsonConvert.SerializeObject(manager_data, Formatting.Indented);
        }
        catch (Exception ex)
        {
            Logger.LogException(ex, page, "GET_MANAGER_DATA");

            return_object.status      = "error";
            return_object.return_data = "An error occurred while loading Manager data. Please try again. If the error persists, please contact Support.";

            throw;
        }

        return(return_object);
    }
Example #2
0
    public static ReturnObject getSourceManagerData(string filters)
    {
        masters_change_manager page_object = new masters_change_manager();
        DBConnection           db_connection = new DBConnection();
        ReturnObject           return_object = new ReturnObject();
        DataTable source_manager_data = new DataTable();
        string    employee_id, query, company_code = string.Empty;
        int       access = 0;

        try
        {
            access      = Convert.ToInt32(HttpContext.Current.Session["access_level"]);
            employee_id = HttpContext.Current.Session["employee_id"].ToString();
            // If manager is logged in then in source manager only that manager ID should be there ..
            if (access == 1)
            {
                query = "select DISTINCT emp_code as employee_code, (emp_name +' [' + emp_code + ']') as employee_name from employeemaster e left join companymaster c on e.emp_company = c.companycode left join branchmaster b on e.emp_branch = b.branchcode left join deptmaster d on e.emp_department = d.deptcode left join desigmaster de on e.emp_designation = de.desigcode where e.emp_status = 1 and e.IsManager = 1 and e.emp_code ='" + employee_id + "'";
            }
            else
            {
                query = "select DISTINCT emp_code as employee_code, (emp_name +' [' + emp_code + ']') as employee_name from employeemaster e left join companymaster c on e.emp_company = c.companycode left join branchmaster b on e.emp_branch = b.branchcode left join deptmaster d on e.emp_department = d.deptcode left join desigmaster de on e.emp_designation = de.desigcode where e.emp_status = 1 and e.IsManager = 1";
            }

            query = page_object.GetFilterQuery(query, filters);

            source_manager_data = db_connection.ReturnDataTable(query);

            return_object.status      = "success";
            return_object.return_data = JsonConvert.SerializeObject(source_manager_data, Formatting.Indented);
        }
        catch (Exception ex)
        {
            Logger.LogException(ex, page, "GET_SOURCE_MANAGER_DATA");

            return_object.status      = "error";
            return_object.return_data = "An error occurred while loading Manager data. Please try again. If the error persists, please contact Support.";

            throw;
        }

        return(return_object);
    }