示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblMessage.Text = string.Empty;


            if (!IsPostBack)
            {
                int itemID;
                int registryId = 0;

                if (Request["itemId"] != null && int.TryParse(Request["itemId"].ToString(), out itemID))
                {
                    registryId = new RegistryDAO().GetRegistryIDByItem(itemID);
                }

                if (registryId == 0 && (Request["regid"] == null || !int.TryParse(Request["regid"].ToString(), out registryId)))
                {
                    return;
                }

                RegistryDAO dao = new RegistryDAO();

                if (!dao.IsInMainDepartment(registryId, (Guid)Membership.GetUser().ProviderUserKey))
                {
                    lblMessage.Text   = "Brak uprawnień do edycji/zapisu.";
                    lblSave.Visible   = false;
                    lblCancel.Visible = false;
                    fs.Visible        = false;
                    return;
                }

                using (IDataReader idr = dao.GetRegistryDefinitionByRegistryId(registryId))
                {
                    if (idr.Read())
                    {
                        Session["registryDefinition"] = idr["definicja"].ToString();
                    }
                }
            }
            generateFields();
        }