Beispiel #1
0
 private void InitCountryGrid()
 {
     BOMarket mktBo = (BOMarket)m_bo;
     if (base.FormMode == NanCrm.FormMode.Add)
     {
         mktBo.Init();
     }
     UpdateData(false);
     objList.DataSourceType = typeof(CountryMD);
     //this.olvcName.AspectGetter = delegate(object row)
     //{
     //    return "cfl";
     //};
     //this.olvcName.Renderer = new MappedImageRenderer(new Object[] { "cfl", Resources.ButtonChoose });
     objList.SmallImageList = imageList;
     this.olvcName.ImageGetter = delegate(object row)
     {
         return 0;
     };
     MarketMD mkt = (MarketMD)mktBo.GetBOTable();
     foreach (int id in mkt.CountryIds)
     {
         BOCountry ctyBo = new BOCountry();
         ctyBo.GetById(id);
         m_ctyList.Add((CountryMD)ctyBo.GetBOTable());
     }
     CountryMD cty = new CountryMD();
     cty.ID = -1;
     m_ctyList.Add(cty);
     objList.SetObjects(m_ctyList);
 }
Beispiel #2
0
        public override bool GetById(int id)
        {
            CountryMD mkt = m_dbConn.GetTableData(GetTableName(), id).ConvertToTarget <CountryMD>();

            m_boTable = mkt;

            return(m_boTable == null);
        }
Beispiel #3
0
        public override bool Init()
        {
            CountryMD ctyTb = (CountryMD)m_boTable;

            ctyTb.ID = GetNextID();

            return(base.Init());
        }
Beispiel #4
0
        public override bool OnIsValid()
        {
            bool      isValid = true;
            CountryMD ctyTb   = (CountryMD)m_boTable;

            if (string.IsNullOrEmpty(ctyTb.Name))
            {
                isValid = false;
            }
            return(isValid);
        }
Beispiel #5
0
        public object CopyFrom(object fromObj)
        {
            CountryMD from = (CountryMD)fromObj;

            this.ID       = from.ID;
            this.Name     = from.Name;
            this.ForeName = from.ForeName;
            this.Alias    = from.Alias;
            this.Capital  = from.Capital;
            return(this);
        }
Beispiel #6
0
        public List <CountryMD> GetMktCountry()
        {
            List <CountryMD> result    = new List <CountryMD>();
            string           ctyTbName = GetTableName(BOIDEnum.Country);
            string           counties  = string.Empty;
            MarketMD         mkt       = (MarketMD)m_boTable;

            foreach (int ctyId in mkt.CountryIds)
            {
                CountryMD cty = m_dbConn.GetTableData(ctyTbName, ctyId).ConvertToTarget <CountryMD>();
                result.Add(cty);
            }

            return(result);
        }
Beispiel #7
0
 public void LoadGridData()
 {
     try
     {
         IList ctybos = m_bo.GetDataList();
         List<CountryMD> ctyList = Utilities.ConvertList<CountryMD>(ctybos);
         CountryMD newCty = new CountryMD();
         newCty.ID = BusinessObject.GetBONextID(m_boId);
         ctyList.Add(newCty);
         objList.SetObjects(ctyList);
         objList.DataSourceType = typeof(CountryMD);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.ToString());
     }
 }
Beispiel #8
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (this.GetType() != obj.GetType())
            {
                return(false);
            }

            CountryMD cty = (CountryMD)obj;

            return(cty.ID == this.ID &&
                   cty.Name == this.Name &&
                   cty.ForeName == this.ForeName &&
                   cty.Alias == this.Alias &&
                   cty.Capital == this.Capital);
        }
Beispiel #9
0
        protected override bool OnCheckData(object data, BOAction action = BOAction.Add)
        {
            bool result = true;

            if (action == BOAction.Delete)
            {
                CountryMD       delMd   = (CountryMD)data;
                BOMarket        mktBo   = (BOMarket)BOFactory.GetBO(BOIDEnum.Market);
                List <MarketMD> mktList = mktBo.GetDataList().Cast <JObject>().Select(x => x.ConvertToTarget <MarketMD>()).ToList();;
                MarketMD        find    = mktList.Find(x => x.CountryIds.Contains(delMd.ID));
                if (find != null)
                {
                    result = false;
                    ReportStatusMessage(new SatusMessageInfo(MessageType.Error, MessageCode.RefenenceError, this,
                                                             "删除失败!国家 \"" + delMd.Name + "\" 在市场区域 \"" + find.Name + "\" 中被引用!"));
                }
            }
            else
            {
            }
            return(result);
        }
Beispiel #10
0
 //private CountryMD m_boCty;
 public BOCountry()
 {
     base.m_boId = BOIDEnum.Country;
     m_boTable = new CountryMD();
 }
Beispiel #11
0
 //private CountryMD m_boCty;
 public BOCountry()
 {
     base.m_boId = BOIDEnum.Country;
     m_boTable   = new CountryMD();
 }