예제 #1
0
 // returns next standard section w.r.t the current standard
 public List <StandardSectionMapDTO> NextStandardSection(int currentSerial)
 {
     using (IDbSvc dbSvc = new DbSvc(_configSvc))
     {
         try
         {
             dbSvc.OpenConnection();
             MySqlCommand command = new MySqlCommand();
             command.CommandText = "select StandardSectionId,concat(StandardName,' ', SectionName) as StandardSectionDesc from standardsectionmap ssm join standard std on std.StandardId = ssm.StandardId join section sc on sc.SectionId = ssm.SectionId where ssm.Active = 1 AND ssm.Serial=(@currentSerial+1) order by StandardSectionDesc";
             command.Parameters.Add("@currentSerial", MySqlDbType.Int32).Value = currentSerial;
             command.Connection = dbSvc.GetConnection() as MySqlConnection;
             _dtData            = new DataTable();
             MySqlDataAdapter msDa = new MySqlDataAdapter(command);
             msDa.Fill(_dtData);
             List <StandardSectionMapDTO> lstStandardSection = new List <StandardSectionMapDTO>();
             if (_dtData != null && _dtData.Rows.Count > 0)
             {
                 StandardSectionMapDTO standardSectionMapDTO = null;
                 foreach (DataRow dr in _dtData.Rows)
                 {
                     standardSectionMapDTO = new StandardSectionMapDTO();
                     standardSectionMapDTO.StandardSectionId   = (int)dr["StandardSectionId"];
                     standardSectionMapDTO.StandardSectionDesc = dr["StandardSectionDesc"].ToString();
                     lstStandardSection.Add(standardSectionMapDTO);
                 }
             }
             return(lstStandardSection);
         }
         catch (Exception exp)
         {
             throw exp;
         }
     }
 }
예제 #2
0
        // return next Standard Section List w.r.t Current Standard
        public SelectList getNextStandardSectionDropDown(int currentStandardId)
        {
            List <StandardSectionMapDTO> rDto = _ddlRepo.NextStandardSection(currentStandardId);

            StandardSectionMapDTO ssDto = new StandardSectionMapDTO();

            ssDto.StandardSectionId   = -1;
            ssDto.StandardSectionDesc = string.Empty;

            rDto.Insert(0, ssDto);

            return(new SelectList(rDto, "StandardSectionId", "StandardSectionDesc"));
        }
예제 #3
0
        public SelectList getStandardSectionDropDownWithSerial()
        {
            List <StandardSectionMapDTO> rDto = _ddlRepo.StandardSectionWithSerial();

            StandardSectionMapDTO ssDto = new StandardSectionMapDTO();

            ssDto.StandardSectionId   = -1;
            ssDto.StandardSectionDesc = "SELECT";

            rDto.Insert(0, ssDto);

            return(new SelectList(rDto, "StandardSectionId", "StandardSectionDesc"));
        }
예제 #4
0
        public List <StandardSectionMapDTO> StandardSectionWithSerial()
        {
            List <StandardSectionMapDTO> lstStandardSection = null;

            using (IDbSvc dbSvc = new DbSvc(_configSvc))
            {
                try
                {
                    dbSvc.OpenConnection();
                    MySqlCommand command = new MySqlCommand();
                    command.CommandText = "select StandardSectionId,concat(StandardName, ' ', SectionName) as StandardSectionDesc,Serial from standardsectionmap ssm join standard std on std.StandardId = ssm.StandardId join section sc on sc.SectionId = ssm.SectionId where ssm.Active = 1";
                    command.Connection  = dbSvc.GetConnection() as MySqlConnection;
                    lstStandardSection  = new List <StandardSectionMapDTO>();

                    _dtData = new DataTable();
                    MySqlDataAdapter msDa = new MySqlDataAdapter(command);
                    msDa.Fill(_dtData);

                    if (_dtData != null && _dtData.Rows.Count > 0)
                    {
                        StandardSectionMapDTO standardSectionMapDTO = null;
                        foreach (DataRow dr in _dtData.Rows)
                        {
                            standardSectionMapDTO = new StandardSectionMapDTO();
                            standardSectionMapDTO.StandardSectionId   = (int)dr["StandardSectionId"];
                            standardSectionMapDTO.StandardSectionDesc = dr["StandardSectionDesc"].ToString();
                            standardSectionMapDTO.Serial = (int)dr["Serial"];

                            lstStandardSection.Add(standardSectionMapDTO);
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
            return(lstStandardSection);
        }