コード例 #1
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        ADLHeaderDetailnDateTime aDLHeaderDetailnDateTime = new ADLHeaderDetailnDateTime();

        aDLHeaderDetailnDateTime.ADLDateTimeID     = Int32.Parse(ddlADLDateTime.SelectedValue);
        aDLHeaderDetailnDateTime.ADLHeaderDetailID = Int32.Parse(ddlADLHeaderDetail.SelectedValue);
        aDLHeaderDetailnDateTime.ADLHeaderDetailID = Int32.Parse(ddlADLHeaderDetail.SelectedValue);
        aDLHeaderDetailnDateTime.ExtraField1       = txtExtraField1.Text;
        aDLHeaderDetailnDateTime.ExtraField2       = txtExtraField2.Text;
        aDLHeaderDetailnDateTime.ExtraField3       = txtExtraField3.Text;
        aDLHeaderDetailnDateTime.ExtraField4       = txtExtraField4.Text;
        aDLHeaderDetailnDateTime.ExtraField5       = txtExtraField5.Text;
        int resutl = ADLHeaderDetailnDateTimeManager.InsertADLHeaderDetailnDateTime(aDLHeaderDetailnDateTime);

        Response.Redirect("AdminADLHeaderDetailnDateTimeDisplay.aspx");
    }
コード例 #2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        lblMsg.Visible = true;
        int ADLDateTimeID = 0;

        if (ddlExistingRecord.SelectedValue == "0")
        {
            ADLDateTime aDLDateTime = new ADLDateTime();

            aDLDateTime.ADLDateTimeValue = DateTime.Now;
            ADLDateTimeID = ADLDateTimeManager.InsertADLDateTime(aDLDateTime);
        }
        else
        {
            ADLDateTimeID = int.Parse(ddlExistingRecord.SelectedValue);
            ADLHeaderDetailnDateTimeManager.DeleteADLHeaderDetailnDateTimeByADLDateTimeID(ADLDateTimeID);
        }

        foreach (GridViewRow gvr in gvHeader.Rows)
        {
            HiddenField hfADLHeaderID = (HiddenField)gvr.FindControl("hfADLHeaderID");
            GridView    gvDetail      = (GridView)gvr.FindControl("gvDetail");

            foreach (GridViewRow gvrDetail in gvDetail.Rows)
            {
                HiddenField     hfADLHeaderDetialID  = (HiddenField)gvrDetail.FindControl("hfADLHeaderDetialID");
                TextBox         txtNewStatus         = (TextBox)gvrDetail.FindControl("txtNewStatus");
                TextBox         txtRemark            = (TextBox)gvrDetail.FindControl("txtRemark");
                DropDownList    ddlADLStatusInGrid   = (DropDownList)gvrDetail.FindControl("ddlADLStatusInGrid");
                RadioButtonList rbtnlADLStatusInGrid = (RadioButtonList)gvrDetail.FindControl("rbtnlADLStatusInGrid");

                //if (txtNewStatus.Text != "" || ddlADLStatusInGrid.SelectedValue != "0")
                try
                {
                    ADLHeaderDetailnDateTime aDLHeaderDetailnDateTime = new ADLHeaderDetailnDateTime();

                    aDLHeaderDetailnDateTime.ADLDateTimeID     = ADLDateTimeID;
                    aDLHeaderDetailnDateTime.ADLHeaderDetailID = Int32.Parse(hfADLHeaderDetialID.Value);
                    aDLHeaderDetailnDateTime.ExtraField1       = (txtNewStatus.Text == "" ? rbtnlADLStatusInGrid.SelectedValue : txtNewStatus.Text);
                    aDLHeaderDetailnDateTime.ExtraField2       = getLogin().ExtraField4;
                    aDLHeaderDetailnDateTime.ExtraField3       = txtRemark.Text;
                    aDLHeaderDetailnDateTime.ExtraField4       = getLogin().LoginID.ToString();
                    aDLHeaderDetailnDateTime.ExtraField5       = "";
                    int resutl = ADLHeaderDetailnDateTimeManager.InsertADLHeaderDetailnDateTime(aDLHeaderDetailnDateTime);
                }
                catch (Exception ex)
                { }
            }
        }


        loadMedicineTimenDateDate();

        foreach (GridViewRow gvr in gvHeader.Rows)
        {
            HiddenField hfADLHeaderID = (HiddenField)gvr.FindControl("hfADLHeaderID");
            GridView    gvDetail      = (GridView)gvr.FindControl("gvDetail");

            foreach (GridViewRow gvrDetail in gvDetail.Rows)
            {
                HiddenField     hfADLHeaderDetialID  = (HiddenField)gvrDetail.FindControl("hfADLHeaderDetialID");
                TextBox         txtNewStatus         = (TextBox)gvrDetail.FindControl("txtNewStatus");
                TextBox         txtRemark            = (TextBox)gvrDetail.FindControl("txtRemark");
                DropDownList    ddlADLStatusInGrid   = (DropDownList)gvrDetail.FindControl("ddlADLStatusInGrid");
                RadioButtonList rbtnlADLStatusInGrid = (RadioButtonList)gvrDetail.FindControl("rbtnlADLStatusInGrid");
                txtRemark.Text = "";
                rbtnlADLStatusInGrid.SelectedIndex = -1;
            }
        }
    }