コード例 #1
0
ファイル: frmMarketMD.cs プロジェクト: ToughBill/NanCrm
        private void objList_CellClick(object sender, CellClickEventArgs e)
        {
            if (e.Column == null)
            {
                return;
            }

            if (e.HitTest.RowIndex == objList.Items.Count - 1 && e.ColumnIndex != 1 && e.ColumnIndex != 0)
            {
                CountryMD cty = (CountryMD)e.HitTest.RowObject;
                if (string.IsNullOrWhiteSpace(cty.Name))
                {
                    GetStatusBar().DisplayMessage(MessageType.Error, "国家名字不能为空!");
                    objList.EditSubItem(objList.GetItem(e.RowIndex), 1);
                    return;
                }
            }
            if (e.ColumnIndex == 1 && e.HitTest.HitTestLocation == HitTestLocation.Image)
            {
                frmCFL cfl = new frmCFL(objList.BOID);
                cfl.ReturnProc = CountryRetProc;
                cfl.MdiParent  = this.MdiParent;
                cfl.Show();
            }
        }
コード例 #2
0
ファイル: frmMarketMD.cs プロジェクト: ToughBill/NanCrm
        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);
        }
コード例 #3
0
ファイル: frmCountry.cs プロジェクト: ToughBill/NanCrm
        private void objList_CellClick(object sender, CellClickEventArgs e)
        {
            CountryMD cty = (CountryMD)e.HitTest.RowObject;

            if (cty != null && e.HitTest.ColumnIndex != 1 && string.IsNullOrWhiteSpace(cty.Name))
            {
                GetStatusBar().DisplayMessage(MessageType.Error, "国家名字不能为空!");
                objList.EditSubItem(objList.GetItem(e.RowIndex), 1);
            }
        }
コード例 #4
0
ファイル: frmCountry.cs プロジェクト: ToughBill/NanCrm
 private void objList_CellEditFinishing(object sender, CellEditEventArgs e)
 {
     if (e.ListViewItem.Index == objList.Items.Count - 1)
     {
         if (string.IsNullOrWhiteSpace(e.NewValue.ToString()))
         {
             return;
         }
         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;
     }
 }
コード例 #5
0
ファイル: frmCountry.cs プロジェクト: ToughBill/NanCrm
 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());
     }
 }
コード例 #6
0
ファイル: frmMarketMD.cs プロジェクト: ToughBill/NanCrm
        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;
            }
        }