Example #1
0
        private void grdAmenitiesMasterView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (CommFun.IsNullCheck(grdAmenitiesMasterView.GetRowCellValue(grdAmenitiesMasterView.FocusedRowHandle, "AmenityName").ToString(), CommFun.datatypes.vartypestring).ToString().Trim() == "")
            {
                grdAmenitiesMasterView.CancelUpdateCurrentRow();
                return;
            }
            if (m_bAns == true)
            {
                return;
            }

            if (grdAmenitiesMasterView.IsNewItemRow(grdAmenitiesMasterView.FocusedRowHandle) == true)
            {
                if (BsfGlobal.FindPermission("Amenities Master-Add") == false)
                {
                    MessageBox.Show("You don't have Rights to Amenities Master-Add");
                    return;
                }
                m_bAns = true;
                string sAmenityName = grdAmenitiesMasterView.GetRowCellValue(grdAmenitiesMasterView.FocusedRowHandle, "AmenityName").ToString();
                int    iAId         = ProjectInfoDL.InsertAmenitiesMaster(sAmenityName);
                grdAmenitiesMasterView.SetRowCellValue(grdAmenitiesMasterView.FocusedRowHandle, "AmenityId", iAId);
                m_bAns = false;
            }
            else
            {
                if (BsfGlobal.FindPermission("Amenities Master-Modify") == false)
                {
                    MessageBox.Show("You don't have Rights to Amenities Master-Modify");
                    return;
                }
                int    iAId         = Convert.ToInt32(grdAmenitiesMasterView.GetRowCellValue(grdAmenitiesMasterView.FocusedRowHandle, "AmenityId").ToString());
                string sAmenityName = grdAmenitiesMasterView.GetRowCellValue(grdAmenitiesMasterView.FocusedRowHandle, "AmenityName").ToString();
                ProjectInfoDL.UpdateAmenitiesMaster(iAId, sAmenityName);
            }
        }