Exemplo n.º 1
0
        /// <summary>
        /// selects authority record for updation and show authority form
        /// </summary>
        private void BindUpdateAuthorityData()
        {
            int selectedrowindex = AuthorityControldetails_dgv.SelectedCells[0].RowIndex;

            AuthorityControlVo autUpdateVo = (AuthorityControlVo)AuthorityControldetails_dgv.Rows[selectedrowindex].DataBoundItem;

            AddAuthorityControlForm newAddForm = new AddAuthorityControlForm(CommonConstants.MODE_UPDATE, autUpdateVo);

            newAddForm.ShowDialog(this);

            if (newAddForm.IntSuccess > 0)
            {
                messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
                GridBind(FormConditionVo());
            }
            else if (newAddForm.IntSuccess == 0)
            {
                messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
                GridBind(FormConditionVo());
            }
        }
Exemplo n.º 2
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            AuthorityControlVo inVo = (AuthorityControlVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Delete From m_authority_control");
            sqlQuery.Append(" Where	");
            sqlQuery.Append(" authority_control_cd = :authcontcd ;");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("authcontcd", inVo.AuthorityControlCode);

            AuthorityControlVo outVo = new AuthorityControlVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates seacrh condition as per user inputs
        /// </summary>
        /// <returns>search condition</returns>
        private AuthorityControlVo FormConditionVo()
        {
            AuthorityControlVo inVo = new AuthorityControlVo();

            if (AuthorityControlCode_txt.Text != string.Empty)
            {
                inVo.AuthorityControlCode = AuthorityControlCode_txt.Text;
            }

            if (AuthorityControlName_txt.Text != string.Empty)
            {
                inVo.AuthorityControlName = AuthorityControlName_txt.Text;
            }

            if (ParentControl_cmb.SelectedIndex > -1)
            {
                inVo.ParentControlCode = ParentControl_cmb.SelectedValue.ToString();
            }

            //if (FormName_txt.Text != string.Empty)
            //{
            //    inVo.FormName = FormName_txt.Text;
            //}

            //if (AssemblyName_txt.Text != string.Empty)
            //{
            //    inVo.AssemblyName = AssemblyName_txt.Text;
            //}

            return(inVo);
        }
Exemplo n.º 4
0
        /// <summary>
        /// delete the selected record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Delete_btn_Click(object sender, EventArgs e)
        {
            int selectedrowindex = AuthorityControldetails_dgv.SelectedCells[0].RowIndex;

            DataGridViewRow selectedRow = AuthorityControldetails_dgv.Rows[selectedrowindex];

            messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colAuthorityControlCode"].Value.ToString());
            DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text);

            if (dialogResult == DialogResult.OK)
            {
                AuthorityControlVo inVo = new AuthorityControlVo
                {
                    AuthorityControlCode = selectedRow.Cells["colAuthorityControlCode"].Value.ToString(),
                };

                try
                {
                    AuthorityControlVo checkVo = CheckRelation(inVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00007", Properties.Resources.mmce00007, ROLE.ToString());
                        popUpMessage.Information(messageData, Text);
                        return;
                    }

                    AuthorityControlVo outVo = (AuthorityControlVo)base.InvokeCbm(new DeleteAuthorityControlMasterMntCbm(), inVo, false);

                    if (outVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);

                        GridBind(FormConditionVo());
                    }
                    else if (outVo.AffectedCount == 0)
                    {
                        messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);
                        GridBind(FormConditionVo());
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                }
            }
            else if (dialogResult == DialogResult.Cancel)
            {
                //do something else
            }
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            AuthorityControlVo inVo = (AuthorityControlVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Insert into m_authority_control");
            sqlQuery.Append(" ( ");
            sqlQuery.Append(" authority_control_cd, ");
            sqlQuery.Append(" authority_control_name, ");

            if (inVo.ParentControlCode != null)
            {
                sqlQuery.Append(" parent_control_cd, ");
            }
            sqlQuery.Append(" registration_user_cd, ");
            sqlQuery.Append(" registration_date_time ");
            sqlQuery.Append(" ) ");
            sqlQuery.Append("VALUES	");
            sqlQuery.Append(" ( ");
            sqlQuery.Append(" :authcontcd ,");
            sqlQuery.Append(" :authcontname ,");

            if (inVo.ParentControlCode != null)
            {
                sqlQuery.Append(" :parentcontcd ,");
            }
            sqlQuery.Append(" :registrationusercode ,");
            sqlQuery.Append(" now() ");
            sqlQuery.Append(" ); ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("authcontcd", inVo.AuthorityControlCode);
            sqlParameter.AddParameterString("authcontname", inVo.AuthorityControlName);

            if (inVo.ParentControlCode != null)
            {
                sqlParameter.AddParameterString("parentcontcd", inVo.ParentControlCode);
            }

            sqlParameter.AddParameterString("registrationusercode", inVo.RegistrationUserCode);
            //sqlParameter.AddParameterDateTime("registrationdatetime", inVo.RegistrationDateTime);

            AuthorityControlVo outVo = new AuthorityControlVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Exemplo n.º 6
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="pmode"></param>
        /// <param name="authorityItem"></param>
        public AddAuthorityControlForm(string pmode, AuthorityControlVo authorityItem = null)
        {
            InitializeComponent();

            mode       = pmode;
            updateData = authorityItem;


            if (string.Equals(mode, CommonConstants.MODE_UPDATE))
            {
                this.Text = UpdateText_lbl.Text;
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// For setting selected user record into respective controls(textbox and combobox) for update operation
        /// passing selected user data as parameter
        /// </summary>
        /// <param name="autInVo"></param>
        private void LoadAuthorityData(AuthorityControlVo autInVo)
        {
            if (autInVo != null)
            {
                this.AuthorityControlCode_txt.Text = autInVo.AuthorityControlCode;

                this.AuthorityControlName_txt.Text = autInVo.AuthorityControlName;

                this.ParentControl_cmb.SelectedValue = autInVo.ParentControlCode;

                //this.AssemblyName_txt.Text = dgvAuthority.Cells["colAssemblyName"].Value.ToString();

                //this.FormName_txt.Text = dgvAuthority.Cells["colFormName"].Value.ToString();
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// checks duplicate auth Code
        /// </summary>
        /// <param name="authVo"></param>
        /// <returns></returns>
        private AuthorityControlVo DuplicateCheck(AuthorityControlVo authVo)
        {
            AuthorityControlVo outVo = new AuthorityControlVo();

            try
            {
                outVo = (AuthorityControlVo)base.InvokeCbm(new CheckAuthorityControlMasterMntCbm(), authVo, false);
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            return(outVo);
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            AuthorityControlVo inVo = (AuthorityControlVo)arg;

            AuthorityControlVo outVo = new AuthorityControlVo();

            StringBuilder sqlQuery = new StringBuilder();

            //create SQL
            sqlQuery.Append("select count(rac.role_cd) as RoleCount from m_authority_control ac");
            sqlQuery.Append(" inner join m_role_authority_control rac on rac.authority_control_cd = ac.authority_control_cd");

            sqlQuery.Append(" where 1 = 1 ");

            if (inVo.AuthorityControlCode != null)
            {
                sqlQuery.Append(" and UPPER(ac.authority_control_cd) = UPPER(:authcontcd) ");
            }

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            if (inVo.AuthorityControlCode != null)
            {
                sqlParameter.AddParameterString("authcontcd", inVo.AuthorityControlCode);
            }

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            outVo.AffectedCount = 0;

            while (dataReader.Read())
            {
                outVo.AffectedCount = Convert.ToInt32("0" + dataReader["RoleCount"].ToString());
            }

            dataReader.Close();

            return(outVo);
        }
Exemplo n.º 10
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            AuthorityControlVo inVo = (AuthorityControlVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Update m_authority_control");
            sqlQuery.Append(" Set ");
            sqlQuery.Append(" authority_control_name = :authcontname ");

            //if (inVo.ParentControlCode != null)
            //{
            sqlQuery.Append(" , ");
            sqlQuery.Append(" parent_control_cd = :parentcontcd ");
            //}
            sqlQuery.Append(" Where	");
            sqlQuery.Append(" authority_control_cd = :authcontcd ;");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("authcontcd", inVo.AuthorityControlCode);
            sqlParameter.AddParameterString("authcontname", inVo.AuthorityControlName);

            if (inVo.ParentControlCode != null)
            {
                sqlParameter.AddParameterString("parentcontcd", inVo.ParentControlCode);
            }
            else
            {
                sqlParameter.AddParameter("parentcontcd", DBNull.Value);
            }

            AuthorityControlVo outVo = new AuthorityControlVo
            {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Exemplo n.º 11
0
        /// <summary>
        /// form datatable from vo
        /// </summary>
        private void FormDatatableFromVo()
        {
            parentControlDatatable = new DataTable();
            parentControlDatatable.Columns.Add("Code");
            parentControlDatatable.Columns.Add("Name");

            try
            {
                AuthorityControlVo authOutVo = (AuthorityControlVo)base.InvokeCbm(new GetAuthorityControlMasterMntCbm(), new AuthorityControlVo(), false);

                foreach (AuthorityControlVo auth in authOutVo.AuthorityControlListVo)
                {
                    parentControlDatatable.Rows.Add(auth.AuthorityControlCode, auth.AuthorityControlCode);
                }
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Fills all authority records to gridview control
        /// </summary>
        private void GridBind(AuthorityControlVo conditionInVo)
        {
            AuthorityControldetails_dgv.DataSource = null;

            try
            {
                AuthorityControlVo outVo = (AuthorityControlVo)base.InvokeCbm(new GetAuthorityControlMasterMntCbm(), conditionInVo, false);

                BindingList <List <UserVo> > userBind = new BindingList <List <UserVo> >();

                AuthorityControldetails_dgv.AutoGenerateColumns = false;

                BindingSource bindingSource1 = new BindingSource(outVo.AuthorityControlListVo, null);

                if (bindingSource1 != null && bindingSource1.Count > 0)
                {
                    AuthorityControldetails_dgv.DataSource = bindingSource1;
                }
                else
                {
                    messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                }
                AuthorityControldetails_dgv.ClearSelection();

                Update_btn.Enabled = false;

                Delete_btn.Enabled = false;
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Binds tree view with role
        /// </summary>
        /// <param name="userList"></param>
        private void PopulateTreeView(List <UserVo> userList)
        {
            RoleVo roleOutVo = new RoleVo();

            AuthorityControlVo authorityOutVo = new AuthorityControlVo();

            try
            {
                roleOutVo = (RoleVo)base.InvokeCbm(new GetRoleMasterMntCbm(), roleInVo, false);

                AuthorityControlVo authorityInVo = new AuthorityControlVo();

                authorityOutVo = (AuthorityControlVo)base.InvokeCbm(new GetAuthorityControlMasterMntCbm(), authorityInVo, false);
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                Logger.Error(exception.GetMessageData());
                return;
            }

            UserRoleDetails_tv.Nodes.Clear();

            TreeNode[] headerNode = new TreeNode[userList.Count];

            int i = 0;

            foreach (UserVo user in userList)
            {
                TreeNode child = new TreeNode
                {
                    Text = user.UserCode + ": " + user.UserName,
                    Tag  = user.UserCode
                };

                headerNode[i] = child;

                int childNodes = roleOutVo.RoleListVo.Count;

                TreeNode[] rootNodes = new TreeNode[childNodes];

                int node = 0;

                //UserRoleVo userRoleInVo = new UserRoleVo();

                UserRoleVo userRoleOutVo = new UserRoleVo();

                try
                {
                    userRoleOutVo = (UserRoleVo)base.InvokeCbm(new GetUserRoleMasterMntCbm(), new UserRoleVo(), false);
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    Logger.Error(exception.GetMessageData());
                    return;
                }

                foreach (RoleVo role in roleOutVo.RoleListVo)
                {
                    TreeNode rootChild = new TreeNode
                    {
                        Text = role.RoleCode + ": " + role.RoleName,
                        Tag  = role.RoleCode
                    };

                    List <UserRoleVo> userRoleList = userRoleOutVo.UserRoleListVo.Where(t => t.UserCode == child.Tag.ToString()).ToList();

                    foreach (UserRoleVo userRole in userRoleList)
                    {
                        if (userRole.RoleCode == rootChild.Tag.ToString())
                        {
                            rootChild.Checked = true;
                        }
                    }

                    rootNodes[node] = rootChild;

                    headerNode[i].Nodes.Add(rootNodes[node]);

                    RoleAuthorityControlVo roleAuthorityOutVo = new RoleAuthorityControlVo();

                    try
                    {
                        roleAuthorityOutVo = (RoleAuthorityControlVo)base.InvokeCbm(new GetRoleAuthorityControlMasterMntCbm(), new RoleAuthorityControlVo(), false);
                    }
                    catch (Framework.ApplicationException exception)
                    {
                        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                        Logger.Error(exception.GetMessageData());
                        return;
                    }

                    List <RoleAuthorityControlVo> roleAuthorityList = roleAuthorityOutVo.RoleAuthorityControlListVo.Where(t => t.RoleCode == rootChild.Tag.ToString()).ToList();

                    int authorityNodes = roleAuthorityList.Count;

                    TreeNode[] authorityRootNodes = new TreeNode[authorityNodes];

                    int subnode = 0;

                    foreach (RoleAuthorityControlVo roleAuth in roleAuthorityList)
                    {
                        AuthorityControlVo authVo = authorityOutVo.AuthorityControlListVo.Where(t => t.AuthorityControlCode == roleAuth.AuthorityControlCode).ToList().First();

                        TreeNode authorityChild = new TreeNode
                        {
                            Text = authVo.AuthorityControlCode + ": " + authVo.AuthorityControlName,
                            Tag  = authVo.AuthorityControlCode
                        };

                        authorityRootNodes[subnode] = authorityChild;

                        rootNodes[node].Nodes.Add(authorityRootNodes[subnode]);

                        subnode += 1;
                    }

                    node += 1;
                }

                UserRoleDetails_tv.Nodes.Add(headerNode[i]);

                i += 1;
            }
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            AuthorityControlVo inVo  = (AuthorityControlVo)arg;
            AuthorityControlVo outVo = new AuthorityControlVo();


            StringBuilder sqlQuery = new StringBuilder();

            //create SQL
            sqlQuery.Append("Select * from m_authority_control ");

            sqlQuery.Append(" where 1 = 1 ");

            if (inVo.AuthorityControlCode != null)
            {
                sqlQuery.Append(" and UPPER(authority_control_cd) like UPPER(:authcontcd) ");
            }

            if (inVo.AuthorityControlName != null)
            {
                sqlQuery.Append(" and UPPER(authority_control_name) like UPPER(:authcontname) ");
            }

            if (inVo.ParentControlCode != null)
            {
                sqlQuery.Append(" and parent_control_cd = :parentcontrol ");
            }

            if (inVo.AssemblyName != null)
            {
                sqlQuery.Append(" and UPPER(assembly_name) like UPPER(:assemblyname) ");
            }

            if (inVo.FormName != null)
            {
                sqlQuery.Append(" and UPPER(form_name) like UPPER(:formname) ");
            }

            sqlQuery.Append(" order by authority_control_cd");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            if (inVo.AuthorityControlCode != null)
            {
                sqlParameter.AddParameterString("authcontcd", inVo.AuthorityControlCode + "%");
            }

            if (inVo.AuthorityControlName != null)
            {
                sqlParameter.AddParameterString("authcontname", inVo.AuthorityControlName + "%");
            }

            if (inVo.AssemblyName != null)
            {
                sqlParameter.AddParameterString("assemblyname", inVo.AssemblyName + "%");
            }

            if (inVo.FormName != null)
            {
                sqlParameter.AddParameterString("formname", inVo.FormName + "%");
            }

            if (inVo.ParentControlCode != null)
            {
                sqlParameter.AddParameterString("parentcontrol", inVo.ParentControlCode);
            }

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            while (dataReader.Read())
            {
                AuthorityControlVo currOutVo = new AuthorityControlVo
                {
                    AuthorityControlCode = dataReader["authority_control_cd"].ToString(),
                    AuthorityControlName = dataReader["authority_control_name"].ToString(),
                    ParentControlCode    = dataReader["parent_control_cd"].ToString()
                };
                outVo.AuthorityControlListVo.Add(currOutVo);
            }

            dataReader.Close();

            return(outVo);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Binds data for excel export
        /// </summary>
        /// <returns></returns>
        private DataTable BindDataForExcel()
        {
            AuthorityControlVo authorityOutVo = null;
            UserVo             userOutVo      = null;
            UserRoleVo         userRoleOutVo  = null;

            try
            {
                authorityOutVo = (AuthorityControlVo)DefaultCbmInvoker.Invoke(new GetAuthorityControlMasterMntCbm(), new AuthorityControlVo());
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            try
            {
                userOutVo = (UserVo)DefaultCbmInvoker.Invoke(new GetUserMasterMntCbm(), new UserVo());
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            try
            {
                userRoleOutVo = (UserRoleVo)DefaultCbmInvoker.Invoke(new GetUserAuthorityCbm(), new UserRoleVo());
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            DataTable dt = new DataTable();
            DataRow   dr;

            dt.Columns.Add("AuthorityName");
            dt.Columns.Add("SubAuthorityName");
            dt.Columns.Add("FormName");

            if (userOutVo != null && userOutVo.UserListVo.Count > 0)
            {
                foreach (UserVo user in userOutVo.UserListVo)
                {
                    dt.Columns.Add(user.UserCode);
                }

                //dr = dt.NewRow();
                //dr["AuthorityName"] = "Authority Name";
                //dr["SubAuthorityName"] = "SubAuthority Name";
                //dr["FormName"] = "Form Name";

                //foreach (UserVo user in userOutVo.UserListVo)
                //{
                //    dr[user.UserCode] = user.UserName;
                //}

                //dt.Rows.Add(dr);
            }


            if (authorityOutVo != null && authorityOutVo.AuthorityControlListVo.Count > 0)
            {
                foreach (AuthorityControlVo authorityVo in authorityOutVo.AuthorityControlListVo)
                {
                    if (string.IsNullOrWhiteSpace(authorityVo.ParentControlCode))
                    {
                        dr = dt.NewRow();

                        dr["AuthorityName"] = authorityVo.AuthorityControlName;
                        dt.Rows.Add(dr);

                        List <AuthorityControlVo> controlList = authorityOutVo.AuthorityControlListVo.
                                                                Where(t => t.ParentControlCode == authorityVo.AuthorityControlCode).ToList();

                        if (controlList != null && controlList.Count > 0)
                        {
                            foreach (AuthorityControlVo controlVo in controlList)
                            {
                                dr = dt.NewRow();
                                dr["SubAuthorityName"] = controlVo.AuthorityControlName;
                                dt.Rows.Add(dr);

                                List <AuthorityControlVo> childControlList = authorityOutVo.AuthorityControlListVo.
                                                                             Where(t => t.ParentControlCode == controlVo.AuthorityControlCode).ToList();

                                if (childControlList != null && childControlList.Count > 0)
                                {
                                    foreach (AuthorityControlVo childControlVo in childControlList)
                                    {
                                        dr             = dt.NewRow();
                                        dr["FormName"] = childControlVo.AuthorityControlName;

                                        List <UserRoleVo> userRoleList = userRoleOutVo.UserRoleListVo.
                                                                         Where(t => t.AuthorityControlCode == childControlVo.AuthorityControlCode).ToList();

                                        foreach (UserRoleVo userRole in userRoleList)
                                        {
                                            dr[userRole.UserCode] = ((char)0x221A).ToString();
                                        }
                                        dt.Rows.Add(dr);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return(dt);
        }
Exemplo n.º 16
0
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            var sch = StringCheckHelper.GetInstance();

            AuthorityControlVo inVo = new AuthorityControlVo();

            if (CheckMandatory())
            {
                if (!sch.IsSmallAlphabetOrNumeric(AuthorityControlCode_txt.Text))
                {
                    messageData = new MessageData("mmce00006", Properties.Resources.mmce00006, AuthorityControlCode_lbl.Text);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    AuthorityControlCode_txt.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(AuthorityControlName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    AuthorityControlName_txt.Focus();
                    return;
                }
                inVo.AuthorityControlCode = AuthorityControlCode_txt.Text.Trim();

                inVo.AuthorityControlName = AuthorityControlName_txt.Text.Trim();

                if (ParentControl_cmb.SelectedIndex > -1)
                {
                    inVo.ParentControlCode = ParentControl_cmb.SelectedValue.ToString();
                }
                //inVo.AssemblyName = AssemblyName_txt.Text;

                //inVo.FormName = FormName_txt.Text;

                //inVo.RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

                inVo.RegistrationUserCode = UserData.GetUserData().UserCode;

                //inVo.FactoryCode = UserData.GetUserData().FactoryCode;

                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    AuthorityControlVo checkVo = DuplicateCheck(inVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, AuthorityControlCode_lbl.Text + " : " + AuthorityControlCode_txt.Text);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);

                        return;
                    }
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        AuthorityControlVo outVo = (AuthorityControlVo)base.InvokeCbm(new AddAuthorityControlMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        AuthorityControlVo outVo = (AuthorityControlVo)base.InvokeCbm(new UpdateAuthorityControlMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());

                    return;
                }

                if ((IntSuccess > 0) || (IntSuccess == 0))
                {
                    this.Close();
                }
            }
        }