Beispiel #1
0
        private long SaveRecord()
        {
            long id = Convert.ToInt64(lblUID.Text);

            AccessRights        clsAccessRights = new AccessRights();
            AccessRightsDetails clsDetails;

            foreach (DataListItem itemAccessCategory in lstAccessCategory.Items)
            {
                DataList lstItem = (DataList)itemAccessCategory.FindControl("lstItem");
                foreach (DataListItem item in lstItem.Items)
                {
                    HtmlInputCheckBox chkList  = (HtmlInputCheckBox)item.FindControl("chkList");
                    HtmlInputCheckBox chkRead  = (HtmlInputCheckBox)item.FindControl("chkRead");
                    HtmlInputCheckBox chkWrite = (HtmlInputCheckBox)item.FindControl("chkWrite");

                    clsDetails            = new AccessRightsDetails();
                    clsDetails.UID        = id;
                    clsDetails.TranTypeID = Convert.ToInt16(chkList.Value);
                    clsDetails.Read       = chkRead.Checked;
                    clsDetails.Write      = chkWrite.Checked;

                    clsAccessRights.Modify(clsDetails);
                }
            }
            clsAccessRights.CommitAndDispose();

            return(id);
        }
Beispiel #2
0
        private void ApplyToUsers()
        {
            Int32 intGroupID = Convert.ToInt32(lblGroupID.Text);

            AccessRightsDetails clsDetails;
            AccessUser          clsAccessUser = new AccessUser();
            DataTable           dt            = clsAccessUser.ListAsDataTable(AccessGroupTypes.All, string.Empty, 0, intGroupID);

            AccessRights clsAccessRights = new AccessRights(clsAccessUser.Connection, clsAccessUser.Transaction);

            foreach (DataRow dr in dt.Rows)
            {
                long lngUID = long.Parse(dr["UID"].ToString());

                foreach (DataListItem itemAccessCategory in lstAccessCategory.Items)
                {
                    DataList lstItem = (DataList)itemAccessCategory.FindControl("lstItem");
                    foreach (DataListItem item in lstItem.Items)
                    {
                        HtmlInputCheckBox chkList  = (HtmlInputCheckBox)item.FindControl("chkList");
                        HtmlInputCheckBox chkRead  = (HtmlInputCheckBox)item.FindControl("chkRead");
                        HtmlInputCheckBox chkWrite = (HtmlInputCheckBox)item.FindControl("chkWrite");

                        clsDetails            = new AccessRightsDetails();
                        clsDetails.UID        = lngUID;
                        clsDetails.TranTypeID = Convert.ToInt16(chkList.Value);
                        clsDetails.Read       = chkRead.Checked;
                        clsDetails.Write      = chkWrite.Checked;

                        clsAccessRights.Modify(clsDetails);
                    }
                }
            }

            clsAccessUser.CommitAndDispose();
        }