/// <summary> /// /// </summary> /// <param name="dm"></param> /// <param name="checkForm"></param> /// <param name="presetValues"></param> /// <returns></returns> public static ArchiveCheckForm Execute(IDisplayManager dm, ArchiveCheckForm checkForm, Dictionary <string, object> presetValues) { if (presetValues != null) { foreach (KeyValuePair <string, object> kvp in presetValues) { if (kvp.Value == null) { MessageForm.ShowError("请先填写" + kvp.Key + "!"); return(null); } } ISearchManager smc = checkForm.DisplayManager.SearchManager; if (smc != null) { foreach (KeyValuePair <string, object> kvp in presetValues) { smc.SearchControls[kvp.Key].SelectedDataValues = new System.Collections.ArrayList { kvp.Value }; } } } DialogResult ret = checkForm.ShowDialog(); if (ret == DialogResult.OK) { if (presetValues != null) { foreach (KeyValuePair <string, object> kvp in presetValues) { dm.DataControls[kvp.Key].ReadOnly = true; // save controlValue to entity EntityScript.SetPropertyValue(dm.CurrentItem, kvp.Key, dm.DataControls[kvp.Key].SelectedDataValue); } } //IControlManager detailCm = ((ArchiveDetailFormAutoWithDetailGrid)detailForm).DetailGrid.ControlManager; return(checkForm); } return(null); }
public static void 添加现有车辆管理费用(ArchiveOperationForm masterForm) { IControlManager <凭证费用明细> detailCm = (((IArchiveDetailFormWithDetailGrids)masterForm.ArchiveDetailForm).DetailGrids[0] as IArchiveGrid).ControlManager as IControlManager <凭证费用明细>; ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_会计凭证_车辆管理费用")) as ArchiveCheckForm; if (form.ShowDialog() == DialogResult.OK) { IList <费用> list = new List <费用>(); foreach (object i in form.SelectedEntites) { list.Add(i as 费用); } Hd.Service.process_pz.AddFees(masterForm.DisplayManager.CurrentItem as 凭证, list, detailCm); } }
public static void 批量添加进口箱费用(ArchiveOperationForm masterForm) { IControlManager cm = masterForm.ControlManager; ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_批量添加费用_进口箱")) as ArchiveCheckForm; if (form != null && form.ShowDialog() == DialogResult.OK) { foreach (object i in form.SelectedEntites) { 业务费用 item = new 业务费用(); if (i is 普通箱) { 普通箱 xiang = i as 普通箱; // it must have piao item.票 = xiang.GetType().InvokeMember("票", BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public, null, xiang, null) as 普通票; item.箱 = (i == null ? null : xiang); item.箱Id = i == null ? null : (Guid?)xiang.ID; item.费用实体 = new 普通票 { ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号 }; } else { System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString()); } object entity = cm.AddNew(); if (entity != null) { cm.DisplayManager.Items[cm.DisplayManager.Position] = item; cm.EndEdit(); } else { // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续 masterForm.ControlManager.CancelEdit(); break; } } } }
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<费用>; ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_会计凭证_非业务费用")) as ArchiveCheckForm; 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); } }
public static void 批量添加进口费用(ArchiveOperationForm masterForm) { IControlManager cm = masterForm.ControlManager; ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_批量添加费用_进口票")) as ArchiveCheckForm; if (form != null && form.ShowDialog() == DialogResult.OK) { foreach (object i in form.SelectedEntites) { 业务费用 item = new 业务费用(); if (i is 普通票) { item.票 = i as 普通票; item.费用实体 = new 普通票 { ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号 }; } else { System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString()); } object entity = cm.AddNew(); if (entity != null) { cm.DisplayManager.Items[cm.DisplayManager.Position] = item; cm.EndEdit(); } else { // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续 masterForm.ControlManager.CancelEdit(); break; } } } }
public static void 批量添加进口其他费用(ArchiveOperationForm masterForm) { int cnt = 0; ArchiveCheckForm form = ServiceProvider.GetService <IWindowFactory>().CreateWindow(ADInfoBll.Instance.GetWindowInfo("选择_批量添加费用_进口其他业务票")) as ArchiveCheckForm; if (form.ShowDialog() == DialogResult.OK) { foreach (object i in form.SelectedEntites) { //普通票 entity = i as 普通票; 进口其他业务票 entity2 = i as 进口其他业务票; using (IRepository rep = ServiceProvider.GetService <IRepositoryFactory>().GenerateRepository <进口其他业务票>()) { rep.Initialize(entity2.箱, entity2); cnt += 批量生成费用(rep, 45, entity2, entity2.箱, null, null); } } MessageForm.ShowInfo("已生成" + cnt + "条收款费用!"); } }
public static void 批量添加费用(ArchiveOperationForm masterForm) { IControlManager cm = masterForm.ControlManager; ArchiveSelectForm selectForm = new ArchiveSelectForm("批量添加非业务费用"); if (selectForm.ShowDialog() == DialogResult.OK) { ArchiveCheckForm form = selectForm.SelectedForm as ArchiveCheckForm; if (form != null && form.ShowDialog() == DialogResult.OK) { foreach (object i in form.SelectedEntites) { 非业务费用 newItem = new 非业务费用(); if (i is 费用实体) { newItem.费用实体 = i as 费用实体; } else { System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString()); } cm.AddNew(); cm.DisplayManager.Items[cm.DisplayManager.Position] = newItem; cm.EndEdit(); //string filter = "现有费用实体类型 LIKE '%" + (int)item.费用实体.费用实体类型 + ",%'"; //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = ControlDataLoad.GetGridComboEditor("费用项_非业务", filter); } } } }
public static void 批量添加费用(ArchiveOperationForm masterForm) { IControlManager cm = masterForm.ControlManager; ArchiveSelectForm selectForm = new ArchiveSelectForm("批量添加业务费用"); if (selectForm.ShowDialog() == DialogResult.OK) { ArchiveCheckForm form = selectForm.SelectedForm as ArchiveCheckForm; if (form != null && form.ShowDialog() == DialogResult.OK) { foreach (object i in form.SelectedEntites) { 业务费用 item = new 业务费用(); if (i is 普通票) { item.票 = i as 普通票; item.费用实体 = new 普通票 { ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号 }; } else if (i is 普通箱) { 普通箱 xiang = i as 普通箱; // it must have piao item.票 = xiang.GetType().InvokeMember("票", BindingFlags.GetProperty | BindingFlags.Instance | BindingFlags.Public, null, xiang, null) as 普通票; item.箱 = (i == null ? null : xiang); item.箱Id = i == null ? null : (Guid?)xiang.ID; item.费用实体 = new 普通票 { ID = item.票.ID, Version = item.票.Version, 费用实体类型编号 = item.票.费用实体类型编号 }; } else { System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString()); } object entity = cm.AddNew(); if (entity != null) { cm.DisplayManager.Items[cm.DisplayManager.Position] = item; cm.EndEdit(); } else { // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续 masterForm.ControlManager.CancelEdit(); break; } //bool isPiao = (i is 普通票); //string filter = "现有费用实体类型 LIKE '%" + (int)item.票.费用实体类型; //if (isPiao) //{ // filter += ",%' AND 票 = " + isPiao; //} //else //{ // filter += ",%' AND 箱 = " + !isPiao; //} //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = ControlDataLoad.GetGridComboEditor("费用项_业务", filter); } } } }
public static void 批量添加费用(ArchiveOperationForm masterForm) { IControlManager cm = masterForm.ControlManager; ArchiveSelectForm selectForm = new ArchiveSelectForm("批量添加业务费用"); if (selectForm.ShowDialog() == DialogResult.OK) { ArchiveCheckForm form = selectForm.SelectedForm as ArchiveCheckForm; if (form != null && form.ShowDialog() == DialogResult.OK) { foreach (object i in form.SelectedEntites) { 业务费用 item = new 业务费用(); if (i is 车辆产值) { 车辆产值 tang = i as 车辆产值; item.车辆 = (i == null ? null : tang.车辆); item.车辆编号 = i == null ? null : (Guid?)tang.车辆编号; item.费用实体 = tang; item.车辆产值 = tang; } else if (i is 任务) { 任务 xiang = i as 任务; // it must have piao //item.车辆产值 = xiang.车辆产值; item.任务 = (i == null ? null : xiang); item.车辆 = (i == null ? null : xiang.车辆产值.车辆); item.车辆编号 = i == null ? null : (Guid?)xiang.车辆产值.车辆编号; item.费用实体 = xiang.车辆产值;// new 车辆产值 { ID = item.车辆产值.ID, Version = item.车辆产值.Version }; item.车辆产值 = xiang.车辆产值; } else { System.Diagnostics.Debug.Assert(false, "选中的费用实体类型不是要求类型,而是" + i.GetType().ToString()); } object entity = cm.AddNew(); if (entity != null) { cm.DisplayManager.Items[cm.DisplayManager.Position] = item; cm.EndEdit(); } else { // 出现错误,不再继续。 AddNew的时候,前一个出现错误,没保存。然后提示时候保存,选不继续 masterForm.ControlManager.CancelEdit(); break; } //bool isPiao = (i is 普通票); //string filter = "现有费用实体类型 LIKE '%" + (int)item.票.费用实体类型; //if (isPiao) //{ // filter += ",%' AND 票 = " + isPiao; //} //else //{ // filter += ",%' AND 箱 = " + !isPiao; //} //masterForm.ActiveGrid.CurrentDataRow.Cells["费用项编号"].CellEditorManager = ControlDataLoad.GetGridComboEditor("费用项_业务", filter); } } } }