public override object CommandBody(params object[] paras) { if (paras.Length < 2) { throw new ArgumentException(); } ProjectAllocationCalcSearchCondtion searchCondition = new ProjectAllocationCalcSearchCondtion(); searchCondition.ProjectCode = paras[0] as string; searchCondition.ProjectName = paras[1] as string; if (OnProgress != null) { string TaskName = ProjectAllocationResource.Message.Project_TaskMessage_Load; ProjectAllocationFramework.Statues.ProgressChangedEventArgs args = new ProjectAllocationFramework.Statues.ProgressChangedEventArgs(TaskName); OnProgress(null, args); } ProjectAllocationCalcManager manager = new ProjectAllocationCalcManager(); List <ProjectAllocationCalcEntity> data = manager.GetDataFromDB(OnProgress, searchCondition); Core.CoreData[CoreDataType.PROJECTALLOCATIONCALC_SEARCH] = data; return(data); }
public override object CommandBody(params object[] paras) { if (paras.Length < 1) { throw new ArgumentException(); } ProjectAllocationCalcEntity SaveData = paras[0] as ProjectAllocationCalcEntity; ProjectAllocationCalcManager manager = new ProjectAllocationCalcManager(); if (OnProgress != null) { string TaskName = ProjectAllocationResource.Message.Project_TaskMessage_Validate; ProjectAllocationFramework.Statues.ProgressChangedEventArgs args = new ProjectAllocationFramework.Statues.ProgressChangedEventArgs(TaskName); OnProgress(null, args); } //check manager.DataValidation(OnProgress, SaveData); if (OnProgress != null) { string TaskName = ProjectAllocationResource.Message.Project_TaskMessage_Save; ProjectAllocationFramework.Statues.ProgressChangedEventArgs args = new ProjectAllocationFramework.Statues.ProgressChangedEventArgs(TaskName); OnProgress(null, args); } //save manager.SaveDataToDB(OnProgress, SaveData); return(SaveData); }
private void btnProject_Click(object sender, EventArgs e) { string assemblyName = Path.Combine(Application.StartupPath, "Project.dll"); IEntry instance = ApplicationDispatcher.GetInstance(assemblyName, new String[] { "" }); Form objForm = instance.GetSearchDialog(null); if (objForm.ShowDialog() == DialogResult.OK) { var objForm1 = objForm as frmBase; if (objForm1 != null) { foreach (DataGridViewRow item in objForm1.SelectedRows()) { ProjectEntity entity = new ProjectEntity(); entity.ProjectCode = ConvertUtil.ToString(item.Cells["projectCodeColumn"].Value); entity.ProjectName = ConvertUtil.ToString(item.Cells["projectNameColumn"].Value); if (!string.IsNullOrEmpty(entity.ProjectCode)) { this.txtProjectName.Text = entity.ProjectName; this.txtProjectName.Tag = entity.ProjectCode; // 查询该项目的计算产值记录 ProjectAllocationCalcManager manager = new ProjectAllocationCalcManager(); ProjectAllocationCalcEntity projectAllocationCalcEntity = manager.GetProjectAllocationCalcEntity(OnProgressChanged, entity.ProjectCode); // 如果没有找到的话 if (projectAllocationCalcEntity == null) { projectAllocationCalcEntity = new ProjectAllocationCalcEntity(); projectAllocationCalcEntity.ProjectCode = entity.ProjectCode; projectAllocationCalcEntity.ProjectName = entity.ProjectName; projectAllocationCalcEntity.Worth = 0.0; } this.ProjectAllocationCalcEntity = projectAllocationCalcEntity; break; } } } } }