Пример #1
0
        private void FillCheck()
        {
            grdCheck.DataSource = null;
            DataTable dt = new DataTable();

            if (m_sType == "FlatType")
            {
                if (m_sCType == "")
                {
                    return;
                }

                dt = UnitDirBL.FlatTypeCheckList(m_iId, m_sCType, m_icostCentreId);
                grdCheck.DataSource = dt;
                grdCheckView.PopulateColumns();
                grdCheckView.Columns["CheckListId"].Visible = false;
                grdCheckView.Columns["Status"].Visible      = false;
                grdCheckView.Columns["CheckListName"].OptionsColumn.AllowEdit = false;

                RepositoryItemDateEdit expDate = new RepositoryItemDateEdit();
                grdCheckView.Columns["ExpCompletionDate"].ColumnEdit = expDate;
                //grdCheckView.Columns["Status"].Width = 50;
                //grdCheckView.Columns["Status"].Caption = "Select";
                //grdCheckView.Columns["Status"].AppearanceHeader.Options.UseTextOptions = true;
                //grdCheckView.Columns["Status"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                selection = new GridSelectAll(grdCheckView);
                selection.CheckMarkColumn.VisibleIndex = 2;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    bool b_Status = Convert.ToBoolean(CommFun.IsNullCheck(dt.Rows[i]["Status"], CommFun.datatypes.varTypeBoolean));
                    grdCheckView.SetRowCellValue(i, selection.CheckMarkColumn, b_Status);
                }

                grdCheckView.OptionsBehavior.Editable = true;
            }
            else if (m_sType == "Flat")
            {
                if (m_sCType == "")
                {
                    return;
                }

                dt = UnitDirBL.FlatCheckList(m_iId, m_sCType);
                grdCheck.DataSource = dt;
                if (dt != null)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (Convert.ToBoolean(CommFun.IsNullCheck(dt.Rows[i]["Status"], CommFun.datatypes.varTypeBoolean)) == true)
                        {
                        }
                        else
                        {
                            bChkAlertSend = true;
                        }
                    }
                }
                grdCheckView.PopulateColumns();
                grdCheckView.Columns["CheckListId"].Visible = false;
                grdCheckView.Columns["Status"].Visible      = false;
                grdCheckView.Columns["CheckListName"].OptionsColumn.AllowEdit = false;
                grdCheckView.Columns["ExecutiveId"].Caption = "Executive";

                RepositoryItemDateEdit expDate = new RepositoryItemDateEdit();
                grdCheckView.Columns["ExpCompletionDate"].ColumnEdit = expDate;

                DataTable dtExe = new DataTable();
                RepositoryItemLookUpEdit cboExecutive = new RepositoryItemLookUpEdit();
                dtExe = UnitDirBL.Executive();
                cboExecutive.DataSource = dtExe;
                cboExecutive.ForceInitialize();
                cboExecutive.PopulateColumns();
                cboExecutive.DisplayMember             = "ExecName";
                cboExecutive.ValueMember               = "ExecId";
                cboExecutive.ShowHeader                = false;
                cboExecutive.ShowFooter                = false;
                cboExecutive.Columns["ExecId"].Visible = false;
                cboExecutive.NullText = "None";
                grdCheckView.Columns["ExecutiveId"].ColumnEdit = cboExecutive;

                //grdCheckView.Columns["Status"].Width = 50;
                //grdCheckView.Columns["Status"].Caption = "Select";
                //grdCheckView.Columns["Status"].AppearanceHeader.Options.UseTextOptions = true;
                //grdCheckView.Columns["Status"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                selection = new GridSelectAll(grdCheckView);
                selection.CheckMarkColumn.VisibleIndex = 2;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    bool b_Status = Convert.ToBoolean(CommFun.IsNullCheck(dt.Rows[i]["Status"], CommFun.datatypes.varTypeBoolean));
                    grdCheckView.SetRowCellValue(i, selection.CheckMarkColumn, b_Status);
                }

                grdCheckView.OptionsBehavior.Editable = true;
            }
            else if (m_sType == "ProjectInfo")
            {
                dt = UnitDirBL.ProjectCheckList(m_iId);

                grdCheck.DataSource = dt;
                grdCheckView.PopulateColumns();
                grdCheckView.Columns["CheckListId"].Visible = false;
                grdCheckView.Columns["Status"].Visible      = false;
                grdCheckView.Columns["CheckListName"].OptionsColumn.AllowEdit = false;

                RepositoryItemDateEdit Date = new RepositoryItemDateEdit();
                grdCheckView.Columns["CompletionDate"].ColumnEdit = Date;

                //grdCheckView.Columns["Status"].Width = 50;
                //grdCheckView.Columns["Status"].Caption = "Select";
                //grdCheckView.Columns["Status"].AppearanceHeader.Options.UseTextOptions = true;
                //grdCheckView.Columns["Status"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                selection = new GridSelectAll(grdCheckView);
                selection.CheckMarkColumn.VisibleIndex = 2;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    bool b_Status = Convert.ToBoolean(CommFun.IsNullCheck(dt.Rows[i]["Status"], CommFun.datatypes.varTypeBoolean));
                    grdCheckView.SetRowCellValue(i, selection.CheckMarkColumn, b_Status);
                }

                grdCheckView.OptionsBehavior.Editable = true;
            }
            else if (m_sType == "Final")
            {
                //if (m_iId == 0) { MessageBox.Show("Select Flat"); return; }
                if (dtFinal != null && dtFinal.Rows.Count > 0)
                {
                    dt = dtFinal; grdCheck.DataSource = dt;
                }                                                                                         //dtLand = dt;
                else
                {
                    if (m_sBussinessType == "L")
                    {
                        dt     = UnitDirBL.FinalCheckListPlot(m_iId);
                        dtLand = UnitDirBL.FinalPlot(m_iId);
                        grdCheck.DataSource = dt;

                        if (dt != null)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                for (int j = 0; j < dtLand.Rows.Count; j++)
                                {
                                    if (Convert.ToInt32(dtLand.Rows[j]["CheckListId"]) == Convert.ToInt32(dt.Rows[i]["CheckListId"]))
                                    {
                                    }
                                    else
                                    {
                                        bChkAlertSend = true;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        dt = UnitDirBL.FinalCheckListFlat(m_iId);
                        grdCheck.DataSource = dt;

                        if (dt != null)
                        {
                            for (int i = 0; i < dt.Rows.Count; i++)
                            {
                                if (Convert.ToBoolean(CommFun.IsNullCheck(dt.Rows[i]["Status"], CommFun.datatypes.varTypeBoolean)) == true)
                                {
                                }
                                else
                                {
                                    bChkAlertSend = true;
                                }
                            }
                        }
                    }
                }
                grdCheckView.PopulateColumns();
                grdCheckView.Columns["CheckListId"].Visible = false;
                grdCheckView.Columns["CheckListName"].OptionsColumn.AllowEdit = false;
                grdCheckView.Columns["ExecutiveId"].Caption = "Executive";

                RepositoryItemDateEdit expDate = new RepositoryItemDateEdit();
                grdCheckView.Columns["ExpCompletionDate"].ColumnEdit = expDate;

                DataTable dtExe = new DataTable();
                dtExe = UnitDirBL.Executive();
                RepositoryItemLookUpEdit cboExecutive = new RepositoryItemLookUpEdit();
                cboExecutive.DataSource = dtExe;
                cboExecutive.ForceInitialize();
                cboExecutive.PopulateColumns();
                cboExecutive.DisplayMember             = "ExecName";
                cboExecutive.ValueMember               = "ExecId";
                cboExecutive.ShowHeader                = false;
                cboExecutive.ShowFooter                = false;
                cboExecutive.Columns["ExecId"].Visible = false;
                cboExecutive.NullText = "None";
                grdCheckView.Columns["ExecutiveId"].ColumnEdit = cboExecutive;

                if (m_sBussinessType == "B")
                {
                    grdCheckView.Columns["Status"].Visible = false;
                    selection = new GridSelectAll(grdCheckView);
                    selection.CheckMarkColumn.VisibleIndex = 2;

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        bool b_Status = Convert.ToBoolean(CommFun.IsNullCheck(dt.Rows[i]["Status"], CommFun.datatypes.varTypeBoolean));
                        grdCheckView.SetRowCellValue(i, selection.CheckMarkColumn, b_Status);
                    }
                }
                else
                {
                    selection = new GridSelectAll(grdCheckView);
                    selection.CheckMarkColumn.VisibleIndex = 2;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        for (int j = 0; j < dtLand.Rows.Count; j++)
                        {
                            if (Convert.ToInt32(dt.Rows[i]["CheckListId"]) == Convert.ToInt32(dtLand.Rows[j]["CheckListId"]))
                            {
                                grdCheckView.SetRowCellValue(i, selection.CheckMarkColumn, true);
                            }
                        }
                    }
                }

                grdCheckView.OptionsBehavior.Editable = true;
            }
            else if (m_sType == "Cancel")
            {
                if (dtCancel != null && dtCancel.Rows.Count > 0)
                {
                    dt = dtCancel;
                }
                else
                {
                    dt = UnitDirBL.CancelCheckListFlat(m_iId);
                }

                if (dt != null)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        if (Convert.ToBoolean(CommFun.IsNullCheck(dt.Rows[i]["Status"], CommFun.datatypes.varTypeBoolean)) == true)
                        {
                        }
                        else
                        {
                            bChkAlertSend = true;
                        }
                    }
                }

                grdCheck.DataSource = dt;
                grdCheckView.PopulateColumns();
                grdCheckView.Columns["CheckListId"].Visible = false;
                grdCheckView.Columns["Status"].Visible      = false;
                grdCheckView.Columns["CheckListName"].OptionsColumn.AllowEdit = false;
                grdCheckView.Columns["ExecutiveId"].Caption = "Executive";

                RepositoryItemDateEdit expDate = new RepositoryItemDateEdit();
                grdCheckView.Columns["ExpCompletionDate"].ColumnEdit = expDate;

                DataTable dtExe = new DataTable();
                dtExe = UnitDirBL.Executive();
                RepositoryItemLookUpEdit cboExecutive = new RepositoryItemLookUpEdit();
                cboExecutive.DataSource    = dtExe;
                cboExecutive.DisplayMember = "ExecName";
                cboExecutive.ValueMember   = "ExecId";
                cboExecutive.ForceInitialize();
                cboExecutive.PopulateColumns();
                cboExecutive.ShowHeader = false;
                cboExecutive.ShowFooter = false;
                cboExecutive.Columns["ExecId"].Visible = false;
                cboExecutive.NullText = "None";
                grdCheckView.Columns["ExecutiveId"].ColumnEdit = cboExecutive;

                selection = new GridSelectAll(grdCheckView);
                selection.CheckMarkColumn.VisibleIndex = 2;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    bool b_Status = Convert.ToBoolean(CommFun.IsNullCheck(dt.Rows[i]["Status"], CommFun.datatypes.varTypeBoolean));
                    grdCheckView.SetRowCellValue(i, selection.CheckMarkColumn, b_Status);
                }

                grdCheckView.OptionsBehavior.Editable = true;
            }
            else if (m_sType == "Project")
            {
                if (m_sCType == "")
                {
                    return;
                }

                dt = UnitDirBL.ProjectCheckListFlat(m_iId, m_sCType);

                grdCheck.DataSource = dt;
                grdCheckView.PopulateColumns();
                grdCheckView.Columns["CheckListId"].Visible = false;
                grdCheckView.Columns["Status"].Visible      = false;

                grdCheckView.Columns["CheckListName"].OptionsColumn.AllowEdit = false;
                grdCheckView.Columns["CheckListName"].Width = 200;
                //grdCheckView.Columns["Status"].Width = 50;
                //grdCheckView.Columns["Status"].Caption = "Select";
                //grdCheckView.Columns["Status"].AppearanceHeader.Options.UseTextOptions = true;
                //grdCheckView.Columns["Status"].AppearanceHeader.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;
                selection = new GridSelectAll(grdCheckView);
                selection.CheckMarkColumn.VisibleIndex = 2;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    bool b_Status = Convert.ToBoolean(CommFun.IsNullCheck(dt.Rows[i]["Status"], CommFun.datatypes.varTypeBoolean));
                    grdCheckView.SetRowCellValue(i, selection.CheckMarkColumn, b_Status);
                }

                grdCheckView.OptionsBehavior.Editable = true;
            }

            grdCheckView.Appearance.HeaderPanel.Font      = new Font(grdCheckView.Appearance.HeaderPanel.Font, FontStyle.Bold);
            grdCheckView.OptionsSelection.InvertSelection = true;
            grdCheckView.OptionsSelection.EnableAppearanceHideSelection = false;
            grdCheckView.Appearance.FocusedRow.BackColor = Color.Teal;
            grdCheckView.Appearance.FocusedRow.ForeColor = Color.White;
            grdCheckView.BestFitColumns();
        }