Example #1
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); }
        }
Example #2
0
        protected override void PageLoadEvent(object sender, System.EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    ApplicationAssert.CheckCondition((Request.QueryString["id"] != null && Request.QueryString["num"] != null), "Missing parameters. Please reload the page.");

                    OItemID      = Int32.Parse(Request.QueryString["id"]);
                    base.LineNum = Int32.Parse(Request.QueryString["num"]);

                    if (LoadID == 0)
                    {
                        if (Request.QueryString["load_id"] != null)
                        {
                            LoadID = Int32.Parse(Request.QueryString["load_id"]);
                        }
                        else
                        {
                            LoadID = 0;
                        }
                    }

                    var line_item = LineNum.GetLineNum(OItemID, base.LineNum);
                    if (LoadID == 0 || OItemID == 0)
                    {
                        throw new Exception("Your session has beed expired. Please logout from the application and login again.");
                    }
                    var open_item = Item.GetOpenItem(OItemID, LoadID, line_item.ULOOrgCode, line_item.ReviewerUserID);

                    InitControls(open_item.IsArchived);

                    bool bln_update;
                    bool line_on_reassign;
                    line_on_reassign = LineNum.LineOnReassignRequest(OItemID, base.LineNum, line_item.ULOOrgCode, line_item.ReviewerUserID);
                    if (line_on_reassign)
                    {
                        lblHeaderLabel.Text = lblHeaderLabel.Text + " unavailable for update, waiting for reassignment.";
                    }
                    else if (open_item.Organization != line_item.Organization)
                    {
                        lblHeaderLabel.Text = lblHeaderLabel.Text + " (belong " + line_item.Organization + ")"; //?
                    }
                    bln_update = LineNum.AvailableForUpdate(open_item.IsArchived, (open_item.ParentLoadID > 0),
                                                            open_item.Organization, line_item.Organization, line_on_reassign, open_item.ReviewerUserID, User, CurrentUserOrganization, CurrentUserID);

                    //if (OrgCode != line_item.ULOOrgCode)
                    //     bln_update = false;
                    //else
                    //    bln_update = Item.AvailableForUpdate(open_item.IsArchived, (open_item.ParentLoadID > 0), open_item.Organization, open_item.ReviewerUserID, User, CurrentUserOrganization, CurrentUserID);

                    if (Errors.Count == 0)
                    {
                        LoadOpenItemDetails(open_item, bln_update);
                        LoadLineNumDetails(line_item, bln_update, open_item.IsArchived);
                    }


                    if (!bln_update)
                    {
                        btnSave.Enabled      = false;
                        btnSave.Visible      = false;
                        ctrlContacts.Enabled = false;
                        ctrlAttachments.ShowEmailIcon(false, txtReviewerEmail.Value, lblDocNumber.Text);
                        ctrlAttachments.ShowAddAttBtn(false);
                    }
                    else
                    {
                        ctrlAttachments.ShowAddAttBtn(true);
                        if (lblValid.Text.ToLower().Trim() == "valid" || lblValid.Text.ToLower().Trim() == "invalid")
                        {
                            ctrlAttachments.ShowEmailIcon(true, txtReviewerEmail.Value, lblDocNumber.Text);
                        }
                        else
                        {
                            ctrlAttachments.ShowEmailIcon(false, txtReviewerEmail.Value, lblDocNumber.Text);
                        }
                        ctrlContacts.Enabled = true;
                    }

                    if (open_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.";
                    }
                }
            }
            catch (Exception ex)
            {
                AddError(ex);
            }
            finally
            {
                //if (Errors.Count > 0)
                //    lblError.Text = GetErrors();
            }
        }