Exemple #1
0
        void cfvGoodsStatus_ServerValidate(object source, ServerValidateEventArgs args)
        {
            args.IsValid = false;

            eGoodsRefusedStatus status = (eGoodsRefusedStatus)Enum.Parse(typeof(eGoodsRefusedStatus), cboGoodsStatus.SelectedItem.Text.Replace(" ", ""));

            if (status == eGoodsRefusedStatus.Dumped || status == eGoodsRefusedStatus.Outstanding || status == eGoodsRefusedStatus.NotApplicable)
            {
                args.IsValid = true;
            }
        }
Exemple #2
0
        private void dgGoods_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView row = (DataRowView)e.Item.DataItem;

                ////////////////////////////////////////////////////////
                int refusalId                = (int)row["RefusalId"];
                eGoodsRefusedType type       = (eGoodsRefusedType)row["RefusalTypeId"];
                HtmlAnchor        hypRefusal = (HtmlAnchor)e.Item.FindControl("hypRefusal");
                if (type == eGoodsRefusedType.Shorts || type == eGoodsRefusedType.OverAndAccepted)
                {
                    hypRefusal.HRef      = "shortage.aspx?wiz=true&jobId=" + m_jobId.ToString() + "&instructionId=" + m_instructionId.ToString() + "&refusalId=" + refusalId + "&t=2" + "&csid=" + this.CookieSessionID;
                    hypRefusal.InnerText = refusalId.ToString();
                }
                else
                {
                    hypRefusal.HRef      = "refusal.aspx?wiz=true&jobId=" + m_jobId.ToString() + "&instructionId=" + m_instructionId.ToString() + "&refusalId=" + refusalId + "&t=1" + this.CookieSessionID;
                    hypRefusal.InnerText = refusalId.ToString();
                }

                ///////////////////////////////////////////////////////

                int storePointId = 0;
                if (row["StorePointId"] != DBNull.Value)
                {
                    storePointId = (int)row["StorePointId"];
                }
                int returnPointId = 0;
                if (row["ReturnPointId"] != DBNull.Value)
                {
                    returnPointId = (int)row["ReturnPointId"];
                }

                if (storePointId != 0 || returnPointId != 0)
                {
                    Facade.IPoint facPoint = new Facade.Point();
                    if (storePointId != 0)
                    {
                        Label lblStoreAt = (Label)e.Item.FindControl("lblStoreAt");

                        Entities.Point storePoint = facPoint.GetPointForPointId(storePointId);
                        lblStoreAt.Text = storePoint.OrganisationName + ", " + storePoint.PostTown.TownName;

                        Uri pointAddressUri = new Uri(Request.Url, Page.ResolveUrl("~/Point/GetPointAddressHtml.aspx"));
                        lblStoreAt.Attributes.Add("onMouseOver", "ShowPoint('" + pointAddressUri.ToString() + "', '" + storePointId.ToString() + "')");
                        lblStoreAt.Attributes.Add("onMouseOut", "HidePoint()");
                    }

                    if (returnPointId != 0)
                    {
                        Label lblReturnTo = (Label)e.Item.FindControl("lblReturnTo");

                        Entities.Point returnPoint = facPoint.GetPointForPointId(returnPointId);
                        lblReturnTo.Text = returnPoint.OrganisationName + ", " + returnPoint.PostTown.TownName;

                        Uri pointAddressUri = new Uri(Request.Url, Page.ResolveUrl("~/Point/GetPointAddressHtml.aspx"));
                        lblReturnTo.Attributes.Add("onMouseOver", "ShowPoint('" + pointAddressUri.ToString() + "', '" + returnPointId.ToString() + "')");
                        lblReturnTo.Attributes.Add("onMouseOut", "HidePoint()");
                    }
                }

                // Only allow goods of status Outstanding to be edited or deleted (unless this is a return job).
                if (row["RefusalStatusId"] != DBNull.Value)
                {
                    eGoodsRefusedStatus status = (eGoodsRefusedStatus)row["RefusalStatusId"];

                    //if ((status != eGoodsRefusedStatus.Outstanding && type != eGoodsRefusedType.Shorts && type != eGoodsRefusedType.OverAndAccepted) && m_job.JobType != eJobType.Return)
                    //{
                    //    // This has been commented out following a desire by Tony to be able to view the details - instead the Update Goods button is disabled.
                    //    //((Button) e.Item.Cells[8].Controls[0]).Enabled = false;
                    //    ((Button) e.Item.Cells[8].Controls[0]).Text = "View";
                    //    ((Button) e.Item.Cells[10].Controls[0]).Enabled = false;
                    //}
                }
            }
        }