コード例 #1
0
    protected void ddlPreviousSubTypes_Changed(object sender, EventArgs e)
    {
        List <RollBackDistributionInfo> lastRBInfos   = selectedOldRollBackInfos;
        List <RollBackDistributionInfo> totalInfos    = listOldRollBackInfos;
        GridViewRowCollection           displayedRows = gvOldPolicies.Rows;

        foreach (GridViewRow gvRow in displayedRows)
        {
            CheckBox cbIsForRollBack    = gvRow.FindControl("cbIsForRollBack") as CheckBox;
            int      rollBackInfoID     = Convert.ToInt32(gvOldPolicies.DataKeys[gvRow.RowIndex].Value);
            RollBackDistributionInfo fi = lastRBInfos.Where(f => f.ID == rollBackInfoID).SingleOrDefault();
            fi.IsForRollBack = cbIsForRollBack.Checked;
            RollBackDistributionInfo trdi = totalInfos.Where(f => f.ID == rollBackInfoID).SingleOrDefault();
            trdi.IsForRollBack = cbIsForRollBack.Checked;
        }
        selectedOldRollBackInfos = lastRBInfos;
        listOldRollBackInfos     = totalInfos;
        List <RollBackDistributionInfo> selectedInfos = new List <RollBackDistributionInfo>();
        int selectedSubTypeID = int.Parse(ddlPreviosSubTypes.SelectedValue);

        if (selectedSubTypeID > 0)
        {
            selectedInfos            = listOldRollBackInfos.Where(c => c.InsuranceSubTypeID == selectedSubTypeID).ToList();
            gvOldPolicies.DataSource = selectedInfos;
            gvOldPolicies.DataBind();
        }
        else
        {
            selectedInfos            = listOldRollBackInfos;
            gvOldPolicies.DataSource = selectedInfos;
            gvOldPolicies.DataBind();
        }
        selectedOldRollBackInfos = selectedInfos;
    }
コード例 #2
0
        protected void lbFuzzySearch_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                TextBox txtFuzzy;
                GridViewRowCollection gvRows = gvRows = gvTransactions.Rows;
                string fuzzyValue            = hdnFuzzySearchField.Value == "SalesType" ? "txtSalesType" : "txtSeller";

                foreach (GridViewRow gvr in gvRows)
                {
                    if (gvr.RowIndex.ToString() == hdnGridFuzzySearchRowId.Value)
                    {
                        txtFuzzy = (gvr.FindControl(fuzzyValue) as TextBox);
                        (gvr.FindControl("hdnIsModified") as HiddenField).Value = "Y";
                        if (lbFuzzySearch.SelectedValue.ToString() == "No results found")
                        {
                            txtFuzzy.Text    = string.Empty;
                            txtFuzzy.ToolTip = string.Empty;
                            return;
                        }

                        txtFuzzy.Text    = lbFuzzySearch.SelectedValue.ToString();
                        txtFuzzy.ToolTip = lbFuzzySearch.SelectedValue.ToString();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler("Error in selecting sale type.", ex.Message);
            }
        }
コード例 #3
0
ファイル: Functions.cs プロジェクト: MushfiqRazib/BO_Music
    public static ArrayList GetOrderGridData(GridView gridView)
    {
        GridViewRowCollection rowCollection = gridView.Rows;
        ArrayList             cartTable     = new ArrayList(rowCollection.Count);

        for (int i = 0; i < rowCollection.Count; i++)
        {
            GridViewRow row = rowCollection[i];

            TextBox control        = (TextBox)row.Cells[4].FindControl("intCtrQuanity");
            TextBox txtArticleCode = (TextBox)row.Cells[7].FindControl("txtArticleCode");
            String  quantity       = control.Text;

            quantity = quantity.Replace("-", "");
            if (quantity == null || quantity.Equals("") || quantity.Substring(0, 1).Equals("-") || int.Parse(quantity) <= 0 || quantity.Equals(""))
            {
                quantity = "1";
            }


            String articleCode = txtArticleCode.Text;
            Order  order       = new Order(articleCode, Convert.ToInt32(quantity));
            order = new Facade().LoadOrderInfo(articleCode, order);
            order.publisherName = new Facade().GetPublisherName(articleCode);
            cartTable.Add(order);


            // String temp= control.GetType().ToString();
        }
        return(cartTable);
    }
コード例 #4
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            GridViewRowCollection grows1 = GridView1.Rows;


            for (int i = 0; i < grows1.Count; i++)
            {
                if (grows1[i].Cells[indexOfIsApproved].Text == "True")
                {
                    SqlDataSource1.UpdateCommand = String.Format(@"UPDATE [dbo].[Items1] SET [ProjectStatus] = 'Approved'
                    WHERE [ID] = {0} ", int.Parse(grows1[i].Cells[indexOfID].Text));
                    SqlDataSource1.Update();
                }
                else if (grows1[i].Cells[indexOfIsApproved].Text == "False")
                {
                    SqlDataSource1.UpdateCommand = String.Format(@"UPDATE [dbo].[Items1] SET [ProjectStatus] = 'Rejected'
                    WHERE [ID] = {0} ", int.Parse(grows1[i].Cells[indexOfID].Text));
                    int cnt = SqlDataSource1.Update();
                }
                else
                {
                    SqlDataSource1.UpdateCommand = String.Format(@"UPDATE [dbo].[Items1] SET [ProjectStatus] = 'Pending'
                    WHERE [ID] = {0} ", int.Parse(grows1[i].Cells[indexOfID].Text));
                    SqlDataSource1.Update();
                }
            }

            this.Response.Write("<script>window.location='Default.aspx'</script>");
        }
    protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
    {
        try
        {
            quitarSeleccionRadio();
            RadioButton rdb = sender as RadioButton;
            rdb.Checked = true;
            GridViewRow grv = (GridViewRow)rdb.Parent.Parent;
            pintarFilaSeleccionada(grv.RowIndex);

            indiceGridSeleccionado = grv.RowIndex;

            int indexfila = 0;
            GridViewRowCollection filas = grvClientes.Rows;
            foreach (GridViewRow f in filas)
            {
                if (indiceGridSeleccionado == indexfila)
                {//f.RowIndex
                    hdfClienteSeleccionado.Value = f.Cells[1].Text;
                    break;
                }
                indexfila = indexfila + 1;
            }
        }
        catch (Exception ex)
        {
            ScriptManager.RegisterStartupScript(this, typeof(Page), "UpdateMsg",
                                                @"alertify.alert('Conciliaci&oacute;n bancaria','Error: "
                                                + ex.Message + "', function(){ alertify.error('Error en la solicitud'); });", true);
        }
    }
コード例 #6
0
    protected void EditRow(int index)
    {
        gvForStationeryCatalogue.EditIndex = index;
        gvForStationeryCatalogue.DataBind();
        GridViewRowCollection a   = gvForStationeryCatalogue.Rows;
        GridViewRow           row = a[index];
        Label        itemLabel    = (Label)row.FindControl("LblItemCode");
        DropDownList ddl          = (DropDownList)row.FindControl("DdlCategory");
        DropDownList ddl2         = (DropDownList)row.FindControl("DdlUOM");

        ddl.DataTextField  = "CategoryName";
        ddl.DataValueField = "CategoryID";
        List <Category> categories = EFBroker_Category.GetCategoryList();
        Item            item       = EFBroker_Item.GetItembyItemCode(itemLabel.Text);

        ddl.DataSource    = categories;
        ddl.SelectedValue = item.CategoryID.ToString();
        ddl.DataBind();

        ddl2.DataSource    = EFBroker_Item.GetDistinctUOMList();
        ddl2.SelectedValue = item.UnitOfMeasure;
        ddl2.DataBind();
        row.BackColor = Color.Yellow;
        return;
    }
コード例 #7
0
    protected void dvDataSource_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
    {
        object          o     = e.ReturnValue;
        IncomingFacture inFac = (IncomingFacture)o;

        if (inFac.IncomingFactureType.Code == IncomingFactureType.ZA_POLISI)
        {
            GridView              gvNewPolicies    = (GridView)DetailsView1.FindControl("gvNewPolicies");
            List <FactureInfo>    lastFactureInfos = listFactureInfos;
            GridViewRowCollection displayedRows    = gvNewPolicies.Rows;
            foreach (GridViewRow gvRow in displayedRows)
            {
                CheckBox    cbIsForFacturing = gvRow.FindControl("cbIsForFacturing") as CheckBox;
                int         factureInfoID    = Convert.ToInt32(gvNewPolicies.DataKeys[gvRow.RowIndex].Value);
                FactureInfo fi = lastFactureInfos.Where(f => f.ID == factureInfoID).SingleOrDefault();
                fi.IsForFacturing = cbIsForFacturing.Checked;
            }
            listFactureInfos = lastFactureInfos;
            List <FactureInfo> listFactureInfo = listFactureInfos.Where(c => c.IsForFacturing == true).ToList();
            foreach (FactureInfo fi in listFactureInfo)
            {
                IncomingFacturePolicyItem ifpi = new IncomingFacturePolicyItem();
                ifpi.IncomingFactureID = inFac.ID;
                ifpi.PolicyItemID      = fi.ID;
                ifpi.IsActive          = true;
                ifpi.Insert();
                PolicyItem pi = PolicyItem.Get(fi.ID);
                pi.PolicyIncomeFactureStatusID = PolicyIncomeFactureStatuse.GetByCode(PolicyIncomeFactureStatuse.CELOSNO_FAKTURIRANA).ID;
                PolicyItem.Table.Context.SubmitChanges();
            }
        }
    }
コード例 #8
0
        public void CalculateTotalValue_TwoRowsWithTheThirdCellUseful_ShouldCalculateTheResult()
        {
            //prepares mock data
            string[,] mockRowValues = new string[, ] {
                { "", "", "99.99" }, { "", "", "299.99" }
            };
            var mockRows = new ArrayList();
            GridViewRowCollection mockRowCollection;

            for (int i = 0; i < mockRowValues.GetLength(0); i++)
            {
                //instantiates grid view rows
                GridViewRow tempRow = new GridViewRow(i, i,
                                                      DataControlRowType.DataRow, DataControlRowState.Normal);

                for (int j = 0; j < mockRowValues.GetLength(1); j++)
                {
                    //instantiates cells, populates them and puts them in current row
                    TableCell tempCell = new TableCell();
                    tempCell.Text = mockRowValues[i, j];
                    tempRow.Cells.Add(tempCell);
                }
                //adds current row in a mock row collection
                mockRows.Add(tempRow);
            }
            mockRowCollection = new GridViewRowCollection(mockRows);

            //tests against assertion
            string totalValueLiteral = ReportHelper.CalculateTotalValue(mockRowCollection, 2);

            Assert.AreEqual(totalValueLiteral, "399.98");
        }
コード例 #9
0
        public void GridViewRowCollection_DefaultProperty()
        {
            GridViewRowCollection collection = new GridViewRowCollection(new ArrayList());

            Assert.AreEqual(0, collection.Count, "Count");
            Assert.AreEqual(false, collection.IsSynchronized, "IsSynchronized"); //Always return false
        }
コード例 #10
0
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        List <RollBackDistributionCompanyInfo> finalList = listSelected;
        GridViewRowCollection displayedRows = gvSelectedRollBаcks.Rows;

        foreach (GridViewRow gvRow in displayedRows)
        {
            CheckBox cbIsForRollBack           = gvRow.FindControl("cbSelected") as CheckBox;
            int      rollBackID                = Convert.ToInt32(gvSelectedRollBаcks.DataKeys[gvRow.RowIndex].Value);
            RollBackDistributionCompanyInfo fi = finalList.Where(c => c.ID == rollBackID).SingleOrDefault();
            fi.IsForRollBack = cbIsForRollBack.Checked;
        }

        if (finalList.Where(c => c.IsForRollBack).ToList().Count > 0)
        {
            if (RollBackDistribution.CanMakeGroupRollBack(finalList.Where(c => c.IsForRollBack).ToList()))
            {
                lblError.Visible = false;
                RollBackDistribution.InsertForCompany(finalList.Where(c => c.IsForRollBack).ToList(), this.PageUser.ID);
            }
            else
            {
                lblError.Text    = "Имате избрано раздолжници од повеќе компании";
                lblError.Visible = true;
            }
        }
        else
        {
            lblError.Text    = "Немате селектирано ниту една раздолжница";
            lblError.Visible = true;
        }
    }
コード例 #11
0
        public void MarkCriticalRow_TwoRowsWIthTheSecondRowCritical_ShouldMarkTheSecondRowRed()
        {
            //prepares mock data
            string[,] mockRowValues = new string[, ] {
                { "", "", "", "Low" }, { "", "", "", "High" }
            };
            var mockRows = new ArrayList();
            GridViewRowCollection mockRowCollection;

            for (int i = 0; i < mockRowValues.GetLength(0); i++)
            {
                //instantiates grid view rows
                GridViewRow tempRow = new GridViewRow(i, i,
                                                      DataControlRowType.DataRow, DataControlRowState.Normal);

                for (int j = 0; j < mockRowValues.GetLength(1); j++)
                {
                    //instantiates cells, populates them and puts them in current row
                    TableCell tempCell = new TableCell();
                    tempCell.Text = mockRowValues[i, j];
                    tempRow.Cells.Add(tempCell);
                }
                //adds current row in a mock row collection
                mockRows.Add(tempRow);
            }
            mockRowCollection = new GridViewRowCollection(mockRows);

            ReportHelper.MarkCriticalRow(mockRowCollection, 3);
            Assert.AreEqual(mockRowCollection[mockRowCollection.Count - 1].CssClass, "danger");
        }
コード例 #12
0
    protected void gvDaps_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        GridView gvDaps    = (GridView)formViewTlProject_Organism.FindControl("gvDaps");
        TextBox  txtDapAdd = (TextBox)formViewTlProject_Organism.FindControl("txtDapAdd");
        Panel    pnlAddDap = (Panel)formViewTlProject_Organism.FindControl("pnlAddDap");

        int RowIndex = ((GridViewRow)(((LinkButton)e.CommandSource).NamingContainer)).RowIndex;

        GridViewRowCollection rows = gvDaps.Rows;
        List <TempDap>        objs = SetGV(rows, RowIndex);

        objs.RemoveAt(RowIndex);

        gvDaps.DataSource = objs;
        gvDaps.DataBind();

        txtDapAdd.Text = "";
        txtDapAdd.Focus();

        if (objs.Count == 0)
        {
            pnlAddDap.Height = Unit.Point(215);
        }
        else
        {
            pnlAddDap.Height = Unit.Point(Convert.ToInt32(pnlAddDap.Height.Value) - 27);
        }
    }
コード例 #13
0
    protected void btnSaveAndBack_Click(object sender, EventArgs e)
    {
        GridView gvDaps = (GridView)formViewTlProject_Organism.FindControl("gvDaps");

        HiddenField hfDap         = (HiddenField)formViewTlProject_Organism.FindControl("hfDap");
        TextBox     txtDap        = (TextBox)formViewTlProject_Organism.FindControl("txtDap");
        TextBox     txtDapCounter = (TextBox)formViewTlProject_Organism.FindControl("txtDapCounter");

        GridViewRowCollection rows     = gvDaps.Rows;
        List <TempDap>        tempDaps = SetGV(rows, -1);

        double total = 0;
        string daps  = "";

        foreach (TempDap tempDap in tempDaps)
        {
            total += Convert.ToDouble(tempDap.Dap);
            daps  += Convert.ToDouble(tempDap.Dap).ToString() + ",";
        }
        daps = (daps.Count() > 1) ? daps.Substring(0, daps.Count() - 1) : daps;

        decimal dap = tempDaps.Count > 1 ? Convert.ToDecimal(Math.Round(Math.Sqrt(Math.Pow(total, 2D) / Convert.ToDouble(tempDaps.Count)) * 100) / 100) : Convert.ToDecimal(total);

        hfDap.Value        = daps;
        txtDap.Text        = dap.ToString();
        txtDapCounter.Text = tempDaps.Count == 0 ? "1" : tempDaps.Count.ToString();

        txtDap.Attributes.Add("style", "background-color: " + (tempDaps.Count <= 1 ? "#FFFFFF;" : "#E3E9EF;"));
        txtDap.Enabled = tempDaps.Count <= 1 ? true : false;

        btnBack_Click(sender, e);
    }
コード例 #14
0
        protected void LkbSalvarListaCompra_Click(object sender, EventArgs e)
        {
            try
            {
                GridViewRowCollection rows = GvwLista.Rows;

                foreach (GridViewRow row in rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {
                        Label   LblIdItemListaCompra = (Label)row.FindControl("iditemlistacompra");
                        TextBox TextQuantidade       = (TextBox)row.FindControl("TxtQuantidade");

                        aplListaCompra.AtualizarQuantidadeItemListaCompra(
                            this.Id,
                            Convert.ToInt32(LblIdItemListaCompra.Text),
                            Convert.ToInt32(TextQuantidade.Text)
                            );
                    }
                }
                MasterPage.SetMensagemMain("Salvo com sucesso!", ETipoMensagem.Sucesso);
            }
            catch (Exception erro)
            {
                MasterPage.SetMensagemMain(erro.Message, ETipoMensagem.Erro);
            }
        }
コード例 #15
0
        public void ActualizarGastosParticulares(GridViewRowCollection rows, string importe, string detalle, string importePorUF, string tipoGasto)
        {
            int col_Apllicar = 4;

            #region Validar
            if (detalle == "")
            {
                throw new Exception("No se ingreso el Detalle");
            }
            else if (importe == "")
            {
                throw new Exception("No se ingreso el Importe");
            }
            else if (importePorUF == "0")
            {
                throw new Exception("No se Actualizo correctamente el Importe para las UF");
            }
            #endregion

            foreach (GridViewRow row in rows)
            {
                CheckBox chk = row.Cells[col_Apllicar].Controls[1] as CheckBox;
                if (chk != null && chk.Checked)
                {
                    GuardarGastosParticulares(row, importe, detalle, importePorUF, tipoGasto);
                }
            }
        }
コード例 #16
0
        public void GridViewRowCollection_DefaultPropertyNotWorking()
        {
            GridViewRowCollection collection = new GridViewRowCollection(new ArrayList());

            // Note : does not contain a definition for `IsReadOnly'
            //Assert.AreEqual (false, collection.IsReadOnly, "IsReadOnly");		//Always return false
            Assert.AreEqual(collection, collection.SyncRoot, "SyncRoot");
        }
コード例 #17
0
 public static void AgentDoctorViewReportColourMark(GridViewRowCollection ReportGridViewRowsCollection)
 {
     for (int i = 0; i < ReportGridViewRowsCollection.Count; i++)
     {
         GridViewRow specificRow = ReportGridViewRowsCollection[i];
         AgentDoctorCssClassAdapterViewReportGVrow(specificRow);
     }
 }
コード例 #18
0
        // --------------------------------------------------------------------------------------------//
        // Metodo que inicia o gridview
        // --------------------------------------------------------------------------------------------//

        protected void Bindgridview(String order, String DataIni, String DataFin)
        {
            //Response.Write("Order: "+order+" DataIni: "+DataIni+" DataFin: "+DataFin);

            // --------------------------------------------------------------------------------------------//
            // resgata do banco uma lista de propostas com a ordem e datas informadas
            // --------------------------------------------------------------------------------------------//

            List <ObjectProposta> coll = Controle.Getinstance().ResgatarPropostas(order, DataIni, DataFin);


            GridView1.DataSource = coll;
            GridView1.PageSize   = 15;
            GridView1.DataBind();


            // --------------------------------------------------------------------------------------------//
            // faz o tratamento no grid para mostrar o botão autorizar ou a Label autorizar
            // --------------------------------------------------------------------------------------------//

            GridViewRowCollection rc = GridView1.Rows;

            for (int i = 0; i < rc.Count; i++)
            {
                autorizar    = (Button)rc[i].Cells[6].FindControl("autorizar");
                autorizarLbl = (Label)rc[i].Cells[6].FindControl("autorizarLbl");


                if ((coll[i].cdPropostaSISSER.Equals("Não Apresenta")) && (coll[i].autorizacao_usuario == 0))
                {
                    autorizar.Visible    = true;
                    autorizarLbl.Visible = false;
                }
                else
                {
                    autorizar.Visible      = false;
                    autorizarLbl.Visible   = true;
                    autorizarLbl.ForeColor = Color.Green;
                }
            }

            // --------------------------------------------------------------------------------------------//
            // Verifica se a lista recebida esta vazia, se estiver, apresenta uma menssagem
            // --------------------------------------------------------------------------------------------//

            if (coll.Count != 0)
            {
                information.Visible      = false;
                TDataInicial.BorderColor = Color.Blue;
                TDataFinal.BorderColor   = Color.Blue;
            }
            else
            {
                information.Visible   = true;
                information.ForeColor = Color.Red;
                information.Text      = "Não há propostas eleitas para esta lista";
            }
        }
コード例 #19
0
 public static void MarkCriticalRow(GridViewRowCollection rows, int cellPosition)
 {
     foreach (GridViewRow row in rows)
     {
         string riskLevel = row.Cells[cellPosition].Text;
         if (riskLevel == "High")
         {
             row.CssClass = "danger";
         }
     }
 }
コード例 #20
0
        public void MarkCriticalRow_EmptyRow_ShouldChangeNothing()
        {
            //prepares mock data
            GridViewRowCollection mockRowCollection;
            var mockRows = new ArrayList();

            mockRowCollection = new GridViewRowCollection(mockRows);
            //tests against assertion
            ReportHelper.MarkCriticalRow(mockRowCollection, 3);
            Assert.AreEqual(mockRows.Count, 0);
        }
コード例 #21
0
        private void Bindgridview()
        {
            coll = Controle.Getinstance().ResgatarEventLogs(nrProposta.Text);


            if (coll.Count == 0)
            {
                information.Text = "Não a dados para essa proposta.";
                LimparGrid();
            }
            else
            {
                idApoliceSession     = coll[0].IDApolice;
                GridView1.DataSource = coll;

                labelCdSisser.Visible = true;
                GridView1.DataBind();



                GridViewRowCollection rc = GridView1.Rows;

                for (int i = 0; i < rc.Count; i++)
                {
                    if ((dados = (Button)rc[i].Cells[6].FindControl("Dados")).CommandArgument.Equals("Não Apresenta"))
                    {
                        dados.Visible = false;
                    }
                    ;


                    if ((lblErro = (Label)rc[i].Cells[4].FindControl("lblErro")).Text.Equals("Não Apresenta"))
                    {
                        lblErro.ForeColor = Color.Green;
                    }
                    else
                    {
                        lblErro.ForeColor = Color.Red;
                    }
                }

                if (coll[0].Codigo_Proposta_SISSER == 0 && coll[0].autorizacao_usuario == 0)
                {
                    CdPropostaSISSER.Text = "Não Apresenta";
                    Autorizar.Visible     = true;
                }
                else
                {
                    CdPropostaSISSER.Text = coll[0].Codigo_Proposta_SISSER.ToString();
                    Autorizar.Visible     = false;
                }
            }
        }
コード例 #22
0
        public static string CalculateTotalValue(GridViewRowCollection rows, int cellPosition)
        {
            decimal totalValue = 0;

            foreach (GridViewRow row in rows)
            {
                decimal value = decimal.Parse(row.Cells[cellPosition].Text);
                totalValue += value;
            }

            return(totalValue.ToString());
        }
コード例 #23
0
        public void CalculateTotalValue_EmptyRow_ShouldReturnZero()
        {
            //prepares mock data
            GridViewRowCollection mockRowCollection;
            var mockRows = new ArrayList();

            mockRowCollection = new GridViewRowCollection(mockRows);
            //tests against assertion
            string totalValueLiteral = ReportHelper.CalculateTotalValue(mockRowCollection, 2);

            Assert.AreEqual(totalValueLiteral, "0");
        }
コード例 #24
0
ファイル: tasks.aspx.cs プロジェクト: BadBoyJH/NURacing
        //control the background color for the Gridview
        private void SetBkColor()
        {
            GridViewRowCollection rows = todoTable.Rows;

            for (int i = 0; i < rows.Count; i++)
            {
                //set the background color for every second row of Gridview
                if (i % 2 == 0)
                {
                    rows[i].BackColor = System.Drawing.ColorTranslator.FromHtml("#141414");
                }
            }
        }
コード例 #25
0
        public void GridViewRowCollection_AssignProperty()
        {
            ArrayList list = new ArrayList();

            list.Add(new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Normal));
            GridViewRowCollection collection = new GridViewRowCollection(list);

            Assert.AreEqual(1, collection.Count, "Count");
            // Note : does not contain a definition for `IsReadOnly'
            //Assert.AreEqual (false, collection.IsReadOnly, "IsReadOnly");		//Always return false
            Assert.AreEqual(false, collection.IsSynchronized, "IsSynchronized"); //Always return false
            Assert.AreEqual(typeof(GridViewRow), collection[0].GetType(), "Item");
        }
コード例 #26
0
        public void GridViewRowCollection_CopyTo()
        {
            ArrayList list = new ArrayList();

            list.Add(new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Normal));
            GridViewRowCollection collection = new GridViewRowCollection(list);

            GridViewRow[] rows = new GridViewRow[collection.Count];
            collection.CopyTo(rows, 0);
            Assert.AreEqual(collection.Count, rows.Length, "CopyToLenth");
            Assert.IsNotNull(rows[0], "CopyToTargetCreated");
            Assert.AreEqual(collection[0].GetType(), rows[0].GetType(), "CopyToTargetType");
        }
コード例 #27
0
        public void GridViewRowCollection_GetEnumerator()
        {
            ArrayList list = new ArrayList();

            list.Add(new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Normal));
            GridViewRowCollection collection = new GridViewRowCollection(list);
            IEnumerator           numerator  = collection.GetEnumerator();

            Assert.IsNotNull(numerator, "IEnumeratorCreated");
            numerator.Reset();
            numerator.MoveNext();
            Assert.AreEqual(numerator.Current, collection[0], "GetEnumeratorCurrent");
            Assert.AreEqual(typeof(GridViewRow), numerator.Current.GetType(), "");
        }
コード例 #28
0
        /// <summary>
        /// Gets a value indicating whether the specified business object is
        /// currently represented by the <see cref="GridViewRowCollection"/> object.
        /// </summary>
        /// <param name="rows">A <see cref="GridViewRowCollection"/> object.</param>
        /// <param name="link">The current business object.</param>
        /// <returns>True if the specified business object is represented by
        /// the <see cref="GridViewRowCollection"/> object.</returns>
        public bool IsCurrentItem(GridViewRowCollection rows, Object link)
        {
            GridViewRow row = GetRow(rows, link);
            String      origValue, currValue;
            bool        isCurrent = false;

            if (row != null)
            {
                isCurrent = true;

                foreach (EntityProperty property in PropertyMappings)
                {
                    if (property.IsKey)
                    {
                        /*
                         * value = GetOriginalValue(row, property.DataField);
                         *
                         * // compare original value
                         * if ( !EntityUtil.IsPropertyValueEqual(link, property.DataField, value) )
                         * {
                         *      isCurrent = false;
                         *      break;
                         * }
                         * // check for current value, if OriginalValueControlID is used
                         * if ( !String.IsNullOrEmpty(property.OriginalValueControlID) )
                         * {
                         *      strValue = String.Format("{0}", GetValue(row, property.DataField));
                         *
                         *      if ( String.IsNullOrEmpty(strValue) )
                         *      {
                         *              isCurrent = false;
                         *              break;
                         *      }
                         * }
                         */

                        origValue = String.Format("{0}", GetOriginalValue(row, property.DataField));
                        currValue = String.Format("{0}", GetValue(row, property.DataField));

                        if (!String.IsNullOrEmpty(origValue) && String.IsNullOrEmpty(currValue))
                        {
                            isCurrent = false;
                            break;
                        }
                    }
                }
            }

            return(isCurrent);
        }
コード例 #29
0
ファイル: GroupFactures.aspx.cs プロジェクト: yonass/ASUC2
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        DateTime              startDate        = DateTime.Parse(tbStartDate.Text);
        DateTime              endDate          = DateTime.Parse(tbEndDate.Text);
        List <FactureInfo>    lastFactureInfos = listNewFactureInfos;
        GridViewRowCollection displayedRows    = gvNewPolicies.Rows;

        foreach (GridViewRow gvRow in displayedRows)
        {
            CheckBox    cbIsForFacturing = gvRow.FindControl("cbIsForFacturing") as CheckBox;
            int         factureInfoID    = Convert.ToInt32(gvNewPolicies.DataKeys[gvRow.RowIndex].Value);
            FactureInfo fi = lastFactureInfos.Where(facInfo => facInfo.ID == factureInfoID).SingleOrDefault();
            fi.IsForFacturing = cbIsForFacturing.Checked;
        }
        listNewFactureInfos = lastFactureInfos;
        List <PolicyItem> items = new List <PolicyItem>();

        foreach (FactureInfo fi in lastFactureInfos)
        {
            if (fi.IsForFacturing)
            {
                PolicyItem pi = PolicyItem.Get(fi.ID);
                items.Add(pi);
            }
        }
        if (items.Count > 0)
        {
            if (ddlClients.SelectedIndex != -1)
            {
                int clientID  = int.Parse(ddlClients.SelectedValue);
                int factureID = Broker.DataAccess.Facture.CreateGroupFacture(this.PageUser.ID, clientID, startDate, endDate, items);
                FactureID         = factureID;
                btnPrint.Visible  = true;
                btnInsert.Visible = false;
                //btnPrintAnex.Visible = true;
                InsertClientInFinansovo(clientID);
            }
            else
            {
                lblError.Visible = true;
                btnPrint.Visible = false;
            }
        }
        else
        {
            lblError.Visible = true;
            btnPrint.Visible = false;
        }
    }
コード例 #30
0
    private bool GetValueByLabel(GridViewRowCollection rows, string label)
    {
        bool value = false;

        foreach (GridViewRow dr in dgvNonOptional.Rows)
        {
            if (dr.Cells.Count > 1 && dr.Cells[0].Text == label)
            {
                var chk = (CheckBox)dr.Cells[1].FindControl("chbValue");
                value = chk.Checked;
                break;
            }
        }
        return(value);
    }