コード例 #1
0
        private void grdServicesMasterView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (CommFun.IsNullCheck(grdServicesMasterView.GetRowCellValue(grdServicesMasterView.FocusedRowHandle, "ServiceName").ToString(), CommFun.datatypes.vartypestring).ToString().Trim() == "")
            {
                grdServicesMasterView.CancelUpdateCurrentRow();
                return;
            }
            if (m_bAns == true)
            {
                return;
            }

            ProjectInfoBO ServicesBO = new ProjectInfoBO();

            if (grdServicesMasterView.IsNewItemRow(grdServicesMasterView.FocusedRowHandle) == true)
            {
                if (BsfGlobal.FindPermission("NearByServices Master-Add") == false)
                {
                    MessageBox.Show("You don't have Rights to NearByServices Master-Add");
                    return;
                }
                m_bAns = true;
                string sNearName = grdServicesMasterView.GetRowCellValue(grdServicesMasterView.FocusedRowHandle, "ServiceName").ToString();
                int    iNId      = ProjectInfoDL.InsertNBSMaster(sNearName);
                grdServicesMasterView.SetRowCellValue(grdServicesMasterView.FocusedRowHandle, "ServiceId", iNId);

                m_bAns = false;
            }
            else
            {
                if (BsfGlobal.FindPermission("NearByServices Master-Modify") == false)
                {
                    MessageBox.Show("You don't have Rights to NearByServices Master-Modify");
                    return;
                }
                int    iNId      = Convert.ToInt32(grdServicesMasterView.GetRowCellValue(grdServicesMasterView.FocusedRowHandle, "ServiceId").ToString());
                string sNearName = grdServicesMasterView.GetRowCellValue(grdServicesMasterView.FocusedRowHandle, "ServiceName").ToString();
                ServicesBO.s_NBSName = grdServicesMasterView.GetRowCellValue(grdServicesMasterView.FocusedRowHandle, "ServiceName").ToString();
                ProjectInfoDL.UpdateServicesMaster(iNId, sNearName);
            }
        }