protected void btnAdd_Click(object sender, EventArgs e)
    {
        ADLDateTime aDLDateTime = new ADLDateTime();

        aDLDateTime.ADLDateTime = txtADLDateTime.Text;
        int resutl = ADLDateTimeManager.InsertADLDateTime(aDLDateTime);

        Response.Redirect("AdminADLDateTimeDisplay.aspx");
    }
Exemple #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;
            }
        }
    }