示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Master.PageTitle = "Forms";
                if (CurrentManual != 0)
                {
                    Manual m = new Manual();
                    if (m.LoadByPrimaryKey(CurrentManual))
                        uiLabelModule.Text = m.Title;
                    else
                        Response.Redirect("Manuals.aspx");
                }
                else
                    Response.Redirect("Manuals.aspx");

                BindData();
            }

            MarkNotificationsAsRead();
        }
        protected void uiRadGridmanuals_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "EditManual")
            {
                Manual objData = new Manual();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                uiTextBoxTitle.Text = objData.Title;

                CurrentManual = objData;
                uiPanelEdit.Visible = true;
                uiPanelViewAll.Visible = false;
                uiPanelEditVersions.Visible = false;
                uiPanelVersions.Visible = true;
                uiLinkButtonEditForms.Visible = true;
                BindData_Versions();
            }

            else if (e.CommandName == "DeleteManual")
            {
                Manual objData = new Manual();
                objData.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString()));

                ManualVersion versions = new ManualVersion();
                versions.GetVersionsByManualID(objData.ManualID);
                versions.DeleteAll();
                versions.Save();

                ManualForm forms = new ManualForm();
                forms.GetFormsByManualID(objData.ManualID);
                for (int i = 0; i < forms.RowCount; i++)
                {
                    FromVersion formversions = new FromVersion();
                    formversions.GetVersionsByFormID(forms.ManualFormID);
                    formversions.MarkAsDeleted();
                    formversions.Save();
                }

                forms.DeleteAll();
                forms.Save();

                objData.MarkAsDeleted();
                objData.Save();
                BindData();
            }
        }