Esempio n. 1
0
        //public class ClassName
        //{
        //    public int strnum { get; set; }
        //}

        public IEnumerable <DomainEntity.StoreEntity> GetAllStore(DomainEntity.StoreEntity entity)
        {
            try
            {
                var storeList = new List <DomainEntity.StoreEntity>();
                using (StoreContext)
                {
                    if (StoreDBOPEN(Function.getStoreConnectionString(entity.login_entity), StoreContext))
                    {
                        string strgetStoreID = "SELECT MM770RSC.TBLFLD.TBLVAL FROM MM770RSC.TBLFLD WHERE MM770RSC.TBLFLD.TBLNAM = 'WMSRA' AND MM770RSC.TBLFLD.TBLVAL != '' ";
                        var    StoreCommand  = new OdbcCommand(strgetStoreID, StoreContext);
                        var    STRReader     = StoreCommand.ExecuteReader();

                        List <int> strnum = new List <int>();

                        while (STRReader.Read())
                        {
                            strnum.Add((int)STRReader.GetInt32(0));
                        }
                        string strNumString = string.Join(",", strnum);
                        STRReader.Close();
                        StoreCommand.Dispose();


                        using (JDAContext)
                        {
                            if (DBOPEN(Function.getConnectionString(entity.login_entity), JDAContext))
                            {
                                string querystring = "SELECT " + entity.login_entity.dBname + ".TBLSTR.STRNUM, "
                                                     + entity.login_entity.dBname + ".TBLSTR.REGNUM, "
                                                     + entity.login_entity.dBname + ".TBLSTR.STRDST, "
                                                     + entity.login_entity.dBname + ".TBLSTR.STRNAM, "
                                                     + entity.login_entity.dBname + ".TBLSTR.STMNGR, "
                                                     + entity.login_entity.dBname + ".TBLSTR.STRWHS "
                                                     + "FROM " + entity.login_entity.dBname + ".TBLSTR WHERE " + entity.login_entity.dBname + ".TBLSTR.STRNUM in(" + strNumString + ") ";
                                //+ "FETCH FIRST 50 ROWS ONLY";

                                var JDACommand = new OdbcCommand(querystring, JDAContext);
                                JDACommand.CommandTimeout = 0;
                                var JDAReader = JDACommand.ExecuteReader();
                                while (JDAReader.Read())
                                {
                                    var storeDetails = new DomainEntity.StoreEntity();
                                    storeDetails.store       = JDAReader.GetInt32(JDAReader.GetOrdinal("STRNUM"));
                                    storeDetails.region      = JDAReader.GetInt32(JDAReader.GetOrdinal("REGNUM"));
                                    storeDetails.district    = JDAReader.GetInt32(JDAReader.GetOrdinal("STRDST"));
                                    storeDetails.description = JDAReader.GetString(JDAReader.GetOrdinal("STRNAM"));
                                    storeDetails.manager     = JDAReader.GetString(JDAReader.GetOrdinal("STMNGR"));
                                    storeDetails.warehouse   = JDAReader.GetString(JDAReader.GetOrdinal("STRWHS"));
                                    storeList.Add(storeDetails);
                                }
                                JDAReader.Close();
                                JDACommand.Dispose();
                            }
                        }
                    }
                }
                return(storeList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                JDAContext.Close();
                StoreContext.Close();
            }
        }
Esempio n. 2
0
 public void Update(DomainEntity.StoreEntity entity)
 {
     throw new NotImplementedException();
 }