/// <devdoc>
        /// Walks up the stack of NamingContainers starting at 'control' to find a control with the ID 'controlID'.
        /// Important : Note that the search is never done on the 'control' itself by this method.
        /// </devdoc>
        public static Control FindControl(Control control, string controlID) {
            Debug.Assert(control != null, "control should not be null");
            Debug.Assert(!String.IsNullOrEmpty(controlID), "controlID should not be empty");
            Control currentContainer = control;
            Control foundControl = null;

            if (control == control.Page) {
                // If we get to the Page itself while we're walking up the
                // hierarchy, just return whatever item we find (if anything)
                // since we can't walk any higher.
                return control.FindControl(controlID);
            }

            while (foundControl == null && currentContainer != control.Page) {
                currentContainer = currentContainer.NamingContainer;
                if (currentContainer == null) {
                    throw new HttpException(SR.GetString(SR.DataBoundControlHelper_NoNamingContainer, control.GetType().Name, control.ID));
                }
                foundControl = currentContainer.FindControl(controlID);
            }

            return foundControl;
        }
Example #2
0
        protected void dtgRendiciones_ItemDataBound1(object sender, DataGridItemEventArgs e)
        {
            Control      container = e.Item;
            ListItemType itemType  = e.Item.ItemType;

            // Reviso si estoy en el detalle de items
            if (itemType == ListItemType.Item || itemType == ListItemType.AlternatingItem)
            {
                // Estoy en el detalle de items
                if (e.Item.DataItem == null)
                {
                    return;
                }
                // Busco la subgrilla y la configuro
                DataGrid dtgGuias;
                dtgGuias = (DataGrid)container.FindControl("dtgGuias");
                AdministrarGrillas.Configurar(dtgGuias, "GuiaID", 10, true, true);
                dtgGuias.ShowFooter  = false;
                dtgGuias.AllowPaging = dtgGuias.AllowPaging;
                string agenciaOrigenID = String.Empty;
                string NroRendicion    = String.Empty;

                if (null != dtgGuias)
                {
                    // Cargo los datos en los controles
                    Label lblAgenciaOrigenID = (Label)e.Item.FindControl("lblUsuario");
                    agenciaOrigenID = lblAgenciaOrigenID.Text.Trim();

                    Label lblNroRendicion = (Label)e.Item.FindControl("lblNroRendicion");
                    NroRendicion = lblNroRendicion.Text.Trim();

                    DsReporteRendicionUsuario dsGuiasTDE = (DsReporteRendicionUsuario)Session["dsGuias"];

                    HtmlImage btnExpandButton = (HtmlImage)container.FindControl("imageRendicion_");


                    // Cargo el script para mostrar y ocultar la subgrilla
                    if ((e.Item.ItemIndex + 3) < 10)
                    {
                        if (btnExpandButton != null)
                        {
                            btnExpandButton.Attributes.Add("OnClick",
                                                           "Toggle('dtgRendiciones_ctl0" + (e.Item.ItemIndex + 3) + "_divGuias', 'dtgRendiciones_ctl0" + (e.Item.ItemIndex + 3) + "_imageRendicion_');window.document.getElementById('txtUnidadVentaID').value='" + agenciaOrigenID + "';window.document.getElementById('txtUnidadVentaIDI').value=" + NroRendicion + ";");
                        }

                        script += "if (param != 'dtgRendiciones_ctl0" + (e.Item.ItemIndex + 3) + "_divGuias'){";
                        script += "document.all['dtgRendiciones_ctl0" + (e.Item.ItemIndex + 3) + "_divGuias'].style.display = 'none';";
                        script += "document.all['dtgRendiciones_ctl0" + (e.Item.ItemIndex + 3) + "_imageRendicion_'].src = 'Images/plus.gif';}";
                        script += "else\n";
                        script += "document.all['dtgRendiciones_ctl0" + (e.Item.ItemIndex + 3) + "_imageRendicion_'].src = 'Images/minus.gif';";
                    }
                    else
                    {
                        if (btnExpandButton != null)
                        {
                            btnExpandButton.Attributes.Add("OnClick",
                                                           "Toggle('dtgRendiciones_ctl" + (e.Item.ItemIndex + 3) + "_divGuias', 'dtgRendiciones_ctl" + (e.Item.ItemIndex + 3) + "_imageRendicion_');window.document.getElementById('txtUnidadVentaID').value='" + agenciaOrigenID + "';window.document.getElementById('txtUnidadVentaIDI').value=" + NroRendicion + ";");
                        }
                        script += "if (param != 'dtgRendiciones_ctl" + (e.Item.ItemIndex + 3) + "_divGuias'){";
                        script += "document.all['dtgRendiciones_ctl" + (e.Item.ItemIndex + 3) + "_divGuias'].style.display = 'none';";
                        script += "document.all['dtgRendiciones_ctl" + (e.Item.ItemIndex + 3) + "_imageRendicion_'].src = 'Images/plus.gif';}";
                        script += "else\n";
                        script += "document.all['dtgRendiciones_ctl" + (e.Item.ItemIndex + 3) + "_imageRendicion_'].src = 'Images/minus.gif';";
                    }

                    dtgGuias.PageIndexChanged += new System.Web.UI.WebControls.DataGridPageChangedEventHandler(PaginarInternoAg);

                    dtgGuias.DataSource = dsGuiasTDE.Datos.Select("usuario = '" + agenciaOrigenID + "' and NroRendicion = " + NroRendicion);
                    dtgGuias.DataBind();
                }
            }
        }
Example #3
0
        /// <summary>
        /// Gets the field control from the control that was added using the CreateControl method
        /// </summary>
        /// <param name="attributeControl">The attribute control.</param>
        /// <returns></returns>
        public Control GetControl(Control attributeControl)
        {
            var id = $"attribute_field_{Id}";

            return(attributeControl.ID == id ? attributeControl : attributeControl.FindControl(id));
        }
Example #4
0
        //FUNCION PARA GRABAR LA ORDEN
        protected void Grabar_Orden(Object Sender, EventArgs e)
        {
            grabar.Enabled = false;
            Utils.MostrarAlerta(Response, "Grabación de la Orden. Acepte, espere e imprima los formatos !!!");

            ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            //A continuacion cargamos los controles que contienen los datos necesarios para grabar la orden de trabajo en la base de datos
            Control controlDatosOrden       = datosOrigen.Controls[0];
            Control controlDatosVehiculo    = datosVehiculo.Controls[0];
            Control controlDatosPropietario = datosPropietario.Controls[0];
            Control controlKitsCombos       = kitsCombos.Controls[0];
            Control controlPeritaje         = operacionesPeritaje.Controls[0];

            //Aun falta por revisar si hubo cambio de PROPIETARIO, cuando hay cambio de dueño debemos actualizar mcatalogovehiculo
            string nit         = ((TextBox)controlDatosPropietario.FindControl("datos")).Text;
            string contacto    = ((TextBox)controlDatosPropietario.FindControl("contacto")).Text;
            string vin         = ((TextBox)controlDatosVehiculo.FindControl("identificacion")).Text;
            string tipoUsuario = DBFunctions.SingleData("SELECT tpro_codigo FROM tpropietariotaller WHERE tpro_nombre='" + ((RadioButtonList)controlDatosPropietario.FindControl("tipoCliente")).SelectedItem.ToString().Trim() + "'");

            if (DBFunctions.SingleData("SELECT mnit_nit FROM mcatalogovehiculo WHERE mcat_vin='" + vin + "'") != nit && tipoUsuario == "P")
            {
                DBFunctions.NonQuery("UPDATE mcatalogovehiculo SET mnit_nit='" + nit + "' WHERE mcat_vin='" + vin + "'");
            }

            //Ahora vamos a revisar si la orden de trabajo viene por parte de un seguro, o por cualquiera de los dos tipos de garantia
            string cargo = ((DropDownList)controlDatosOrden.FindControl("cargo")).SelectedValue;

            //
            if (cargo == "S")
            {
                cargoGrabar = new ArrayList();
                cargoGrabar.Add("seguro");
                cargoGrabar.Add(((TextBox)controlDatosVehiculo.FindControl("nitAseguradora")).Text);
                cargoGrabar.Add(((TextBox)controlDatosVehiculo.FindControl("siniestro")).Text);
                cargoGrabar.Add(Convert.ToDouble(((TextBox)controlDatosVehiculo.FindControl("porcentajeDeducible")).Text.Trim()).ToString());
                cargoGrabar.Add(Convert.ToDouble(((TextBox)controlDatosVehiculo.FindControl("valorMinDeducible")).Text.Trim()).ToString());
                cargoGrabar.Add(((TextBox)controlDatosVehiculo.FindControl("numeroAutorizacionAsegura")).Text);
            }
            else if (cargo == "G")
            {
                cargoGrabar = new ArrayList();
                cargoGrabar.Add("garantia");
                cargoGrabar.Add(((TextBox)controlDatosVehiculo.FindControl("nitCompania")).Text);
                cargoGrabar.Add(((TextBox)controlDatosVehiculo.FindControl("numeroAutorizacionGarant")).Text);
            }
            else
            {
                cargoGrabar = null;
            }
            //////////////////////////////////////////////////////////////////////////////////////////////////////////I
            //////////////////////////////////////////////////////////////////////////////////////////////////////////
            // Fin de revision de los cargos de la orden
            // Se llenan los datables que van a ser enviados a la clase de Orden en el contructor
            if (!Distribuir_Tablas(((DataGrid)controlKitsCombos.FindControl("kitsOperaciones")), DBFunctions.SingleData("SELECT pdoc_codigo FROM pdocumento WHERE pdoc_nombre='" + ((DropDownList)controlDatosOrden.FindControl("tipoDocumento")).SelectedItem.ToString() + "'"), ((TextBox)controlDatosOrden.FindControl("numOrden")).Text.Trim()) && (!Distribuir_Tablas_Repuestos()))
            {
                Orden      miOrden      = null;
                Cotizacion miCotizacion = new Cotizacion();
                //string tipoTrabajo = DBFunctions.SingleData("SELECT ttra_codigo FROM ttrabajoorden WHERE ttra_nombre='" + ((DropDownList)controlDatosOrden.FindControl("servicio")).SelectedItem.ToString().Trim() + "'");
                string tipoTrabajo = ((DropDownList)controlDatosOrden.FindControl("servicio")).SelectedValue;
                if (tipoTrabajo == "P" || tipoTrabajo == "C")
                {
                    int         cantidadGrillas = System.Convert.ToInt32(Session["cantidadGrillas"]);
                    DataTable[] tablasAsociadas;
                    tablasAsociadas = new DataTable[cantidadGrillas];
                    for (int i = 0; i < cantidadGrillas; i++)
                    {
                        tablasAsociadas[i] = ((DataTable[])Session["tablasAsociadas"])[i].Copy();
                    }
                    Distribuir_Tabla_Peritaje(((PlaceHolder)controlPeritaje.FindControl("gruposPeritaje")),
                                              tablasAsociadas,
                                              ((ArrayList)Session["codigosGruposPeritaje"]),
                                              cantidadGrillas,
                                              DBFunctions.SingleData("SELECT pdoc_codigo FROM pdocumento WHERE pdoc_nombre='" + ((DropDownList)controlDatosOrden.FindControl("tipoDocumento")).SelectedItem.ToString() + "'"),
                                              ((TextBox)controlDatosOrden.FindControl("numOrden")).Text.Trim());

                    bool grabarTransferencias = tipoTrabajo == "P"; // cuando es peritaje si, cuando es cotización no

                    if (tipoTrabajo == "P")
                    {
                        miOrden = new Orden(operacionesGrabar, accesoriosGrabar, operacionesPeritajeGrabar, cargoGrabar, grabarTransferencias);
                    }
                    else
                    {
                        miOrden = new Orden(operacionesGrabar, accesoriosGrabar, operacionesPeritajeGrabar, cargoGrabar, repuestosGrabar, grabarTransferencias);
                    }
                }
                else
                {
                    miOrden = new Orden(operacionesGrabar, accesoriosGrabar, repuestosGrabar, cargoGrabar);
                }
                //En caso que sea una orden de trabajo la grabamos aqui
                miOrden.CodigoPrefijo            = DBFunctions.SingleData("SELECT pdoc_codigo FROM pdocumento WHERE pdoc_nombre='" + ((DropDownList)controlDatosOrden.FindControl("tipoDocumento")).SelectedItem.ToString() + "'");
                miOrden.NumeroOrden              = ((TextBox)controlDatosOrden.FindControl("numOrden")).Text.Trim();
                miOrden.Catalogo                 = ((DropDownList)controlDatosVehiculo.FindControl("modelo")).SelectedValue;
                miOrden.VinIdentificacion        = ((TextBox)controlDatosVehiculo.FindControl("identificacion")).Text;
                miOrden.NitPropietario           = ((TextBox)controlDatosPropietario.FindControl("datos")).Text;
                miOrden.TipoUsuario              = tipoUsuario;
                miOrden.EstadoOrden              = "E";
                miOrden.Cargo                    = ((DropDownList)controlDatosOrden.FindControl("cargo")).SelectedValue;
                miOrden.TipoTrabajo              = tipoTrabajo;
                miOrden.FechaEntrada             = ((TextBox)controlDatosOrden.FindControl("fecha")).Text.Trim();
                miOrden.HoraEntrada              = ((TextBox)controlDatosOrden.FindControl("hora")).Text.Trim() + ":" + ((TextBox)controlDatosOrden.FindControl("minutos")).Text.Trim();
                miOrden.FechaHoraCreacion        = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                miOrden.FechaEntrega             = UtilitarioPlanning.ValidarParametrosFecha(Convert.ToDateTime(((TextBox)controlKitsCombos.FindControl("fechaEstimada")).Text)).ToString("yyyy-MM-dd");
                miOrden.HoraEntrega              = ((TextBox)controlKitsCombos.FindControl("horaEstimada")).Text;
                miOrden.Salida                   = "NULL";
                miOrden.NumeroEntrada            = "1";
                miOrden.Kilometraje              = System.Convert.ToDouble(((TextBox)controlDatosVehiculo.FindControl("kilometraje")).Text.Trim()).ToString();
                miOrden.Recepcionista            = DBFunctions.SingleData("SELECT pven_codigo FROM pvendedor WHERE pven_nombre='" + ((DropDownList)controlDatosOrden.FindControl("codigoRecep")).SelectedItem.ToString().Trim() + "'");
                miOrden.Taller                   = DBFunctions.SingleData("SELECT palm_almacen FROM palmacen WHERE tvig_vigencia='V' and palm_descripcion='" + ((DropDownList)controlDatosOrden.FindControl("almacen")).SelectedItem.ToString().Trim() + "'");
                miOrden.EstadoPrecios            = "A";
                miOrden.NumeroLocker             = "1";
                miOrden.EstadoLiquidacion        = "L";
                miOrden.NivelCombustible         = "1";
                miOrden.ObsrCliente              = ((TextBox)controlDatosOrden.FindControl("obsrCliente")).Text;
                miOrden.ObsrRecepcionista        = ((TextBox)controlDatosOrden.FindControl("obsrRecep")).Text;
                miOrden.ListaPrecios             = DBFunctions.SingleData("SELECT ppreta_codigo FROM ppreciotaller WHERE ppreta_nombre='" + ((DropDownList)controlDatosOrden.FindControl("listaPrecios")).SelectedItem.ToString().Trim() + "'");
                miOrden.TipoPago                 = DBFunctions.SingleData("SELECT ttip_codigo FROM ttipopago WHERE ttip_nombre='" + ((DropDownList)controlDatosPropietario.FindControl("tipoPago")).SelectedItem.ToString() + "'");
                miOrden.CodigoEstadoCita         = ((Label)controlDatosOrden.FindControl("lbEstCita")).Text.Trim();
                miOrden.NitTransferencia         = DBFunctions.SingleData("SELECT pnital_nittaller FROM pnittaller WHERE palm_almacen='" + miOrden.Taller + "' fetch first row only");
                miOrden.TipoTransferencia        = ((DropDownList)controlDatosOrden.FindControl("tipoPedido")).SelectedValue;
                miOrden.PrefijoTransferencia     = DBFunctions.SingleData("SELECT pdoc_codigo FROM pdocumento WHERE tdoc_tipodocu='TT' fetch first row only"); // debería parametrizarse en el web.config
                miOrden.TotalTransferencia       = this.Calcular_Total_Transferencia();
                miOrden.TotalTransferenciaSinIVA = this.Calcular_Total_Transferencia_SinIVA();
                miOrden.AlmacenTransferencia     = DBFunctions.SingleData("SELECT palm_almacen FROM palmacen WHERE tvig_vigencia='V' and pcen_centinv is not null fetch first row only"); // debería parametrizarse en el web.config
                miOrden.KitsAplicados            = (ArrayList)Session["escogidos2"];
                miOrden.Contacto                 = contacto;
                miOrden.AceptaEncuesta           = true;
                miOrden.RevisionElevador         = true;
                miOrden.EntregoPresupuesto       = true;

                if (grabar.Text == "Guardar Modificación")
                {
                    if (miOrden.Actualizar_Orden_Trabajo(true))
                    {
                        Utils.MostrarAlerta(Response, "La orden ha sido actualizada");
                    }
                    else
                    {
                        lb.Text = miOrden.ProcessMsg;
                    }
                }
                else if (grabar.Text == "Guardar Orden Preliquidada")
                {
                    if (miOrden.Actualizar_Orden_Trabajo(false))
                    {
                        lb.Text = miOrden.ProcessMsg;
                    }
                    else
                    {
                        lb.Text = miOrden.ProcessMsg;
                    }
                }

                else if (miOrden.CommitValues())
                {
                    string numPedido        = DBFunctions.SingleData("Select MPED_NUMERO from DBXSCHEMA.MPEDIDOTRANSFERENCIA where MORD_NUMEORDE=" + miOrden.NumeroOrden + " AND PPED_CODIGO='" + miOrden.TipoTransferencia + "';");
                    string numTransferencia = DBFunctions.SingleData("Select MFAC_NUMERO from DBXSCHEMA.MORDENTRANSFERENCIA where MORD_NUMEORDE=" + miOrden.NumeroOrden + " AND PDOC_FACTURA='" + miOrden.PrefijoTransferencia + "';");
                    string presupuesto      = miOrden.EntregoPresupuesto ? "S" : "N";
                    lb.Text = "<br>BIEN : " + miOrden.ProcessMsg;
                    Session.Clear();
                    Response.Redirect("" + indexPage + "?process=Automotriz.OrdenTrabajoCotizaciones&prefOT=" + miOrden.CodigoPrefijo + "&numOT=" + miOrden.NumeroOrden + "&prefTRA=" + miOrden.PrefijoTransferencia + "&numTRA=" + numTransferencia + "&tipoPED=" + miOrden.TipoTransferencia + "&numPED=" + numPedido + "&pres=" + presupuesto);
                }
                else
                {
                    lb.Text += "<br>MAL :" + miOrden.ProcessMsg;
                }
            }
            else
            {
                Utils.MostrarAlerta(Response, "Existe Algun Elemento Repetido, Por Favor Verifique las Tablas");
            }
        }
        protected void Add(object sender, EventArgs e)
        {
            try
            {
                //if (GetPermission[3].ToString() == "True")
                //{
                if ((Session["CompanyCode"] != null) && (Session["OCode"] != null))
                {
                    Listvch_Details objList = new Listvch_Details();
                    Control         control = null;

                    if (dtg_ACT.FooterRow != null)
                    {
                        control = dtg_ACT.FooterRow;
                    }
                    else
                    {
                        control = dtg_ACT.Controls[0].Controls[0];
                    }

                    objList.Voucher_Details_ID = CurrentID;
                    objList.Nature             = Convert.ToString((control.FindControl("cmbNature") as DropDownList).Text);
                    objList.Ledger_Code        = Convert.ToString(Session["LedgerCode"]);
                    objList.Particulars        = Convert.ToString((control.FindControl("txtParticulars") as TextBox).Text);
                    objList.ChequeNo           = Convert.ToString((control.FindControl("txtChequeNo") as TextBox).Text);
                    objList.Debit  = Convert.ToDouble((control.FindControl("txtDebit") as TextBox).Text);
                    objList.Credit = Convert.ToDouble((control.FindControl("txtCredit") as TextBox).Text);

                    if (Session["LedgerCode"] != null)
                    {
                        objVch_List.Add(objList);
                        CurrentID = CurrentID + 1;

                        Session["entries_cv"] = objVch_List;

                        this.BindListData();
                        GrandTotal_Dr();
                        GrandTotal_Cr();
                        Session["LedgerCode"]       = null;
                        this.messagePanel.Visible   = true;
                        lblMessage.Text             = "Ledger Added to List!!";
                        this.messagePanel.BackColor = Color.Green;
                        this.lblMessage.ForeColor   = Color.White;
                    }
                    else
                    {
                        this.messagePanel.Visible   = true;
                        lblMessage.Text             = "Unable to add with Empty Ledger!!";
                        this.messagePanel.BackColor = Color.Red;
                        this.lblMessage.ForeColor   = Color.White;
                    }
                }
                else
                {
                    Response.Redirect("..\\..\\Default.aspx");
                }
                //}
                //else
                //{
                //    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "User Permission", "alert('You don't have permission to access this page!!)');", true);
                //    HttpContext.Current.Response.Redirect("..\\UI_Utilities\\DeniedPage.aspx");
                //}
            }
            catch (Exception ex)
            {
                this.messagePanel.Visible   = true;
                this.lblMessage.Text        = ex.Message.ToString();
                this.messagePanel.BackColor = Color.Red;
                this.lblMessage.ForeColor   = Color.White;
            }
        }
        protected void Rep_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            string sql = "";

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                StringBuilder sb   = new StringBuilder();
                Control       ctrl = e.Item.Controls[0];
                Literal       lit  = (Literal)ctrl.FindControl("LitColnums");
                if (lit != null)
                {
                    // sql = "select Code,MC from a_eke_sysModelItems where ModelID='" + modelid + "' and delTag=0 and Custom=0 order by PX";
                    //lit.Text = eOleDB.getOptions(sql, "MC", "Code", DataBinder.Eval(e.Item.DataItem, "Code").ToString());
                    DataTable     dt  = getColumns(dr["code"].ToString());
                    StringBuilder _sb = new StringBuilder();
                    foreach (DataRow _dr in dt.Rows)
                    {
                        _sb.Append("<option value=\"" + _dr["code"].ToString() + "\"" + (_dr["code"].ToString().ToLower() == DataBinder.Eval(e.Item.DataItem, "Code").ToString().ToLower() ? " selected" : "") + ">" + _dr["mc"].ToString() + "</option>");
                    }
                    lit.Text = _sb.ToString();
                }

                lit = (Literal)ctrl.FindControl("LitObjects");
                #region 绑定对象
                if (lit != null)
                {
                    for (int i = 0; i < AllTables.Rows.Count; i++)
                    {
                        sb.Append("<option value=\"" + AllTables.Rows[i]["name"].ToString() + "\"" + (DataBinder.Eval(e.Item.DataItem, "BindObject").ToString() == AllTables.Rows[i]["name"].ToString() ? " selected" : "") + " title=\"" + AllTables.Rows[i]["name"].ToString() + "\">" + AllTables.Rows[i]["name"].ToString() + "</option>\r\n");
                    }
                    lit.Text = sb.ToString();
                    if (DataBinder.Eval(e.Item.DataItem, "BindObject").ToString().Length > 0)
                    {
                        lit = (Literal)ctrl.FindControl("LitValue");
                        if (lit != null)
                        {
                            sql      = "select b.name from sysobjects a inner join  syscolumns b on a.id=b.id where a.name='" + DataBinder.Eval(e.Item.DataItem, "BindObject").ToString() + "' order by b.colid";//b.colid";
                            lit.Text = eOleDB.getOptions(sql, "name", "name", DataBinder.Eval(e.Item.DataItem, "BindValue").ToString());

                            lit = (Literal)ctrl.FindControl("LitText");
                            if (lit != null)
                            {
                                lit.Text = eOleDB.getOptions(sql, "name", "name", DataBinder.Eval(e.Item.DataItem, "BindText").ToString());
                            }
                        }
                    }
                }
                #endregion
                #region  项
                lit = (Literal)ctrl.FindControl("LitOptions");
                if (lit != null)
                {
                    //HtmlControl hc = (HtmlControl)ctrl.FindControl("spanbind");
                    HtmlGenericControl hc = (HtmlGenericControl)ctrl.FindControl("spanbind");
                    if (hc != null)
                    {
                        //hc.Attributes.Add("style","border:1px solid #ff0000");
                        //Response.Write("has<br>");
                    }
                    sb  = new StringBuilder();
                    sql = "select ModelConditionItemID,mc,conditionvalue,px from a_eke_sysModelConditionItems where ModelConditionID='" + DataBinder.Eval(e.Item.DataItem, "ModelConditionID").ToString() + "' and delTag=0 order by px,addTime ";
                    DataTable tb = eOleDB.getDataTable(sql);
                    // sb.Append("<a href=\"?act=addconditem&modelid=" + modelid + "&cid=" + DataBinder.Eval(e.Item.DataItem, "ModelConditionID").ToString() + "\">添加选项</a><br>");


                    sb.Append("<table id=\"eDataTable\" class=\"eDataTable\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" widt5h=\"100%\">");
                    sb.Append("<thead>");
                    sb.Append("<tr>");
                    sb.Append("<td height=\"25\" width=\"30\" bgc3olor=\"#ffffff\" align=\"center\"><a title=\"添加选项\" href=\"javascript:;\" onclick=\"addModelConditionItem(this,'" + DataBinder.Eval(e.Item.DataItem, "ModelConditionID").ToString() + "');\"><img width=\"16\" height=\"16\" src=\"images/add.jpg\" border=\"0\"></a></td>");
                    sb.Append("<td width=\"110\">&nbsp;选项名称</td>");
                    sb.Append("<td width=\"150\">&nbsp;条件</td>");
                    sb.Append("<td width=\"60\">&nbsp;显示顺序</td>");
                    sb.Append("</tr>");
                    sb.Append("</thead>");
                    if (tb.Rows.Count > 0)
                    {
                        if (hc != null)
                        {
                            hc.Attributes.Add("style", "display:none;");
                        }
                        for (int i = 0; i < tb.Rows.Count; i++)
                        {
                            sb.Append("<tr" + ((i + 1) % 2 == 0 ? " class=\"alternating\" eclass=\"alternating\"" : " eclass=\"\"") + " onmouseover=\"this.className='cur';\" onmouseout=\"this.className=this.getAttribute('eclass');\">");
                            sb.Append("<td height=\"32\" align=\"center\"><a title=\"删除选项\" href=\"javascript:;\" onclick=\"delModelConditionItem(this,'" + tb.Rows[i]["ModelConditionItemID"].ToString() + "');\"><img width=\"16\" height=\"16\" src=\"images/del.jpg\" border=\"0\"></a></td>");
                            sb.Append("<td><input type=\"text\" value=\"" + tb.Rows[i]["mc"].ToString() + "\" oldvalue=\"" + tb.Rows[i]["mc"].ToString() + "\" class=\"edit\"  onBlur=\"setModelConditionItem(this,'" + tb.Rows[i]["ModelConditionItemID"].ToString() + "','mc');\" /></td>");
                            sb.Append("<td><input type=\"text\" value=\"" + tb.Rows[i]["conditionvalue"].ToString() + "\" oldvalue=\"" + tb.Rows[i]["conditionvalue"].ToString() + "\" class=\"edit\"  onBlur=\"setModelConditionItem(this,'" + tb.Rows[i]["ModelConditionItemID"].ToString() + "','conditionvalue');\" /></td>");
                            sb.Append("<td><input reload=\"true\" type=\"text\" value=\"" + (tb.Rows[i]["px"].ToString() == "999999" || tb.Rows[i]["px"].ToString() == "0" ? "" : tb.Rows[i]["px"].ToString()) + "\" oldvalue=\"" + (tb.Rows[i]["px"].ToString() == "999999" || tb.Rows[i]["px"].ToString() == "0" ? "" : tb.Rows[i]["px"].ToString()) + "\" class=\"edit\"  onBlur=\"setModelConditionItem(this,'" + tb.Rows[i]["ModelConditionItemID"].ToString() + "','px');\" /></td>");
                            sb.Append("</tr>");
                        }
                    }
                    sb.Append("</table>");

                    lit.Text = sb.ToString();
                }
                #endregion
            }
        }
Example #7
0
        protected void ctrl_Benef_Load(object sender, EventArgs e)
        {
            Glass.UI.Web.Controls.ctrlBenef benef = (Glass.UI.Web.Controls.ctrlBenef)sender;
            GridViewRow linhaControle             = benef.Parent.Parent as GridViewRow;

            Control dtvPedido = linhaControle.Parent;

            while (dtvPedido.ID != "mainTable")
            {
                dtvPedido = dtvPedido.Parent;
            }

            dtvPedido = dtvPedido.FindControl("dtvPedido");

            var tipoPedido = PedidoDAO.Instance.GetTipoPedido(null, Conversoes.StrParaUint(Request["idPedido"]));

            Control codProd = null;

            if (linhaControle.FindControl("lblChild_CodProdComposicaoIns") != null)
            {
                codProd = linhaControle.FindControl("lblChild_CodProdComposicaoIns");
            }
            else
            {
                codProd = linhaControle.FindControl("txtChild_CodProdComposicaoIns");
            }

            TextBox     txtAltura       = (TextBox)linhaControle.FindControl("txtChild_AlturaComposicaoIns");
            TextBox     txtEspessura    = (TextBox)linhaControle.FindControl("txtChild_EspessuraComposicao");
            TextBox     txtLargura      = (TextBox)linhaControle.FindControl("txtChild_LarguraComposicaoIns");
            HiddenField hdfPercComissao = (HiddenField)dtvPedido.FindControl("hdfPercComissao");
            TextBox     txtQuantidade   = (TextBox)linhaControle.FindControl("txtChild_QtdeComposicaoIns");
            HiddenField hdfTipoEntrega  = (HiddenField)dtvPedido.FindControl("hdfTipoEntrega");

            HiddenField hdfTotalM2 = null;

            if (!Beneficiamentos.UsarM2CalcBeneficiamentos)
            {
                if (linhaControle.FindControl("hdfChild_TotMComposicao") != null)
                {
                    hdfTotalM2 = (HiddenField)linhaControle.FindControl("hdfChild_TotMComposicao");
                }
                else if (linhaControle.FindControl("hdfChild_TotM2ComposicaoIns") != null)
                {
                    hdfTotalM2 = (HiddenField)linhaControle.FindControl("hdfChild_TotM2ComposicaoIns");
                }
            }
            else
            {
                if (linhaControle.FindControl("hdfChild_TotM2CalcComposicao") != null)
                {
                    hdfTotalM2 = (HiddenField)linhaControle.FindControl("hdfChild_TotM2CalcComposicao");
                }
                else if (linhaControle.FindControl("hdfChild_TotM2CalcComposicaoIns") != null)
                {
                    hdfTotalM2 = (HiddenField)linhaControle.FindControl("hdfChild_TotM2CalcComposicaoIns");
                }
            }

            TextBox     txtValorIns   = (TextBox)linhaControle.FindControl("txtChild_ValorComposicaoIns");
            HiddenField hdfCliRevenda = (HiddenField)dtvPedido.FindControl("hdfCliRevenda");
            HiddenField hdfIdCliente  = (HiddenField)dtvPedido.FindControl("hdfIdCliente");
            HiddenField hdfCustoProd  = (HiddenField)linhaControle.FindControl("hdfChild_CustoProdComposicao");

            benef.CampoAltura             = txtAltura;
            benef.CampoEspessura          = txtEspessura;
            benef.CampoLargura            = txtLargura;
            benef.CampoPercComissao       = hdfPercComissao;
            benef.CampoQuantidade         = txtQuantidade;
            benef.CampoQuantidadeAmbiente = null;
            benef.CampoTipoEntrega        = hdfTipoEntrega;
            benef.CampoTotalM2            = hdfTotalM2;
            benef.CampoValorUnitario      = txtValorIns;
            benef.CampoCusto       = hdfCustoProd;
            benef.CampoProdutoID   = codProd;
            benef.CampoRevenda     = hdfCliRevenda;
            benef.CampoClienteID   = hdfIdCliente;
            benef.CampoAplicacaoID = linhaControle.FindControl("hdfChild_IdAplicacaoComposicao");
            benef.CampoProcessoID  = linhaControle.FindControl("hdfChild_IdProcessoComposicao");
            benef.CampoAplicacao   = linhaControle.FindControl("txtChild_AplComposicaoIns");
            benef.CampoProcesso    = linhaControle.FindControl("txtChild_ProcComposicaoIns");
            benef.IdProdPed        = IdProdPed;

            benef.TipoBenef = tipoPedido == Glass.Data.Model.Pedido.TipoPedidoEnum.MaoDeObraEspecial ?
                              TipoBenef.MaoDeObraEspecial : TipoBenef.Venda;
        }
        /// <summary>
        /// Handles the ItemDataBound event of the grdCustomFields control.
        /// </summary>
        /// <param name="s">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.Web.UI.WebControls.DataGridItemEventArgs"/> instance containing the event data.</param>
        protected void grdCustomFields_ItemDataBound(Object s, DataGridItemEventArgs e)
        {
            Control container = e.Item;

            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.SelectedItem)
            {
                if (e.Item.DataItem == null)
                {
                    return;
                }

                var btnExpandButton = (HtmlImage)container.FindControl("image_");
                if (btnExpandButton != null)
                {
                    var c = (HtmlControl)e.Item.FindControl("divSelectionValues");
                    btnExpandButton.Attributes.Add("OnClick", string.Format("Toggle('{0}', '{1}');", c.ClientID, btnExpandButton.ClientID));
                }

                var currentCustomField = (UserCustomField)e.Item.DataItem;

                var lblName = (Label)e.Item.FindControl("lblName");
                lblName.Text = currentCustomField.Name;

                var lblDataType = (Label)e.Item.FindControl("lblDataType");
                lblDataType.Text = currentCustomField.DataType.ToString();

                var lblFieldType = (Label)e.Item.FindControl("lblFieldType");
                lblFieldType.Text = LocalizeFieldType(currentCustomField.FieldType);

                var lblRequired = (Label)e.Item.FindControl("lblRequired");
                lblRequired.Text = currentCustomField.Required ? Resources.SharedResources.Yes : Resources.SharedResources.No;

                var btnDelete = (ImageButton)e.Item.FindControl("btnDeleteCustomField");
                var message   = string.Format(GetLocalResourceObject("ConfirmDelete").ToString(), currentCustomField.Name.Trim());
                btnDelete.Attributes.Add("onclick", String.Format("return confirm('{0}');", message.JsEncode()));

                var table = e.Item.Cells[grdCustomFields.Columns.Count - 1].FindControl("tblSelectionValues") as HtmlTable;

                if (table != null)
                {
                    //only drop down list fields have selection values.
                    if (currentCustomField.FieldType == CustomFieldType.DropDownList)
                    {
                        e.Item.FindControl("image_").Visible = true;
                        table.Visible = true;
                        e.Item.Cells[e.Item.Cells.Count - 1].Visible = true;

                        var grid = (DataGrid)e.Item.Cells[grdCustomFields.Columns.Count - 1].FindControl("grdSelectionValues");
                        ViewState["CustomFieldId"] = currentCustomField.Id;
                        grid.DataSource            = GetCustomFieldSelections(currentCustomField.Id);
                        grid.DataKeyField          = "Id";
                        grid.DataBind();
                    }
                    else
                    {
                        e.Item.FindControl("image_").Visible = false;
                        table.Visible = false;
                        e.Item.Cells[e.Item.Cells.Count - 1].Visible = false;
                    }
                }
            }

            if (e.Item.ItemType == ListItemType.EditItem)
            {
                var currentCustomField = (UserCustomField)e.Item.DataItem;
                var txtCustomFieldName = (TextBox)e.Item.FindControl("txtCustomFieldName");
                var customFieldType    = (DropDownList)e.Item.FindControl("dropCustomFieldType");
                var dataType           = (DropDownList)e.Item.FindControl("dropEditDataType");
                var required           = (CheckBox)e.Item.FindControl("chkEditRequired");

                required.Checked              = currentCustomField.Required;
                txtCustomFieldName.Text       = currentCustomField.Name;
                customFieldType.SelectedValue = Convert.ToString((int)currentCustomField.FieldType);
                dataType.SelectedValue        = currentCustomField.DataType.ToString();
                dataType.Items.Clear();
                dataType.DataSource = Enum.GetNames(typeof(ValidationDataType));
                dataType.DataBind();
            }
        }
Example #9
0
        protected void ctrlBenef_Load(object sender, EventArgs e)
        {
            ctrlBenef   benef         = (ctrlBenef)sender;
            GridViewRow linhaControle = benef.Parent.Parent as GridViewRow;
            Control     dtvOrcamento  = linhaControle.Parent;

            while (dtvOrcamento.ID != "mainTable")
            {
                dtvOrcamento = dtvOrcamento.Parent;
            }

            dtvOrcamento = dtvOrcamento.FindControl("dtvOrcamento");

            Control codProd = null;

            if (linhaControle.FindControl("lblCodProdComposicaoIns") != null)
            {
                codProd = linhaControle.FindControl("lblCodProdComposicaoIns");
            }
            else
            {
                codProd = linhaControle.FindControl("txtCodProdComposicaoIns");
            }

            TextBox     txtAltura       = (TextBox)linhaControle.FindControl("txtAlturaComposicaoIns");
            TextBox     txtEspessura    = (TextBox)linhaControle.FindControl("txtEspessuraComposicao");
            TextBox     txtLargura      = (TextBox)linhaControle.FindControl("txtLarguraComposicaoIns");
            HiddenField hdfPercComissao = (HiddenField)dtvOrcamento.FindControl("hdfPercComissao");
            TextBox     txtQuantidade   = (TextBox)linhaControle.FindControl("txtQtdeComposicaoIns");
            HiddenField hdfTipoEntrega  = (HiddenField)dtvOrcamento.FindControl("hdfTipoEntrega");
            HiddenField hdfTotalM2      = null;

            if (!Beneficiamentos.UsarM2CalcBeneficiamentos)
            {
                if (linhaControle.FindControl("hdfTotMComposicao") != null)
                {
                    hdfTotalM2 = (HiddenField)linhaControle.FindControl("hdfTotMComposicao");
                }
                else if (linhaControle.FindControl("hdfTotM2ComposicaoIns") != null)
                {
                    hdfTotalM2 = (HiddenField)linhaControle.FindControl("hdfTotM2ComposicaoIns");
                }
            }
            else
            {
                if (linhaControle.FindControl("hdfTotM2CalcComposicao") != null)
                {
                    hdfTotalM2 = (HiddenField)linhaControle.FindControl("hdfTotM2CalcComposicao");
                }
                else if (linhaControle.FindControl("hdfTotM2CalcComposicaoIns") != null)
                {
                    hdfTotalM2 = (HiddenField)linhaControle.FindControl("hdfTotM2CalcComposicaoIns");
                }
            }

            TextBox     txtValorIns   = (TextBox)linhaControle.FindControl("txtValorComposicaoIns");
            HiddenField hdfCliRevenda = (HiddenField)dtvOrcamento.FindControl("hdfCliRevenda");
            HiddenField hdfIdCliente  = (HiddenField)dtvOrcamento.FindControl("hdfIdCliente");
            HiddenField hdfCustoProd  = (HiddenField)linhaControle.FindControl("hdfCustoProdComposicao");

            benef.CampoAltura             = txtAltura;
            benef.CampoEspessura          = txtEspessura;
            benef.CampoLargura            = txtLargura;
            benef.CampoPercComissao       = hdfPercComissao;
            benef.CampoQuantidade         = txtQuantidade;
            benef.CampoQuantidadeAmbiente = null;
            benef.CampoTipoEntrega        = hdfTipoEntrega;
            benef.CampoTotalM2            = hdfTotalM2;
            benef.CampoValorUnitario      = txtValorIns;
            benef.CampoCusto       = hdfCustoProd;
            benef.CampoProdutoID   = codProd;
            benef.CampoRevenda     = hdfCliRevenda;
            benef.CampoClienteID   = hdfIdCliente;
            benef.CampoAplicacaoID = linhaControle.FindControl("hdfIdAplicacaoComposicao");
            benef.CampoProcessoID  = linhaControle.FindControl("hdfIdProcessoComposicao");
            benef.CampoAplicacao   = linhaControle.FindControl("txtAplComposicaoIns");
            benef.CampoProcesso    = linhaControle.FindControl("txtProcComposicaoIns");
            benef.TipoBenef        = TipoBenef.Venda;
        }
Example #10
0
 /// <summary>Finds a control by its ID.</summary>
 /// <param name="source">The source value.</param>
 /// <param name="id">The ID of the control.</param>
 /// <returns>The control, if found.</returns>
 public static T FindControl <T> (this Control source, string id) where T : Control
 {
     return(source.FindControl(id) as T);
 }
Example #11
0
        protected void InsertButton_Click(object sender, EventArgs e)
        {
            Control control = null;

            if (GridView1.FooterRow != null)
            {
                control = GridView1.FooterRow;
            }
            else
            {
                control = GridView1.Controls[0].Controls[0];
            }

            TextBox txtVcCommentBy  = control.FindControl("footerVcCommentBy") as TextBox;
            TextBox txtVcComment    = control.FindControl("footerVcComment") as TextBox;
            TextBox txtVcAcctNo     = control.FindControl("footerVcAcctNo") as TextBox;
            TextBox txtVcClient     = control.FindControl("footerVcClient") as TextBox;
            TextBox txtVcPatName    = control.FindControl("footerVcPatName") as TextBox;
            TextBox txtVcPatSSN     = control.FindControl("footerVcPatSSN") as TextBox;
            TextBox txtVcPatIns     = control.FindControl("footerVcPatIns") as TextBox;
            TextBox txtVcPatInsIdNo = control.FindControl("footerVcPatInsIdNo") as TextBox;
            TextBox txtDecTotalChgs = control.FindControl("footerDecTotalChgs") as TextBox;
            TextBox txtDecExpected  = control.FindControl("footerDecExpected") as TextBox;
            TextBox txtVcUpCategory = control.FindControl("footerVcUpCategory") as TextBox;

            String InsertQuery = string.Format(
                "Insert into Initial(vcCommentBy,vcComment,vcAcctNo,vcClient,vcPatName,vcPatSSN, vcPatIns,vcPatInsIdNo,"
                + "decTotalChgs,decExpected,vcUpCategory) values ("
                + "'{0}','{1}',{2},{3},{4},{5},{6},{7},{8},{9},{10}) ",
                txtVcCommentBy.Text,
                txtVcComment.Text,
                txtVcAcctNo.Text.Equals("(Optional)") ? "NULL" : "'" + txtVcAcctNo.Text + "'",
                txtVcClient.Text.Equals("(Optional)") ? "NULL" : "'" + txtVcClient.Text + "'",
                txtVcPatName.Text.Equals("(Optional)") ? "NULL" : "'" + txtVcPatName.Text + "'",
                txtVcPatSSN.Text.Equals("(Optional)") ? "NULL" : "'" + txtVcPatSSN.Text + "'",
                txtVcPatIns.Text.Equals("(Optional)") ? "NULL" : "'" + txtVcPatIns.Text + "'",
                txtVcPatInsIdNo.Text.Equals("(Optional)") ? "NULL" : "'" + txtVcPatInsIdNo.Text + "'",
                txtDecTotalChgs.Text.Equals("(Optional)") ? "NULL" : "'" + txtDecTotalChgs.Text + "'",
                txtDecExpected.Text.Equals("(Optional)") ? "NULL" : "'" + txtDecExpected.Text + "'",
                txtVcUpCategory.Text.Equals("(Optional)") ? "NULL" : "'" + txtVcUpCategory.Text + "'"
                );
            string connectionstring = ConfigurationManager.ConnectionStrings["CommentsConnectionString"].ConnectionString;

            using (SqlConnection conn = new SqlConnection(connectionstring))
            {
                conn.Open();
                SqlCommand comm = new SqlCommand(InsertQuery, conn);
                comm.CommandType = CommandType.Text;
                comm.ExecuteNonQuery();
            }

            btnClear_Click(null, null);
        }
Example #12
0
 public static CheckBox FindCheckBox(this Control self, string id)
 => self.FindControl(id) as CheckBox;
Example #13
0
 public static HiddenField FindHiddenField(this Control self, string id)
 => self.FindControl(id) as HiddenField;
Example #14
0
 public static TextBox FindTextBox(this Control self, string id)
 => self.FindControl(id) as TextBox;
Example #15
0
 public static Label FindLabel(this Control self, string id)
 => self.FindControl(id) as Label;
Example #16
0
        protected override void CreateChildControls()
        {
            if (Cacheable && CanCache && IsInCache)
            {
                return;
            }

            if (ShowExecutionTime)
            {
                Timer.Start();
            }

            Content   rootContent      = null;
            Exception controlException = null;

            try
            {
                rootContent = GetModel() as Content;
                if (rootContent != null)
                {
                    rootContent.ChildrenDefinition.AllChildren = AllChildren;
                }
            }
            catch (Exception ex)
            {
                Logger.WriteException(ex);
                controlException = ex;
            }

            var model = new ContentCollectionViewModel {
                State = this.State
            };

            try
            {
                var childCount = 0;
                if (rootContent != null)
                {
                    try
                    {
                        childCount = rootContent.Children.Count();
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteException(ex);
                        if (controlException == null)
                        {
                            controlException = ex;
                        }
                    }
                }

                try
                {
                    model.Pager = GetPagerModel(childCount, State, string.Empty);
                }
                catch (Exception ex)
                {
                    Logger.WriteException(ex);
                    if (controlException == null)
                    {
                        controlException = ex;
                    }

                    //in case of error, set dummy pager model
                    model.Pager = new PagerModel(0, State, string.Empty);
                }

                model.ReferenceAxisName = CollectionAxis == CollectionAxisMode.ReferenceProperty ? ReferenceAxisName : null;
                model.Content           = rootContent;

                if (RenderingMode == RenderMode.Xslt)
                {
                    XmlModelData = model.ToXPathNavigator();
                }
                else if (RenderingMode == RenderMode.Ascx || RenderingMode == RenderMode.Native)
                {
                    var viewPath = RenderingMode == RenderMode.Native
                                       ? "/root/Global/Renderers/ContentCollectionView.ascx"
                                       : Renderer;

                    Control presenter = null;

                    try
                    {
                        var viewHead = NodeHead.Get(viewPath);
                        if (viewHead != null && SecurityHandler.HasPermission(viewHead, PermissionType.RunApplication))
                        {
                            presenter = Page.LoadControl(viewPath);
                        }

                        // we may display a message if the user does not have enough permissions for the view
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteException(ex);
                        if (controlException == null)
                        {
                            controlException = ex;
                        }
                    }

                    if (presenter != null)
                    {
                        var ccView = presenter as ContentCollectionView;
                        if (ccView != null)
                        {
                            ccView.Model = model;
                        }

                        if (rootContent != null)
                        {
                            var itemlist = presenter.FindControl(ContentListID);
                            if (itemlist != null)
                            {
                                try
                                {
                                    ContentQueryPresenterPortlet.DataBindingHelper.SetDataSourceAndBind(itemlist,
                                                                                                        rootContent.Children);
                                }
                                catch (Exception ex)
                                {
                                    Logger.WriteException(ex);
                                    if (controlException == null)
                                    {
                                        controlException = ex;
                                    }
                                }
                            }
                        }

                        var itemPager = presenter.FindControl("ContentListPager");
                        if (itemPager != null)
                        {
                            try
                            {
                                ContentQueryPresenterPortlet.DataBindingHelper.SetDataSourceAndBind(itemPager,
                                                                                                    model.Pager.PagerActions);
                            }
                            catch (Exception ex)
                            {
                                Logger.WriteException(ex);
                                if (controlException == null)
                                {
                                    controlException = ex;
                                }
                            }
                        }

                        Controls.Clear();
                        Controls.Add(presenter);
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.WriteException(ex);
                if (controlException == null)
                {
                    controlException = ex;
                }
            }

            try
            {
                if (controlException != null)
                {
                    BuildErrorMessage(controlException);
                }
            }
            catch (Exception ex)
            {
                var errorText = SNSR.GetString(SNSR.Portlets.ContentCollection.ErrorLoadingContentView, HttpUtility.HtmlEncode(ex.Message));

                this.Controls.Clear();
                this.Controls.Add(new LiteralControl(errorText));
            }

            ChildControlsCreated = true;

            if (ShowExecutionTime)
            {
                Timer.Stop();
            }
        }
Example #17
0
    private static void ControlAddParameter(Control _control, string title, string icon, string value, int record, string info, string value2, int record2, string html)
    {
        Control _controlsTitle = _control.FindControl("hddTitle");

        if (_controlsTitle != null)
        {
            Type objTypeTitle = _controlsTitle.GetType();
            if (objTypeTitle.Name == "HiddenField")
            {
                HiddenField objlbl = (HiddenField)_controlsTitle;
                objlbl.Value = title;
            }
        }

        Control _controlsTitle1 = _control.FindControl("lblTitle");

        if (_controlsTitle1 != null)
        {
            Type objTypeTitle1 = _controlsTitle1.GetType();
            if (objTypeTitle1.Name == "Label")
            {
                Label objlbl1 = (Label)_controlsTitle1;
                objlbl1.Text = title;
            }
        }

        Control _controlsIcon = _control.FindControl("imgIcon");

        if (_controlsIcon != null)
        {
            Type objTypeIcon = _controlsIcon.GetType();
            if (objTypeIcon.Name == "Image")
            {
                Image objimg = (Image)_controlsIcon;
                objimg.ImageUrl = "~/Upload/Widgets/Icons/" + icon;
            }
        }


        Control _controlsValue = _control.FindControl("hddValue");

        if (_controlsValue != null)
        {
            Type objTypeValue = _controlsValue.GetType();
            if (objTypeValue.Name == "HiddenField")
            {
                HiddenField objvalue = (HiddenField)_controlsValue;
                objvalue.Value = value;
            }
        }

        Control _controlsRecord = _control.FindControl("hddRecord");

        if (_controlsRecord != null)
        {
            Type objTypeRecord = _controlsRecord.GetType();
            if (objTypeRecord.Name == "HiddenField")
            {
                HiddenField objRecord = (HiddenField)_controlsRecord;
                objRecord.Value = record.ToString();
            }
        }

        Control _controlsHelp = _control.FindControl("ltlAdvModule");

        if (_controlsHelp != null)
        {
            Type objTypeHelp = _controlsHelp.GetType();
            if (objTypeHelp.Name == "Literal")
            {
                Literal objHelp = (Literal)_controlsHelp;
                objHelp.Text = info;
            }
        }

        Control _controlsValue2 = _control.FindControl("hddValue2");

        if (_controlsValue2 != null)
        {
            Type objTypeValue2 = _controlsValue2.GetType();
            if (objTypeValue2.Name == "HiddenField")
            {
                HiddenField objvalue2 = (HiddenField)_controlsValue2;
                objvalue2.Value = value2;
            }
        }

        Control _controlsRecord2 = _control.FindControl("hddRecord2");

        if (_controlsRecord2 != null)
        {
            Type objTypeRecord2 = _controlsRecord2.GetType();
            if (objTypeRecord2.Name == "HiddenField")
            {
                HiddenField objRecord2 = (HiddenField)_controlsRecord2;
                objRecord2.Value = record2.ToString();
            }
        }

        Control _controlsHTML = _control.FindControl("ltlHTML");

        if (_controlsHTML != null)
        {
            Type objTypeHTML = _controlsHTML.GetType();
            if (objTypeHTML.Name == "Literal")
            {
                Literal objHTML = (Literal)_controlsHTML;
                objHTML.Text = html;
            }
        }
    }
Example #18
0
 public WebControl b(Control Conteneur, String strID)
 {
     return((WebControl)Conteneur.FindControl(strID));
 }
Example #19
0
        // *********************************************************************
        //  InitializeSkin
        //
        /// <summary>
        /// Initialize the control template and populate the control with values
        /// </summary>
        // ***********************************************************************/
        override protected void InitializeSkin(Control skin)
        {
            System.Web.UI.WebControls.Image img;
            Label     label;
            HyperLink link;
            Repeater  repeater;

            // Get the statistics
            Statistics siteStats = Statistics.GetSiteStatistics();

            // Find the stats image
            img = (System.Web.UI.WebControls.Image)skin.FindControl("StatsImg");
            if (null != img)
            {
                img.ImageUrl = Globals.ApplicationVRoot + "/skins/" + Globals.Skin + "/images/icon_stats.gif";
            }

            // Find the total Users
            label = (Label)skin.FindControl("TotalUsers");
            if (null != label)
            {
                label.Text = siteStats.TotalUsers.ToString("n0");
            }

            // Find the total threads
            label = (Label)skin.FindControl("TotalThreads");
            if (null != label)
            {
                label.Text = siteStats.TotalThreads.ToString("n0");
            }

            // Find the total posts
            label = (Label)skin.FindControl("TotalPosts");
            if (null != label)
            {
                label.Text = siteStats.TotalPosts.ToString("n0");
            }

            // New threads in past 24 hours
            label = (Label)skin.FindControl("NewThreadsInPast24Hours");
            if (null != label)
            {
                label.Text = siteStats.NewThreadsInPast24Hours.ToString("n0");
            }

            // New posts in past 24 hours
            label = (Label)skin.FindControl("NewPostsInPast24Hours");
            if (null != label)
            {
                label.Text = siteStats.NewPostsInPast24Hours.ToString("n0");
            }

            // New users in past 24 hours
            label = (Label)skin.FindControl("NewUsersInPast24Hours");
            if (null != label)
            {
                label.Text = siteStats.NewUsersInPast24Hours.ToString("n0");
            }

            // Most viewed
            link = (HyperLink)skin.FindControl("MostViewedThread");
            if (null != link)
            {
                link.Text = siteStats.MostViewsSubject;

                // Don't link if there are no posts yet
                if (siteStats.MostViewsPostID > 0)
                {
                    link.NavigateUrl = Globals.UrlShowPost + siteStats.MostViewsPostID;
                }
            }

            // Most posts
            link = (HyperLink)skin.FindControl("MostActiveThread");
            if (null != link)
            {
                link.Text = siteStats.MostActiveSubject;

                // Don't link if there are no posts yet
                if (siteStats.MostActivePostID > 0)
                {
                    link.NavigateUrl = Globals.UrlShowPost + siteStats.MostActivePostID;
                }
            }

            // Most read
            link = (HyperLink)skin.FindControl("MostReadThread");
            if (null != link)
            {
                link.Text = siteStats.MostReadPostSubject;

                // Don't link if there are no posts yet
                if (siteStats.MostReadPostID > 0)
                {
                    link.NavigateUrl = Globals.UrlShowPost + siteStats.MostReadPostID;
                }
            }

            // Most active user
            repeater = (Repeater)skin.FindControl("TopUsers");
            if (null != repeater)
            {
                repeater.DataSource = Users.GetMostActiveUsers();
                repeater.DataBind();
            }

            // Newest user
            link = (HyperLink)skin.FindControl("NewestUser");
            if (null != link)
            {
                link.Text = siteStats.NewestUser;

                // Don't enable link if there are no posts yet
                if (siteStats.MostReadPostID > 0)
                {
                    link.NavigateUrl = Globals.UrlUserProfile + siteStats.NewestUser;
                }
            }
        }
Example #20
0
        //protected  void  Guardar_Cita(Object  Sender, EventArgs e)
        //{

        //    datosCliente = (DatosCliente)phDatosCliente.Controls[0];
        //    Control controlHiddencolores = (Control)phDatosCliente.Controls[0];
        //    if ((placa.Text == "") || !datosCliente.TieneSuficientesDatos())
        //        Utils.MostrarAlerta(Response, "Hace Falta Algún Dato. Revise Por Favor");
        //    else
        //    {
        //        ArrayList sqlStrings = new ArrayList();
        //        string codigoRecepcionista = DBFunctions.SingleData("SELECT pven_codigo FROM pvendedor WHERE pven_nombre='"+recepcion.SelectedItem.ToString()+"'");
        //        string fechaGrabacion = calFecha.SelectedDate.ToString("yyyy-MM-dd");
        //        if(codigoRecepcionista == null || codigoRecepcionista.Equals(""))
        //        {
        //            Utils.MostrarAlerta(Response, "Por favor seleccione un recepcionista");
        //            return;
        //        }

        //        DateTime horaAlmuerzo = System.Convert.ToDateTime(DBFunctions.SingleData("SELECT pven_horalmuerzo FROM pvendedor WHERE pven_codigo='"+codigoRecepcionista+"'"));
        //        DateTime horaFinal = horaAlmuerzo.AddMinutes(59);
        //        DateTime hora = System.Convert.ToDateTime(horaEsc.SelectedItem.ToString());
        //        string kit = (servicio.SelectedValue.Length==0) ? "NULL" : "'"+servicio.SelectedValue+"'";
        //        if((hora>=horaAlmuerzo)&&(hora<horaFinal))
        //            Utils.MostrarAlerta(Response, "Lo sentimos ha esta hora el recepcionista se encuentra reservado");
        //            //lbErr.Text = "Lo sentimos ha esta hora el recepcionista se encuentra reservado";
        //        else if((!DBFunctions.RecordExist("SELECT * FROM mcitataller WHERE mcit_fecha='"+fechaGrabacion+"' AND mcit_hora='"+horaEsc.SelectedItem.ToString()+"' AND mcit_codven='"+codigoRecepcionista+"'"))&&(!DBFunctions.RecordExist("SELECT * FROM mcitataller where mcit_fecha='"+fechaGrabacion+"' AND mcit_placa='"+placa.Text+"'")))
        //        {
        //            sqlStrings.Add("INSERT INTO mcitataller VALUES('" + fechaGrabacion + "','" + horaEsc.SelectedItem.ToString() + "','" + codigoRecepcionista + "','" + vehiculos.SelectedValue + "','" + placa.Text.ToString() + "','" + datosCliente.Nombrecompleto + "','" + datosCliente.Telefono + "','" + datosCliente.Celular + "','" + datosCliente.Email + "'," + kit + ",'N','" + tbObservaciones.Text + "','" + HttpContext.Current.User.Identity.Name.ToLower() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + taller.SelectedValue + "')");
        //            if (DBFunctions.Transaction(sqlStrings))
        //            {
        //                lbErr.Text = "";
        //                Utils.MostrarAlerta(Response, "Su CITA ha sido creada SATISFACTORIAMENTE .. lo esperamos !");
        //            }
        //            else
        //            {
        //                lbErr.Text = "Error :" + DBFunctions.exceptions;
        //                Utils.MostrarAlerta(Response, "La CITA no ha podido ser registrada. Por favor revise los datos de ingreso.");
        //            }

        //            this.PrepararTabla(taller.SelectedItem.ToString());
        //            this.LlenarCitas(calFecha.SelectedDate.ToString("yyyy-MM-dd"), "SI", horaEsc.SelectedItem.ToString(), codigoRecepcionista);
        //        }
        //        else
        //            Utils.MostrarAlerta(Response, "Usted ha escogido una opcion invalida o ya tiene una cita programada para hoy");
        //    }
        //}

        protected void Guardar_Cita_dgCitas(Object sender, CommandEventArgs e)
        {
            DataTable dtPrueba = new DataTable();

            dtPrueba = (DataTable)Session["dtCitas"];
            //string nombreRecepcionista = dtPrueba.Columns[];

            datosCliente = (DatosCliente)phDatosCliente.Controls[0];
            if ((placa.Text == "") || !datosCliente.TieneSuficientesDatos())
            {
                Utils.MostrarAlerta(Response, "Hace Falta Algún Dato. Revise Por Favor");
            }
            else
            {
                ArrayList sqlStrings          = new ArrayList();
                string    pruebaRecepcionista = (e.CommandArgument).ToString();
                string    codigoRecepcionista = pruebaRecepcionista.Substring(0, pruebaRecepcionista.IndexOf("_"));
                //string codigoRecepcionista = DBFunctions.SingleData("SELECT pven_codigo FROM pvendedor WHERE pven_nombre='" + recepcion.SelectedItem.ToString() + "'");
                string fechaGrabacion = calFecha.SelectedDate.ToString("yyyy-MM-dd");


                if (codigoRecepcionista == null || codigoRecepcionista.Equals(""))
                {
                    Utils.MostrarAlerta(Response, "Por favor seleccione un recepcionista");
                    return;
                }

                DateTime horaAlmuerzo = System.Convert.ToDateTime(DBFunctions.SingleData("SELECT pven_horalmuerzo FROM pvendedor WHERE pven_codigo='" + codigoRecepcionista + "'"));
                DateTime horaFinal    = horaAlmuerzo.AddMinutes(59);
                DateTime hora         = System.Convert.ToDateTime(horaEsc.SelectedItem.ToString());
                string   kit          = (servicio.SelectedValue.Length == 0) ? "NULL" : "'" + servicio.SelectedValue + "'";
                if ((hora >= horaAlmuerzo) && (hora < horaFinal))
                {
                    Utils.MostrarAlerta(Response, "Lo sentimos ha esta hora el recepcionista se encuentra reservado");
                }
            }

            datosCliente = (DatosCliente)phDatosCliente.Controls[0];

            Control controlHiddencolores = (Control)phDatosCliente.Controls[0];

            string colores = ((HiddenField)controlHiddencolores.FindControl("HiColores")).Value;

            if (colores == "verde")
            {
                colores = "V";
            }
            else if (colores == "rojo")
            {
                colores = "R";
            }
            else if (colores == "amarillo")
            {
                colores = "A";
            }
            else
            {
                colores = "V";
            }
            if ((placa.Text == "") && !datosCliente.TieneSuficientesDatos())
            {
                Utils.MostrarAlerta(Response, "Falta algun dato por entrar. Por favor revise");
            }
            else
            {
                ArrayList sqlStrings = new ArrayList();

                string opc = (e.CommandArgument).ToString();
                //string opc = ((CommandEventArgs)e).CommandArgument.ToString();
                string codigoRecepcionista = opc.Substring(0, opc.IndexOf("_"));
                string horaGrabacion       = opc.Substring(opc.IndexOf("_") + 1);
                string fechaGrabacion      = calFecha.SelectedDate.ToString("yyyy-MM-dd");
                string kit   = (servicio.SelectedValue.Length == 0) ? "NULL" : "'" + servicio.SelectedValue + "'";
                string Color = colores;


                if (!DBFunctions.RecordExist("SELECT * FROM mcitataller where mcit_fecha='" + fechaGrabacion + "' AND mcit_placa='" + placa.Text + "'"))
                {
                    sqlStrings.Add("INSERT INTO mcitataller VALUES('" + fechaGrabacion + "','" + horaGrabacion + "','" + codigoRecepcionista + "','" + vehiculos.SelectedValue + "','" + placa.Text.ToString() + "','" + datosCliente.Nombrecompleto + "','" + datosCliente.Telefono + "','" + datosCliente.Celular + "','" + datosCliente.Email + "'," + kit + ",'N','" + tbObservaciones.Text + "','" + HttpContext.Current.User.Identity.Name.ToLower() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + taller.SelectedValue + "','" + Color + "');");
                    if (DBFunctions.Transaction(sqlStrings))
                    {
                        lbErr.Text = "";
                        Utils.MostrarAlerta(Response, "Su CITA ha sido creada SATISFACTORIAMENTE .. lo esperamos !");
                    }
                    else
                    {
                        lbErr.Text = "Error :" + DBFunctions.exceptions;
                        Utils.MostrarAlerta(Response, "La CITA no ha podido ser registrada. Por favor revise los datos de ingreso.");
                    }
                    this.PrepararTabla(taller.SelectedItem.ToString());
                    this.LlenarCitas(calFecha.SelectedDate.ToString("yyyy-MM-dd"), "SI", horaGrabacion, codigoRecepcionista);
                }
                else
                {
                    Utils.MostrarAlerta(Response, "Usted ya tiene una cita para el dia de hoy");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["WebFormCases.Models.supplyModelConnectionString"].ConnectionString))
                {
                    using (SqlCommand com = new SqlCommand("select distinct Department from DummyTable order by Department;select * from DummyTable order by Batch_No,Department", con))
                    {
                        con.Open();

                        List <string> departments = new List <string>();



                        List <Batch> list = new List <Batch>();
                        using (SqlDataReader reader = com.ExecuteReader())
                        {
                            if (reader.HasRows)
                            {
                                while (reader.Read())
                                {
                                    departments.Add(reader.GetString(0));
                                }


                                reader.NextResult();
                                //declare a variable to save the current BatchNo
                                // to decide whether to create a new Batch
                                string BatchNo = null;


                                // declare a variable to store the total qty
                                Double totalQty = 0;
                                // declare a variable to store the total value
                                Double totalValue = 0;

                                //declare a variable to save the current Batch
                                Batch batch = null;
                                while (reader.Read())
                                {
                                    totalQty   += reader.GetDouble(4);
                                    totalValue += reader.GetDouble(5);

                                    if (BatchNo == null)
                                    {
                                        // set the Batch property
                                        batch         = new Batch();
                                        batch.BatchNo = reader.GetString(1);
                                        BatchNo       = batch.BatchNo;

                                        batch.Total_Qty = reader.GetDouble(2);
                                        if (reader.GetString(3) == departments[0])
                                        {
                                            batch.Dep1Qty   = reader.GetDouble(4);
                                            batch.Dep1Value = reader.GetDouble(5);
                                        }
                                        if (reader.GetString(3) == departments[1])
                                        {
                                            batch.Dep2Qty   = reader.GetDouble(4);
                                            batch.Dep2Value = reader.GetDouble(5);
                                        }
                                    }
                                    if (BatchNo != null && BatchNo != reader.GetString(1))
                                    {
                                        //create a new batch and add the old batch to the list
                                        batch.TotalQty   = batch.Dep1Qty + batch.Dep2Qty;
                                        batch.TotalValue = batch.Dep1Value + batch.Dep2Value;
                                        list.Add(batch);
                                        batch           = new Batch();
                                        batch.BatchNo   = reader.GetString(1);
                                        BatchNo         = batch.BatchNo;
                                        batch.Total_Qty = reader.GetDouble(2);
                                        if (reader.GetString(3) == departments[0])
                                        {
                                            batch.Dep1Qty   = reader.GetDouble(4);
                                            batch.Dep1Value = reader.GetDouble(5);
                                        }
                                        if (reader.GetString(3) == departments[1])
                                        {
                                            batch.Dep2Qty   = reader.GetDouble(4);
                                            batch.Dep2Value = reader.GetDouble(5);
                                        }
                                    }
                                    if (BatchNo != null && BatchNo == reader.GetString(1))
                                    {
                                        // only set the property of the batch
                                        batch.Total_Qty = reader.GetDouble(2);
                                        if (reader.GetString(3) == departments[0])
                                        {
                                            batch.Dep1Qty   = reader.GetDouble(4);
                                            batch.Dep1Value = reader.GetDouble(5);
                                        }
                                        if (reader.GetString(3) == departments[1])
                                        {
                                            batch.Dep2Qty   = reader.GetDouble(4);
                                            batch.Dep2Value = reader.GetDouble(5);
                                        }
                                    }
                                }

                                //add the last batch
                                batch.TotalQty   = batch.Dep1Qty + batch.Dep2Qty;
                                batch.TotalValue = batch.Dep1Value + batch.Dep2Value;
                                list.Add(batch);


                                Repeater1.DataSource = list;
                                Repeater1.DataBind();


                                //get the footer of the reperter
                                Control footerControl = Repeater1.Controls[1 + list.Count];

                                // set the totalqty and total value
                                Literal literal = footerControl.FindControl("TotalQTY") as Literal;
                                literal.Text = totalQty.ToString();
                                literal      = footerControl.FindControl("TotalValue") as Literal;
                                literal.Text = totalValue.ToString();
                            }
                        }
                    }
                }
            }
        }
        /// <summary>
        /// Recalculates the prices.
        /// </summary>
        /// <param name="container">The container.</param>
        private void RecalculatePrices(Control container, string senderId)
        {
            var rntxtQuantity               = ((RadNumericTextBox)container.FindControl("rntxtQuantity"));
            var rntxtCurrencyPrice          = ((RadNumericTextBox)container.FindControl("rntxtCurrencyPrice"));
            var rntxtCurrencyAmount         = ((RadNumericTextBox)container.FindControl("rntxtCurrencyAmount"));
            var rntxtRate                   = ((RadNumericTextBox)container.FindControl("rntxtRate"));
            var rntxtPrice                  = ((RadNumericTextBox)container.FindControl("rntxtPrice"));
            var rntxtAmount                 = ((RadNumericTextBox)container.FindControl("rntxtAmount"));
            var rntxtCurrencyDiscountAmount = ((RadNumericTextBox)container.FindControl("rntxtCurrencyDiscountAmount"));
            var rntxtDiscountAmount         = ((RadNumericTextBox)container.FindControl("rntxtDiscountAmount"));
            var rntxtDiscount               = ((RadNumericTextBox)container.FindControl("rntxtDiscount"));
            var rntxtCurrencyTotalAmount    = ((RadNumericTextBox)container.FindControl("rntxtCurrencyTotalAmount"));
            var rntxtTotalAmount            = ((RadNumericTextBox)container.FindControl("rntxtTotalAmount"));

            var quantity               = rntxtQuantity.Value ?? 0;
            var currencyPrice          = rntxtCurrencyPrice.Value ?? 0;
            var currencyAmount         = rntxtCurrencyAmount.Value ?? 0;
            var rate                   = rntxtRate.Value ?? 0;
            var price                  = rntxtPrice.Value ?? 0;
            var amount                 = rntxtAmount.Value ?? 0;
            var currencyDiscountAmount = rntxtCurrencyDiscountAmount.Value ?? 0;
            var discountAmount         = rntxtDiscountAmount.Value ?? 0;
            var discount               = rntxtDiscount.Value ?? 0;
            var currencyTotalAmount    = rntxtCurrencyTotalAmount.Value ?? 0;
            var totalAmount            = rntxtTotalAmount.Value ?? 0;

            switch (senderId)
            {
            case "rntxtQuantity":
            case "rntxtCurrencyPrice":
            case "rntxtRate":
                currencyAmount                    = currencyPrice * quantity;
                price                             = currencyPrice * rate;
                amount                            = currencyAmount * rate;
                currencyDiscountAmount            = (currencyAmount / 100) * discount;
                discountAmount                    = (amount / 100) * discount;
                currencyTotalAmount               = currencyAmount - currencyDiscountAmount;
                totalAmount                       = amount - discountAmount;
                rntxtCurrencyDiscountAmount.Value = currencyDiscountAmount;
                rntxtDiscountAmount.Value         = discountAmount;
                rntxtCurrencyAmount.Value         = currencyAmount;
                rntxtPrice.Value                  = price;
                rntxtAmount.Value                 = amount;
                rntxtCurrencyTotalAmount.Value    = currencyTotalAmount >= 0 ? currencyTotalAmount : 0;
                rntxtTotalAmount.Value            = totalAmount >= 0 ? totalAmount : 0;
                break;

            case "rntxtCurrencyAmount":
                currencyPrice                  = currencyAmount / quantity;
                price                          = currencyPrice * rate;
                amount                         = currencyAmount * rate;
                currencyTotalAmount            = currencyAmount - currencyDiscountAmount;
                totalAmount                    = amount - discountAmount;
                rntxtCurrencyPrice.Value       = currencyPrice;
                rntxtPrice.Value               = price;
                rntxtAmount.Value              = amount;
                rntxtCurrencyTotalAmount.Value = currencyTotalAmount >= 0 ? currencyTotalAmount : 0;
                rntxtTotalAmount.Value         = totalAmount >= 0 ? totalAmount : 0;
                break;

            case "rntxtPrice":
                currencyPrice                  = price / rate;
                currencyAmount                 = currencyPrice * quantity;
                amount                         = currencyAmount * rate;
                currencyTotalAmount            = currencyAmount - currencyDiscountAmount;
                totalAmount                    = amount - discountAmount;
                rntxtCurrencyPrice.Value       = currencyPrice;
                rntxtCurrencyAmount.Value      = currencyAmount;
                rntxtAmount.Value              = amount;
                rntxtCurrencyTotalAmount.Value = currencyTotalAmount >= 0 ? currencyTotalAmount : 0;
                rntxtTotalAmount.Value         = totalAmount >= 0 ? totalAmount : 0;
                break;

            case "rntxtAmount":
                currencyAmount                 = amount / rate;
                price                          = amount / quantity;
                currencyPrice                  = currencyAmount / quantity;
                currencyTotalAmount            = currencyAmount - currencyDiscountAmount;
                totalAmount                    = amount - discountAmount;
                rntxtCurrencyPrice.Value       = currencyPrice;
                rntxtCurrencyAmount.Value      = currencyAmount;
                rntxtPrice.Value               = price;
                rntxtCurrencyTotalAmount.Value = currencyTotalAmount >= 0 ? currencyTotalAmount : 0;
                rntxtTotalAmount.Value         = totalAmount >= 0 ? totalAmount : 0;
                break;

            case "rntxtCurrencyDiscountAmount":
                discountAmount = currencyDiscountAmount * rate;
                if (currencyAmount > 0)
                {
                    discount = 100 - (((currencyAmount - currencyDiscountAmount) / currencyAmount) * 100);
                }
                currencyTotalAmount            = currencyAmount - currencyDiscountAmount;
                totalAmount                    = amount - discountAmount;
                rntxtDiscountAmount.Value      = discountAmount;
                rntxtDiscount.Value            = discount;
                rntxtCurrencyTotalAmount.Value = currencyTotalAmount >= 0 ? currencyTotalAmount : 0;
                rntxtTotalAmount.Value         = totalAmount >= 0 ? totalAmount : 0;
                break;

            case "rntxtDiscountAmount":
                currencyDiscountAmount = discountAmount / rate;
                if (amount > 0)
                {
                    discount = 100 - (((amount - discountAmount) / amount) * 100);
                }
                currencyTotalAmount = currencyAmount - currencyDiscountAmount;
                totalAmount         = amount - discountAmount;
                rntxtCurrencyDiscountAmount.Value = currencyDiscountAmount;
                rntxtDiscount.Value            = discount;
                rntxtCurrencyTotalAmount.Value = currencyTotalAmount >= 0 ? currencyTotalAmount : 0;
                rntxtTotalAmount.Value         = totalAmount >= 0 ? totalAmount : 0;
                break;

            case "rntxtDiscount":
                currencyDiscountAmount            = (currencyAmount / 100) * discount;
                discountAmount                    = (amount / 100) * discount;
                currencyTotalAmount               = currencyAmount - currencyDiscountAmount;
                totalAmount                       = amount - discountAmount;
                rntxtCurrencyDiscountAmount.Value = currencyDiscountAmount;
                rntxtDiscountAmount.Value         = discountAmount;
                rntxtCurrencyTotalAmount.Value    = currencyTotalAmount >= 0 ? currencyTotalAmount : 0;
                rntxtTotalAmount.Value            = totalAmount >= 0 ? totalAmount : 0;
                break;

            case "rntxtCurrencyTotalAmount":
                totalAmount                       = currencyTotalAmount * rate;
                discount                          = ((currencyAmount - currencyTotalAmount) / currencyAmount) * 100;
                discountAmount                    = (amount / 100) * discount;
                currencyDiscountAmount            = (currencyAmount / 100) * discount;
                rntxtCurrencyDiscountAmount.Value = currencyDiscountAmount;
                rntxtDiscountAmount.Value         = discountAmount;
                rntxtDiscount.Value               = discount;
                rntxtTotalAmount.Value            = totalAmount >= 0 ? totalAmount : 0;
                break;

            case "rntxtTotalAmount":
                currencyTotalAmount               = totalAmount / rate;
                discount                          = ((amount - totalAmount) / amount) * 100;
                discountAmount                    = (amount / 100) * discount;
                currencyDiscountAmount            = (currencyAmount / 100) * discount;
                rntxtCurrencyDiscountAmount.Value = currencyDiscountAmount;
                rntxtDiscountAmount.Value         = discountAmount;
                rntxtDiscount.Value               = discount;
                rntxtCurrencyTotalAmount.Value    = currencyTotalAmount >= 0 ? currencyTotalAmount : 0;
                break;
            }
        }
        protected void dgLedger_List_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                Control control = null;
                if (dtg_ACT.FooterRow != null)
                {
                    control = dtg_ACT.FooterRow;
                }
                else
                {
                    control = dtg_ACT.Controls[0].Controls[0];
                }

                if (dgLedger_List.Rows.Count > 0)
                {
                    DropDownList cmbNature = null;
                    cmbNature = control.FindControl("cmbNature") as DropDownList;
                    Nature    = cmbNature.Text;

                    TextBox Particulars = null;
                    Particulars      = control.FindControl("txtParticulars") as TextBox;
                    Particulars.Text = dgLedger_List.SelectedRow.Cells[1].Text;

                    TextBox Cheque = null;
                    Cheque      = control.FindControl("txtChequeNo") as TextBox;
                    Cheque.Text = "N/A";

                    TextBox Debit = null;
                    Debit = control.FindControl("txtDebit") as TextBox;

                    TextBox Credit = null;
                    Credit = control.FindControl("txtCredit") as TextBox;

                    foreach (GridViewRow row in dgLedger_List.Rows)
                    {
                        if (row.RowIndex == dgLedger_List.SelectedIndex)
                        {
                            row.BackColor = ColorTranslator.FromHtml("#A1DCF2");
                            row.ToolTip   = string.Empty;

                            Session["LedgerCode"] = dgLedger_List.DataKeys[row.RowIndex].Values[0].ToString();
                        }
                        else
                        {
                            row.BackColor = ColorTranslator.FromHtml("#FFFFFF");
                            row.ToolTip   = "Click to select this row.";
                        }
                    }

                    if (Nature != "Dr./Cr.")
                    {
                        if (Nature == "DEBIT")
                        {
                            Debit.Text = "";
                            Debit.Focus();
                            Credit.Text = "0.00";

                            Debit.Enabled  = true;
                            Debit.ReadOnly = false;
                            Credit.Enabled = false;
                        }

                        if (Nature == "CREDIT")
                        {
                            Credit.Text = "";
                            Credit.Focus();
                            Debit.Text = "0.00";

                            Debit.Enabled   = false;
                            Credit.ReadOnly = false;
                            Credit.Enabled  = true;
                        }
                    }
                    else
                    {
                        messagePanel.Visible      = true;
                        lblMessage.Text           = "Please Select Dr./Cr. Type!!";
                        messagePanel.BackColor    = Color.Green;
                        this.lblMessage.ForeColor = Color.White;
                        Session["LedgerCode"]     = null;
                    }
                }
                else
                {
                    messagePanel.Visible      = true;
                    this.lblMessage.Text      = "No Company Found!";
                    this.lblMessage.ForeColor = Color.Maroon;
                }
            }
            catch (Exception ex)
            {
                this.messagePanel.Visible   = true;
                this.lblMessage.Text        = ex.Message.ToString();
                this.messagePanel.BackColor = Color.Red;
                this.lblMessage.ForeColor   = Color.White;
            }
        }
 public static Control FindControlRecursive(Control root, string id)
 {
     return(root.FindControl(id));
 }
Example #25
0
        protected void gridDatos_Item(object Sender, DataGridCommandEventArgs e)
        {
            double  valor = 0;
            Control padre = (this.Parent).Parent;

            if (((Button)e.CommandSource).CommandName == "devolver")
            {
                if (!Validar_CheckBox(ref valor))
                {
                    ((Label)padre.FindControl("lbDetalle")).Text               = "Detalle de la Devolución :";
                    ((Label)padre.FindControl("lbDetalle")).Visible            = true;
                    ((Label)padre.FindControl("lbValor")).Text                 = "Valor Devuelto :";
                    ((Label)padre.FindControl("lbValor")).Visible              = true;
                    ((Label)padre.FindControl("lbTotalEf")).Visible            = false;
                    ((Panel)padre.FindControl("panelValores")).Visible         = true;
                    ((TextBox)padre.FindControl("totalEfectivo")).Visible      = false;
                    ((TextBox)padre.FindControl("detalleTransaccion")).Visible = true;
                    ((TextBox)padre.FindControl("valorConsignado")).Visible    = true;
                    ((TextBox)padre.FindControl("valorConsignado")).ReadOnly   = true;
                    ((TextBox)padre.FindControl("valorConsignado")).Text       = ((Convert.ToDouble(((TextBox)padre.FindControl("valorConsignado")).Text.Substring(1))) + valor).ToString("C");
                    ((Button)padre.FindControl("guardar")).Enabled             = true;
                    ((Button)e.Item.Cells[8].Controls[1]).Text                 = "Cancelar";
                    ((Button)e.Item.Cells[8].Controls[1]).CommandName          = "cancelar";
                }
                else
                {
                    Utils.MostrarAlerta(Response, "Debe seleccionar por lo menos un cheque");
                }
            }
            else if (((Button)e.CommandSource).CommandName == "cancelar")
            {
                double valor2 = 0;
                ((Button)e.Item.Cells[7].Controls[1]).CommandName = "devolver";
                ((Button)e.Item.Cells[7].Controls[1]).Text        = "Devolver";
                for (int i = 0; i < gridDatos.Items.Count; i++)
                {
                    if (gridDatos.Items[i].Visible == false)
                    {
                        ((CheckBox)gridDatos.Items[i].Cells[7].Controls[1]).Checked = false;
                        gridDatos.Items[i].Visible = true;
                        valor2 = valor2 + (Convert.ToDouble(tablaDatos.Rows[i][5]));
                        tablaDatos.Rows[i][7] = false;
                    }
                }
                Session["tablaDatos"] = tablaDatos;
                ((TextBox)padre.FindControl("valorConsignado")).Text = ((Convert.ToDouble(((TextBox)padre.FindControl("valorConsignado")).Text.Substring(1))) - valor2).ToString("C");
                if (((TextBox)padre.FindControl("valorConsignado")).Text == "$0.00")
                {
                    ((Button)padre.FindControl("guardar")).Enabled = false;
                }
            }
        }
Example #26
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            AppRelativeVirtualPath = "~/";

            try
            {
                if (CurrentUserId == -1)
                {
                    CurrentUserId = UserId;
                }
                string sOutput = string.Empty;
                try
                {
                    int defaultTemplateId = MainSettings.ForumTemplateID;
                    if (DefaultForumViewTemplateId >= 0)
                    {
                        defaultTemplateId = DefaultForumViewTemplateId;
                    }
                    sOutput = BuildForumView(defaultTemplateId, CurrentUserId, Page.ResolveUrl("~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme + "/"));
                }
                catch (Exception ex)
                {
                    //sOutput = ex.Message
                    //DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(Me, ex)
                }

                if (sOutput != string.Empty)
                {
                    try
                    {
                        if (sOutput.Contains("[TOOLBAR"))
                        {
                            var    lit      = new LiteralControl();
                            object sToolbar = null; //DataCache.CacheRetrieve("aftb" & ModuleId)
                            sToolbar = Utilities.GetFileContent(SettingKeys.TemplatePath + "ToolBar.txt");
                            DataCache.CacheStore("aftb" + ModuleId, sToolbar);
                            sToolbar = Utilities.ParseToolBar(sToolbar.ToString(), TabId, ModuleId, UserId, CurrentUserType);
                            lit.Text = sToolbar.ToString();
                            sOutput  = sOutput.Replace("[TOOLBAR]", sToolbar.ToString());
                        }
                        Control tmpCtl = null;
                        try
                        {
                            tmpCtl = ParseControl(sOutput);
                        }
                        catch (Exception ex)
                        {
                        }
                        if (tmpCtl != null)
                        {
                            try
                            {
                                Controls.Add(tmpCtl);
                                LinkControls(Controls);
                                if (!SubsOnly)
                                {
                                    var plh = (PlaceHolder)(tmpCtl.FindControl("plhQuickJump"));
                                    if (plh != null)
                                    {
                                        ctlForumJump = new af_quickjump
                                        {
                                            MOID = ModuleId, dtForums = ForumTable, ModuleId = ModuleId
                                        };
                                        plh.Controls.Add(ctlForumJump);
                                    }
                                    plh = (PlaceHolder)(tmpCtl.FindControl("plhUsersOnline"));
                                    if (plh != null)
                                    {
                                        ForumBase ctlWhosOnline;
                                        ctlWhosOnline = (ForumBase)(LoadControl("~/Desktopmodules/ActiveForums/controls/af_usersonline.ascx"));
                                        ctlWhosOnline.ModuleConfiguration = ModuleConfiguration;
                                        plh.Controls.Add(ctlWhosOnline);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
                    }
                }
            }
            catch (Exception ex)
            {
                Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Example #27
0
    private void SetUpImportButtons(Control row, airportImportCandidate aic, bool fAllowBlast)
    {
        ((Button)row.FindControl("btnAddFAA")).Visible  = !String.IsNullOrEmpty(aic.FAA) && (fAllowBlast || aic.FAAMatch == null);
        ((Button)row.FindControl("btnAddIATA")).Visible = !String.IsNullOrEmpty(aic.IATA) && (fAllowBlast || aic.IATAMatch == null);
        ((Button)row.FindControl("btnAddICAO")).Visible = !String.IsNullOrEmpty(aic.ICAO) && (fAllowBlast || aic.ICAOMatch == null);

        // don't offer to fix distances over maxDistanceToFix, to avoid accidentally stomping on airports somewhere else in the world.
        const double maxDistanceToFix = 50.0;

        ((Button)row.FindControl("btnFixLocationFAA")).Visible  = (aic.FAAMatch != null && aic.MatchStatusFAA == airportImportCandidate.MatchStatus.InDBWrongLocation && aic.DistanceFromAirport(aic.FAAMatch) < maxDistanceToFix);
        ((Button)row.FindControl("btnFixLocationIATA")).Visible = (aic.IATAMatch != null && aic.MatchStatusIATA == airportImportCandidate.MatchStatus.InDBWrongLocation && aic.DistanceFromAirport(aic.IATAMatch) < maxDistanceToFix);
        ((Button)row.FindControl("btnFixLocationICAO")).Visible = (aic.ICAOMatch != null && aic.MatchStatusICAO == airportImportCandidate.MatchStatus.InDBWrongLocation && aic.DistanceFromAirport(aic.ICAOMatch) < maxDistanceToFix);

        // And don't offer to fix type if that's not the error
        ((Button)row.FindControl("btnFixTypeFAA")).Visible  = (aic.FAAMatch != null && aic.MatchStatusFAA == airportImportCandidate.MatchStatus.WrongType && aic.DistanceFromAirport(aic.FAAMatch) < maxDistanceToFix);
        ((Button)row.FindControl("btnFixTypeIATA")).Visible = (aic.IATAMatch != null && aic.MatchStatusIATA == airportImportCandidate.MatchStatus.WrongType && aic.DistanceFromAirport(aic.IATAMatch) < maxDistanceToFix);
        ((Button)row.FindControl("btnFixTypeICAO")).Visible = (aic.ICAOMatch != null && aic.MatchStatusICAO == airportImportCandidate.MatchStatus.WrongType && aic.DistanceFromAirport(aic.ICAOMatch) < maxDistanceToFix);

        // And don't offer to fix type if that's not the error
        ((Button)row.FindControl("btnOverwriteFAA")).Visible  = aic.FAAMatch != null && (aic.MatchStatusFAA == airportImportCandidate.MatchStatus.WrongType || aic.DistanceFromAirport(aic.FAAMatch) >= maxDistanceToFix);
        ((Button)row.FindControl("btnOverwriteIATA")).Visible = aic.IATAMatch != null && (aic.MatchStatusIATA == airportImportCandidate.MatchStatus.WrongType || aic.DistanceFromAirport(aic.IATAMatch) >= maxDistanceToFix);
        ((Button)row.FindControl("btnOverwriteICAO")).Visible = aic.ICAOMatch != null && (aic.MatchStatusICAO == airportImportCandidate.MatchStatus.WrongType || aic.DistanceFromAirport(aic.ICAOMatch) >= maxDistanceToFix);
    }
Example #28
0
 public static T FindById <T>(this Control control, string id) where T : Control
 {
     return(control.FindControl(id).As <T>());
 }
Example #29
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Control control = null;

            if (GV.FooterRow != null)
            {
                control = GV.FooterRow;
            }
            else
            {
                control = GV.Controls[0].Controls[0];
            }
            string     UserId       = (control.FindControl("txtUserId") as TextBox).Text;
            string     FirstName    = (control.FindControl("txtFirstName") as TextBox).Text;
            string     LastName     = (control.FindControl("txtLastName") as TextBox).Text;
            string     PhoneNumber  = (control.FindControl("txtPhoneNumber") as TextBox).Text;
            string     EmailID      = (control.FindControl("txtEmailI") as TextBox).Text;
            string     Address      = (control.FindControl("txtAddress") as TextBox).Text;
            string     City         = (control.FindControl("txtCity") as TextBox).Text;
            string     State        = (control.FindControl("txtState") as TextBox).Text;
            string     Country      = (control.FindControl("txtCountry") as TextBox).Text;
            string     Department   = (control.FindControl("txtDepartment") as DropDownList).Text;
            string     Gender       = (control.FindControl("txtGender") as DropDownList).Text;
            string     TenthBoard   = (control.FindControl("txtTenthBoard") as DropDownList).Text;
            string     TenthMarks   = (control.FindControl("txtTenthMarks") as TextBox).Text;
            string     TwelfthBoard = (control.FindControl("txtTwelfthBoard") as DropDownList).Text;
            string     TwelfthMarks = (control.FindControl("txtTwelfthMarks") as TextBox).Text;
            char       Delete_Flag  = 'N';
            SqlCommand cmd          = new SqlCommand("insert into [details] values(@FirstName,@LastName,@PhoneNumber,@EmailID,@Address,@City,@State,@Country,@Department,@Gender,@TenthBoard,@TenthMarks,@TwelfthBoard,@TwelfthMarks,@Delete_Flag)", con);

            cmd.Parameters.AddWithValue("@FirstName", FirstName);
            cmd.Parameters.AddWithValue("@LastName", LastName);
            cmd.Parameters.AddWithValue("@PhoneNumber", PhoneNumber);
            cmd.Parameters.AddWithValue("@EmailId", EmailID);
            cmd.Parameters.AddWithValue("@Address", Address);
            cmd.Parameters.AddWithValue("@City", City);
            cmd.Parameters.AddWithValue("@State", State);
            cmd.Parameters.AddWithValue("@Country", Country);
            cmd.Parameters.AddWithValue("@Department", Department);
            cmd.Parameters.AddWithValue("@Gender", Gender);
            cmd.Parameters.AddWithValue("@TenthBoard", TenthBoard);
            cmd.Parameters.AddWithValue("@TenthMarks", TenthMarks);
            cmd.Parameters.AddWithValue("@TwelfthBoard", TwelfthBoard);
            cmd.Parameters.AddWithValue("@TwelfthMarks", TwelfthMarks);
            cmd.Parameters.AddWithValue("@Delete_Flag", Delete_Flag);
            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
            Response.Redirect(Request.Url.AbsoluteUri);
        }
Example #30
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            if (Page.IsPostBack)
            {
                ChangePassword changePassword = NamingContainer as ChangePassword;
                if (changePassword != null)
                {
                    Control container = changePassword.ChangePasswordTemplateContainer;
                    if (container != null)
                    {
                        CommandEventArgs cmdArgs   = null;
                        String[]         prefixes  = { "ChangePassword", "Cancel", "Continue" };
                        String[]         postfixes = { "PushButton", "Image", "Link" };
                        foreach (string prefix in prefixes)
                        {
                            foreach (string postfix in postfixes)
                            {
                                string  id   = prefix + postfix;
                                Control ctrl = container.FindControl(id);
                                if ((ctrl != null) && (!String.IsNullOrEmpty(Page.Request.Params.Get(ctrl.UniqueID))))
                                {
                                    switch (prefix)
                                    {
                                    case "ChangePassword":
                                        cmdArgs = new CommandEventArgs(ChangePassword.ChangePasswordButtonCommandName, this);
                                        break;

                                    case "Cancel":
                                        cmdArgs = new CommandEventArgs(ChangePassword.CancelButtonCommandName, this);
                                        break;

                                    case "Continue":
                                        cmdArgs = new CommandEventArgs(ChangePassword.ContinueButtonCommandName, this);
                                        break;
                                    }
                                    break;
                                }
                            }
                            if (cmdArgs != null)
                            {
                                break;
                            }
                        }

                        if ((cmdArgs != null) && (cmdArgs.CommandName == ChangePassword.ChangePasswordButtonCommandName))
                        {
                            Page.Validate();
                            if (!Page.IsValid)
                            {
                                cmdArgs = null;
                            }
                        }

                        if (cmdArgs != null)
                        {
                            RaiseBubbleEvent(this, cmdArgs);
                        }
                    }
                }
            }
        }
Example #31
0
 protected virtual Control FindPlaceholder(string containerID, Control container) {
     return container.FindControl(containerID);
 }
        /// <summary>
        /// Data bind on DataTable
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSubmitDate_Click(object sender, EventArgs e)
        {
            try
            {
                GetSession session = new GetSession();
                string     rangeA  = Request.Form["rangeBa"];
                string     rangeB  = Request.Form["rangeBb"];
                if (rangeA == string.Empty || rangeB == string.Empty)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Alert", "<script type='text/javascript'>alert('please select date');window.location='Transaction.aspx';</script>'");
                }
                else
                {
                    string databaseDateFormat = "yyyy/MM/dd";
                    string dateFrom           = DateTime.ParseExact(Request.Form["rangeBa"], "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None).ToString(databaseDateFormat);
                    //string dateFrom = Convert.ToDateTime(Request.Form["rangeBa"].ToString()).ToString(databaseDateFormat);
                    //string test= Request.Form["rangeBa"];
                    //string dateFrom = DateTime.Parse(Request.Form["rangeBa"].ToString()).ToString();
                    //DateTime dt = DateTime.ParseExact(dateFrom,databaseDateFormat,null);
                    //string dateFrom = DateTime.Parse(Request.Form["rangeBa"].ToString()).ToString(databaseDateFormat);
                    string dateTo = DateTime.ParseExact(Request.Form["rangeBb"], "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None).ToString(databaseDateFormat);
                    //string dateTo = DateTime.Parse(Request.Form["rangeBb"].ToString()).ToString(databaseDateFormat);


                    SqlConnection sconTransaction = DatabaseConnection.GetConnection();
                    SqlCommand    command         = new SqlCommand("GetInvestorLedgerStatement", sconTransaction);
                    command.CommandTimeout = 360;
                    command.CommandType    = CommandType.StoredProcedure;

                    sconTransaction.Close();
                    command.Parameters.Add("@AccountRef", SqlDbType.VarChar).Value = session.AccountNumber;
                    command.Parameters.Add("@FromDate", SqlDbType.DateTime).Value  = dateFrom;
                    command.Parameters.Add("@ToDate", SqlDbType.DateTime).Value    = dateTo;

                    SqlDataAdapter sdaInvestorLedgerStatement = new SqlDataAdapter(command);
                    DataTable      dtInvestorLedgerStatement  = new DataTable();
                    sdaInvestorLedgerStatement.Fill(dtInvestorLedgerStatement);

                    //ADD BALANCE COLUMN
                    SqlConnection sconTransactionBalanceForward    = DatabaseConnection.GetConnection();
                    SqlCommand    commandTransactionBalanceForward = new SqlCommand("GetClientAccountStatusDetailsAsOn", sconTransactionBalanceForward);
                    commandTransactionBalanceForward.CommandType = CommandType.StoredProcedure;
                    sconTransactionBalanceForward.Close();
                    //string dateFrom = DateTime.ParseExact(Request.Form["rangeBa"], "dd/MM/yyyy", CultureInfo.InvariantCulture, DateTimeStyles.None).ToString(databaseDateFormat);
                    string date = DateTime.Parse(dateFrom).AddDays(-1).ToString("yyyy/MM/dd");
                    Session["date"] = date;
                    commandTransactionBalanceForward.Parameters.Add("@AccountRef", SqlDbType.VarChar).Value  = session.AccountNumber;
                    commandTransactionBalanceForward.Parameters.Add("@LedgerDate", SqlDbType.DateTime).Value = date;

                    SqlDataAdapter sdaTransactionBalanceForward = new SqlDataAdapter(commandTransactionBalanceForward);
                    DataTable      dtTransactionBalanceForward  = new DataTable();

                    double forwardBalance = 0;
                    sdaTransactionBalanceForward.Fill(dtTransactionBalanceForward);

                    if (dtTransactionBalanceForward.Rows.Count > 0)
                    {
                        forwardBalance = Double.Parse(dtTransactionBalanceForward.Rows[0]["LedgerBalance"].ToString());
                    }

                    double balanceForward = forwardBalance;
                    dtInvestorLedgerStatement.Columns.Add("Balance", typeof(decimal));
                    //dt.Columns.Add(new DataColumn(columnName = "Balance", dataType = typeof (decimal)));

                    foreach (DataRow dr in dtInvestorLedgerStatement.Rows)
                    {
                        forwardBalance = forwardBalance + (Double.Parse(dr["Credit"].ToString()) - Double.Parse(dr["Debit"].ToString()));
                        dr["Balance"]  = forwardBalance;
                    }

                    rptLedger.DataSource = dtInvestorLedgerStatement;
                    rptLedger.DataBind();

                    Control HeaderTemplate = rptLedger.Controls[0].Controls[0];
                    Label   lblHeader      = HeaderTemplate.FindControl("lblBalanceForward") as Label;
                    lblHeader.Text = balanceForward.ToString("#,##0.00");

                    double totalDebit = 0;
                    foreach (DataRow dr in dtInvestorLedgerStatement.Rows)
                    {
                        totalDebit = totalDebit + Double.Parse(dr["Debit"].ToString());
                    }

                    lblDebit.Text = totalDebit.ToString("#,##0.00");

                    double totalCredit = 0;
                    foreach (DataRow dr in dtInvestorLedgerStatement.Rows)
                    {
                        totalCredit = totalCredit + Double.Parse(dr["Credit"].ToString());
                    }

                    lblCredit.Text  = totalCredit.ToString("#,##0.00");
                    lblBalance.Text = forwardBalance.ToString("#,##0.00");
                }
            }

            catch (Exception ex)
            {
                Response.Redirect("../../LoginErrorPage.aspx?ex=" + Server.UrlEncode(ex.Message) + "&st=" + Server.UrlEncode(ex.StackTrace));
            }
        }