Esempio n. 1
0
    protected void btnSaveNewADL_Click(object sender, EventArgs e)
    {
        foreach (DataListItem item in dlADLDetail.Items)
        {
            CheckBox chkSelect = (CheckBox)item.FindControl("chkSelect");
            if (chkSelect.Checked && chkSelect.ToolTip == "0") //newly selected
            {
                ADLHeaderDetail aDLHeaderDetail = new ADLHeaderDetail();

                aDLHeaderDetail.ADLDetailID = Int32.Parse(chkSelect.ValidationGroup);
                aDLHeaderDetail.ADLHeaderID = Int32.Parse(ddlADLHeader.SelectedValue);
                aDLHeaderDetail.ResidentID  = Int32.Parse(Request.QueryString["ResidentID"]);
                aDLHeaderDetail.ExtraField1 = "";
                aDLHeaderDetail.ExtraField2 = "";
                aDLHeaderDetail.ExtraField3 = "";
                aDLHeaderDetail.ExtraField4 = "";
                aDLHeaderDetail.ExtraField5 = "";
                int resutl = ADLHeaderDetailManager.InsertADLHeaderDetail(aDLHeaderDetail);
            }
            else
            if (!chkSelect.Checked && chkSelect.ToolTip != "0")     //Need to delete
            {
                ADLHeaderDetailManager.DeleteADLHeaderDetail(int.Parse(chkSelect.ToolTip));
            }
        }

        lblNewADLSaveMessage.Visible   = true;
        lblNewADLSaveMessage.ForeColor = System.Drawing.Color.Green;

        loadADLDetailStatus();
        loadGrid();
        ddlADLHeader_SelectedIndexChanged(this, new EventArgs());
    }
    protected void lbDelete_Click(object sender, EventArgs e)
    {
        LinkButton linkButton = new LinkButton();

        linkButton = (LinkButton)sender;
        bool result = ADLHeaderDetailManager.DeleteADLHeaderDetail(Convert.ToInt32(linkButton.CommandArgument));

        showADLHeaderDetailGrid();
    }