Esempio n. 1
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();
            }
        }
Esempio 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();
            }
        }