Beispiel #1
0
        private void 填写原因ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var sheet = Datas.ActiveSheet;
            var rows  = FarPointExtensions.GetSelectionRows(sheet);
            var ids   = new List <string>();

            if (rows.Length > 0)
            {
                var form = new TestOverTimeReason(new Guid(sheet.Cells[rows[0].Index, 10].Value.ToString()), OverTimeTable);
                //form.FormClosed += new FormClosedEventHandler(TestOverTimeProcess_FormClosed);
                form.Show();
            }
            //Row Row = spread_test_overtime.ActiveSheet.ActiveRow;
            //if (Row != null)
            //{
            //    DataRow r = Row.Tag as DataRow;
            //    if (r == null)
            //    {
            //        return;
            //    }
            //    Guid id = new Guid(r["ID"].ToString());
            //    TestOverTimeReason totr = new TestOverTimeReason(id);
            //    totr.ShowDialog();
            //}
        }
Beispiel #2
0
        private void 填写原因ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var sheet = spread_test_overtime.ActiveSheet;
            var rows  = FarPointExtensions.GetSelectionRows(sheet);
            var ids   = new List <string>();

            if (rows.Length > 0)
            {
                var form = new TestOverTimeReason(new Guid(sheet.Cells[rows[0].Index, 0].Value.ToString()), OverTimeTable);
                form.Show();
            }
        }
Beispiel #3
0
        public Guid GetSelectionModuleID()
        {
            var rows = FarPointExtensions.GetSelectionRows(TableModules.ActiveSheet);

            if (rows != null && rows.Length > 0)
            {
                var tag = TableModules.ActiveSheet.Cells[rows[0].Index, 0].Tag;
                return(new Guid(Convert.ToString(tag)));
            }

            return(Guid.Empty);
        }
Beispiel #4
0
        private void 处理ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var sheet = spread_test_overtime.ActiveSheet;
            var rows  = FarPointExtensions.GetSelectionRows(sheet);
            var ids   = new List <string>();

            foreach (var row in rows)
            {
                var form = new TestOverTimeProcess(new Guid(sheet.Cells[row.Index, 0].Value.ToString()), OverTimeTable);
                form.FormClosed += new FormClosedEventHandler(TestOverTimeProcess_FormClosed);
                form.Show();
            }
        }
Beispiel #5
0
        private void bt_approval_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tb_process.Text))
            {
                MessageBox.Show("请填写处理结果", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            var rows = FarPointExtensions.GetSelectionRows(Sheet);
            var ids  = new List <Guid>();

            if (ApplyAll.Checked)
            {
                foreach (Row row in Sheet.Rows)
                {
                    if (row.Tag == null)
                    {
                        continue;
                    }

                    var id = new Guid(row.Tag.ToString());

                    ids.Add(id);
                }
            }
            else
            {
                foreach (var row in rows)
                {
                    var id = new Guid(row.Tag.ToString());
                    if (id == null)
                    {
                        continue;
                    }

                    ids.Add(id);
                }
            }

            if (ids.Count == 0)
            {
                MessageBox.Show("请选择要处理的数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                ProcessOverTime(1, ids.ToArray());
            }
        }
Beispiel #6
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            var rows = FarPointExtensions.GetSelectionRows(Sheet);
            var ids  = new List <Guid>();

            if (ApplyAll.Checked)
            {
                foreach (Row row in Sheet.Rows)
                {
                    if (row.Tag == null)
                    {
                        continue;
                    }

                    var id = new Guid(row.Tag.ToString());

                    ids.Add(id);
                }
            }
            else
            {
                foreach (var row in rows)
                {
                    var id = new Guid(row.Tag.ToString());
                    if (id == null)
                    {
                        continue;
                    }

                    ids.Add(id);
                }
            }

            if (ids.Count == 0)
            {
                MessageBox.Show("请选择要处理的数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                CaiJiHelperClient.UpdateTestOverTimeStatus(ids.ToArray(), 0);
                SetDataSource();
                this.Close();
                //ProcessOverTime(1, ids.ToArray());
            }
        }
Beispiel #7
0
        private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var sheet = spread_test_overtime.ActiveSheet;
            var rows  = FarPointExtensions.GetSelectionRows(sheet);

            if (rows == null || rows.Length == 0)
            {
                MessageBox.Show("没有选中要删除的数据", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            var ids = new List <string>();

            foreach (var row in rows)
            {
                ids.Add(sheet.Cells[row.Index, 0].Value.ToString());
            }

            DocumentHelperClient.DeleteTestOverTime(ids);
            BindTestOverTime(Yqun.Common.ContextCache.ApplicationContext.Current);
        }
Beispiel #8
0
        private void OverTimeMenu_Opening(object sender, CancelEventArgs e)
        {
            var rows = FarPointExtensions.GetSelectionRows(spread_test_overtime.ActiveSheet);

            if (rows == null || rows.Length == 0)
            {
                return;
            }

            var row = rows[0].Tag as DataRow;

            if (row == null)
            {
                return;
            }

            if (userType.IndexOf("监理") > 0)
            {
                var code = Convert.ToString(row["TestRoomCode"]);
                填写原因ToolStripMenuItem.Visible = Yqun.Common.ContextCache.ApplicationContext.Current.InTestRoom.Code == code;
            }
        }
Beispiel #9
0
        private void SetStatisticsTable()
        {
            var map      = "";
            var columns  = new List <StatisticsSetting>();
            var settings = new List <StatisticsModuleSetting>();

            if (CurrentStatistics != null)
            {
                try
                {
                    columns = JsonConvert.DeserializeObject <List <StatisticsSetting> >(CurrentStatistics.Columns);
                }
                catch (Exception e)
                {
                    var m = JsonConvert.DeserializeObject <Dictionary <string, string> >(CurrentStatistics.Columns);
                    columns = new List <StatisticsSetting>();
                    foreach (var key in m.Keys)
                    {
                        columns.Add(new StatisticsSetting()
                        {
                            ItemName  = key,
                            BindField = m[key],
                        });
                    }
                }
            }
            if (columns == null)
            {
                columns = new List <StatisticsSetting>();
            }

            if (SelectionModule != null)
            {
                map      = Convert.ToString(SelectionModule["StatisticsMap"]);
                settings = JsonConvert.DeserializeObject <List <StatisticsModuleSetting> >(map);
            }

            if (settings == null)
            {
                settings = new List <StatisticsModuleSetting>();
            }

            var fixIndex = 0;

            foreach (var column in columns)
            {
                var setting = settings.Find(m => m.StatisticsItemName == column.ItemName);
                if (setting == null)
                {
                    settings.Insert(0, new StatisticsModuleSetting()
                    {
                        StatisticsItemName = column.ItemName,
                        BindField          = column.BindField
                    });

                    fixIndex++;
                }
            }

            var sheet = CloneSheet(TableStatistics.ActiveSheet, settings.Count);
            var index = 0;

            foreach (var set in settings)
            {
                if (index < fixIndex)
                {
                    FarPointExtensions.LockCell(sheet.Cells[index, 6], "#");
                    FarPointExtensions.LockCell(sheet.Cells[index, 1], "#");
                    FarPointExtensions.LockCell(sheet.Cells[index, 0], "#");
                }

                sheet.Cells[index, 0].Value = set.StatisticsItemName;
                sheet.Cells[index, 1].Value = GetKey(set.BindField);
                sheet.Cells[index, 2].Value = set.SheetName;
                sheet.Cells[index, 2].Tag   = set.SheetID;
                sheet.Cells[index, 3].Value = set.CellName;
                sheet.Cells[index, 3].Tag   = set.CellName;

                index += 1;
            }

            TableStatistics.Sheets.Clear();
            TableStatistics.Sheets.Add(sheet);

            sheet.CellChanged += new SheetViewEventHandler(TableStatistics_Sheet1_CellChanged);
        }
Beispiel #10
0
        private void bt_save_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(tb_reason.Text.Trim()))
            {
                MessageBox.Show("延时原因不能为空!");
                return;
            }
            var ids = new List <Guid>();

            if (chkAll.Checked)
            {
                for (int i = 0; i < Sheet.Rows.Count; i++)
                {
                    var t = Sheet.Rows[i].Tag.ToString();
                    if (string.IsNullOrEmpty(t))
                    {
                        continue;
                    }

                    ids.Add(new Guid(t));
                }
            }
            else
            {
                var rows = FarPointExtensions.GetSelectionRows(Sheet);
                foreach (var row in rows)
                {
                    var t = row.Tag.ToString();
                    if (string.IsNullOrEmpty(t))
                    {
                        continue;
                    }

                    ids.Add(new Guid(t));
                }
            }

            if (ids.Count <= 0)
            {
                MessageBox.Show("请选择要处理的数据!");
                return;
            }

            try
            {
                CaiJiHelperClient.SubmitCommentMulti(ids.ToArray(), tb_reason.Text.Trim(), 2);

                SetDataSource();
                MessageBox.Show("保存成功,请等待监理审批!");
                if (chkAll.Checked)
                {
                    this.Close();
                }
            }
            catch
            {
                MessageBox.Show("保存失败,请联系管理员");
            }
            //try
            //{
            //    CaiJiHelperClient.SubmitComment(id, tb_reason.Text.Trim());
            //    MessageBox.Show("保存成功");
            //}
            //catch
            //{
            //    MessageBox.Show("保存失败,请联系管理员");
            //}
            //this.Close();
        }