Example #1
0
        private void FillDepartmentEntity()
        {
            string strSql = "";

            strSql = "SELECT oce_id AS ID,replace(convert(char(24),ltrim(OCE_DESCRIPTION  )) + oce_id,' ',' ' ) as NAME FROM ent_org_common_entities where cem_entity_id='DEP' and  oce_isdeleted='0'";

            SqlConnection con = new SqlConnection(m_connections);

            con.Open();
            SqlCommand     cmd         = new SqlCommand(strSql, con);
            SqlDataAdapter adpt        = new SqlDataAdapter(cmd);
            DataSet        thisDataSet = new DataSet();

            adpt.Fill(thisDataSet);

            LstDepartment.DataValueField = "ID";
            LstDepartment.DataTextField  = "NAME";

            LstDepartment.DataSource = thisDataSet.Tables[0];

            LstDepartment.DataBind();
        }
        private void FillDepartmentEntity()
        {
            try
            {
                string strSql = "";

                strSql = "SELECT oce_id AS ID,replace(convert(char(24),ltrim(OCE_DESCRIPTION  )) + oce_id,' ',' ' ) as NAME FROM ent_org_common_entities where cem_entity_id='DEP' and  oce_isdeleted='0'";

                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand     cmd         = new SqlCommand(strSql, conn);
                SqlDataAdapter adpt        = new SqlDataAdapter(cmd);
                DataSet        thisDataSet = new DataSet();
                adpt.Fill(thisDataSet);

                LstDepartment.DataValueField = "ID";
                LstDepartment.DataTextField  = "NAME";

                LstDepartment.DataSource = thisDataSet.Tables[0];

                LstDepartment.DataBind();
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "EmployeeManagerHierarchyAdd");
            }
        }