Ejemplo n.º 1
0
 public ChooseEstimatedCostForm(WordMethods wm)
 {
     InitializeComponent();
     chooseComboBox.Items.Add("человеко-часы");
     chooseComboBox.Items.Add("другое");
     _wm = wm;
 }
Ejemplo n.º 2
0
        public static void setAttributesForEstimatedCostTable(WordMethods wm, int rowsCount, int colsCount)
        {
            for (int i = 0; i < colsCount; i++)
            {
                wm.setSelectionToCell(1, i + 1);
                wm.Selection.Text     = Contract.getElementOfHeadersOfEstimatedCostForm(i + 1);
                wm.Selection.FontSize = 12;
                wm.Selection.FontName = "Times New Roman";
                wm.Selection.VertAl   = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter;
                wm.Selection.Aligment = TextAligment.Center;
            }

            for (int i = 0; i < rowsCount - 1; i++)
            {
                for (int j = 0; j < colsCount; j++)
                {
                    wm.setSelectionToCell(i + 2, j + 1);  //wordDoc.SetColumnWidth(1,120);//wordDoc.SetColumnWidth(2, 60)
                    wm.Selection.FontSize = 12;
                    wm.Selection.FontName = "Times New Roman";
                    wm.Selection.VertAl   = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter;
                    wm.Selection.Aligment = TextAligment.Center;
                }
            }

            //for (int i = 0; i < dataGridView1.RowCount; i++)
            //{
            //    wm.setWidthForCell(i + 1, 1, 40);
            //    wm.setWidthForCell(i + 1, 3, 200);
            //}
        }
Ejemplo n.º 3
0
 private void okButton_Click(object sender, EventArgs e)
 {
     try
     {
         WordMethods.FillShowTemplate(insertTable, wm);
         Contract.insertFileCalculateEstCost(wm);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Что-то пошло не так");
     }
 }
Ejemplo n.º 4
0
 private void nextButton_Click(object sender, EventArgs e)
 {
     try
     {
         contractType = contrTypeComboBox.SelectedItem.ToString();
         _wm          = new WordMethods(pathToPatternFile, true);
         GeneralDataForm gdf = new GeneralDataForm(contractType, pathToPatternFile, _wm);
         gdf.Visible = true;
     }
     catch
     {
         MessageBox.Show("Выберите тип договора");
     }
 }
Ejemplo n.º 5
0
        private void nextButton_Click(object sender, EventArgs e)
        {
            try
            {
                WordMethods.FillShowTemplate(insertTable, _wm);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Что-то не так со вставкой календарного плана");
            }
            ChooseEstimatedCostForm cecf = new ChooseEstimatedCostForm(_wm);

            cecf.Visible = true;

            //insert table
        }
Ejemplo n.º 6
0
        //различные методы меняющие что-то.

        public static void insertTable(WordMethods wm, string type, int rowsCount, int colsCount)
        {
            switch (type)
            {
            case "worksch":
                insertWorkSchedulesTable(wm, rowsCount, colsCount);
                break;

            case "estcost":
                insertEstimatedCostTable(wm, rowsCount, colsCount);
                break;

            default:
                break;
            }
        }
Ejemplo n.º 7
0
        public static void setAttributesForWorkSchedulesTable(WordMethods wm, int rowsCount, int colsCount) // Counts from dataGridView
        {
            wm.setHeightForRow(2, 15);
            wm.setColumnWidth(1, 40);
            wm.setHeightForRow(1, 45);

            for (int i = 0; i < colsCount; i++)
            {
                wm.setSelectionToCell(1, i + 1);
                wm.Selection.FontSize = 12;
                wm.Selection.FontName = "Times New Roman";
                wm.Selection.VertAl   = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter;
                wm.Selection.Aligment = TextAligment.Center;
                wm.setSelectionToCell(2, i + 1);
                wm.Selection.FontSize = 12;
                wm.Selection.FontName = "Times New Roman";
                wm.Selection.VertAl   = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter;
                wm.Selection.Aligment = TextAligment.Center;
            }


            for (int i = 0; i < rowsCount - 1; i++)
            {
                for (int j = 0; j < colsCount; j++)
                {
                    wm.setSelectionToCell(i + 3, j + 1);  //wordDoc.SetColumnWidth(1,120);//wordDoc.SetColumnWidth(2, 60)
                    wm.Selection.FontSize = 12;
                    wm.Selection.FontName = "Times New Roman";
                    wm.Selection.VertAl   = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter;
                    wm.Selection.Aligment = TextAligment.Center;

                    // _wm.Selection.setLineSpacing(1f);
                    //_wm.setColumnWidth(1, 300);
                    //_wm.Selection.Aligment = TextAligment.Center; //где-то нужно будет поменять выравнивание
                }
            }

            for (int i = 0; i < rowsCount - 1; i++)
            {
                wm.setSelectionToCell(i + 3, 2);
                wm.Selection.VertAl   = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter;
                wm.Selection.Aligment = TextAligment.Left;
                wm.setSelectionToCell(i + 3, 5);
                wm.Selection.VertAl   = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter;
                wm.Selection.Aligment = TextAligment.Left;
            }
        }
Ejemplo n.º 8
0
 public static void FillShowTemplate(Action <WordMethods> method, WordMethods wm)
 {
     try
     {
         method(wm);
     }
     catch (Exception e)
     {
         if (wm == null)
         {
             throw new Exception("Ошибка! Документ был закрыт.");
         }
         else
         {
             throw new Exception("Возникла некоторая ошибка при выполнении действия");
         }
     }
 }
Ejemplo n.º 9
0
        private void insertTable(WordMethods wm)
        {
            Contract.insertTable(wm, "estcost", dataGridView1.RowCount + 1, dataGridView1.ColumnCount);

            for (int i = 0; i < dataGridView1.ColumnCount; i++)
            {
                Contract.insertToCell(wm, Contract.getElementOfHeadersOfEstimatedCostForm(i + 1), 1, i + 1);
            }



            for (int i = 0; i < dataGridView1.RowCount - 1; i++)
            {
                for (int j = 0; j < dataGridView1.ColumnCount; j++)
                {
                    Contract.insertToCell(wm, (string)dataGridView1[j, i].Value, i + 2, j + 1);
                }
            }

            Contract.insertToCell(wm, "Итого:" + "<COST> (<COSTWORD>) рублей", dataGridView1.RowCount + 1, 1);
            Contract.setDocumentsVisible(wm, true);
        }
Ejemplo n.º 10
0
        private void insertTable(WordMethods _wm)
        {
            Contract.insertTable(_wm, "worksch", dataGridView1.RowCount + 1, dataGridView1.ColumnCount);

            for (int i = 0; i < dataGridView1.ColumnCount; i++)
            {
                Contract.insertToCell(_wm, headers[i], 1, i + 1);
                Contract.insertToCell(_wm, (i + 1).ToString(), 2, i + 1);
            }

            for (int i = 0; i < dataGridView1.RowCount - 1; i++)
            {
                for (int j = 0; j < dataGridView1.ColumnCount; j++)
                {
                    Contract.insertToCell(_wm, (string)dataGridView1[j, i].Value, i + 3, j + 1);
                }
            }

            Contract.setAttributesForWorkSchedulesTable(_wm, dataGridView1.RowCount, dataGridView1.ColumnCount);

            Contract.setDocumentsVisible(_wm, true);
        }
Ejemplo n.º 11
0
 public static void setDocumentsVisible(WordMethods wm, bool value)
 {
     wm.Visible = value;
 }
Ejemplo n.º 12
0
 public static void insertFileWithAdvance(WordMethods wm)
 {
 }
Ejemplo n.º 13
0
 public static void insertFileCalculateEstCost(WordMethods wm)
 {
     wm.goToBookmark("estcostfile");
     wm.insertFile(pathToFolderWithFiles + "est_cost.doc");
 }
Ejemplo n.º 14
0
 private static void insertEstimatedCostTable(WordMethods wm, int rowsCount, int colsCount)
 {
     wm.goToBookmark("w2");
     wm.insertTable(rowsCount, colsCount, true);
 }
Ejemplo n.º 15
0
 public GeneralDataForm(string _contrType, string _pathToPatternFile, WordMethods wm)
 {
     InitializeComponent();
     contrType = _contrType;
     _wm       = wm;
 }
Ejemplo n.º 16
0
 private static void insertWorkSchedulesTable(WordMethods wm, int rowsCount, int colsCount)
 {
     wm.goToBookmark("w1");
     wm.insertTable(rowsCount, colsCount, false);
 }
Ejemplo n.º 17
0
 public static void replaceString(WordMethods wm, string label, string newString)
 {
     wm.replace(label, newString);
 }
Ejemplo n.º 18
0
 public static void goToBookmark(WordMethods wm, string bookmarksName)
 {
     wm.goToBookmark(bookmarksName);
 }
Ejemplo n.º 19
0
 public static void insertToCell(WordMethods wm, string text, int i, int j)
 {
     wm.setSelectionToCell(i, j);
     wm.Selection.Text = text;
 }
Ejemplo n.º 20
0
 public WorkSchedulesForm(WordMethods wm)
 {
     InitializeComponent();
     _wm = wm;
 }
Ejemplo n.º 21
0
        public EstimatedCostForm(string type, WordMethods wmVal)
        {
            InitializeComponent();
            wm = wmVal;
            string contractType = mainForm.getContractType();

            if (type == "человеко-часы")
            {
                var numberColumn = new DataGridViewColumn();
                numberColumn.HeaderText   = "№\nп/п";
                numberColumn.Width        = 50;
                numberColumn.ReadOnly     = false;
                numberColumn.Frozen       = true;
                numberColumn.CellTemplate = new DataGridViewTextBoxCell();
                dataGridView1.Columns.Add(numberColumn);
                Contract.addToHeadersOfEstimatedCostForm("№\nп/п");
                var execCountColumn = new DataGridViewColumn();
                execCountColumn.HeaderText   = "Исполнители/количество";
                execCountColumn.Width        = 150;
                execCountColumn.ReadOnly     = false;
                execCountColumn.Frozen       = true;
                execCountColumn.CellTemplate = new DataGridViewTextBoxCell();
                dataGridView1.Columns.Add(execCountColumn);
                Contract.addToHeadersOfEstimatedCostForm("Исполнители/количество");
                var execPostColumn = new DataGridViewColumn();
                execPostColumn.HeaderText   = "Исполнители/Должность";
                execPostColumn.Width        = 150;
                execPostColumn.ReadOnly     = false;
                execPostColumn.Frozen       = true;
                execPostColumn.CellTemplate = new DataGridViewTextBoxCell();
                dataGridView1.Columns.Add(execPostColumn);
                Contract.addToHeadersOfEstimatedCostForm("Исполнители/Должность");
                var manDaysColumn = new DataGridViewColumn();
                manDaysColumn.HeaderText   = "Количество человеко/дней";
                manDaysColumn.Width        = 150;
                manDaysColumn.ReadOnly     = false;
                manDaysColumn.Frozen       = true;
                manDaysColumn.CellTemplate = new DataGridViewTextBoxCell();
                dataGridView1.Columns.Add(manDaysColumn);
                Contract.addToHeadersOfEstimatedCostForm("Количество человеко/дней");
                var avSalaryColumn = new DataGridViewColumn();
                avSalaryColumn.HeaderText   = "Средняя заработная плата за 1 день, руб";
                avSalaryColumn.Width        = 150;
                avSalaryColumn.ReadOnly     = false;
                avSalaryColumn.Frozen       = true;
                avSalaryColumn.CellTemplate = new DataGridViewTextBoxCell();
                dataGridView1.Columns.Add(avSalaryColumn);
                Contract.addToHeadersOfEstimatedCostForm("Средняя заработная плата за 1 день, руб");
                var basicSalaryColumn = new DataGridViewColumn();
                basicSalaryColumn.HeaderText   = "Основная заработная плата, руб.";
                basicSalaryColumn.Width        = 150;
                basicSalaryColumn.ReadOnly     = false;
                basicSalaryColumn.Frozen       = true;
                basicSalaryColumn.CellTemplate = new DataGridViewTextBoxCell();
                dataGridView1.Columns.Add(basicSalaryColumn);
                Contract.addToHeadersOfEstimatedCostForm("Основная заработная плата, руб.");
                flag = false;
            }
            else if (type == "другое")  // Возможно,будет несколько типов
            {
                flag = true;
                switch (mainForm.getContractType())
                {
                case "Определение комнонентного состава для N отходов":
                {
                    var numberColumn = new DataGridViewColumn();
                    numberColumn.HeaderText   = "№\nп/п";
                    numberColumn.Width        = 50;
                    numberColumn.ReadOnly     = false;
                    numberColumn.Frozen       = true;
                    numberColumn.CellTemplate = new DataGridViewTextBoxCell();
                    dataGridView1.Columns.Add(numberColumn);
                    Contract.addToHeadersOfEstimatedCostForm("№\nп/п");
                    var nameEjColumn = new DataGridViewColumn();
                    nameEjColumn.HeaderText   = "Наименование отхода";
                    nameEjColumn.Width        = 437;
                    nameEjColumn.ReadOnly     = false;
                    nameEjColumn.Frozen       = true;
                    nameEjColumn.CellTemplate = new DataGridViewTextBoxCell();
                    dataGridView1.Columns.Add(nameEjColumn);
                    Contract.addToHeadersOfEstimatedCostForm("Наименование отхода");
                    var costColumn = new DataGridViewColumn();
                    costColumn.HeaderText   = "Стоимость определения компонентного состава,руб";
                    costColumn.Width        = 437;
                    costColumn.ReadOnly     = false;
                    costColumn.Frozen       = true;
                    costColumn.CellTemplate = new DataGridViewTextBoxCell();
                    dataGridView1.Columns.Add(costColumn);
                    Contract.addToHeadersOfEstimatedCostForm("Стоимость определения компонентного состава,руб");
                    break;
                }
                }
            }
        }