static void ArchiveDetailForm_DataControlsCreated(object sender, EventArgs e) { ArchiveDetailForm form = sender as ArchiveDetailForm; ((form.DisplayManager.DataControls["对账单"] as IWindowControl).Control as MyTextBox).DoubleClick += new EventHandler(Fp_dzd_DoubleClick); ((form.DisplayManager.DataControls["金额"] as IWindowControl).Control as MyCurrencyTextBox).TextChanged += new EventHandler(process_fp_TextChanged); }
private void Save(SaveType saveType) { // 验证控件有效值(有些控件需移出焦点后对其他控件产生影响,如果这里不Validate,会先执行Save) this.ValidateChildren(); if (m_cm.SaveCurrent()) { 任务 entity = m_cmT.DisplayManagerT.CurrentEntity; switch (saveType) { case SaveType.暂存待确认: 任务Dao.生成预录入号(entity); break; case SaveType.预录入发送: entity.IsActive = true; entity.是否拒绝 = false; 任务Dao.生成预录入号(entity); break; default: break; } m_cm.EndEdit(true); if (m_cm.State == StateType.View) { ArchiveDetailForm.UpdateStatusDataControl(m_cm, m_gridName); m_cm.DisplayManager.OnPositionChanged(System.EventArgs.Empty); } } }
public static void Fp_dzd_DoubleClick(object sender, EventArgs e) { if (sender is MyTextBox) { MyTextBox box_dzd = sender as MyTextBox; if (box_dzd.SelectedDataValue == null) { ArchiveDetailForm form = box_dzd.FindForm() as ArchiveDetailForm; decimal money = Convert.ToDecimal(((form.DisplayManager.DataControls["金额"] as IWindowControl).Control as MyCurrencyTextBox).SelectedDataValue); string xgr = ((form.DisplayManager.DataControls["相关人编号"] as IWindowControl).Control as MyComboBox).SelectedDataValue.ToString(); using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <对账单>()) { IList <对账单> list = (rep as Feng.NH.INHibernateRepository).List <对账单>(NHibernate.Criterion.DetachedCriteria.For <对账单>() .Add(NHibernate.Criterion.Expression.Eq("金额", money)) .Add(NHibernate.Criterion.Expression.Eq("相关人编号", xgr)) .AddOrder(NHibernate.Criterion.Order.Desc("关账日期")).SetMaxResults(1)); if (list == null || list.Count == 0) { MessageForm.ShowWarning("找不到有效的对账单!"); return; } box_dzd.SelectedDataValue = list[0].编号; } } } }
public static void 生成凭证(ArchiveOperationForm masterForm) { IList <费用> list = GetSelectedFee4Pz(masterForm); if (list.Count == 0) { ServiceProvider.GetService <IMessageBox>().ShowWarning("请选择未出对帐单和凭证的费用!"); return; } if (!MessageForm.ShowYesNo("是否要生成选中项相应的凭证?", "确认")) { return; } ArchiveOperationForm masterFormKj = ServiceProvider.GetService <IApplication>().ExecuteAction("资金票据_凭证") as ArchiveOperationForm; if (masterFormKj != null) { if (masterFormKj.DoAdd()) { ArchiveDetailForm detailFormKj = masterFormKj.ArchiveDetailForm as ArchiveDetailForm; IControlManager <凭证费用明细> detailCmKj = (((IArchiveDetailFormWithDetailGrids)detailFormKj).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager <凭证费用明细>; IRelationalDao masterDao = masterFormKj.ControlManager.Dao as IRelationalDao; MemoryDao <凭证费用明细> memoryBll = (masterDao.GetRelationalDao(0) as IMemoriedRelationalDao).DetailMemoryDao as MemoryDao <凭证费用明细>; //MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMemoriedMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>; (masterFormKj.DisplayManager.CurrentItem as 凭证).凭证类别 = 凭证类别.付款凭证; detailFormKj.UpdateContent(); process_pz.AddFees(masterFormKj.DisplayManager.CurrentItem as 凭证, list, detailCmKj); } } }
//public static void 审核(ArchiveOperationForm masterForm) //{ // if (MessageForm.ShowYesNo("是否确认审核?", "确认") == System.Windows.Forms.DialogResult.No) // return; // using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<凭证>()) // { // (new 凭证Dao()).Audit(rep, masterForm.DisplayManager.CurrentItem as 凭证); // } // masterForm.ControlManager.RaiseEntityChangedEvent(true); //} //public static void 撤销审核(ArchiveOperationForm masterForm) //{ // if (MessageForm.ShowYesNo("是否确认撤销审核?", "确认") == System.Windows.Forms.DialogResult.No) // return; // using (IRepository rep = ServiceProvider.GetService<IRepositoryFactory>().GenerateRepository<凭证>()) // { // (new 凭证Dao()).Unaudit(rep, masterForm.DisplayManager.CurrentItem as 凭证); // } // masterForm.ControlManager.RaiseEntityChangedEvent(true); //} #region "凭证费用明细审核" //public static void 审核费用(ArchiveOperationForm masterForm) //{ // IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>; // IBaseDao masterDao = ((IArchiveGrid)masterForm.ActiveGrid).Bll as IBaseDao; // MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>; // MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>; // if (detailCm.DisplayManager.Position == -1) // { // MessageForm.ShowError("请选择要核销的费用项目!"); // return; // } // if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 == "000") // { // 审核不核销费用(masterForm, detailForm, windowMenuInfo); // } // else // { // RepositoryHelper.Initialize(detailCm.DisplayManagerT.CurrentEntity.费用项, detailCm.DisplayManagerT.CurrentEntity); // detailCm.DisplayManagerT.CurrentEntity.费用项 = EntityBufferCollection.Instance["费用项"].Get(detailCm.DisplayManagerT.CurrentEntity.费用项编号) as 费用项; // 凭证费用明细 entity = detailCm.DisplayManagerT.CurrentEntity; // int? 费用类别编号 = entity.收付标志 == 收付标志.收 ? entity.费用项.收入类别 : entity.费用项.支出类别; // if (费用类别编号.HasValue) // { // 费用类别 费用类别 = EntityBufferCollection.Instance["费用类别"].Get(费用类别编号.Value) as 费用类别; // if (费用类别.大类 == "业务常规" || 费用类别.大类 == "业务额外") // { // 审核业务核销费用(masterForm, detailForm, windowMenuInfo); // } // else // { // 审核非业务核销费用(masterForm, detailForm, windowMenuInfo); // } // } // else // { // throw new ArgumentException("无有效费用类别!"); // } // } //} //public static void 审核不核销费用(ArchiveOperationForm masterForm) //{ // IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>; // IBaseDao masterDao = ((IArchiveGrid)masterForm.ActiveGrid).Bll as IBaseDao; // MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>; // MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>; // if (detailCm.DisplayManager.Position == -1) // { // MessageForm.ShowError("请选择要核销的费用项目!"); // return; // } // if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 != "000") // { // MessageForm.ShowError("此项目不为应收应付款,不能核销!"); // return; // } // detailCm.DisplayManagerT.CurrentEntity.审核状态 = true; // detailCm.RaiseEntityChangedEvent(true); // memoryBll.Update(detailCm.DisplayManagerT.CurrentEntity); //} //public static void 审核业务核销费用(ArchiveOperationForm masterForm) //{ // IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>; // IBaseDao masterDao = ((IArchiveGrid)masterForm.ActiveGrid).Bll as IBaseDao; // MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>; // MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>; // if (detailCm.DisplayManager.Position == -1) // { // MessageForm.ShowError("请选择要核销的费用项目!"); // return; // } // if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 == "000") // { // MessageForm.ShowError("此项目为应收应付款,不能核销!"); // return; // } // ArchiveCheckForm form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo(108)) as ArchiveCheckForm; // ISearchControl fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["相关人编号"]; // fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.相关人编号 }; // fc.ReadOnly = true; // fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["费用项编号"]; // fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.费用项编号 }; // fc.ReadOnly = true; // fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["收付标志"]; // fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.收付标志 }; // fc.ReadOnly = true; // if (form.ShowDialog() == DialogResult.OK) // { // IList<费用> list = new List<费用>(); // foreach (object i in form.SelectedEntites) // { // list.Add(i as 费用); // } // AddFees(masterForm.DisplayManager.CurrentItem as 凭证, list, detailCm, memoryBll, memoryBll2, false); // } //} //public static void 审核非业务核销费用(ArchiveOperationForm masterForm) //{ // IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>; // IBaseDao masterDao = ((IArchiveGrid)masterForm.ActiveGrid).Bll as IBaseDao; // MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>; // MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>; // if (detailCm.DisplayManager.Position == -1) // { // MessageForm.ShowError("请选择要核销的费用项目!"); // return; // } // if (detailCm.DisplayManagerT.CurrentEntity.费用项编号 == "000") // { // MessageForm.ShowError("此项目为应收应付款,不能核销!"); // return; // } // ArchiveCheckForm form = ServiceProvider.GetService<IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo(109)) as ArchiveCheckForm; // ISearchControl fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["相关人编号"]; // fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.相关人编号 }; // fc.ReadOnly = true; // fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["费用项编号"]; // fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.费用项编号 }; // fc.ReadOnly = true; // fc = (form.DisplayManager.SearchManager as ISearchManagerControls).SearchControls["收付标志"]; // fc.SelectedDataValues = new ArrayList { detailCm.DisplayManagerT.CurrentEntity.收付标志 }; // fc.ReadOnly = true; // if (form.ShowDialog() == DialogResult.OK) // { // IList<费用> list = new List<费用>(); // foreach (object i in form.SelectedEntites) // { // list.Add(i as 费用); // } // AddFees(masterForm.DisplayManager.CurrentItem as 凭证, list, detailCm, memoryBll, memoryBll2, false); // } //} //public static void 清空审核数据(ArchiveOperationForm masterForm) //{ // IControlManager<凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)detailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager<凭证费用明细>; // IBaseDao masterDao = ((IArchiveGrid)masterForm.ActiveGrid).Bll as IBaseDao; // MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>; // MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>; // if (detailCm.DisplayManager.Position == -1) // { // MessageForm.ShowError("请选择要核销的费用项目!"); // return; // } // if (MessageForm.ShowYesNo("是否要清空审核数据?", "确认") == DialogResult.No) // { // return; // } // RepositoryHelper.Initialize(detailCm.DisplayManagerT.CurrentEntity.费用, detailCm.DisplayManagerT.CurrentEntity); // foreach (费用 i in detailCm.DisplayManagerT.CurrentEntity.费用) // { // i.凭证费用明细 = null; // memoryBll2.Delete(i); // } // detailCm.DisplayManagerT.CurrentEntity.费用.Clear(); // detailCm.DisplayManagerT.CurrentEntity.审核状态 = false; // detailCm.RaiseEntityChangedEvent(true); // memoryBll.Update(detailCm.DisplayManagerT.CurrentEntity); //} #endregion public static void 新增成本发票(ArchiveOperationForm masterForm) { ArchiveDetailForm form = Feng.Windows.Utils.ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo("非业务财务_成本发票"), null); form.ControlManager.AddNew(); form.UpdateContent(); form.ControlManager.DisplayManager.DataControls["金额"].SelectedDataValue = masterForm.ControlManager.DisplayManager.DataControls["金额.数额"].SelectedDataValue; form.ControlManager.DisplayManager.DataControls["凭证号"].SelectedDataValue = masterForm.ControlManager.DisplayManager.DataControls["凭证号"].SelectedDataValue; DialogResult ret = form.ShowDialog(); }
private void btn预录入发送_Click(object sender, EventArgs e) { if (m_cm.DisplayManager.CurrentItem != null) { //为了测试方便,删除验证 //RemoveAllValidation(); ArchiveDetailForm.AddValidations(m_cm, m_gridName); m_显示区Grid.ArchiveGridHelper.AddValidations(); Save(SaveType.预录入发送); RemoveGridValidations(); } }
private void btn备案确认_Click(object sender, EventArgs e) { 进口票 entity = m_cm.DisplayManagerT.CurrentEntity; if (entity != null) { if (!Check票(entity)) { return; } ArchiveDetailForm.AddValidations(m_cm, m_gridName); bool ret = Save(SaveType.正式备案确认); } }
//public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo) //{ // return GenerateArchiveDetailForm(windowInfo, null); //} public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo) { ArchiveDetailForm ret = null; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); if (tabInfos.Count == 0) { throw new ArgumentException("there should be winTab infos in window of " + windowInfo.Name); } ISearchManager sm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(tabInfos[0], null); IWindowControlManager cmParent = null; if (string.IsNullOrEmpty(tabInfos[0].ControlManagerClassName)) { IDisplayManager dmParent = ServiceProvider.GetService <IManagerFactory>().GenerateDisplayManager(tabInfos[0], sm); ret = GenerateArchiveDetailForm(windowInfo, dmParent); } else { cmParent = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(tabInfos[0], sm) as IWindowControlManager; IBaseDao daoParent = ServiceProvider.GetService <IManagerFactory>().GenerateBusinessLayer(tabInfos[0]); cmParent.Dao = daoParent; ret = GenerateArchiveDetailForm(windowInfo, cmParent, daoParent as IRelationalDao); } ret.Text = windowInfo.Text; ret.Name = windowInfo.Name; ArchiveSearchForm searchForm = null; ret.SetSearchPanel(() => { if (searchForm == null) { searchForm = new ArchiveSearchForm(ret, sm, tabInfos[0]); if (cmParent != null) { cmParent.StateControls.Add(searchForm); } } return(searchForm); }); return(ret); }
private bool Save(SaveType saveType) { if (m_cm.State == StateType.Edit) { this.ValidateChildren(); } bool ret = Save(m_cm, saveType); if (m_cm.State == StateType.View) { ArchiveDetailForm.UpdateStatusDataControl(m_cm, m_gridName); m_cm.DisplayManager.OnPositionChanged(System.EventArgs.Empty); } return(ret); }
static void process_fp_TextChanged(object sender, EventArgs e) { MyCurrencyTextBox dc = sender as MyCurrencyTextBox; ArchiveDetailForm form = dc.FindForm() as ArchiveDetailForm; if (form != null) { decimal?d = Feng.Utils.ConvertHelper.ToDecimal(dc.Value); if (d.HasValue) { form.DisplayManager.DataControls["大写金额"].SelectedDataValue = Feng.Windows.Utils.ChineseHelper.ConvertToChinese(d.Value); } else { form.DisplayManager.DataControls["大写金额"].SelectedDataValue = null; } } }
private void btn备案确认_Click(object sender, EventArgs e) { 任务 entity = m_cmT.DisplayManagerT.CurrentEntity; if (entity != null) { if (!任务备案确认主界面.Check任务(entity)) { return; } //为了测试方便,删除验证 //RemoveAllValidation(); ArchiveDetailForm.AddValidations(m_cm, m_gridName); Save(SaveType.正式备案确认); } }
static void process_cl_cezjy_DoubleClick(object sender, EventArgs e) { MyCurrencyTextBox box = sender as MyCurrencyTextBox; ArchiveDetailForm form = box.FindForm() as ArchiveDetailForm; decimal count = Convert.ToDecimal(form.DisplayManager.DataControls["升数"].SelectedDataValue); if (form.DisplayManager.DataControls["费用归属"] != null && form.DisplayManager.DataControls["费用归属"].SelectedDataValue.ToString() == "驾驶员") { box.SelectedDataValue = decimal.Multiply(Convert.ToDecimal(jsyyj), count).ToString(); } else if (form.DisplayManager.DataControls["费用归属"] != null && form.DisplayManager.DataControls["费用归属"].SelectedDataValue.ToString() == "车主") { box.SelectedDataValue = decimal.Multiply(Convert.ToDecimal(czyj), count).ToString(); } else { box.SelectedDataValue = decimal.Multiply(Convert.ToDecimal(cbyj), count).ToString(); } }
private void btn预录入发送_Click(object sender, EventArgs e) { 任务 entity = m_cm.DisplayManagerT.CurrentEntity; if (entity != null) { //为了测试方便,删除验证 //RemoveAllValidation(); ArchiveDetailForm.AddValidations(m_cm, m_gridName); //if (m_cm.DisplayManager.DataControls["任务性质"].SelectedDataValue != null) //{ // 任务性质 rwxz = (任务性质)m_cm.DisplayManager.DataControls["任务性质"].SelectedDataValue; // if (rwxz != 任务性质.进口拆箱 && rwxz != 任务性质.出口装箱) // { // m_cm.RemoveValidation("箱型"); // } //} Save(SaveType.预录入发送); } }
void DataRowTemplate_EditEnded(object sender, EventArgs e) { Xceed.Grid.DataRow row = sender as Xceed.Grid.DataRow; if (row.Cells["费用项"].Value != null) { if (row.Cells["费用项"].Value.ToString() == "011") { ArchiveDetailForm detailForm = ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo("资金票据_凭证_会计付款_固定资产")); if (detailForm != null) { detailForm.ControlManager.AddNew(); detailForm.UpdateContent(); detailForm.DisplayManager.DataControls["购入金额"].SelectedDataValue = row.Cells["金额"].Value; Hd.Model.Kj.固定资产 entity = detailForm.DisplayManager.CurrentItem as Hd.Model.Kj.固定资产; if (this.DisplayManager.DataControls["日期"].SelectedDataValue != null) { entity.购入时间 = (DateTime)this.DisplayManager.DataControls["日期"].SelectedDataValue; } else { entity.购入时间 = System.DateTime.Today; } detailForm.ShowDialog(); } } else if (row.Cells["费用项"].Value.ToString() == "012") { ArchiveDataControlForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("资金票据_凭证_会计付款_结算期限")) as ArchiveDataControlForm; if (form != null) { if (form.ShowDialog() == DialogResult.OK) { row.Cells["结算期限"].Value = form.DataControls["结算期限"].SelectedDataValue; row.Cells["业务分类"].Value = form.DataControls["业务分类"].SelectedDataValue; } } } } }
public static void Ck_货代自编号_DoubleClick(object sender, EventArgs e) { if (sender is MyTextBox) { MyTextBox box_hdzbh = sender as MyTextBox; if (box_hdzbh.SelectedDataValue == null) { ArchiveDetailForm form = box_hdzbh.FindForm() as ArchiveDetailForm; if (((form.DisplayManager.DataControls["委托人编号"] as IWindowControl).Control as MyComboBox).SelectedDataValue == null || ((form.DisplayManager.DataControls["委托时间"] as IWindowControl).Control as MyDatePicker).SelectedDataValue == null) { return; } string wtr = ((form.DisplayManager.DataControls["委托人编号"] as IWindowControl).Control as MyComboBox).SelectedDataValue.ToString(); DateTime wtsj = DateTime.Parse(((form.DisplayManager.DataControls["委托时间"] as IWindowControl).Control as MyDatePicker).SelectedDataValue.ToString()); box_hdzbh.SelectedDataValue = Get货代自编号(wtr, wtsj, GetSimpleParamValue(form.GridName + "_货代自编号")); } } }
public static void 添加新建非业务费用(ArchiveOperationForm masterForm) { IControlManager <凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager <凭证费用明细>; //IDao masterDao = masterForm.ControlManager.Dao; //MemoryDao<凭证费用明细> memoryBll = (masterDao.GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<凭证费用明细>; //MemoryDao<费用> memoryBll2 = (((masterDao.GetSubDao(0) as IMasterDao).DetailDao as IBaseDao).GetSubDao(0) as IMasterDao).DetailMemoryDao as MemoryDao<费用>; ArchiveDetailForm form = Feng.Windows.Utils.ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo("非业务财务_借贷"), null); form.ControlManager.AddNew(); form.UpdateContent(); if (form.ShowDialog() == DialogResult.OK) { 费用实体 entity = form.ControlManager.DisplayManager.CurrentItem as 费用实体; if (entity == null) { throw new ArgumentNullException("invalid 费用实体"); } AddFees(masterForm.DisplayManager.CurrentItem as 凭证, entity.费用, detailCm); } }
static void process_pz_TextChanged(object sender, EventArgs e) { MyCurrencyTextBox dc = sender as MyCurrencyTextBox; ArchiveDetailForm form = dc.FindForm() as ArchiveDetailForm; if (form != null) { if (form.DisplayManager.DataControls["大写金额"] == null) { return; } decimal?d = Feng.Utils.ConvertHelper.ToDecimal(dc.TextBoxArea.Text); // dc.Value 不反映Text,只反映上一步的Text。 即摁入123456时,Value=12345 if (d.HasValue) { form.DisplayManager.DataControls["大写金额"].SelectedDataValue = Feng.Windows.Utils.ChineseHelper.ConvertToChinese(d.Value); } else { form.DisplayManager.DataControls["大写金额"].SelectedDataValue = null; } } }
private void btn备案确认_Click(object sender, EventArgs e) { 任务 entity = m_cmT.DisplayManagerT.CurrentEntity; if (entity != null) { if (!Check任务(entity)) { return; } //为了测试方便,删除验证 //RemoveAllValidation(); ArchiveDetailForm.AddValidations(m_cm, m_gridName); bool ret = Save(SaveType.正式备案确认); if (ret) { m_rightGrid.CurrentDataRow.Cells["预录入号"].ForeColor = Color.Green; m_rightGrid.MoveCurrentRow(Xceed.Grid.VerticalDirection.Down, Xceed.Grid.GridSection.Current); } } }
static void process_pz_DoubleClick(object sender, EventArgs e) { MyCurrencyTextBox dc = sender as MyCurrencyTextBox; ArchiveDetailForm form = dc.FindForm() as ArchiveDetailForm; if (form != null) { decimal sum = 0; IArchiveGrid grid = ((form as IArchiveDetailFormWithDetailGrids).DetailGrids[0] as IArchiveGrid); foreach (Xceed.Grid.DataRow row in grid.DataRows) { if (row.Cells["收付标志"].Value != null && row.Cells["金额"].Value != null) { decimal?d = ConvertHelper.ToDecimal(row.Cells["金额"].Value); if ((收付标志)row.Cells["收付标志"].Value == 收付标志.收) { sum += d.Value; } else { sum -= d.Value; } } } if ((凭证类别)form.DisplayManager.DataControls["凭证类别"].SelectedDataValue == 凭证类别.收款凭证) { dc.SelectedDataValue = sum; } else { dc.SelectedDataValue = -sum; } } }
static void ArchiveDetailForm_DataControlsCreated(object sender, EventArgs e) { ArchiveDetailForm form = sender as ArchiveDetailForm; ((form.DisplayManager.DataControls["货代自编号"] as IWindowControl).Control as MyTextBox).DoubleClick += new EventHandler(Ck_货代自编号_DoubleClick); }
private bool Save(SaveType saveType) { if (m_cm.State == StateType.Edit) { this.ValidateChildren(); if (!m_cm.SaveCurrent()) { return(false); } } 进口票 entity = m_cm.DisplayManagerT.CurrentEntity; switch (saveType) { case SaveType.正式备案确认: if (entity.任务 != null) { for (int i = 0; i < entity.任务.Count; ++i) { 任务Dao.生成任务号(entity.任务[i], i); m_cm2.Dao.Update(entity.任务[i]); } } break; case SaveType.拒绝确认: entity.IsActive = false; if (entity.任务 != null) { foreach (任务 i in entity.任务) { i.是否拒绝 = true; i.IsActive = false; i.任务号 = null; m_cm2.Dao.Update(i); } } break; default: break; } bool ret; if (m_cm.State == StateType.Edit) { ret = m_cm.EndEdit(true); } else { try { m_cm.Dao.Update(entity); ret = true; } catch (Exception ex) { ExceptionProcess.ProcessWithNotify(ex); ret = false; } } if (m_cm.State == StateType.View) { ArchiveDetailForm.UpdateStatusDataControl(m_cm, m_gridName); m_cm.DisplayManager.OnPositionChanged(System.EventArgs.Empty); } return(ret); }
//private static void AddManualDetailForm(System.Windows.Forms.Form form, IArchiveDetailFormAuto detailFormAuto) //{ // form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; // form.TopLevel = false; // detailFormAuto.ReplaceFlowLayoutPanel(form); //} public static ArchiveDetailForm GenerateArchiveDetailForm(WindowInfo windowInfo, IWindowControlManager cmParent, IBaseDao daoParent, IDisplayManager dmParent, IArchiveDetailForm originalDetailForm = null) { ArchiveDetailForm detailForm = originalDetailForm as ArchiveDetailForm; IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); IList <WindowTabInfo> detailFormTabInfos = new List <WindowTabInfo>(); IList <WindowTabInfo> detailFormTabInfos2 = new List <WindowTabInfo>(); foreach (WindowTabInfo subTabInfo in tabInfos[0].ChildTabs) { if (subTabInfo.IsInDetailForm) { detailFormTabInfos.Add(subTabInfo); } else { detailFormTabInfos2.Add(subTabInfo); } } //if (detailStyleForm == null && windowInfo.DetailForm != null) //{ // FormInfo formInfo = ADInfoBll.Instance.GetFormInfo(windowInfo.DetailForm.Name); // if (formInfo == null) // { // throw new ArgumentException("There is no FormInfo with Name of " + windowInfo.DetailForm.Name); // } // detailStyleForm = CreateForm(formInfo); //} //if (detailStyleForm != null) //{ // ret = detailStyleForm as ArchiveDetailForm; //} // 当第二层的任何一个ControlManager为空时,DetailForm作为不可编辑的。 bool isControlManagerEnable = cmParent != null; if (isControlManagerEnable) { for (int i = 0; i < detailFormTabInfos.Count; ++i) { if (string.IsNullOrEmpty(detailFormTabInfos[i].ControlManagerClassName)) { dmParent = cmParent.DisplayManager; isControlManagerEnable = false; break; } } } if (detailForm == null) { if (detailFormTabInfos.Count == 0) { if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAuto(cmParent, tabInfos[0].GridName); } else { detailForm = new ArchiveDetailFormAuto(dmParent, tabInfos[0].GridName); } } else if (detailFormTabInfos.Count == 1) { if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAutoWithDetailGrid(cmParent, tabInfos[0].GridName); } else { detailForm = new ArchiveDetailFormAutoWithDetailGrid(dmParent, tabInfos[0].GridName); } } else { string[] texts = new string[detailFormTabInfos.Count]; for (int i = 0; i < detailFormTabInfos.Count; ++i) { texts[i] = detailFormTabInfos[i].Text; } if (isControlManagerEnable) { detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(cmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts); } else { detailForm = new ArchiveDetailFormAutoWithMultiDetailGrid(dmParent, tabInfos[0].GridName, detailFormTabInfos.Count, texts); } } //IArchiveDetailFormAuto detailFormAuto = ret as IArchiveDetailFormAuto; //if (detailStyleForm != null && detailFormAuto != null) //{ // AddManualDetailForm(detailStyleForm, detailFormAuto); //} } else { // Dao 在cmParent处已经设置了 if (isControlManagerEnable) { detailForm.SetControlMananger(cmParent, tabInfos[0].GridName); } else { detailForm.SetDisplayManager(dmParent, tabInfos[0].GridName); } } detailForm.Name = windowInfo.Name; detailForm.Text = windowInfo.Text; // 只有2层可编辑。主层(控件)-第二层(grid)。再下去就是第二层grid的DetailGrid,不可编辑。 IArchiveDetailFormWithDetailGrids detailFormWithGrids = detailForm as IArchiveDetailFormWithDetailGrids; if (detailFormWithGrids != null) { for (int i = 0; i < detailFormTabInfos.Count; ++i) { if (i >= detailFormWithGrids.DetailGrids.Count) { break; } // 主是ControlManager,并不一定子也是ControlManager。 // 主可以在grid编辑,不能通过DetailForm编辑。此时DetailForm是另外显示的东西。 if (isControlManagerEnable) { var daoRelational = daoParent as IRelationalDao; if (daoRelational == null) { throw new ArgumentException("IArchiveDetailFormWithDetailGrids must has IRelationalDao."); } ISearchManager subSm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], cmParent.DisplayManager); IWindowControlManager subCm = ServiceProvider.GetService <IManagerFactory>().GenerateControlManager(detailFormTabInfos[i], subSm) as IWindowControlManager; subCm.Name = detailFormTabInfos[i].Name; ((IArchiveGrid)detailFormWithGrids.DetailGrids[i]).SetControlManager(subCm, detailFormTabInfos[i].GridName); ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos[i]); IBaseDao subDao = daoRelational.GetRelationalDao(i); if (subDao is IMemoriedRelationalDao) { IMemoryDao subMemoryDao = ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).DetailMemoryDao; subCm.Dao = subMemoryDao; //subMemoryDao.AddSubDao(new MasterDetailMemoryDao<>(cmParent)); ((IMemoriedRelationalDao)daoRelational.GetRelationalDao(i)).AddRelationToMemoryDao(cmParent.DisplayManager); } else { subCm.Dao = subDao; } } else { ISearchManager subSm = ServiceProvider.GetService <IManagerFactory>().GenerateSearchManager(detailFormTabInfos[i], dmParent); IDisplayManager subDm = ServiceProvider.GetService <IManagerFactory>().GenerateDisplayManager(detailFormTabInfos[i], subSm); subDm.Name = detailFormTabInfos[i].Name; detailFormWithGrids.DetailGrids[i].SetDisplayManager(subDm, detailFormTabInfos[i].GridName); } GenerateDetailGrids(detailFormWithGrids.DetailGrids[i], detailFormTabInfos[i]); } } if (isControlManagerEnable) { // Generate Other Daos for (int i = 0; i < detailFormTabInfos2.Count; ++i) { if (!string.IsNullOrEmpty(detailFormTabInfos2[i].BusinessLayerClassName)) { ManagerFactory.GenerateBusinessLayer(daoParent as IRelationalDao, detailFormTabInfos2[i]); } } } // if Master Tab's IsInDetailForm=false, Invisible it if (!tabInfos[0].IsInDetailForm) { if (detailForm is IArchiveDetailFormAuto) { (detailForm as IArchiveDetailFormAuto).RemoveControls(); } } return(detailForm); }
/// <summary> /// CreateWindow /// </summary> /// <param name="windowInfo"></param> /// <returns></returns> public object CreateWindow(WindowInfo windowInfo) { MyForm returnForm = null; switch (windowInfo.WindowType) { case WindowType.Maintain: case WindowType.Transaction: { returnForm = new GeneratedArchiveOperationForm(windowInfo); } break; case WindowType.Query: { // decide gridType IList <WindowTabInfo> tabInfos = ADInfoBll.Instance.GetWindowTabInfosByWindowId(windowInfo.Name); IList <GridColumnInfo> gridColumns = ADInfoBll.Instance.GetGridColumnInfos(tabInfos[0].GridName); foreach (GridColumnInfo info in gridColumns) { if (!string.IsNullOrEmpty(info.ParentPropertyName)) { returnForm = new GeneratedArchiveSeeForm(windowInfo, DataGridType.DataUnboundGridLoadOnce); } } returnForm = new GeneratedArchiveSeeForm(windowInfo); } break; case WindowType.QueryBound: { returnForm = new GeneratedArchiveSeeForm(windowInfo, DataGridType.DataBoundGridLoadOnDemand); } break; case WindowType.TransactionBound: { returnForm = new GeneratedArchiveOperationForm(windowInfo, ArchiveGridType.ArchiveBoundGrid); } break; case WindowType.Select: { returnForm = new GeneratedArchiveCheckForm(windowInfo); } break; case WindowType.DatabaseReport: { returnForm = new GeneratedArchiveDatabaseReportForm(windowInfo); } break; case WindowType.DataSetReport: { returnForm = new GeneratedArchiveDataSetReportForm(windowInfo); } break; case WindowType.SelectWindow: { using (ArchiveSelectForm selectForm = new ArchiveSelectForm(windowInfo.Name)) { if (selectForm.ShowDialog() == DialogResult.OK) { returnForm = selectForm.SelectedForm; } else { returnForm = null; } } } break; case WindowType.DetailTransaction: { ArchiveDetailForm form = ArchiveFormFactory.GenerateArchiveDetailForm(ADInfoBll.Instance.GetWindowInfo(windowInfo.Name), null); form.Load += new EventHandler(delegate(object sender, System.EventArgs e) { form.UpdateContent(); form.SetMenuState(); }); form.SetAsMdiChild(); //// 创建TaskPane //GridRelatedControl gridRelatedControl = null; //form.SetGridRelatedPanel(() => // { // if (gridRelatedControl == null) // { // gridRelatedControl = new GridRelatedControl(form.GridName, form.DisplayManager, form); // } // return gridRelatedControl; // }); form.GenerateWindowMenu(ADInfoBll.Instance.GetWindowMenuInfo(windowInfo.Name)); form.Disposed += new EventHandler(delegate(object sender, System.EventArgs e) { form.DisposeWindowMenu(); }); returnForm = form; } break; case WindowType.DataControl: { returnForm = new GeneratedArchiveDataControlForm(windowInfo); } break; case WindowType.ExcelOperation: { returnForm = new GeneratedArchiveExcelForm(windowInfo); } break; default: throw new ArgumentException("Invalid WindowType in WindowInfo"); } if (WindowCreated != null) { WindowCreated(returnForm, System.EventArgs.Empty); } return(returnForm); }
private void Save(SaveType saveType) { // 验证控件有效值(有些控件需移出焦点后对其他控件产生影响,如果这里不Validate,会先执行Save) this.ValidateChildren(); 进口票 jkp = m_cm.DisplayManager.CurrentItem as 进口票; if (jkp == null) { return; } if (m_cm.SaveCurrent()) { switch (saveType) { case SaveType.暂存待确认: jkp.IsActive = false; for (int i = 0; i < m_显示区Grid.DataRows.Count; ++i) { 任务 entity = m_显示区Grid.DataRows[i].Tag as 任务; entity.任务来源 = 任务来源.手工; entity.任务性质 = 任务性质.进口拆箱; 任务Dao.生成预录入号(entity, i); m_cm2.Dao.Update(entity); } break; case SaveType.预录入发送: if (!Check总箱量(jkp)) { return; } jkp.IsActive = true; for (int i = 0; i < m_显示区Grid.DataRows.Count; ++i) { 任务 entity = m_显示区Grid.DataRows[i].Tag as 任务; if (string.IsNullOrEmpty(entity.预录入号)) { entity.任务来源 = 任务来源.手工; entity.任务性质 = 任务性质.进口拆箱; 任务Dao.生成预录入号(entity, i); } entity.IsActive = true; entity.是否拒绝 = false; m_cm2.Dao.Update(entity); } break; default: break; } m_cm.EndEdit(true); if (m_cm.State == StateType.View) { ArchiveDetailForm.UpdateStatusDataControl(m_cm, m_gridName); m_cm.DisplayManager.OnPositionChanged(System.EventArgs.Empty); } } }