Beispiel #1
0
        public Sections Get(long SectionID)
        {
            Employee_DL objEmployee_DL = new Employee_DL(Connection);

            SectionsCollec objSectionsCollec = new SectionsCollec();

            try
            {
                SqlParameter[] paramList = new SqlParameter[] {
                    new SqlParameter("@SectionID", SectionID)
                };

                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_Section_By_ID", paramList);



                Sections objSections = new Sections();

                if (dt.Rows.Count > 0)
                {
                    objSections.DepID       = Convert.ToInt64(dt.Rows[0]["DepID"]);
                    objSections.SectionHead = objEmployee_DL.Get(Convert.ToString(dt.Rows[0]["SuperviserID"]));
                    objSections.SectionName = Convert.ToString(dt.Rows[0]["SectionName"]);
                    objSections.SectionID   = Convert.ToInt64(dt.Rows[0]["SectionID"]);
                }


                return(objSections);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
Beispiel #2
0
        public SectionsCollec Get()
        {
            Employee_DL objEmployee_DL = new Employee_DL(Connection);

            SectionsCollec objSectionsCollec = new SectionsCollec();

            try
            {
                DataTable dt = Execute.RunSP_DataTable(Connection, "SPGET_Section");


                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    Sections objSections = new Sections();


                    objSections.DepID       = Convert.ToInt64(dt.Rows[i]["DepID"]);
                    objSections.SectionHead = objEmployee_DL.Get(Convert.ToString(dt.Rows[i]["SuperviserID"]));
                    objSections.SectionName = Convert.ToString(dt.Rows[i]["SectionName"]);
                    objSections.SectionID   = Convert.ToInt64(dt.Rows[i]["SectionID"]);

                    objSectionsCollec.Add(objSections);
                }


                return(objSectionsCollec);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }