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 static BusinessObject GetBO(BOIDEnum boid)
 {
     BusinessObject bo = null;
     switch (boid)
     {
         case BOIDEnum.Country:
             bo = new BOCountry();
             break;
         default: break;
     }
     bo.Init();
     return bo;
 }
Beispiel #3
0
 public static BusinessObject GetBO(BOIDEnum boid)
 {
     BusinessObject bo = null;
     switch (boid)
     {
         case BOIDEnum.BOSequence:
             bo = new BOSequence();
             break;
         case BOIDEnum.Country:
             bo = new BOCountry();
             break;
         case BOIDEnum.ProductGroup:
             bo = new BOProductGroup();
             break;
         case BOIDEnum.Market:
             bo = new BOMarket();
             break;
         case BOIDEnum.MarketDetail:
             bo = new BOMarketDetail();
             break;
         case BOIDEnum.SearchPlantf:
             bo = new BOBPSearchPlan();
             break;
         case BOIDEnum.Texture:
             bo = new BOTexture();
             break;
         case BOIDEnum.KeyWord:
             bo = new BOKeyWord();
             break;
         case BOIDEnum.KeyWordList:
             bo = new BOKWList();
             break;
         case BOIDEnum.Product:
             bo = new BOProduct();
             break;
         case BOIDEnum.PSearchPlan:
             bo = new BOProductSearchPlan();
             break;
         case BOIDEnum.PSearchResult:
             bo = new BOBPSearchResult();
             break;
         case BOIDEnum.BP:
             bo = new BOBP();
             break;
         default: break;
     }
     bo.Init();
     return bo;
 }
Beispiel #4
0
        private void objList_CellEditFinishing(object sender, CellEditEventArgs e)
        {
            if (e.ListViewItem.Index == objList.Items.Count - 1)
            {
                if (e.Cancel || string.IsNullOrWhiteSpace(e.NewValue.ToString()))
                {
                    return;
                }
                BOCountry bo = new BOCountry();
                bo.GetByName(e.NewValue.ToString());
                //objList.GetItem(e.ListViewItem.Index).RowObject = bo.GetBOTable();
                //e.ListViewItem.RowObject = (CountryMD)bo.GetBOTable();
                CountryMD old = (CountryMD)e.ListViewItem.RowObject;
                old.CopyFrom(bo.GetBOTable());
                //objList.RefreshItem(e.ListViewItem);


                CountryMD obj = (CountryMD)objList.AddEmptyRow();
                int maxIdInDb = BusinessObject.GetBONextID(BOIDEnum.Country);
                int maxIdOfUi = objList.Objects.Cast<CountryMD>().ToList().Max(x => x.ID);
                obj.ID = Math.Max(maxIdInDb, maxIdOfUi) + 1;
            }
        }
Beispiel #5
0
 private bool IsValidCountryName(string name)
 {
     BOCountry ctyBo = new BOCountry();
     
     IList list = ctyBo.GetDataList();
     var find = list.Cast<JObject>().ToList().Find(x => x.ConvertToTarget<CountryMD>().Name == name);
     if(find == null)
     {
         return false;
     }
     return true;
 }