Beispiel #1
0
        private void InitControls(bool ItemIsArchived)
        {
            ddlValid.DataSource     = Lookups.GetValidationValuesList();
            ddlValid.DataValueField = "Valid";
            ddlValid.DataTextField  = "ValidValueDescription";
            ddlValid.DataBind();

            var dtJust = Lookups.GetJustificationDefaultList();

            //ddlJustification.DataSource = dtJust;
            //ddlJustification.DataValueField = "Justification";
            //ddlJustification.DataTextField = "JustificationDescription";
            //ddlJustification.DataBind();

            rblJustification.DataSource     = dtJust;
            rblJustification.DataValueField = "Justification";
            rblJustification.DataTextField  = "JustificationDescription";
            rblJustification.DataBind();
            rblJustification.Items.RemoveAt(0);


            var arrDisplayAddOn  = "";
            var arrAddOnDescList = "";
            var sAddOnDesc       = "";

            foreach (DataRow dr in dtJust.Rows)
            {
                arrDisplayAddOn = arrDisplayAddOn + dr["DisplayAddOnField"].ToString() + "|";

                if (dr["AddOnDescription"].ToString().Trim() == "")
                {
                    sAddOnDesc = "None";
                }
                else
                {
                    sAddOnDesc = dr["AddOnDescription"].ToString();
                }
                arrAddOnDescList = arrAddOnDescList + sAddOnDesc + "|";
            }
            txtDisplayAddOn.Value  = arrDisplayAddOn;
            txtAddOnDescList.Value = arrAddOnDescList;

            if (ItemIsArchived)
            {
                dtCodeList = Lookups.GetActiveAndExpiredCodeList();
            }
            else
            {
                dtCodeList = Lookups.GetActiveCodeList();
            }
            ddlCode.DataSource     = dtCodeList;
            ddlCode.DataValueField = "Code";
            ddlCode.DataTextField  = "CodeDefinition";
            ddlCode.DataBind();

            var arrCodeList       = "";
            var arrCodeDescList   = "";
            var arrCodeValidation = "";

            foreach (DataRow dr in dtCodeList.Rows)
            {
                arrCodeList       = arrCodeList + dr["Code"].ToString() + "|";
                arrCodeDescList   = arrCodeDescList + dr["CodeDefinition"].ToString() + "|";
                arrCodeValidation = arrCodeValidation + dr["Valid"].ToString() + "|";
            }
            txtCodeList.Value       = arrCodeList;
            txtCodeDescList.Value   = arrCodeDescList;
            txtCodeValidation.Value = arrCodeValidation;

            //wire client events:
            btnSave.Attributes["onclick"]   = "javascript:return on_save();";
            btnCancel.Attributes["onclick"] = "javascript:window.location.href='OpenItemDetails.aspx?id=" + OItemID.ToString() + "&org=" + OrgCode + "&user="******"';";
            ddlValid.Attributes["onchange"] = "javascript:return on_valid_select(this);";
            ddlCode.Attributes["onchange"]  = "javascript:return on_code_select(this);";
            //ddlJustification.Attributes["onchange"] = "javascript:return on_justification_select(this);";
            var j_id = 0;

            foreach (ListItem li in rblJustification.Items)
            {
                j_id = j_id + 1;
                //j_id = rblJustification.SelectedItem.Value;
                //li.AddOnClick("javascript:rbl_display_Just_explanation('" + li.Value + "')");
                li.AddOnClick("javascript:rbl_display_Just_explanation('" + j_id + "')");
            }
            //rblJustification.SelectedItem.Value
        }
Beispiel #2
0
        void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                var str_error = "";

                var item_id      = Int32.Parse(txtItemID.Value);
                var line_num     = Int32.Parse(lblLineNum.Text);
                var ulo_org_code = lblOrgCode.Text;
                var comments     = txtComment.Text.Trim();
                var rwa          = txtRWA.Text.Trim();

                var valid = Int32.Parse(ddlValid.SelectedValue);
                if (valid == 0)
                {
                    str_error = "Please select 'Valid' value.<br/>";
                }

                var justification = Int32.Parse(rblJustification.SelectedValue);
                var just_addon    = "";
                var just_other    = "";
                if (justification == 6)
                {
                    just_other = txtJustOther.Text.Trim();
                }
                else
                {
                    just_addon = txtAddJustification.Text.Trim();
                }
                if (justification == 0)
                {
                    str_error = str_error + "Please select 'Justification' value.<br/>";
                }
                if (justification == 6 && just_other.Length == 0)
                {
                    rblJustification.SelectedIndex = 0;
                    str_error = str_error + "Please enter your text for 'Justification' value.<br/>";
                }

                var code         = ddlCode.SelectedValue;
                var code_comment = txtCodeComment.Text.Trim();
                if (code == "")
                {
                    str_error = str_error + "Please select 'Code' value.<br/>";
                }

                if (str_error.Length > 0)
                {
                    str_error = str_error + "This is required field.";
                    lblMsgValidation.Visible = true;
                    lblMsgValidation.Text    = str_error;
                    return;
                }

                LineNum.UpdateDetails(item_id, LoadID, line_num, ulo_org_code, valid, comments, justification, just_addon, just_other, code, code_comment, rwa, CurrentUserID);

                //for update Items grid view:
                ItemsDataView = null;

                //Response.Redirect("OpenItemDetails.aspx?id=" + item_id.ToString() + "&org=" + ulo_org_code + "&user="******"OpenItemDetails.aspx?id=" + OItemID.ToString() + "&org=" + OrgCode + "&user=" + CurrentItemReviewerID.ToString());
            }
            catch (Exception ex)
            {
                AddError(ex);
            }
            finally
            {
                //if (Errors.Count > 0)
                //    lblError.Text = GetErrors();
            }
        }