Exemplo n.º 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
        }
Exemplo n.º 2
0
        protected override void PageLoadEvent(object sender, System.EventArgs e)
        {
            try
            {
                //lblError.Text = "";

                if (!IsPostBack)
                {
                    ApplicationAssert.CheckCondition(
                        (Request.QueryString["id"] != null && Request.QueryString["org"] != null && Request.QueryString["user"] != null),
                        "Missing parameters. Please reload the page.");

                    if (Request.QueryString["load"] != null && Request.QueryString["load"] != "")
                    {
                        var _load = 0;
                        if (Int32.TryParse(Request.QueryString["load"], out _load))
                        {
                            LoadID = _load;
                        }
                    }

                    OItemID = Int32.Parse(Request.QueryString["id"]);
                    OrgCode = Request.QueryString["org"];
                    CurrentItemReviewerID = Int32.Parse(Request.QueryString["user"]);

                    ItemLinesDataView = null;
                    txtItemID.Value   = OItemID.ToString();

                    var item = Item.GetOpenItem(OItemID, LoadID, OrgCode, CurrentItemReviewerID);
                    BlnForUpdate = Item.AvailableForUpdate(item.IsArchived, (item.ParentLoadID > 0), item.Organization, item.ReviewerUserID, User, CurrentUserOrganization, CurrentUserID);


                    LoadItemDetails(item);
                    LoadFeedbackTable(item);
                    BindGridData(item);

                    //txtComment.Attributes.Add(onchange", "javascript:onchange_comment();");
                    if (item.ReviewerUserID == 0)
                    {
                        //lblError.Text = lblError.Text + "<br>Item is not assigned yet, therefore can't be edited. If you have admin rights, please return to the Open Items list page and assign the item.";
                    }
                }



                var    cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "context");
                String callbackScript;
                callbackScript = "function CallServer(arg, context)" + "{ " + cbReference + ";}";
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true);

                WireClientEvents();
            }
            catch (Exception ex)
            {
                AddError(ex);
            }
            finally
            {
                //if (Errors.Count > 0)
                //    lblError.Text = GetErrors();
            }
        }
Exemplo n.º 3
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();
            }
        }
Exemplo n.º 4
0
        void gvLineNums_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    var ulo_org_code      = (string)((DataRowView)e.Row.DataItem)[12];
                    var line_num          = (int)((DataRowView)e.Row.DataItem)[1];
                    var line_organization = (string)((DataRowView)e.Row.DataItem)[17];
                    var reviewer_id       = (int)((DataRowView)e.Row.DataItem)[13];

                    var chk_reassign = (HtmlInputCheckBox)e.Row.FindControl("chk_reassign");
                    if (chk_reassign != null)
                    {
                        if (BlnForUpdate && LineNum.AvailableForUpdate(false, false, lblOrganization.Text, line_organization,
                                                                       LineNum.LineOnReassignRequest(OItemID, line_num, ulo_org_code, reviewer_id),
                                                                       reviewer_id, User, CurrentUserOrganization, CurrentUserID))
                        {
                            chk_reassign.AddOnClick("javascript:line_selected(this," + line_num.ToString() + ");");

                            btnReviewer.Disabled     = false;
                            btnReviewer.Visible      = true;
                            lblReassignLines.Visible = true;
                        }
                        else
                        {
                            chk_reassign.Disabled = true;
                        }
                    }

                    for (var i = 2; i < e.Row.Cells.Count; i++)
                    {
                        //if (LoadID != 11) // this needs to be corrected ??????
                        //{
                        //    e.Row.Cells[i].AddOnClick("javascript:get_line_details('LineNumDetails.aspx?id=" + OItemID.ToString() + "&num=" + line_num.ToString() + "');");
                        //}
                        //else
                        //{
                        //    e.Row.Cells[i].AddOnClick("javascript:get_line_details('OIBA53Review.aspx?id=" + OItemID.ToString() + "&num=" + line_num.ToString() + "');");
                        //}
                        e.Row.Cells[i].AddOnClick("javascript:get_line_details('LineNumDetails.aspx?id=" + OItemID.ToString() + "&num=" + line_num.ToString() + "');");
                    }
                }
            }
            catch (Exception ex) { AddError(ex); }
        }