예제 #1
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     try
     {
         //检验文件名是否合法
         if (!FileOperate.IsValideFileName(txtCostCalcualteName.Text))
         {
             throw new Exception("The Name must be illeage");
         }
         //检测是否和已有保存的文件文件名冲突
         if (FileOperate.IsFileAlreadyExist(txtCostCalcualteName.Text,Properties.Settings.Default.WorkingDirectory))
         {
             throw new Exception("Same name files exsit, change another name");
         }
         //触发事件
         if (New!=null)
         {
             CostCalculationSheetEventArgs args = new CostCalculationSheetEventArgs();
             args.CalcualteSheetFileName = txtCostCalcualteName.Text;
             args.Remark = txtRemark.Text;
             New(this,args);
         }
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #2
0
 private void btnOpen_Click(object sender, EventArgs e)
 {
     if (lvFileList.SelectedItems.Count == 0)
     {
         return;
     }
     if (OpenDoc != null)
     {
         CostCalculationSheetEventArgs args = new CostCalculationSheetEventArgs();
         args.CalcualteSheetFileName = lvFileList.SelectedItems[0].SubItems[3].Text;
         OpenDoc(this, args);
     }
     this.Close();
 }
예제 #3
0
        private void f_OpenDoc(object sender, CostCalculationSheetEventArgs e)
        {
            try
            {
                XMLDocOp doc = new XMLDocOp();
                string fileName = e.CalcualteSheetFileName;
                CurrentCalculateSheet = doc.Read(fileName);

                LoadCurrentCostSheetData();
                //设置为已经保存
                SetCurrentCalculateSheetSaved();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #4
0
 private void f_New(object sender, CostCalculationSheetEventArgs e)
 {
     //初始化当前计算表
     CurrentCalculateSheet = new CostCalculationSheet(e.CalcualteSheetFileName,e.Remark);
     //CreateTestData();
     LoadCurrentCostSheetData();
 }