예제 #1
0
        private void OnDrop(object sender, Telerik.Windows.DragDrop.DragEventArgs e)
        {
            EstimateDetails draggedItem = (EstimateDetails)DragDropPayloadManager.GetDataFromObject(e.Data, "DraggedData");
            var             details     = DragDropPayloadManager.GetDataFromObject(e.Data, "DropDetails") as DropIndicationDetails;
            var             currentRow  = e.OriginalSource as GridViewRow ?? (e.OriginalSource as FrameworkElement).ParentOfType <GridViewRow>();
            EstimateDetails targetItem  = currentRow != null ? (EstimateDetails)currentRow.Item : null;

            if (details == null || draggedItem == null || currentRow == null || targetItem == null)
            {
                return;
            }

            var draggedItemAreaId = draggedItem.NonstandardCategoryID > 0 ? draggedItem.NonstandardCategoryID : draggedItem.AreaId;
            var targetItemAreaId  = targetItem.NonstandardCategoryID > 0 ? targetItem.NonstandardCategoryID : targetItem.AreaId;

            if ((draggedItemAreaId == targetItemAreaId) &&
                (draggedItem.EstimateRevisionDetailsId != targetItem.EstimateRevisionDetailsId))
            {
                var collection = (sender as RadGridView).ItemsSource as IList;
                collection.Remove(draggedItem);
                collection.Insert((sender as RadGridView).Items.IndexOf(currentRow.Item), draggedItem);

                RetailSystemClient mrsClient = new RetailSystemClient();
                mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl());
                mrsClient.MoveEstimateDetailItemCompleted += new EventHandler <MoveEstimateDetailItemCompletedEventArgs>(mrsClient_MoveEstimateDetailItemCompleted);
                mrsClient.MoveEstimateDetailItemAsync(draggedItem.EstimateRevisionDetailsId, targetItem.EstimateRevisionDetailsId, (App.Current as App).CurrentUserId);
            }
            else
            {
            }

            e.Handled = true;
        }
예제 #2
0
        private void HyperlinkButton_AnswerClick(object sender, RoutedEventArgs e)
        {
            RadWindow              win = new RadWindow();
            EstimateDetails        pag = new EstimateDetails();
            Grid                   gr  = (Grid)((HyperlinkButton)e.OriginalSource).Parent;
            ValidationErrorMessage er  = ((GridViewCell)(gr.Parent)).ParentRow.DataContext as ValidationErrorMessage;

            mrsClient = new RetailSystemClient();
            mrsClient.Endpoint.Address     = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl());
            mrsClient.GetPagByIDCompleted += delegate(object o, GetPagByIDCompletedEventArgs es)
            {
                if (es.Error == null)
                {
                    pag = es.Result;
                    AppOptionFromTree acceptDlg = new AppOptionFromTree(pag, "STUDIOM_ANSWER", 0);
                    win.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen;
                    win.Header  = "Add Option Window";
                    win.Content = acceptDlg;
                    win.Closed += new EventHandler <WindowClosedEventArgs>(win_AddOptionClosed);
                    win.ShowDialog();
                }
                else
                {
                    ExceptionHandler.PopUpErrorMessage(es.Error, "GetPagByIDCompleted");
                }
            };
            mrsClient.GetPagByIDAsync(estimaterevisionid, er.HomeDisplayOptionId);
        }
예제 #3
0
        //public void UpdateNoteTemplateItem(string templateid, string productareagroupid, decimal quantity, decimal price, string extradescription, int userid)
        //{
        //    mrsClient = new RetailSystemClient();
        //    mrsClient.UpdateNotesTemplateItemCompleted += new EventHandler<UpdateNotesTemplateItemCompletedEventArgs>(mrsClient_UpdateNotesTemplateItemCompleted);
        //    mrsClient.UpdateNotesTemplateItemAsync(templateid,productareagroupid, quantity, price, extradescription, userid);
        //    mrsClient = null;
        //}
        public void UpdateNoteTemplateItem(EstimateDetails pag)
        {
            mrsClient = new RetailSystemClient();
            mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl());

            mrsClient.UpdateNotesTemplateItemCompleted += new EventHandler <UpdateNotesTemplateItemCompletedEventArgs>(mrsClient_UpdateNotesTemplateItemCompleted);
            mrsClient.UpdateNotesTemplateItemAsync(pag.TemplateID, pag.ProductAreaGroupID.ToString(), pag.Quantity, pag.Price, pag.ExtraDescription, pag.InternalDescription, pag.AdditionalNotes, userid, pag.UseDefaultQuantity);
            mrsClient = null;
        }
예제 #4
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            RadButton       btn  = (RadButton)sender;
            EstimateDetails item = (EstimateDetails)btn.DataContext;

            ((NotesTemplateViewModel)LayoutRoot.DataContext).UpdateNoteTemplateItem(item);
            item.ModifiedOn = DateTime.Now.ToString("dd/MM/yyyy");
            item.ModifiedBy = (App.Current as App).CurrentUserFullName;
            CloseDetailsPanel(sender, e);
        }
예제 #5
0
 public void RefreshTemplateByID(EstimateDetails pag)
 {
     foreach (var temp in ManagerNotesTemplate)
     {
         if (temp.TemplateID.ToString() == pag.TemplateID)
         {
             temp.NoteTemplateItem.Remove(pag);
             break;
         }
     }
 }
예제 #6
0
        public void RemoveNoteTemplateItemFromTemplate(EstimateDetails pag)
        {
            mrsClient = new RetailSystemClient();
            mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl());

            mrsClient.RemoveItemFromNotesTemplateCompleted += delegate(object o, RemoveItemFromNotesTemplateCompletedEventArgs es)
            {
                bool result = es.Result;
            };
            mrsClient.RemoveItemFromNotesTemplateAsync(pag.TemplateID, pag.ProductAreaGroupID.ToString(), userid);
            mrsClient = null;
            RefreshTemplateByID(pag);
        }
예제 #7
0
        public ReplaceEstimateItem(int revisionid, EstimateDetails edSource)
        {
            estimaterevisionid = revisionid;
            estimateSource     = edSource;

            InitializeComponent();

            if (LayoutRoot != null)
            {
                ((ReplaceEstimateItemViewModel)LayoutRoot.DataContext).IsBusyOptionTree = true;
            }
            textBlockProductID.Text            = edSource.ProductId.ToString();
            radioButtonSameAreaGroup.IsChecked = true;
        }
예제 #8
0
        private void btnAddOption_Click(object sender, RoutedEventArgs e)
        {
            RadWindow       win = new RadWindow();
            EstimateDetails pag = ((GridViewCell)((HyperlinkButton)e.OriginalSource).Parent).ParentRow.DataContext as EstimateDetails;
            //if (!pag.AreaName.ToUpper().Contains("NON STANDARD"))
            //{
            ReplaceAppOptionFromTree acceptDlg = new ReplaceAppOptionFromTree(estimateSource, pag, "OPTIONTREE", 3);

            win.WindowStartupLocation = Telerik.Windows.Controls.WindowStartupLocation.CenterScreen;
            win.Header  = "Replace Product Window";
            win.Content = acceptDlg;
            win.Closed += new EventHandler <WindowClosedEventArgs>(win_AddOptionClosed);
            win.ShowDialog();
        }
예제 #9
0
        public RemoveMasterPromotionItemWindow(EstimateDetails ed)
        {
            InitializeComponent();

            BusyIndicator1.IsBusy = true;

            pag = ed;

            _mrsClient = new RetailSystemClient();
            _mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl());

            _mrsClient.GetExistingPromotionProductByMasterPromotionRevisionDetailsIDCompleted += new EventHandler <GetExistingPromotionProductByMasterPromotionRevisionDetailsIDCompletedEventArgs>(mrsClient_GetExistingPromotionProductByMasterPromotionRevisionDetailsIDCompleted);
            _mrsClient.GetExistingPromotionProductByMasterPromotionRevisionDetailsIDAsync(ed.EstimateRevisionDetailsId.ToString());
        }
예제 #10
0
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            string productDetails = txtProducts.Text;

            string[] items = System.Text.RegularExpressions.Regex.Split(productDetails, "<<PRODUCT CODE:");

            if (items.Length > 1)
            {
                BusyIndicator1.IsBusy = true;

                ObservableCollection <EstimateDetails> products = new ObservableCollection <EstimateDetails>();

                //Start from 1 as item 0 is always blank
                for (int i = 1; i < items.Length; i++)
                {
                    string itemDesc = items[i];
                    int    revDetailsIdStartIndex    = itemDesc.IndexOf("-ID:") + 4;
                    int    revDetailsIdEndIndex      = itemDesc.IndexOf(">>", revDetailsIdStartIndex);
                    int    standardDescStartIndex    = itemDesc.IndexOf("<<STANDARD DESCRIPTION>>") + 24;
                    int    standardDescEndIndex      = itemDesc.IndexOf("<<ADDITIONAL NOTES>>");
                    int    additionalNotesStartIndex = itemDesc.IndexOf("<<ADDITIONAL NOTES>>") + 20;
                    int    additionalNotesEndIndex   = itemDesc.IndexOf("<<EXTRA DESCRIPTION>>");
                    int    extraDescStartIndex       = itemDesc.IndexOf("<<EXTRA DESCRIPTION>>") + 21;
                    //int extraDescEndIndex = itemDesc.IndexOf("<<INTERNAL NOTES>>");
                    //int intDescStartIndex = itemDesc.IndexOf("<<INTERNAL NOTES>>") + 24;

                    string revisionDetailsId = itemDesc.Substring(revDetailsIdStartIndex, revDetailsIdEndIndex - revDetailsIdStartIndex);
                    string standardDesc      = itemDesc.Substring(standardDescStartIndex, standardDescEndIndex - standardDescStartIndex);
                    string additionalNotes   = itemDesc.Substring(additionalNotesStartIndex, additionalNotesEndIndex - additionalNotesStartIndex);
                    string extraDesc         = itemDesc.Substring(extraDescStartIndex);
                    //string extraDesc = itemDesc.Substring(extraDescStartIndex, extraDescEndIndex - extraDescStartIndex);
                    //string intDesc = itemDesc.Substring(intDescStartIndex);

                    EstimateDetails product = new EstimateDetails();
                    product.EstimateRevisionDetailsId = Convert.ToInt32(revisionDetailsId);
                    product.ProductDescription        = standardDesc.Trim();
                    product.AdditionalNotes           = additionalNotes.Trim();
                    product.ExtraDescription          = extraDesc.Trim();
                    //product.InternalDescription = intDesc.Trim();

                    products.Add(product);
                }

                RetailSystemClient mrsClient = new RetailSystemClient();
                mrsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress(Internal.Utilities.GetMetriconRetailSystemWcfClientEndpointUrl());
                mrsClient.UpdateEstimateDetailsDescriptionCompleted += new EventHandler <System.ComponentModel.AsyncCompletedEventArgs>(mrsClient_UpdateEstimateDetailsDescriptionCompleted);
                mrsClient.UpdateEstimateDetailsDescriptionAsync(products, (App.Current as App).CurrentUserId);
            }
        }
예제 #11
0
 public override Style SelectStyle(object item, DependencyObject container)
 {
     if (item is EstimateDetails)
     {
         EstimateDetails pag = item as EstimateDetails;
         if (pag.HomeDisplayOptionId == 0)
         {
             return(NotAvailableStyle);
         }
         else
         {
             return(null);
         }
     }
     return(null);
 }
예제 #12
0
        void win_AddOptionClosed(object sender, WindowClosedEventArgs e)
        {
            RadWindow      dlg = (RadWindow)sender;
            ParameterClass p   = (ParameterClass)dlg.DataContext;

            if (p != null)
            {
                EstimateDetails pag = p.SelectedPAG;

                bool?result = dlg.DialogResult;
                if (result.HasValue && result.Value)
                {
                    if (p.SelectedItemID != "" || p.SelectedStandardInclusionID != "")
                    {
                        //((EstimateViewModel)LayoutRoot.DataContext).SaveSelectedOptionsFromTreeToEstimate(p.SelectedItemID,
                        //    p.SelectedStandardInclusionID,
                        //    EstimateList.SelectedEstimateRevisionId.ToString(),
                        //    p.StudioMQANDA,
                        //    (App.Current as App).CurrentUserId.ToString(),
                        //    p.SelectedDerivedCosts,
                        //    p.SelectedCostExcGSTs,
                        //    p.SelectedQuantities,
                        //    p.SelectedPrices,
                        //    p.SelectedIsAccepteds,
                        //    p.SelectedAreaIds,
                        //    p.SelectedGroupIds,
                        //    p.SelectedPriceDisplayCodeIds,
                        //    p.SelectedIsSiteWorks,
                        //    p.SelectedProductDescriptions,
                        //    p.SelectedAdditionalNotes,
                        //    p.SelectedExtraDescriptions,
                        //    p.SelectedInternalDescriptions);

                        RadWindow window = this.ParentOfType <RadWindow>();
                        if (window != null)
                        {
                            window.DataContext  = p;
                            window.DialogResult = true;
                            window.Close();
                        }
                    }
                }
            }
        }
예제 #13
0
        void win_AddOptionClosed(object sender, WindowClosedEventArgs e)
        {
            RadWindow      dlg = (RadWindow)sender;
            ParameterClass p   = (ParameterClass)dlg.DataContext;

            if (p != null)
            {
                EstimateDetails pag = p.SelectedPAG;

                bool?result = dlg.DialogResult;
                if (result.HasValue && result.Value)
                {
                    if (p.SelectedItemID != "" || p.SelectedStandardInclusionID != "")
                    {
                        SaveData(p, p.Action);
                    }
                }
            }
        }
예제 #14
0
 private void RadGridView2_CellLoaded(object sender, CellEventArgs e)
 {
     if (e.Cell is GridViewCell)
     {
         GridViewColumn col = e.Cell.Column;
         if (col.UniqueName == "naColumn")
         {
             EstimateDetails item = (EstimateDetails)e.Cell.DataContext;
             if (item.HomeDisplayOptionId == 0)
             {
                 Image img = (Image)e.Cell.Content;
                 if (img != null)
                 {
                     img.Visibility = System.Windows.Visibility.Visible;
                 }
             }
         }
     }
 }
예제 #15
0
        private void chkdefaultqty_Click(object sender, RoutedEventArgs e)
        {
            CheckBox ck = (CheckBox)e.OriginalSource;

            EstimateDetails ed     = (EstimateDetails)ck.DataContext;
            StackPanel      panel  = ck.ParentOfType <StackPanel>();
            TextBox         txtqty = (TextBox)panel.FindName("txtQuantity");

            if ((bool)ck.IsChecked)
            {
                txtqty.IsEnabled = false;
                txtqty.Text      = "";
                ed.Quantity      = 0;
            }
            else
            {
                txtqty.IsEnabled = true;
                txtqty.Text      = ed.Quantity.ToString();
            }
        }
예제 #16
0
        public EstimateDetailsTest()
        {
            //Arrange
            estimateData = new EstimateData();
            Mock <JKMServices.BLL.Interface.IResourceManagerFactory> mockBllJKMResource = new Mock <JKMServices.BLL.Interface.IResourceManagerFactory>();

            mockCRMCustomerDetails = new Mock <JKMServices.DAL.CRM.ICustomerDetails>();
            mockCRMEstimateDetails = new Mock <JKMServices.DAL.CRM.IEstimateDetails>();
            Mock <JKMServices.DAL.CRM.IMoveDetails>          mockCRMMoveDetails = new Mock <JKMServices.DAL.CRM.IMoveDetails>();
            Mock <JKMServices.BLL.EmailEngine.IEmailHandler> mockEmailEngine    = new Mock <JKMServices.BLL.EmailEngine.IEmailHandler>();
            Mock <Utility.Logger.ILogger>      mockLogger             = new Mock <Utility.Logger.ILogger>();
            Mock <Utility.ISharepointConsumer> mockSharepointConsumer = new Mock <Utility.ISharepointConsumer>();

            estimateDetails = new EstimateDetails(mockCRMCustomerDetails.Object,
                                                  mockCRMEstimateDetails.Object,
                                                  mockCRMMoveDetails.Object,
                                                  mockEmailEngine.Object,
                                                  mockLogger.Object,
                                                  mockBllJKMResource.Object,
                                                  mockSharepointConsumer.Object);
        }
예제 #17
0
        private void detailgrid_RowDetailsVisibilityChanged(object sender, GridViewRowDetailsEventArgs e)
        {
            if (e.Visibility == Visibility.Visible)
            {
                GridViewRow row = e.Row as GridViewRow;

                if (row != null)
                {
                    EstimateDetails ed    = row.DataContext as EstimateDetails;
                    StackPanel      panel = (StackPanel)e.DetailsElement;

                    TextBox txtqty = (TextBox)panel.FindName("txtQuantity");
                    if (ed.UseDefaultQuantity)
                    {
                        txtqty.IsEnabled = false;
                    }
                    else
                    {
                        txtqty.IsEnabled = true;
                    }
                }
            }
        }
예제 #18
0
 /// <summary>
 /// Returns a pricing estimate for a job, session or other activity that involves Data Services.
 /// </summary>
 /// <param name="estimateDetails">The details of the job, session or other activity for which the estimate is requested.</param>
 public EstimatePrice(EstimateDetails estimateDetails)
 {
     Content = estimateDetails;
 }
예제 #19
0
 private void HyperlinkButton_RemoveItems_Click(object sender, RoutedEventArgs e)
 {
     pag = ((GridViewCell)((HyperlinkButton)e.OriginalSource).Parent).ParentRow.DataContext as EstimateDetails;
     RadWindow.Confirm("Are you sure you want to remove this item from tempale?", new EventHandler <WindowClosedEventArgs>(item_confirm_close));
 }
예제 #20
0
        void mrsClient_GetOptionTreeAsOptionTreeProductsForEstimateItemReplaceCompleted(object sender, GetOptionTreeAsOptionTreeProductsForEstimateItemReplaceCompletedEventArgs e)
        {
            if (e.Error == null)
            {
                ((ReplaceEstimateItemViewModel)LayoutRoot.DataContext).IsBusyOptionTree = true;
                _optiontreeSource = new List <EstimateDetails>();

                List <EstimateDetails> optiontreeTemp = new List <EstimateDetails>();
                int index = 0;
                foreach (OptionTreeProducts p in e.Result)
                {
                    //if (++index > 1000)
                    //    break;
                    EstimateDetails ed = new EstimateDetails();
                    ed.ProductDescription = p.D;
                    ed.ProductName        = p.N;
                    ed.Price               = p.P;
                    ed.AreaName            = p.A;
                    ed.GroupName           = p.G;
                    ed.AreaId              = p.AI;
                    ed.GroupId             = p.GI;
                    ed.StandardOption      = p.S;
                    ed.Quantity            = p.Q;
                    ed.HomeDisplayOptionId = p.I;
                    ed.SiteWorkItem        = p.W;
                    ed.StudioMSortOrder    = p.O;
                    ed.Uom = p.U;
                    //ed.CostExcGST = p.CG;
                    //ed.DerivedCost = p.DC;

                    if (p.M == 0) // Not Studio M
                    {
                        ed.StudioMProduct = false;
                    }
                    else if (p.M == 1) // Studio M Manadatory
                    {
                        ed.StudioMProduct  = true;
                        ed.StudioMIcon     = "./images/color_swatch.png";
                        ed.StudioMTooltips = "Studio M Product. Question not answered yet.";
                    }
                    else if (p.M == 2) // Studio M No Question
                    {
                        ed.StudioMProduct  = true;
                        ed.StudioMIcon     = "./images/green_box.png";
                        ed.StudioMTooltips = "There are no studio M questions.";
                    }
                    else if (p.M == 3) // Studio M Non-Mandatory
                    {
                        ed.StudioMProduct  = true;
                        ed.StudioMIcon     = "./images/color_swatch_gray.png";
                        ed.StudioMTooltips = "Studio M Product. Answers are not mandatory.";
                    }

                    if (p.S)
                    {
                        ed.SOSI         = "./images/upgrade.png";
                        ed.SOSIToolTips = "Upgrade Option.";
                    }

                    //if (p.DC)
                    //{
                    //    ed.DerivedCostIcon = "./images/link.png";
                    //    ed.DerivedCostTooltips = "Derived Cost.";
                    //}
                    //else
                    //{
                    //    ed.DerivedCostIcon = "./images/spacer.gif";
                    //    ed.DerivedCostTooltips = "";
                    //}
                    optiontreeTemp.Add(ed);
                }

                //optiontreeTemp[0].Changed = true;
                // Copy full option tree to re-use later
                _optiontreeSource.AddRange(optiontreeTemp);

                //PAGGrid.ItemsSource = _optiontreeSource;

                radGridViewSelected.ItemsSource = _optiontreeSource;
                if (!optionTreeWorker.IsBusy)
                {
                    // Build Option Tree in another thread
                    optionTreeWorker.RunWorkerAsync();
                }
            }
            else
            {
                ExceptionHandler.PopUpErrorMessage(e.Error, "GetOptionTreeAsOptionTreeProductsCompleted");
            }


            // Remove Event Handler
            mrsClient.GetOptionTreeAsOptionTreeProductsForEstimateItemReplaceCompleted -= new EventHandler <GetOptionTreeAsOptionTreeProductsForEstimateItemReplaceCompletedEventArgs>(mrsClient_GetOptionTreeAsOptionTreeProductsForEstimateItemReplaceCompleted);

            ((ReplaceEstimateItemViewModel)LayoutRoot.DataContext).IsBusyOptionTree = false;
        }
예제 #21
0
        private void RadGridView1_RowLoaded(object sender, RowLoadedEventArgs e)
        {
            HyperlinkButton hl;
            TextBlock       tb;
            Image           img;
            GridViewRow     row = e.Row as GridViewRow;

            if (row != null)
            {
                EstimateDetails ed = row.DataContext as EstimateDetails;
                if (row != null && ed != null)
                {
                    if (ed.AreaId == 43)
                    {
                        if (/*EstimateList.revisiontypepermission.AllowToAddNSR && */ !EstimateList.revisiontypepermission.ReadOnly) //All revisions can now add NSR
                        {
                            foreach (GridViewCell Cell in row.Cells)
                            {
                                if (Cell.FindChildByType <HyperlinkButton>() != null && Cell.FindChildByType <HyperlinkButton>().Name == "btnAddOption")
                                {
                                    hl           = Cell.FindChildByType <HyperlinkButton>();
                                    tb           = Cell.FindChildByType <TextBlock>();
                                    tb.Opacity   = 1;
                                    hl.IsEnabled = true;
                                    img          = Cell.FindChildByType <Image>();
                                    img.Opacity  = 1;
                                }
                                else if (Cell.FindChildByType <HyperlinkButton>() != null && Cell.FindChildByType <HyperlinkButton>().Name == "btnCopy")
                                {
                                    hl           = Cell.FindChildByType <HyperlinkButton>();
                                    hl.IsEnabled = false;
                                    tb           = Cell.FindChildByType <TextBlock>();
                                    tb.Opacity   = 0.3;
                                    img          = Cell.FindChildByType <Image>();
                                    img.Opacity  = 0.3;
                                }
                            }
                        }
                        else
                        {
                            foreach (GridViewCell Cell in row.Cells)
                            {
                                if (Cell.FindChildByType <HyperlinkButton>() != null && Cell.FindChildByType <HyperlinkButton>().Name == "btnAddOption")
                                {
                                    hl           = Cell.FindChildByType <HyperlinkButton>();
                                    tb           = Cell.FindChildByType <TextBlock>();
                                    tb.Opacity   = 0.3;
                                    hl.IsEnabled = false;
                                    img          = Cell.FindChildByType <Image>();
                                    img.Opacity  = 0.3;
                                }
                                else if (Cell.FindChildByType <HyperlinkButton>() != null && Cell.FindChildByType <HyperlinkButton>().Name == "btnCopy")
                                {
                                    hl           = Cell.FindChildByType <HyperlinkButton>();
                                    hl.IsEnabled = false;
                                    tb           = Cell.FindChildByType <TextBlock>();
                                    tb.Opacity   = 0.3;
                                    img          = Cell.FindChildByType <Image>();
                                    img.Opacity  = 0.3;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (!EstimateList.revisiontypepermission.ReadOnly)
                        {
                            if (!EstimateList.revisiontypepermission.AllowToAddNSR)
                            { //All revisions can now add NSR
                              /*
                               * foreach (GridViewCell Cell in row.Cells)
                               * {
                               *  if (Cell.FindChildByType<HyperlinkButton>() != null && Cell.FindChildByType<HyperlinkButton>().Name == "btnAddOption")
                               *  {
                               *      hl = Cell.FindChildByType<HyperlinkButton>();
                               *      tb = Cell.FindChildByType<TextBlock>();
                               *      tb.Opacity = 1;
                               *      hl.IsEnabled = true;
                               *      img = Cell.FindChildByType<Image>();
                               *      img.Opacity = 1;
                               *  }
                               *  else if (Cell.FindChildByType<HyperlinkButton>() != null && Cell.FindChildByType<HyperlinkButton>().Name == "btnCopy")
                               *  {
                               *      hl = Cell.FindChildByType<HyperlinkButton>();
                               *      hl.IsEnabled = false;
                               *      tb = Cell.FindChildByType<TextBlock>();
                               *      tb.Opacity = 0.3;
                               *      img = Cell.FindChildByType<Image>();
                               *      img.Opacity = 0.3;
                               *  }
                               * }
                               */
                            }
                            else
                            {
                                foreach (GridViewCell Cell in row.Cells)
                                {
                                    if (Cell.FindChildByType <HyperlinkButton>() != null && Cell.FindChildByType <HyperlinkButton>().Name == "btnAddOption")
                                    {
                                        hl           = Cell.FindChildByType <HyperlinkButton>();
                                        tb           = Cell.FindChildByType <TextBlock>();
                                        tb.Opacity   = 1;
                                        hl.IsEnabled = true;
                                        img          = Cell.FindChildByType <Image>();
                                        img.Opacity  = 1;
                                    }
                                    else if (Cell.FindChildByType <HyperlinkButton>() != null && Cell.FindChildByType <HyperlinkButton>().Name == "btnCopy")
                                    {
                                        hl           = Cell.FindChildByType <HyperlinkButton>();
                                        hl.IsEnabled = true;
                                        tb           = Cell.FindChildByType <TextBlock>();
                                        tb.Opacity   = 1;
                                        img          = Cell.FindChildByType <Image>();
                                        img.Opacity  = 1;
                                    }
                                }
                            }
                        }
                        else
                        {
                            foreach (GridViewCell Cell in row.Cells)
                            {
                                if (Cell.FindChildByType <HyperlinkButton>() != null && Cell.FindChildByType <HyperlinkButton>().Name == "btnAddOption")
                                {
                                    hl           = Cell.FindChildByType <HyperlinkButton>();
                                    tb           = Cell.FindChildByType <TextBlock>();
                                    tb.Opacity   = 0.3;
                                    hl.IsEnabled = false;
                                    img          = Cell.FindChildByType <Image>();
                                    img.Opacity  = 0.3;
                                }
                                else if (Cell.FindChildByType <HyperlinkButton>() != null && Cell.FindChildByType <HyperlinkButton>().Name == "btnCopy")
                                {
                                    hl           = Cell.FindChildByType <HyperlinkButton>();
                                    hl.IsEnabled = false;
                                    tb           = Cell.FindChildByType <TextBlock>();
                                    tb.Opacity   = 0.3;
                                    img          = Cell.FindChildByType <Image>();
                                    img.Opacity  = 0.3;
                                }
                            }
                        }
                    }
                }
            }
        }