Example #1
0
        private void LoadFields()
        {
            if (QuoteItem != null)
            {
                lblCode.Text = QuoteItem.Code;
                if (!string.IsNullOrEmpty(QuoteItem.Model))
                {
                    lblDescription.Text = StringFormat.Cut(QuoteItem.Model, 32);
                }
                lblDescription.ToolTip = QuoteItem.Description;
                lblPV.Text             = QuoteItem.PriceSell;
                lblQuantity.Text       = QuoteItem.Quantity.ToString();
                lblDeliveryTime.Text   = QuoteItem.DeliveryTime;
                if (quoteItem.SaleCondition != null)
                {
                    lblIncoterm.Text    = QuoteItem.SaleCondition.Title;
                    lblIncoterm.ToolTip = QuoteItem.SaleCondition.Description;
                }

                lblSubtotal.Text = QuoteItem.PriceCurrency.Description + " " + QuoteItem.Subtotal.ToString("#.00");

                lblPL.Text    = QuoteItem.LastPriceList;
                lblPL.ToolTip = QuoteItem.PriceList;
            }
        }
Example #2
0
        protected void rpterPages_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                CatalogPage cp = (e.Item.DataItem as CatalogPage);

                HyperLink hl = (e.Item.FindControl("lnkGo") as HyperLink);
                hl.NavigateUrl = "/pagelist/view/default.aspx?Id=" + cp.ID;
                hl.Text        = cp.Name;
                hl.ToolTip     = string.Format("Ingresar al distribuidor {0}", cp.Name);

                (e.Item.FindControl("litParent") as Literal).Text = "N/D";
                if (cp.Parent != null)
                {
                    (e.Item.FindControl("litParent") as Literal).Text = cp.Parent.Name;
                }

                (e.Item.FindControl("litDescription") as Literal).Text = "N/D";
                if (!string.IsNullOrEmpty(cp.Description))
                {
                    (e.Item.FindControl("litDescription") as Literal).Text = StringFormat.Cut(cp.Description, 32);
                }
            }
        }
Example #3
0
        private void CreateCurrentFilters(IList <IFilter> filters)
        {
            plhCurrentFilters.Controls.Clear();

            foreach (IFilter f in filters)
            {
                if (f is FixedFilter)
                {
                    continue;
                }

                //Add Last Filters to plhCurrentFilters
                FilterLinkButton fl = new FilterLinkButton();
                fl.ID              = "flb" + f.ClassName;
                fl.LinkText        = string.Format("{0} : <b>{1}</b>", Resource.Business.GetString(f.ID), StringFormat.Cut(f.TextValue.ToString().Replace((char)160, ' ').Trim(), 29));
                fl.RelatedFilterID = f.ID.ToString();
                fl.Click          += Link_Click;
                plhCurrentFilters.Controls.Add(fl);
            }

            if (plhCurrentFilters.Controls.Count == 0)
            {
                lblFilterText.Text = "No hay ningún filtro activo.";
            }
            else
            {
                lblFilterText.Text = "Se encuentra filtrando por:";
            }
        }
Example #4
0
        private void LoadFields()
        {
            Quote q = null;

            if (QuoteId > 0)
            {
                q = ControllerManager.Quote.GetById(QuoteId);
            }

            if (q == null)
            {
                Response.Redirect("/accessdenied.aspx");
            }

            if (q.Status == QuoteStatus.Sent)
            {
                lnkEdit.Visible = false;
            }

            ExecutePermissionValidator epv = new ExecutePermissionValidator();

            epv.ClassType     = typeof(Quote);
            epv.KeyIdentifier = Config.SeeQuotes;

            if (PermissionManager.Check(epv) == false)
            {
                PermissionManager.Validate(q);
            }

            lblDistributor.Text = q.Distributor.Name;

            if (!string.IsNullOrEmpty(q.Contact))
            {
                lblContact.Text = q.Contact;
            }
            else
            {
                lblContact.Text = q.Distributor.Contact;
            }
            if (!string.IsNullOrEmpty(q.Email))
            {
                lblMail.Text = q.Email;
            }
            else if (!string.IsNullOrEmpty(q.Distributor.Email))
            {
                lblMail.Text = q.Distributor.Email;
            }
            else if (!string.IsNullOrEmpty(q.Distributor.AlternativeEmail))
            {
                lblMail.Text = q.Distributor.AlternativeEmail;
            }
            else
            {
                lblMail.Text = "N/D";
            }
            lblDate.Text        = q.TimeStamp.CreatedOn.ToShortDateString();
            lblDiscount.Text    = q.Distributor.Discount.ToString("#0.00") + "%";
            lblVigency.Text     = q.Vigency.Description + " dias";
            lblQuoteNumber.Text = q.Number;
            if (q.Distributor.PaymentTerm != null)
            {
                lblPaymentCondition.Text = q.Distributor.PaymentTerm.Title;
            }
            lblIntroText.Text = q.IntroText.Description;
            lblCondition.Text = q.Condition.Description;
            lblStatus.Text    = EnumHelper.GetDescription(q.Status);
            if (q.TimeStamp != null && MembershipHelper.GetUser(q.TimeStamp.CreatedBy) != null)
            {
                lblAutor.Text = MembershipHelper.GetUser(q.TimeStamp.CreatedBy).UserName;
            }
            //lblObservation.Text = q.Observations;
            lblObservation.Text = StringFormat.Cut(q.Observations, 100);
            lblObservation.Attributes["title"] = q.Observations;
            if (!Page.IsPostBack)
            {
                BoundField bf = new BoundField();
                bf.DataField      = "Code";
                bf.HeaderText     = Resource.Business.GetString("GridViewColumnCode");
                bf.SortExpression = "Code";
                GridView1.Columns.Add(bf);

                bf                = new BoundField();
                bf.DataField      = "Description";
                bf.HeaderText     = Resource.Business.GetString("GridViewColumnDescription");
                bf.SortExpression = "Description";
                GridView1.Columns.Add(bf);

                bf                = new BoundField();
                bf.DataField      = "PriceSell";
                bf.HeaderText     = Resource.Business.GetString("GridViewColumnPriceSell");
                bf.SortExpression = "PriceSell";
                GridView1.Columns.Add(bf);

                bf                = new BoundField();
                bf.DataField      = "PriceList";
                bf.HeaderText     = Resource.Business.GetString("GridViewColumnPrice");
                bf.SortExpression = "PriceList";
                GridView1.Columns.Add(bf);

                bf                = new BoundField();
                bf.DataField      = "LeadTime";
                bf.HeaderText     = Resource.Business.GetString("GridViewColumnLeadTime");
                bf.SortExpression = "LeadTime";
                GridView1.Columns.Add(bf);

                epv               = new ExecutePermissionValidator();
                epv.ClassType     = typeof(QuoteItem);
                epv.KeyIdentifier = Config.QuoteItemSourceColumn;

                bf                = new BoundField();
                bf.DataField      = "Source";
                bf.HeaderText     = Resource.Business.GetString("GridViewColumnSource");
                bf.SortExpression = "Source";
                bf.Visible        = PermissionManager.Check(epv);
                GridView1.Columns.Add(bf);
            }

            GridView1.DataSource = q.QuoteItems;
            GridView1.DataBind();

            if ((string.IsNullOrEmpty(q.Distributor.Email) && string.IsNullOrEmpty(q.Distributor.AlternativeEmail) && string.IsNullOrEmpty(q.Email)) || q.Status == QuoteStatus.Rejected)
            {
                btnSendPDF.Visible = false;
                Utils.ShowMessage(this.Page, "No se podra enviar la cotización por correo ya que el Canal de Ventas no tiene correo electronico asignado.", Utils.MessageType.Warning);
            }
        }
Example #5
0
        public HtmlGenericControl GetCurrentPageTitle()
        {
            MenuItem current = this;

            if (current.AlwaysShowParentMenu || (current.Childs.Count == 0 && current.parent != null))
            {
                current = current.parent;
            }

            HtmlGenericControl span = new HtmlGenericControl("span");

            AddParentRecursive(span.Controls, current);

            HtmlGenericControl currentSpan = new HtmlGenericControl("span");

            currentSpan.Attributes["class"] = "current";

            if (this.ID != current.ID)
            {
                if (!current.IsRedirectedToFirstChild)
                {
                    span.Controls.Add(BuildLink(current));
                }
                else
                {
                    currentSpan.InnerHtml += current.Description;
                }

                if (!string.IsNullOrEmpty(this.AlternativeTitle))
                {
                    currentSpan.InnerHtml += string.Format(" <strong>[{0}]</strong>", StringFormat.Cut(this.AlternativeTitle, 29));
                }

                if (!this.AlwaysShowParentMenu)
                {
                    currentSpan.InnerHtml += " : " + this.Description;
                }
            }
            else
            {
                currentSpan.InnerHtml = current.Description;
            }

            span.Controls.Add(currentSpan);
            return(span);
        }
Example #6
0
        private HtmlControl CreateDropdownMenu(MenuItem mi)
        {
            HtmlControl div = new HtmlGenericControl("div");

            div.Attributes["id"]    = mi.ID;
            div.Attributes["class"] = "dropmenudiv";

            if (mi.ShowChilds && mi.Childs.Count > 0)
            {
                foreach (MenuItem child in mi.Childs)
                {
                    if (!PermissionManager.Check(child))
                    {
                        continue;
                    }

                    if (!string.IsNullOrEmpty(child.Separator))
                    {
                        div.Controls.Add(CreateDropDownSeparator(child.Separator));
                    }

                    if (mi.ID == "tabHome" && (child.ID == "tabAdmin" || child.ID == "tabMasterPrice"))
                    {
                        continue;
                    }

                    div.Controls.Add(CreateDropDownAnchor(child));
                }
            }

            // Find all childs lists for the current country
            if (mi.GoToPage == "/masterproductlist/country/")
            {
                int        countryId = Convert.ToInt32(mi.Parameters[0]);
                PriceGroup pg        = new PriceGroup(countryId);

                IList <PriceList> priceLists = ControllerManager.PriceList.GetActivesByPriceGroup(pg, 10);
                if (priceLists.Count > 0)
                {
                    div.Controls.Add(CreateDropDownSeparator("Grupo de Precios"));

                    foreach (PriceList pl in priceLists)
                    {
                        string url = "/pricelists/view/?Id=" + pl.ID;
                        div.Controls.Add(CreateDropDownAnchor(url, StringFormat.Cut(pl.Name, 25)));
                    }
                }

                if (priceLists.Count == 10)
                {
                    div.Controls.Add(CreateDropDownAnchor("/pricelists/?PriceGroupId=" + countryId, "Ver más...", true));
                }

                IList <Distributor> distributors = ControllerManager.Distributor.GetActivesByPriceGroup(pg, 10);
                if (distributors.Count > 0)
                {
                    div.Controls.Add(CreateDropDownSeparator("Canales de Ventas"));

                    foreach (Distributor d in distributors)
                    {
                        string url = "/distributors/view/?Id=" + d.ID;
                        div.Controls.Add(CreateDropDownAnchor(url, StringFormat.Cut(d.Name, 25)));
                    }
                }

                if (distributors.Count == 10)
                {
                    div.Controls.Add(CreateDropDownAnchor("/distributors/?PriceGroupId=" + countryId, "Ver más...", true));
                }
            }

            if (mi.GoToPage == "/distributors/")
            {
                IList <Lookup> lulst = ControllerManager.Lookup.List(LookupType.DistributorType);
                if (lulst.Count > 0)
                {
                    div.Controls.Add(CreateDropDownSeparator("Tipos"));
                    foreach (Lookup lu in lulst)
                    {
                        string url = "/distributors/?LookUpId=" + lu.ID;
                        div.Controls.Add(CreateDropDownAnchor(url, StringFormat.Cut(lu.Description, 25)));
                    }
                }
            }
            if (div.Controls.Count == 0)
            {
                return(null);
            }

            return(div);
        }
Example #7
0
        private void LoadFields()
        {
            Quote q = null;

            if (QuoteId > 0)
            {
                q = ControllerManager.Quote.GetById(QuoteId);
            }

            if (q == null || ((q.Status == QuoteStatus.InAssistence || q.Status == QuoteStatus.AssistenceRequired) && "Chequear si no sos administrador" == "Chequear si no sos administrador"))
            {
                Response.Redirect("/accessdenied.aspx");
            }

            if (q.Status == QuoteStatus.Sent)
            {
                lnkEdit.Visible = false;
            }
            else
            if (!ControllerManager.Quote.ValidateQuote(q))
            {
                Utils.ShowMessage(this.Page, "Se modifico la información de la cotización.", Utils.MessageType.Warning);
            }

            ExecutePermissionValidator epv = new ExecutePermissionValidator();

            epv.ClassType     = typeof(Quote);
            epv.KeyIdentifier = Config.SeeQuotes;

            if (PermissionManager.Check(epv) == false)
            {
                PermissionManager.Validate(q);
            }

            lblDistributor.Text = q.Distributor.Name;

            if (!string.IsNullOrEmpty(q.Contacts))
            {
                lblContact.Text = q.Contacts;
            }
            else
            {
                lblContact.Text = "N/D";
            }

            lblDate.Text        = q.TimeStamp.CreatedOn.ToShortDateString();
            lblDiscount.Text    = q.Distributor.Discount.ToString("#0.00") + "%";
            lblVigency.Text     = q.Vigency.Description + " dias";
            lblQuoteNumber.Text = q.Number;
            if (q.Distributor.PaymentTerm != null)
            {
                lblPaymentCondition.Text = q.Distributor.PaymentTerm.Description;
            }
            lblIntroText.Text = q.IntroText.Description;
            lblCondition.Text = q.Condition.Description;
            lblStatus.Text    = EnumHelper.GetDescription(q.Status);
            MembershipHelperUser mhu = MembershipHelper.GetUser(q.TimeStamp.CreatedBy);

            if (q.TimeStamp != null && mhu != null)
            {
                lblAutor.Text = mhu.FullName;
            }
            //lblObservation.Text = q.Observations;
            lblObservation.Text = StringFormat.Cut(q.Observations, 100);
            lblObservation.Attributes["title"] = q.Observations;
            if (q.Currency != null && q.CurrencyRate != null)
            {
                lblCurrency.Text = q.Currency.Description + " (" + q.CurrencyRate.Rate + ")";
            }
            btnGetAssistence.Visible = q.Status == QuoteStatus.Draft;

            rptQuoteLine.DataSource = q.QuoteItems;
            rptQuoteLine.DataBind();

            lblTotalCount.Text = q.Currency.Description + " " + TotalCount.ToString("0.##");

            if (q.QuoteNotifications.Count == 0 || q.Status == QuoteStatus.Rejected)
            {
                btnSendPDF.Visible = false;
                if (q.QuoteNotifications.Count == 0)
                {
                    Utils.ShowMessage(this.Page, "La cotización no podrá ser enviada por email ya que no tiene contactos asignados.", Utils.MessageType.Warning);
                }
            }
        }