Esempio n. 1
0
        /// <summary>
        /// 그리드의 선택 값에 따른 전체 선택기능을 구현합니다.
        /// </summary>
        /// <param name="oGrid"></param>
        /// <param name="ColUid"></param>
        private void SetGridColumn_CheckBox_SelectAll(ref SAPbouiCOM.Grid oGrid, string ColUid)
        {
            try
            {
                XDocument root = XDocument.Parse(oGrid.DataTable.SerializeAsXML(BoDataTableXmlSelect.dxs_DataOnly));

                //검색 컬럼의 값이 'N'인 행의 개수를 확인합니다. --대상 문서번호가 존재하는 행을 제외
                var query =
                           from
                               c in root.Descendants("Row")
                           where c.Elements("Cells").Elements("Cell").Any(o => o.Element("ColumnUid").Value == ColUid && o.Element("Value").Value == "N")
                           && c.Elements("Cells").Elements("Cell").Any(o => o.Element("ColumnUid").Value == "U_TENTRY" && o.Element("Value").Value == "")//대상문서번호가 없고,
                           && c.Elements("Cells").Elements("Cell").Any(o => o.Element("ColumnUid").Value == "PROC_STS" && o.Element("Value").Value == "1")//처리상태가 정상인 행
                           select c;

                if (query.Count() > 0)
                {

                    //검색 컬럼값이 'N'인 'Row'를 조회하여 'Y'로 갱신
                    var query2 =
                           from
                               c in query.Descendants("Cell")
                           where c.Element("ColumnUid").Value == ColUid && c.Element("Value").Value == "N"
                           select c;

                    foreach (XElement ie in query2)
                    {
                        ie.Element("Value").SetValue("Y");
                    }
                }
                else
                {
                    //검색 컬럼값이 'Y'인 'Row'를 조회하여 'Y'로 갱신
                    var query3 =
                           from
                               c in root.Descendants("Cell")
                           where c.Element("ColumnUid").Value == ColUid && c.Element("Value").Value == "Y"
                           select c;

                    foreach (XElement ie in query3)
                    {
                        ie.Element("Value").SetValue("N");
                    }
                }

                oGrid.DataTable.LoadSerializedXML(SAPbouiCOM.BoDataTableXmlSelect.dxs_DataOnly, root.ToString());

                //U_CHK == 'N' 라인이 0보다 큰가
                //'N' 값이 하나라도 있다면 전체 해제이다.(주의:위 코드에서 갱신된 데이터가 select됨).
                if (query.Count() > 0)
                {
                    oGrid.Rows.SelectedRows.Clear();
                }
                else
                {
                    ////'N' 값이 없다면 전체선택
                    //oGrid.Rows.SelectedRows.AddRange(0, oGrid.Rows.Count);//0번째부터 RowCount 수만큼 선택
                    for (int iLooper = 0; iLooper < oGrid.Rows.Count; iLooper++)
                    {
                        int iRowindex = oGrid.GetDataTableRowIndex(iLooper);
                        if (oGrid.DataTable.GetValue("U_CHK",iRowindex)=="Y")
                        {
                            oGrid.Rows.SelectedRows.Add(iLooper);
                        }
                        
                    }
                    

                }

            }
            catch (Exception ex)
            {

                B1Connections.theAppl.StatusBar.SetText(ex.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 행의 상태값을 변경한다.
        /// </summary>
        /// <param name="oGrid"></param>
        /// <param name="stateFiled"></param>
        /// <param name="gridRowidx"></param>
        public void UpdateRowType(SAPbouiCOM.Grid oGrid, string stateFiled, int gridRowidx)
        {
            int rowidx = oGrid.GetDataTableRowIndex(gridRowidx);

            string ROWTYPE = oGrid.DataTable.GetValue(stateFiled, rowidx).ToString();

            if (string.IsNullOrEmpty(ROWTYPE) || ROWTYPE == SO.RowStatus.RowType.None)
            {
                oGrid.DataTable.SetValue(stateFiled, rowidx, SO.RowStatus.RowType.Insert);
            }
            else if (ROWTYPE == SO.RowStatus.RowType.Normal)
            {
                oGrid.DataTable.SetValue(stateFiled, rowidx, SO.RowStatus.RowType.Update);
            }
        }