private void chkSelect_Checked(object sender, RoutedEventArgs e)
        {
            SimplePAG pag = ((GridViewCell)((CheckBox)e.OriginalSource).Parent).ParentRow.DataContext as SimplePAG;

            foreach (SimplePAG p in upgradelist)
            {
                if (p.HomeDisplayOptionID != pag.HomeDisplayOptionID)
                {
                    p.Selected = false;
                }
            }
        }
Exemple #2
0
        private void OptionsGrid_RowDetailsVisibilityChanged(object sender, GridViewRowDetailsEventArgs e)
        {
            if (e.Visibility == Visibility.Visible)
            {
                GridViewRow row = e.Row as GridViewRow;

                if (row != null)
                {
                    SimplePAG ed          = row.DataContext as SimplePAG;
                    decimal   retailprice = 0;

                    if (row != null && ed != null)
                    {
                        StackPanel    panel       = (StackPanel)e.DetailsElement;
                        RadTabControl rtc         = (RadTabControl)panel.FindName("tabDesc");
                        CheckBox      chksitework = (CheckBox)panel.FindName("chkSitework");

                        RadTabItem im      = (RadTabItem)rtc.FindName("tabstandarddesc");
                        TextBox    txtdesc = (TextBox)im.Content;

                        RadTabItem imadd         = (RadTabItem)rtc.FindName("tabadditionaldesc");
                        Image      addionalimage = (Image)imadd.FindName("imgAdditional");

                        if (ed.AdditionalNotes.Trim() != "")
                        {
                            addionalimage.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            addionalimage.Visibility = Visibility.Collapsed;
                        }

                        RadTabItem imextra    = (RadTabItem)rtc.FindName("tabextradesc");
                        Image      extraimage = (Image)imadd.FindName("imgExtra");

                        if (ed.ExtraDescription.Trim() != "")
                        {
                            extraimage.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            extraimage.Visibility = Visibility.Collapsed;
                        }

                        RadTabItem iminternal    = (RadTabItem)rtc.FindName("tabinternaldesc");
                        Image      internalimage = (Image)imadd.FindName("imgInternal");

                        if (ed.InternalDescription.Trim() != "")
                        {
                            internalimage.Visibility = Visibility.Visible;
                        }
                        else
                        {
                            internalimage.Visibility = Visibility.Collapsed;
                        }

                        RadComboBox cmbcategory = (RadComboBox)panel.FindName("cmbCategory");
                        GetNonStandardAreas(cmbcategory, ed.AreaID);

                        RadComboBox cmbPriceDisplay = (RadComboBox)panel.FindName("cmbPriceDisplay");
                        cmbPriceDisplay.ItemsSource   = ((AddOptionViewModel)LayoutRoot.DataContext).EstimateNonStandardPriceDisplayCode;
                        cmbPriceDisplay.SelectedValue = ed.PriceDisplayCodeId;

                        RadComboBox cmbgroup = (RadComboBox)panel.FindName("cmbGroup");
                        GetNonStandardGroups(ed.AreaID, cmbgroup, ed.GroupID);

                        if (ed.ItemAllowToChangeDisplayCode)
                        {
                            TextBlock txtPriceDisplay = (TextBlock)panel.FindName("txtPriceDisplay");
                            txtPriceDisplay.Visibility = System.Windows.Visibility.Collapsed;
                            cmbPriceDisplay.Visibility = System.Windows.Visibility.Visible;
                        }
                        else
                        {
                            TextBlock txtPriceDisplay = (TextBlock)panel.FindName("txtPriceDisplay");
                            txtPriceDisplay.Visibility = System.Windows.Visibility.Visible;
                            cmbPriceDisplay.Visibility = System.Windows.Visibility.Collapsed;
                        }

                        if (ed.AreaName.ToUpper().Contains("NON STANDARD REQUEST"))
                        {
                            cmbcategory.IsEnabled = true;
                            cmbgroup.IsEnabled    = true;
                            if (txtdesc != null)
                            {
                                txtdesc.IsReadOnly = false;
                            }
                            chksitework.IsEnabled = true;
                        }
                        else
                        {
                            cmbcategory.IsEnabled = false;
                            chksitework.IsEnabled = false;
                            cmbgroup.IsEnabled    = false;
                        }

                        if (ed.ItemAllowToChangeDescription)
                        {
                            txtdesc.IsReadOnly = false;
                        }
                        else
                        {
                            if (txtdesc != null)
                            {
                                txtdesc.IsReadOnly = true;
                            }
                        }

                        TextBox txtPrice = (TextBox)panel.FindName("txtPrice");
                        retailprice = decimal.Parse(txtPrice.Text);
                        if (!ed.ItemAllowToChangePrice)
                        {
                            txtPrice.IsReadOnly = true;
                        }
                        else
                        {
                            txtPrice.IsReadOnly = false;
                        }

                        TextBox txtQty = (TextBox)panel.FindName("txtQuantity");
                        if (!ed.ItemAllowToChangeQuantity)
                        {
                            txtQty.IsReadOnly = true;
                        }
                        else
                        {
                            txtQty.IsReadOnly = false;
                        }

                        TextBox   txtCost = (TextBox)panel.FindName("txtCostExcGST");
                        TextBlock lblCost = (TextBlock)panel.FindName("lblcost");

                        TextBox   txtMargin = (TextBox)panel.FindName("txtMargin");
                        TextBlock lblMargin = (TextBlock)panel.FindName("lblmargin");

                        if ((App.Current as App).CurrentRoleAccessModule.AccessMarginModule && ed.ItemAllowToChangePrice)// only sales estimator can change cost
                        {
                            txtCost.IsReadOnly  = false;
                            txtMargin.IsEnabled = true;
                        }
                        else
                        {
                            txtCost.IsReadOnly  = true;
                            txtMargin.IsEnabled = false;
                        }


                        CheckBox  derivedcost    = (CheckBox)panel.FindName("chkDerivedCost");
                        TextBlock lblderivedcost = (TextBlock)panel.FindName("lblderivedcost");

                        if (((App)App.Current).CurrentRoleAccessModule.AccessMarginModule)
                        {
                            if (ed.Margin.Trim() != "" && retailprice >= 0)
                            {
                                txtMargin.Text = ed.Margin.ToString() + "%";
                            }
                            else
                            {
                                txtMargin.Text = "";
                            }

                            lblMargin.Visibility      = Visibility.Visible;
                            txtMargin.Visibility      = Visibility.Visible;
                            lblCost.Visibility        = Visibility.Visible;
                            txtCost.Visibility        = Visibility.Visible;
                            lblderivedcost.Visibility = Visibility.Visible;
                            derivedcost.Visibility    = Visibility.Visible;
                        }
                        else
                        {
                            lblMargin.Visibility      = Visibility.Collapsed;
                            txtMargin.Visibility      = Visibility.Collapsed;
                            lblCost.Visibility        = Visibility.Collapsed;
                            txtCost.Visibility        = Visibility.Collapsed;
                            lblderivedcost.Visibility = Visibility.Collapsed;
                            derivedcost.Visibility    = Visibility.Collapsed;
                        }

                        TextBox txtSubtotal = (TextBox)panel.FindName("txtSubtotal");
                        txtSubtotal.IsReadOnly = true;

                        CheckBox chkAccepted = (CheckBox)panel.FindName("chkAccepted");

                        if (!EstimateList.revisiontypepermission.ReadOnly && (App.Current as App).SelectedEstimateAllowToAcceptItem)
                        {
                            chkAccepted.IsEnabled = true;
                        }
                        else
                        {
                            chkAccepted.IsEnabled = false;
                        }
                    }
                }
            }
        }