Пример #1
0
 //Get new function of group for update
 private List<DTO.DTOtblGROUP_FUNCTION> GetGroupFunction(int _GroupID)
 {
     List<DTO.DTOtblGROUP_FUNCTION> _GroupFunction = new List<DTO.DTOtblGROUP_FUNCTION>();
     for (int i = 0; i < grdvFunction.DataRowCount; i++)
     {
         DTO.DTOtblGROUP_FUNCTION _func = new DTO.DTOtblGROUP_FUNCTION();
         _func.FUNCTIONID = (int)grdvFunction.GetRowCellValue(i, colFunctionID);
         _func.GROUPID = _GroupID;
         _func.MODULEID = (int)grdvFunction.GetRowCellValue(i, colModuleID);
         _func.VALUE = (bool)grdvFunction.GetRowCellValue(i, colValue);
         _GroupFunction.Add(_func);
     }
     return _GroupFunction;
 }
Пример #2
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            string _GroupName = "";
            frmAddGroup frm = new frmAddGroup();
            frm.ShowDialog();
            if (frm.txtGroupName.Text.Trim() != "")
            {
                _GroupName = frm.txtGroupName.Text;
                busGroupFunction = new BUS.BUStblGROUP_FUNCTION();
                var _busGroup = new BUS.BUStblGROUP();
                var _dtoGroup = new DTO.DTOtblGROUP();
                busFunction = new BUS.BUStblFUNCTION();
                _dtoGroup.GROUPNAME = _GroupName;
                _busGroup.ThemtblGROUP(_dtoGroup);
                LoadGroup();
                int _groupID = _busGroup.LayTatCatblGROUP().OrderBy(a => a.GROUPID).Last().GROUPID;

                #region Them FUNCTION
                var lst = (List<DTO.DTOtblFUNCTION>)busFunction.LayTatCatblFUNCTION();
                for (int i = 0; i < lst.Count; i++)
                {
                    var _dtoGroupFunction = new DTO.DTOtblGROUP_FUNCTION();
                    _dtoGroupFunction.GROUPID = _groupID;
                    _dtoGroupFunction.MODULEID = lst[i].MODULEID;
                    _dtoGroupFunction.FUNCTIONID = lst[i].FUNCTIONID;
                    _dtoGroupFunction.VALUE = false;
                    busGroupFunction.ThemtblGROUP_FUNCTION(_dtoGroupFunction);
                }
                #endregion

                #region Them MODULE
                var lstModule = busModule.LayTatCatblMODULE().ToList();
                for (int i = 0; i < lstModule.Count; i++)
                {
                    var _dtoGroupModule = new DTO.DTOtblGROUPMODULE();
                    _dtoGroupModule.GROUPID = _groupID;
                    _dtoGroupModule.MODULEID = lstModule[i].MODULEID;
                    _dtoGroupModule.VALUE = false;
                    busGroupModule.ThemtblGROUPMODULE(_dtoGroupModule);
                }
                #endregion
            }
        }