/// <summary>
        /// Page_Load handler.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try // try to handle Page_Load
            {
                _ajaxManager = null;

                if ((_ajaxManager = RadAjaxManager.GetCurrent(Page)) == null)
                {
                    _ajaxManager = new RadAjaxManager()
                    {
                        ID = "amLeaderboard", EnableAJAX = true
                    };
                    {
                        plhAjaxManager.Controls.Add(_ajaxManager);
                    }
                }

                var apMain = new AjaxSetting("apMain");
                {
                    apMain.UpdatedControls.Add(new AjaxUpdatedControl("apMain", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apMain);
                    }
                }

                if (!IsPostBack)
                {
                    BindLeaderboard();
                }
            }
            catch (Exception ex) // catch exceptions
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Page_Load handler.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try // try to handle Page_Load
            {
                _ajaxManager = null;

                if ((_ajaxManager = RadAjaxManager.GetCurrent(Page)) == null)
                {
                    _ajaxManager = new RadAjaxManager()
                    {
                        ID = "amLeaderboard", EnableAJAX = true
                    };
                    {
                        plhAjaxManager.Controls.Add(_ajaxManager);
                    }
                }

                var apMain = new AjaxSetting("apMain");
                {
                    apMain.UpdatedControls.Add(new AjaxUpdatedControl("apMain", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apMain);
                    }
                }

                if (!IsPostBack && !Page.IsCallback)
                {
                    if (_settings.BeginDate != null && _settings.EndDate != null)
                    {
                        ctlCompletionDate.DateRange = _settings.DateRange;
                        ctlCompletionDate.StartDate = _settings.BeginDate;
                        ctlCompletionDate.EndDate   = _settings.EndDate;
                    }
                    if (_settings.ShowDateFilter == true)
                    {
                        divDateRange.Style.Add("display", "");
                        //divDateRange.Visible = true;
                    }
                    else
                    {
                        divDateRange.Style.Add("display", "none");
                        //divDateRange.Visible = false;
                    }

                    BindActivitySummary();
                }

                ctlCompletionDate.HideShowDates(ctlCompletionDate.DateRange);

                LearnerModuleId = _settings.LearnerModuleId.ToString();

                RegisterSyncJS(IsPostBack);
            }

            catch (Exception ex) // catch exceptions
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Page_Load handler.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try // try to handle Page_Load
            {
                _ajaxManager = null;

                if ((_ajaxManager = RadAjaxManager.GetCurrent(Page)) == null)
                {
                    _ajaxManager = new RadAjaxManager()
                    {
                        ID = "amEditDefinition", EnableAJAX = true
                    };
                    {
                        phAjaxManager.Controls.Add(_ajaxManager);
                    }
                }

                var apMainSetting = new AjaxSetting("apMain");
                {
                    apMainSetting.UpdatedControls.Add(new AjaxUpdatedControl("apMain", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apMainSetting);
                    }
                }

                if (!IsPostBack)
                {
                    int activityId = 0;

                    if (Int32.TryParse(Request.QueryString["id"], out activityId))
                    {
                        Activity activity = null;

                        if ((_editingActivity = (activity = UnitOfWork.Activities.GetBy(activityId))) == null)
                        {
                            throw new Exception(String.Format("Activity {0} - is not found", activityId));
                        }

                        hfId.Value = activityId.ToString(); tbDescription.Text = activity.Description;

                        tbActivityPoints.Text = activity.ActivityPoints.ToString();
                        {
                            chbOnce.Checked = activity.Once;
                        }
                    }

                    string returnUrl = Request.QueryString["returnUrl"] ?? "/";
                    {
                        btnCancel.NavigateUrl = returnUrl; // bind cancel button return url
                    }
                }
            }
            catch (Exception ex) // catch exceptions
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Exemplo n.º 4
0
    // Creates a new urlgeneratorcollection. Accepts the modules controls, ajaxmanager and control to position it to (usually null)
    public UrlGeneratorCollection(ControlCollection _controls, RadAjaxManager aManager, Control aControlPos)
    {
        // Creates a list of parameters controls
        _listOfControlObject = new List <ParameterControl>();

        // Creates a button that generates the data url
        RadButton _urlGenerator = new RadButton();

        _urlGenerator.Text       = "Get data url";
        _urlGenerator.ID         = "STATIC_URLGENERATOR_BUTTON";
        _urlGenerator.Click     += FindUrl;             // Generates url
        _urlGenerator.RenderMode = RenderMode.Lightweight;
        _urlGenerator.Style.Add("float", "right");
        _urlGenerator.Icon.SecondaryIconCssClass = "rbSearch";
        _urlGenerator.Icon.SecondaryIconRight    = 5;

        // Create a new ajax setting
        AjaxSetting _buttonCtrl = new AjaxSetting(_urlGenerator.ID);

        // Fake label that the radwindow is added to
        _controlWindowHolder    = new Label();
        _controlWindowHolder.ID = "LABEL_WINDOWHOLDER";

        // Add both the radbutton
        AjaxUpdatedControl _ctrlButton = new AjaxUpdatedControl();

        _ctrlButton.ControlID             = _urlGenerator.ID;
        _ctrlButton.UpdatePanelRenderMode = UpdatePanelRenderMode.Block;
        // And the label
        AjaxUpdatedControl _ctrl_Label = new AjaxUpdatedControl();

        _ctrl_Label.ControlID             = _controlWindowHolder.ID;
        _ctrl_Label.UpdatePanelRenderMode = UpdatePanelRenderMode.Block;
        // To the AjaxSetting
        _buttonCtrl.UpdatedControls.Add(_ctrlButton);
        _buttonCtrl.UpdatedControls.Add(_ctrl_Label);
        // Now add the ajaxsetting to the modules ajaxcontroller
        aManager.AjaxSettings.Add(_buttonCtrl);

        // Find the controls index in the control collection
        int _indexOfGrid = _controls.IndexOf(aControlPos);

        //If the control is found, anchor before it
        if (_indexOfGrid >= 0)
        {
            _controls.AddAt(_indexOfGrid, _controlWindowHolder);
            _controls.AddAt(_indexOfGrid, _urlGenerator);
        }
        else // if not, add to top
        {
            _controls.AddAt(0, _controlWindowHolder);
            _controls.AddAt(0, _urlGenerator);
        }
    }
Exemplo n.º 5
0
        /// <summary>
        /// Page_Load handler.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try // try to handle Page_Load
            {
                _ajaxManager = null;

                if ((_ajaxManager = RadAjaxManager.GetCurrent(Page)) == null)
                {
                    _ajaxManager = new RadAjaxManager()
                    {
                        ID = "amMain", EnableAJAX = true
                    };
                    {
                        phAjaxManager.Controls.Add(_ajaxManager);
                    }
                }

                var apMainSetting = new AjaxSetting("apMain");
                {
                    apMainSetting.UpdatedControls.Add(new AjaxUpdatedControl("apMain", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apMainSetting);
                    }
                }

                if (IsPostBack)
                {
                    return;
                }
                int id = -1;

                if (Int32.TryParse(Request.QueryString["id"] ?? "", out id))
                {
                    var foo = UnitOfWork.Foos.GetBy(id);

                    txtName.Text = foo.Name; txtDescription.Text = foo.Description;
                    {
                        hfId.Value = id.ToString();
                    }
                }

                string returnUrl = Request.QueryString["returnUrl"] ?? "/";
                {
                    btnCancel.NavigateUrl = returnUrl;
                }
            }
            catch (Exception ex) // catch exceptions
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Exemplo n.º 6
0
        protected override void renderJQuery(JQueryUI jquery)
        {
            base.renderJQuery(jquery);

            // Generate scripts that are needed by WIDGET, each class that inherits from WidgetSetting can add needed scripts through method GetDependentScripts
            foreach (KeyValuePair <string, string> pair in this.uiSetting.GetDependentScripts( ))
            {
                string key = string.Format("__js{0}", pair.Key);

                if (!ScriptHelper.IsBuilt(new ASPXScriptHolder(this), key))
                {
                    ScriptHelper script = new ScriptHelper( );

                    script.AppendCode(pair.Value);

                    script.Build(new ASPXScriptHolder(this), key, ScriptBuildOption.Startup);
                }
            }

            for (int index = 0; index < this.uiSetting.Ajaxs.Length; index++)
            {
                AjaxSetting ajax = this.uiSetting.Ajaxs[index];

                if (!string.IsNullOrEmpty(ajax.ClientFunction))
                {
                    AjaxManager manager = this.NamingContainer.FindControl(ajax.AjaxManagerID) as AjaxManager;

                    if (null == manager)
                    {
                        throw new Exception(string.Format("没有找到 ID 为 {0} 的 AjaxManager 控件", ajax.AjaxManagerID));
                    }

                    foreach (AjaxSetting target in manager.AjaxList)
                    {
                        if (target.ClientFunction == ajax.ClientFunction)
                        {
                            if (ajax != target)
                            {
                                this.uiSetting.Ajaxs[index] = target;
                            }

                            break;
                        }
                    }
                }
            }

            // Append scripts that create the WIDGET, such as: __repeater( ... )
            jquery.Widget(this.uiSetting);
        }
Exemplo n.º 7
0
        protected void Page_Init(object sender, EventArgs e)
        {
            RadPersistenceManager1.StorageProvider = new SessionStorageProvider(RadPersistenceManager1.StorageProviderKey);
            GridFilterMenu filterMenu       = RadGrid1.FilterMenu;
            int            currentItemIndex = 0;

            while (currentItemIndex < filterMenu.Items.Count)
            {
                RadMenuItem item = filterMenu.Items[currentItemIndex];
                if (item.Text.Contains("Empty") || item.Text.Contains("Null"))
                {
                    filterMenu.Items.Remove(item);
                }
                else
                {
                    currentItemIndex++;
                }
            }

            foreach (var control in btnGroup.Controls)
            {
                var button = control as HtmlButton;
                if (button != null)
                {
                    var ajaxSetting = new AjaxSetting(button.ID);
                    var gridItem    = new AjaxUpdatedControl(RadGrid1.ID, null);
                    var activeItem  = new AjaxUpdatedControl(hfActiveButtonId.ID, null);
                    var searchItem  = new AjaxUpdatedControl(hfFilterButton.ID, null);
                    ajaxSetting.UpdatedControls.Add(gridItem);
                    ajaxSetting.UpdatedControls.Add(activeItem);
                    ajaxSetting.UpdatedControls.Add(searchItem);

                    foreach (var innerControl in btnGroup.Controls)
                    {
                        var innerButton = innerControl as HtmlButton;

                        if (innerButton != null)
                        {
                            var buttonItem = new AjaxUpdatedControl(innerButton.ID, null);
                            ajaxSetting.UpdatedControls.Add(buttonItem);
                        }
                    }

                    RadAjaxManager1.AjaxSettings.Add(ajaxSetting);
                }
            }
        }
Exemplo n.º 8
0
        public static void AddAjaxSetting(this RadAjaxManager manager, Control sourceControl, params Control[] targets)
        {
            var setting = new AjaxSetting(sourceControl.ID);

            foreach (var target in targets)
            {
                if (!IsControlValid(target))
                {
                    continue;
                }

                var update = new AjaxUpdatedControl();
                update.ControlID = target.ID;
                setting.UpdatedControls.Add(update);
            }
            manager.AjaxSettings.Add(setting);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Page_Load hadler.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try // try to handle Page_Load
            {
                _ajaxManager = null;

                if ((_ajaxManager = RadAjaxManager.GetCurrent(Page)) == null)
                {
                    _ajaxManager = new RadAjaxManager()
                    {
                        ID = "amMain", EnableAJAX = true
                    };
                    {
                        phAjaxManager.Controls.Add(_ajaxManager);
                    }
                }

                var apMainSetting = new AjaxSetting("apMain");
                {
                    apMainSetting.UpdatedControls.Add(new AjaxUpdatedControl("apMain", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apMainSetting);
                    }
                }

                if (IsPostBack)
                {
                    return;
                }
                {
                    _model = new FooViewModel()
                    {
                        Foos = UnitOfWork.Foos.GetAll()
                    };
                }
            }
            catch (Exception ex) // catch exceptions
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Page_Load handler.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try // try to handle Page_Load
            {
                _ajaxManager = null;

                if ((_ajaxManager = RadAjaxManager.GetCurrent(Page)) == null)
                {
                    _ajaxManager = new RadAjaxManager()
                    {
                        ID = "amMain", EnableAJAX = true
                    };
                    {
                        phAjaxManager.Controls.Add(_ajaxManager);
                    }
                }

                var apMainSetting = new AjaxSetting("apMain");
                {
                    apMainSetting.UpdatedControls.Add(new AjaxUpdatedControl("apMain", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apMainSetting);
                    }
                }

                if (IsPostBack)
                {
                    return;
                }

                string returnUrl = Request.RawUrl;
                {
                    btnAdd.NavigateUrl = GetControlUrl("EditFoo", "mid=" + ModuleId, "returnUrl=" + returnUrl);
                }
            }
            catch (Exception ex) // catch exceptions
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        protected void getDataQInvoce(string sQ, string sYear)
        {
            detFactura oFactura = new detFactura();
            DBConn     oConn    = new DBConn();

            if (oConn.Open())
            {
                string        arrMes           = string.Empty;
                string        arrReporteVenta  = string.Empty;
                cReporteVenta oReportForInvoce = new cReporteVenta(ref oConn);
                oReportForInvoce.NumContrato = hdd_num_contrato.Value;
                oReportForInvoce.Periodo     = sQ;
                oReportForInvoce.AnoReporte  = sYear;
                DataTable dtReporteVenta = oReportForInvoce.GetReportForInvoice();
                foreach (DataRow oRowReporte in dtReporteVenta.Rows)
                {
                    arrReporteVenta = (string.IsNullOrEmpty(arrReporteVenta) ? oRowReporte["cod_reporte_venta"].ToString() : arrReporteVenta + ";" + oRowReporte["cod_reporte_venta"].ToString());
                    arrMes          = (string.IsNullOrEmpty(arrMes) ? oRowReporte["mes_reporte"].ToString() : arrMes + ";" + oRowReporte["mes_reporte"].ToString());
                }
                arrayReporteVenta = arrReporteVenta.Split(';');
                arrayMes          = arrMes.Split(';');

                string sNomMesUno  = oWeb.getMes(int.Parse(arrayMes[0].ToString())).ToString();
                string sNomMesDos  = oWeb.getMes(int.Parse(arrayMes[1].ToString())).ToString();
                string sNomMesTres = oWeb.getMes(int.Parse(arrayMes[2].ToString())).ToString();

                oFactura.MesNomUno  = sNomMesUno;
                oFactura.MesNomDos  = sNomMesDos;
                oFactura.MesNomTres = sNomMesTres;
                oFactura.getMakeTable();

                cDetalleVenta oDetalleVenta;

                //cProductosContrato oProductosContrato = new cProductosContrato(ref oConn);
                //oProductosContrato.NumContrato = hdd_num_contrato.Value;

                cRoyaltyContrato oRoyaltyContrato = new cRoyaltyContrato(ref oConn);
                oRoyaltyContrato.NumContrato = hdd_num_contrato.Value;

                DataTable dtProdCont = oRoyaltyContrato.GetByInvoce();
                if (dtProdCont != null)
                {
                    foreach (DataRow oRow in dtProdCont.Rows)
                    {
                        bool   bVenta      = false;
                        string pCodRotalty = string.Empty;
                        double sRoyalty    = 0;
                        double sBdi        = 0;
                        string sPeriodo    = string.Empty;
                        string arrMntMes   = string.Empty;

                        foreach (DataRow oRowReporte in dtReporteVenta.Rows)
                        {
                            sPeriodo = oRowReporte["periodo_q"].ToString() + "/" + oRowReporte["ano_reporte"].ToString();

                            oDetalleVenta = new cDetalleVenta(ref oConn);
                            oDetalleVenta.CodigoReporteVenta = oRowReporte["cod_reporte_venta"].ToString();
                            oDetalleVenta.Marca        = oRow["cod_marca"].ToString();
                            oDetalleVenta.Categoria    = oRow["cod_categoria"].ToString();
                            oDetalleVenta.SubCategoria = oRow["cod_subcategoria"].ToString();
                            oDetalleVenta.CodRoyalty   = oRow["cod_royalty"].ToString();
                            DataTable detVenta = oDetalleVenta.GetByFactura();
                            if (detVenta != null)
                            {
                                if (detVenta.Rows.Count > 0)
                                {
                                    //int intPrecioUni = int.Parse(detVenta.Rows[0]["precio_uni"].ToString());
                                    //int intCantidadVenta = int.Parse(detVenta.Rows[0]["cantidad_venta"].ToString());
                                    //int intPrecioUniDevol = int.Parse(detVenta.Rows[0]["precio_uni_devol"].ToString());
                                    //int intCantDescueDevol = int.Parse(detVenta.Rows[0]["cant_descue_devol"].ToString());
                                    bVenta      = true;
                                    pCodRotalty = detVenta.Rows[0]["cod_royalty"].ToString();
                                    sRoyalty    = double.Parse(detVenta.Rows[0]["royalty"].ToString());
                                    sBdi        = double.Parse(detVenta.Rows[0]["bdi"].ToString());

                                    //int intTotalMes = ((intPrecioUni * intCantidadVenta) - (intPrecioUniDevol * intCantDescueDevol));
                                    double intTotalMes = double.Parse(detVenta.Rows[0]["totalmes"].ToString());

                                    arrMntMes = (string.IsNullOrEmpty(arrMntMes) ? intTotalMes.ToString() : arrMntMes + ";" + intTotalMes.ToString());
                                }
                                else
                                {
                                    arrMntMes = (string.IsNullOrEmpty(arrMntMes) ? "0" : arrMntMes + ";0");
                                }
                            }
                            detVenta = null;
                        }

                        if (bVenta)
                        {
                            string[] arrayMntMes = arrMntMes.Split(';');


                            oFactura.Marca        = oRow["cod_marca"].ToString();
                            oFactura.Categoria    = oRow["cod_categoria"].ToString();
                            oFactura.SubCategoria = oRow["cod_subcategoria"].ToString();
                            oFactura.MesUno       = arrayMntMes[0].ToString();
                            oFactura.MesDos       = arrayMntMes[1].ToString();
                            oFactura.MesTres      = arrayMntMes[2].ToString();
                            oFactura.CodRoyalty   = pCodRotalty;
                            oFactura.Royalty      = sRoyalty.ToString();
                            oFactura.Bdi          = sBdi.ToString();
                            oFactura.Periodo      = sPeriodo;

                            double MntRoyUno  = double.Parse(arrayMntMes[0].ToString()) / getValueUsd(arrayMes[0].ToString(), sYear, pCodRotalty);
                            double MntRoyDos  = double.Parse(arrayMntMes[1].ToString()) / getValueUsd(arrayMes[1].ToString(), sYear, pCodRotalty);
                            double MntRoyTres = double.Parse(arrayMntMes[2].ToString()) / getValueUsd(arrayMes[2].ToString(), sYear, pCodRotalty);

                            double MntTotal = MntRoyUno + MntRoyDos + MntRoyTres;

                            oFactura.MontoRoyaltyUsd = (MntTotal * sRoyalty).ToString();

                            double MntDbiUno  = ((double.Parse(arrayMntMes[0].ToString()) / getValueUsd(arrayMes[0].ToString(), sYear, pCodRotalty)) * (sBdi));
                            double MntDbiDos  = ((double.Parse(arrayMntMes[1].ToString()) / getValueUsd(arrayMes[1].ToString(), sYear, pCodRotalty)) * (sBdi));
                            double MntDbiTres = ((double.Parse(arrayMntMes[2].ToString()) / getValueUsd(arrayMes[2].ToString(), sYear, pCodRotalty)) * (sBdi));

                            oFactura.MontoDbiUsd = (MntDbiUno + MntDbiDos + MntDbiTres).ToString();

                            string iSaldo = string.Empty;
                            oFactura.SaldoAdvanceUsd = "0";
                            oFactura.Saldo           = "0";
                            cAdvanceContrato oAdvanceContrato = new cAdvanceContrato(ref oConn);
                            oAdvanceContrato.NumContrato     = hdd_num_contrato.Value;
                            oAdvanceContrato.CodMarca        = oRow["cod_marca"].ToString();
                            oAdvanceContrato.CodCategoria    = oRow["cod_categoria"].ToString();
                            oAdvanceContrato.CodSubCategoria = oRow["cod_subcategoria"].ToString();
                            oAdvanceContrato.Facturado       = true;
                            DataTable dtAdvanceSaldo = oAdvanceContrato.Get();
                            if (dtAdvanceSaldo != null)
                            {
                                if (dtAdvanceSaldo.Rows.Count > 0)
                                {
                                    if (string.IsNullOrEmpty(dtAdvanceSaldo.Rows[0]["saldo"].ToString()))
                                    {
                                        if (double.Parse(oFactura.MontoRoyaltyUsd) > double.Parse(dtAdvanceSaldo.Rows[0]["valor_original"].ToString()))
                                        {
                                            oFactura.SaldoAdvanceUsd = double.Parse(dtAdvanceSaldo.Rows[0]["valor_original"].ToString()).ToString();
                                            oFactura.Saldo           = "0";
                                        }
                                        else
                                        {
                                            if (double.Parse(oFactura.MontoRoyaltyUsd) > 0)
                                            {
                                                oFactura.SaldoAdvanceUsd = double.Parse(oFactura.MontoRoyaltyUsd).ToString();
                                                oFactura.Saldo           = (double.Parse(dtAdvanceSaldo.Rows[0]["valor_original"].ToString()) - double.Parse(oFactura.MontoRoyaltyUsd)).ToString();
                                            }
                                            else
                                            {
                                                oFactura.SaldoAdvanceUsd = "0";
                                                oFactura.Saldo           = "0";
                                            }
                                        }
                                    }
                                    else if (double.Parse(oFactura.MontoRoyaltyUsd) > double.Parse(dtAdvanceSaldo.Rows[0]["saldo"].ToString()))
                                    {
                                        oFactura.SaldoAdvanceUsd = (double.Parse(dtAdvanceSaldo.Rows[0]["saldo"].ToString())).ToString();
                                        oFactura.Saldo           = "0";
                                    }
                                    else
                                    {
                                        if (double.Parse(oFactura.MontoRoyaltyUsd) > 0)
                                        {
                                            oFactura.SaldoAdvanceUsd = double.Parse(oFactura.MontoRoyaltyUsd).ToString();
                                            oFactura.Saldo           = (double.Parse(dtAdvanceSaldo.Rows[0]["saldo"].ToString()) - double.Parse(oFactura.MontoRoyaltyUsd)).ToString();
                                        }
                                        else
                                        {
                                            oFactura.SaldoAdvanceUsd = "0";
                                            oFactura.Saldo           = "0";
                                        }
                                    }
                                }
                            }
                            dtAdvanceSaldo = null;

                            oFactura.FacturaUsd = (double.Parse(oFactura.MontoRoyaltyUsd) + double.Parse(oFactura.MontoDbiUsd) - double.Parse(oFactura.SaldoAdvanceUsd)).ToString();

                            oFactura.AddRow();
                        }
                    }
                }
                dtReporteVenta = null;
                dtProdCont     = null;

                DataTable dtFactura = oFactura.Get();

                RadGrid oGridFractura = new RadGrid();
                oGridFractura.ID                  = "rdGridFactura";
                oGridFractura.ShowStatusBar       = true;
                oGridFractura.ShowFooter          = true;
                oGridFractura.AutoGenerateColumns = false;
                oGridFractura.Skin                = "Sitefinity";
                oGridFractura.ItemDataBound      += oGridFractura_ItemDataBound;
                oGridFractura.ItemCommand        += oGridFractura_ItemCommand;


                oGridFractura.ExportSettings.HideStructureColumns = true;

                oGridFractura.MasterTableView.AutoGenerateColumns      = false;
                oGridFractura.MasterTableView.ShowHeader               = true;
                oGridFractura.MasterTableView.TableLayout              = GridTableLayout.Fixed;
                oGridFractura.MasterTableView.ShowHeadersWhenNoRecords = true;
                oGridFractura.MasterTableView.ShowFooter               = true;
                oGridFractura.MasterTableView.CommandItemDisplay       = GridCommandItemDisplay.Top;
                oGridFractura.MasterTableView.CommandItemSettings.ShowExportToExcelButton = true;
                oGridFractura.MasterTableView.CommandItemSettings.ShowRefreshButton       = false;
                oGridFractura.MasterTableView.CommandItemSettings.ShowAddNewRecordButton  = false;

                GridBoundColumn oGridBoundColumn;
                oGridBoundColumn            = new GridBoundColumn();
                oGridBoundColumn.DataField  = "Marca";
                oGridBoundColumn.HeaderText = "Marca";
                oGridBoundColumn.UniqueName = "Marca";
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn            = new GridBoundColumn();
                oGridBoundColumn.DataField  = "Categoría";
                oGridBoundColumn.HeaderText = "Categoría";
                oGridBoundColumn.UniqueName = "Categoría";
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn            = new GridBoundColumn();
                oGridBoundColumn.DataField  = "Subcategoría";
                oGridBoundColumn.HeaderText = "Subcategoría";
                oGridBoundColumn.UniqueName = "Subcategoría";
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn                             = new GridBoundColumn();
                oGridBoundColumn.DataField                   = sNomMesUno;
                oGridBoundColumn.HeaderText                  = sNomMesUno;
                oGridBoundColumn.UniqueName                  = sNomMesUno;
                oGridBoundColumn.FooterText                  = "Total " + sNomMesUno;
                oGridBoundColumn.DataFormatString            = "{0:N0}";
                oGridBoundColumn.FooterAggregateFormatString = "{0:N0}";
                oGridBoundColumn.Aggregate                   = GridAggregateFunction.Sum;
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn                             = new GridBoundColumn();
                oGridBoundColumn.DataField                   = sNomMesDos;
                oGridBoundColumn.HeaderText                  = sNomMesDos;
                oGridBoundColumn.UniqueName                  = sNomMesDos;
                oGridBoundColumn.FooterText                  = "Total " + sNomMesDos;
                oGridBoundColumn.DataFormatString            = "{0:N0}";
                oGridBoundColumn.FooterAggregateFormatString = "{0:N0}";
                oGridBoundColumn.Aggregate                   = GridAggregateFunction.Sum;
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn                             = new GridBoundColumn();
                oGridBoundColumn.DataField                   = sNomMesTres;
                oGridBoundColumn.HeaderText                  = sNomMesTres;
                oGridBoundColumn.UniqueName                  = sNomMesTres;
                oGridBoundColumn.FooterText                  = "Total " + sNomMesTres;
                oGridBoundColumn.DataFormatString            = "{0:N0}";
                oGridBoundColumn.FooterAggregateFormatString = "{0:N0}";
                oGridBoundColumn.Aggregate                   = GridAggregateFunction.Sum;
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn            = new GridBoundColumn();
                oGridBoundColumn.DataField  = "Royalty (%)";
                oGridBoundColumn.HeaderText = "Royalty (%)";
                oGridBoundColumn.UniqueName = "Royalty (%)";
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn            = new GridBoundColumn();
                oGridBoundColumn.DataField  = "BDI (%)";
                oGridBoundColumn.HeaderText = "BDI (%)";
                oGridBoundColumn.UniqueName = "BDI (%)";
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn            = new GridBoundColumn();
                oGridBoundColumn.DataField  = "Periodo";
                oGridBoundColumn.HeaderText = "Periodo";
                oGridBoundColumn.UniqueName = "Periodo";
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn                             = new GridBoundColumn();
                oGridBoundColumn.DataField                   = "Monto Royalty USD";
                oGridBoundColumn.HeaderText                  = "Monto Royalty USD";
                oGridBoundColumn.UniqueName                  = "Monto Royalty USD";
                oGridBoundColumn.FooterText                  = "Total Royalty USD";
                oGridBoundColumn.DataFormatString            = "{0:N0}";
                oGridBoundColumn.FooterAggregateFormatString = "{0:N0}";
                oGridBoundColumn.Aggregate                   = GridAggregateFunction.Sum;
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn                             = new GridBoundColumn();
                oGridBoundColumn.DataField                   = "Monto BDI USD";
                oGridBoundColumn.HeaderText                  = "Monto BDI USD";
                oGridBoundColumn.UniqueName                  = "Monto BDI USD";
                oGridBoundColumn.FooterText                  = "Total BDI USD";
                oGridBoundColumn.DataFormatString            = "{0:N0}";
                oGridBoundColumn.FooterAggregateFormatString = "{0:N0}";
                oGridBoundColumn.Aggregate                   = GridAggregateFunction.Sum;
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                /*oGridBoundColumn = new GridBoundColumn();
                 * oGridBoundColumn.DataField = "Saldo Advance USD";
                 * oGridBoundColumn.HeaderText = "Saldo Advance USD";
                 * oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);*/

                oGridBoundColumn            = new GridBoundColumn();
                oGridBoundColumn.DataField  = "Saldo Advance USD";
                oGridBoundColumn.HeaderText = "Saldo Advance USD";
                oGridBoundColumn.UniqueName = "Saldo Advance USD";
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridBoundColumn            = new GridBoundColumn();
                oGridBoundColumn.DataField  = "Factura USD";
                oGridBoundColumn.HeaderText = "Factura USD";
                oGridBoundColumn.UniqueName = "Factura USD";
                oGridBoundColumn.FooterText = "Total Factura USD";
                //oGridBoundColumn.DataFormatString = "{0:N0}";
                oGridBoundColumn.FooterAggregateFormatString = "{0:N0}";
                oGridBoundColumn.Aggregate = GridAggregateFunction.Sum;
                oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                oGridFractura.DataSource = dtFactura;
                idGrilla.Visible         = true;
                idGrilla.Controls.Add(oGridFractura);
                idBtnSave.Visible = true;

                ViewState["dtFactura"]         = dtFactura;
                ViewState["arrayMes"]          = arrayMes;
                ViewState["arrayReporteVenta"] = arrayReporteVenta;

                RadAjaxManager oRadAjaxManager = new RadAjaxManager();
                oRadAjaxManager.ClientEvents.OnRequestStart = "onRequestStart";

                AjaxUpdatedControl oAjaxUpdatedControl = new AjaxUpdatedControl();
                oAjaxUpdatedControl.ControlID = "rdGridFactura";

                AjaxSetting oAjaxSetting = new AjaxSetting();
                oAjaxSetting.AjaxControlID = "rdGridFactura";
                oAjaxSetting.UpdatedControls.Add(oAjaxUpdatedControl);

                oRadAjaxManager.AjaxSettings.Add(oAjaxSetting);
                idGrilla.Controls.Add(oRadAjaxManager);
            }
            oConn.Close();
        }
Exemplo n.º 12
0
        /// <summary>
        /// Page_Load handler.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try // try to handle Page_Load
            {
                _ajaxManager = null;

                if ((_ajaxManager = RadAjaxManager.GetCurrent(Page)) == null)
                {
                    _ajaxManager = new RadAjaxManager()
                    {
                        ID = "amEditUser", EnableAJAX = true
                    };
                    {
                        phAjaxManager.Controls.Add(_ajaxManager);
                    }
                }

                var apMainSetting = new AjaxSetting("apMain");
                {
                    apMainSetting.UpdatedControls.Add(new AjaxUpdatedControl("apMain", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apMainSetting);
                    }
                }
                var apScoringActionsSetting = new AjaxSetting("apScoringActions");
                {
                    apScoringActionsSetting.UpdatedControls.Add(new AjaxUpdatedControl("apScoringActions", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apScoringActionsSetting);
                    }
                }
                var apUserBadgesSetting = new AjaxSetting("apUserBadges");
                {
                    apUserBadgesSetting.UpdatedControls.Add(new AjaxUpdatedControl("apUserBadges", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apUserBadgesSetting);
                    }
                }

                if (!IsPostBack)
                {
                    int userId = -1; // define user ID to parse

                    if (Int32.TryParse(Request.QueryString["id"], out userId))
                    {
                        hfId.Value = userId.ToString();

                        if (Int32.TryParse(Request.QueryString["id"], out userId))
                        {
                            _editingUser = UserController.GetUserById(PortalId, userId);
                        }

                        int portalId = PortalId;

                        UserActivity userActivity = UnitOfWork.UserActivities.GetBy(userId, portalId);
                        {
                            decimal activityPoints = (userActivity != null ? userActivity.ActivityPoints : 0);
                            {
                                tbActivityPoints.Text = activityPoints.ToString();
                            }
                        }

                        RebindBadges(userId, portalId);
                    }

                    string backUrl = Request.QueryString["returnUrl"] ?? "/";
                    {
                        btnCancel.NavigateUrl = backUrl;
                    }
                }
            }
            catch (Exception ex) // catch exceptions
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
        protected void getDataInvoceAdvance()
        {
            FacturaAdvance oFactura = new FacturaAdvance();

            oFactura.getMakeTable();

            DBConn oConn = new DBConn();

            if (oConn.Open())
            {
                cAdvanceContrato oAdvanceContrato = new cAdvanceContrato(ref oConn);
                oAdvanceContrato.NumContrato = hdd_num_contrato.Value;
                DataTable dt = oAdvanceContrato.GetForInvoce();
                if (dt != null)
                {
                    foreach (DataRow oRow in dt.Rows)
                    {
                        oFactura.CodMarca        = oRow["cod_marca"].ToString();
                        oFactura.Marca           = oRow["marca"].ToString();
                        oFactura.CodCategoria    = oRow["cod_categoria"].ToString();
                        oFactura.Categoria       = oRow["categoria"].ToString();
                        oFactura.CodSubCategoria = oRow["cod_subcategoria"].ToString();
                        oFactura.SubCategoria    = oRow["subcategoria"].ToString();
                        oFactura.AdvanceUsd      = oRow["valor_original"].ToString();
                        oFactura.AddRow();
                    }

                    DataTable dtFactura = oFactura.Get();

                    RadGrid oGridFractura = new RadGrid();
                    oGridFractura.ID                  = "rdGridFactura";
                    oGridFractura.ShowStatusBar       = true;
                    oGridFractura.ShowFooter          = true;
                    oGridFractura.AutoGenerateColumns = false;
                    oGridFractura.Skin                = "Sitefinity";
                    oGridFractura.ItemDataBound      += oGridFractura_ItemDataBound;
                    oGridFractura.ItemCommand        += oGridFractura_ItemCommand;

                    oGridFractura.ExportSettings.HideStructureColumns = true;

                    oGridFractura.MasterTableView.AutoGenerateColumns      = false;
                    oGridFractura.MasterTableView.ShowHeader               = true;
                    oGridFractura.MasterTableView.TableLayout              = GridTableLayout.Fixed;
                    oGridFractura.MasterTableView.ShowHeadersWhenNoRecords = true;
                    oGridFractura.MasterTableView.ShowFooter               = true;
                    oGridFractura.MasterTableView.CommandItemDisplay       = GridCommandItemDisplay.Top;
                    oGridFractura.MasterTableView.CommandItemSettings.ShowExportToExcelButton = true;
                    oGridFractura.MasterTableView.CommandItemSettings.ShowRefreshButton       = false;
                    oGridFractura.MasterTableView.CommandItemSettings.ShowAddNewRecordButton  = false;

                    GridBoundColumn oGridBoundColumn;
                    oGridBoundColumn            = new GridBoundColumn();
                    oGridBoundColumn.DataField  = "Marca";
                    oGridBoundColumn.HeaderText = "Marca";
                    oGridBoundColumn.UniqueName = "Marca";
                    oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                    oGridBoundColumn            = new GridBoundColumn();
                    oGridBoundColumn.DataField  = "Categoria";
                    oGridBoundColumn.HeaderText = "Categoria";
                    oGridBoundColumn.UniqueName = "Categoria";
                    oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                    oGridBoundColumn            = new GridBoundColumn();
                    oGridBoundColumn.DataField  = "SubCategoria";
                    oGridBoundColumn.HeaderText = "SubCategoria";
                    oGridBoundColumn.UniqueName = "SubCategoria";
                    oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                    oGridBoundColumn                             = new GridBoundColumn();
                    oGridBoundColumn.DataField                   = "Advance USD";
                    oGridBoundColumn.HeaderText                  = "Advance USD";
                    oGridBoundColumn.UniqueName                  = "Advance USD";
                    oGridBoundColumn.FooterText                  = "Total Advance USD";
                    oGridBoundColumn.DataFormatString            = "{0:N0}";
                    oGridBoundColumn.FooterAggregateFormatString = "{0:N0}";
                    oGridBoundColumn.Aggregate                   = GridAggregateFunction.Sum;
                    oGridFractura.MasterTableView.Columns.Add(oGridBoundColumn);

                    oGridFractura.DataSource = dtFactura;
                    idGrilla.Visible         = true;
                    idGrilla.Controls.Add(oGridFractura);
                    idBtnSave.Visible = true;

                    ViewState["FacturaAdvance"] = dtFactura;

                    RadAjaxManager oRadAjaxManager = new RadAjaxManager();
                    oRadAjaxManager.ClientEvents.OnRequestStart = "onRequestStart";

                    AjaxUpdatedControl oAjaxUpdatedControl = new AjaxUpdatedControl();
                    oAjaxUpdatedControl.ControlID = "rdGridFactura";

                    AjaxSetting oAjaxSetting = new AjaxSetting();
                    oAjaxSetting.AjaxControlID = "rdGridFactura";
                    oAjaxSetting.UpdatedControls.Add(oAjaxUpdatedControl);

                    oRadAjaxManager.AjaxSettings.Add(oAjaxSetting);
                    idGrilla.Controls.Add(oRadAjaxManager);
                }
            }
            oConn.Close();
        }
Exemplo n.º 14
0
        /// <summary>
        /// Page_Load handler.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try // try to handle Page_Load
            {
                _ajaxManager = null;

                if ((_ajaxManager = RadAjaxManager.GetCurrent(Page)) == null)
                {
                    _ajaxManager = new RadAjaxManager()
                    {
                        ID = "amMechanics", EnableAJAX = true
                    };
                    {
                        plhAjaxManager.Controls.Add(_ajaxManager);
                    }
                }

                var apAssignmentas = new AjaxSetting("apAssignment");
                {
                    apAssignmentas.UpdatedControls.Add(new AjaxUpdatedControl("apAssignment", "alpMechanics"));
                    {
                        _ajaxManager.AjaxSettings.Add(apAssignmentas);
                    }
                }

                var grActivitiesas = new AjaxSetting("grActivities");
                {
                    grActivitiesas.UpdatedControls.Add(new AjaxUpdatedControl("grActivities", "alpMechanics"));
                    {
                        _ajaxManager.AjaxSettings.Add(grActivitiesas);
                    }
                }
                var grBadgesas = new AjaxSetting("grBadges");
                {
                    grBadgesas.UpdatedControls.Add(new AjaxUpdatedControl("grBadges", "alpMechanics"));
                    {
                        _ajaxManager.AjaxSettings.Add(grBadgesas);
                    }
                }
                var grAssignmentas = new AjaxSetting("grAssignment");
                {
                    grAssignmentas.UpdatedControls.Add(new AjaxUpdatedControl("grAssignment", "alpMechanics"));
                    {
                        _ajaxManager.AjaxSettings.Add(grAssignmentas);
                    }
                }

                if (!IsPostBack)
                {
                    LoadgrActivities("Name", SortDirection.Ascending);
                    loadgrBadges();
                    //loadgrdAssignment("UserName", SortDirection.Ascending);
                    string returnUrl = HttpContext.Current.Request.RawUrl;
                    {
                        hlAddBadge.NavigateUrl = GetControlUrl("EditBadge", "mid=" + ModuleId, "returnUrl=" + returnUrl);
                    }
                }
            }
            catch (Exception ex) // catch exceptions
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// Page_Load hadler.
        /// </summary>
        protected void Page_Load(object sender, EventArgs e)
        {
            try // try to handle Page_Load
            {
                _ajaxManager = null;

                if ((_ajaxManager = RadAjaxManager.GetCurrent(Page)) == null)
                {
                    _ajaxManager = new RadAjaxManager()
                    {
                        ID = "amEditBadge", EnableAJAX = true
                    };
                    {
                        phAjaxManager.Controls.Add(_ajaxManager);
                    }
                }

                var apMainSetting = new AjaxSetting("apMain");
                {
                    apMainSetting.UpdatedControls.Add(new AjaxUpdatedControl("apMain", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apMainSetting);
                    }
                }
                var apActivitiesSetting = new AjaxSetting("apActivities");
                {
                    apActivitiesSetting.UpdatedControls.Add(new AjaxUpdatedControl("apActivities", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apActivitiesSetting);
                    }
                }
                var apSelectorSetting = new AjaxSetting("apSelector");
                {
                    apSelectorSetting.UpdatedControls.Add(new AjaxUpdatedControl("apSelector", "alpMain"));
                    {
                        _ajaxManager.AjaxSettings.Add(apSelectorSetting);
                    }
                }

                if (!IsPostBack)
                {
                    int badgeId = -1; Badge badge = null;

                    ddlUnit.Items.Insert(0, new ListItem("Not expire", "-1"));
                    {
                        Session[ROWS_OBJECT] = new List <BadgeActivityRow>();
                    }

                    var activities = UnitOfWork.Activities.GetAll();
                    {
                        ddlActivities.DataSource = activities.OrderBy(d => d.DisplayName);
                        {
                            ddlActivities.DataBind();
                        }
                    }

                    if (Int32.TryParse(Request.QueryString["id"], out badgeId))
                    {
                        hfId.Value = badgeId.ToString();

                        if ((_editingBadge = (badge = UnitOfWork.Badges.GetBy(badgeId))) == null)
                        {
                            throw new NullReferenceException(String.Format("Badge {0} is not found", badgeId));
                        }

                        tbName.Text = badge.Name; tbDescription.Text = badge.Description;
                        {
                            fsBadgeImage.FileID = badge.ImageFileId; // define badge image file
                        }

                        foreach (var activity in UnitOfWork.BadgeActivities.GetManyBy(badgeId))
                        {
                            (Session[ROWS_OBJECT] as List <BadgeActivityRow>).Add(new BadgeActivityRow(activity, RowState.Existing));
                        }

                        if (badge.ExpirationQuantity.HasValue && badge.ExpirationUnit.HasValue)
                        {
                            tbQuantity.Text = badge.ExpirationQuantity.ToString();
                            {
                                int unit = badge.ExpirationUnit.Value; ddlUnit.SelectedValue = unit.ToString();
                            }
                        }

                        rptBadgeActivities.DataBind();
                    }

                    string returnUrl = Request.QueryString["returnUrl"] ?? "/";
                    {
                        btnCancel.NavigateUrl = returnUrl; // bind cancel button return url
                    }
                }
            }
            catch (Exception ex) // catch exceptions
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }