public static void Convert(System.Data.DataSet ds, System.Web.HttpResponse response, string ExcelName)
    {
        try
        {
            //first let's clean up the response.object
            response.Clear();
            response.Charset = "";
            //set the response mime type for excel

            response.ContentType = "application/vnd.ms-excel";
            //create a string writer
            //response.AddHeader("Content-Disposition", "attachment;filename=Shilpa.xls");

            response.AddHeader("Content-Disposition", "attachment;filename=" + ExcelName + ".xls");

            System.IO.StringWriter stringWrite = new System.IO.StringWriter();
            //create an htmltextwriter which uses the stringwriter
            System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
            //instantiate a datagrid
            System.Web.UI.WebControls.DataGrid dg = new System.Web.UI.WebControls.DataGrid();
            //set the datagrid datasource to the dataset passed in
            dg.DataSource = ds.Tables[0];
            //bind the datagrid
            dg.DataBind();
            //tell the datagrid to render itself to our htmltextwriter
            dg.RenderControl(htmlWrite);
            //all that's left is to output the html
            response.Write(stringWrite.ToString());
            response.End();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
        public void ClearTest()
        {
            var array = new[] { 1, 2, 3, 4 };
            array.Clear();

            CollectionAssert.AreEquivalent(new[] { 0, 0, 0, 0 }, array);
        }
 public void PrepareResponse(System.Web.HttpResponse httpResponse)
 {
     httpResponse.Clear();
     httpResponse.ContentType = "text/csv";
     httpResponse.AddHeader("content-disposition", "attachment; filename=\"" + "export" + ".csv\"");
     httpResponse.BufferOutput = false;
 }
        /// <summary>
        /// Generates the pachube embeddable graph. 
        /// </summary>
        /// <seealso cref="http://pachube.github.com/pachube_graph_library/"/>
        /// <param name="alContent">The Embeddable HTML content.</param>
        public static void GenerateHTML(System.Collections.ArrayList alContent)
        {
            string update = GraphFunctionality.AutoUpdate.ToString().ToLower();
            string rolling = GraphFunctionality.Rolling.ToString().ToLower();
            try
            {
                alContent.Clear();
                foreach (string ID in PachubeData.TOTAL_DATASTREAM_ID)
                {
                    string EmbeddableHTML =
                        "<div id=\"graph\" class=\"pachube-graph\" pachube-resource=\"feeds/" + AlarmByZones.Alarm.UserData.Pachube.feedId + "/datastreams/" + ID +
                        "\" pachube-key=\"" +
                        AlarmByZones.Alarm.UserData.Pachube.apiKey + "\" pachube-options=\"timespan:" +
                        Pachube.EmbeddableGraphGenerator.GraphFunctionality.DEFAULT_TIMESPAN[0] +
                        ";update:"+update+";rolling:"+rolling+";background-color:#FFFFFF;line-color:#FF0066;grid-color:#EFEFEF;" +
                        "border-color:#9D9D9D;text-color:#555555;\" style=\"width:" +
                        Pachube.EmbeddableGraphGenerator.GraphAppearance.WIDTH +
                        ";height:" + Pachube.EmbeddableGraphGenerator.GraphAppearance.HEIGHT +
                        ";background:#F0F0F0;\">Graph: Feed " + AlarmByZones.Alarm.UserData.Pachube.feedId +
                        ", Datastream 1</div><script type=\"text/javascript\" " +
                        "src=\"http://beta.apps.pachube.com/embeddable_graphs/lib/PachubeLoader.js\"></script>";

                    alContent.Add(EmbeddableHTML);
                    alContent.Add("<br/>");
                }
                alContent.Add("<br/>");
                alContent.Add("Reference material from: <a href=\"http://pachube.github.com/pachube_graph_library/ \">Pachube graphic library.</a>" + "");
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
            }
        }
 public static void Convert(System.Data.DataSet ds, int TableIndex, System.Web.HttpResponse response, string ExcelName)
 {
     //lets make sure a table actually exists at the passed in value
     //if it is not call the base method
     if (TableIndex > ds.Tables.Count - 1)
     {
         Convert(ds, response, ExcelName);
     }
     //we've got a good table so
     //let's clean up the response.object
     response.Clear();
     response.Charset = "";
     response.AddHeader("Content-Disposition", "attachment;filename=Shilpa.xls");
     //set the response mime type for excel
     response.ContentType = "application/vnd.ms-excel";
     //create a string writer
     System.IO.StringWriter stringWrite = new System.IO.StringWriter();
     //create an htmltextwriter which uses the stringwriter
     System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
     //instantiate a datagrid
     System.Web.UI.WebControls.DataGrid dg = new System.Web.UI.WebControls.DataGrid();
     //set the datagrid datasource to the dataset passed in
     dg.DataSource = ds.Tables[TableIndex];
     //bind the datagrid
     dg.DataBind();
     //tell the datagrid to render itself to our htmltextwriter
     dg.RenderControl(htmlWrite);
     //all that's left is to output the html
     response.Write(stringWrite.ToString());
     response.End();
 }
Example #6
0
        public static void ExportToCsv(System.Web.HttpResponse response, DataTable exportData, string exportName)
        {
            response.Clear();
            byte[] BOM = { 0xEF, 0xBB, 0xBF }; // UTF-8 BOM karakterleri
            response.BinaryWrite(BOM);
            StringBuilder sb = new StringBuilder();
            foreach (DataColumn dc in exportData.Columns)
            {
                sb.Append((char)(34) + dc.ColumnName + (char)(34));
                sb.Append(";");
            }
            sb = sb.Remove(sb.Length - 1, 1);
            sb.AppendLine();
            foreach (DataRow dr in exportData.Rows)
            {

                for (int i = 0; i < exportData.Columns.Count; i++)
                {
                    sb.Append(dr[i].ToString().Replace(';', ',').Replace('\n', ' ').Replace('\t', ' ').Replace('\r', ' '));
                    sb.Append(";");
                }
                sb = sb.Remove(sb.Length - 1, 1);
                sb.AppendLine();
            }
            response.ContentType = "text/csv";
            response.AppendHeader("Content-Disposition", "attachment; filename=" + exportName + ".csv");
            response.Write(sb.ToString());
            response.End();
        }
Example #7
0
        public static IEnumerable<Todo> NeuLaden(System.Collections.ObjectModel.ObservableCollection<Todo> todos = null)
        {
            if (todos != null) todos.Clear();

            var todoService = new TodoService.TodoServiceClient();
            var loadedTodos = todoService.All().Select(t => new Todo(t)).ToList();

            return loadedTodos;
        }
Example #8
0
	public override void Draw(System.Drawing.Graphics gr) {
		gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
		gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
		gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
		gr.Clear(System.Drawing.Color.White);
		foreach (Vertex v in vertexes)
			v.Draw(gr);
		foreach (Edge e in edges)
			e.Draw(gr);
	}
 protected override void WriteFile(System.Web.HttpResponseBase response)
 {
     response.Clear();
     response.AddHeader("content-disposition", "attachment; filename=" + DownloadedFilename);
     response.ContentType = this.ContentType;
     response.WriteFile(Path);
     response.Flush();
     System.IO.File.Delete(Path);
     response.End();
 }
Example #10
0
 /// <summary>
 /// 读取指定节下的所有键值对
 /// </summary>
 /// <param name="path"></param>
 /// <param name="section"></param>
 /// <param name="values"></param>
 public static void ReadSections(string path, string section, System.Collections.Specialized.NameValueCollection values)
 {
     System.Collections.Specialized.StringCollection keys = new System.Collections.Specialized.StringCollection();
     ReadSections(path, section, keys);
     values.Clear();
     foreach (string key in keys)
     {
         values.Add(key, ReadIniValue(path, section, key));
     }
 }
        public void GenericClearTestCase()
        {
            var array = new[]
            {
                "test",
                "test"
            };
            array.Clear( 0, 2 );

            Assert.AreEqual( null, array[0] );
            Assert.AreEqual( null, array[1] );
        }
 /// <summary>
 /// 把DataTable导出为Word文件
 /// </summary>
 /// <param name="page">Page</param>
 /// <param name="fileName">Word文件名(不包括后缀*.doc)</param>
 /// <param name="dtbl">将要被导出的DataTable对象</param>
 /// <returns></returns>
 public static bool DataTableToWord(System.Web.HttpResponse response, string fileName, DataTable dtbl)
 {
     response.Clear();
     response.Buffer = true;
     response.Charset = "UTF-8";
     response.AppendHeader("Content-Disposition", "attachment;filename=" + fileName + ".doc");
     response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8");
     response.ContentType = "application/ms-word";
     //page.EnableViewState = false;
     response.Write(DataTableToHtmlTable(dtbl));
     response.End();
     return true;
 }
	private static void RefillCollection(string srcValue, System.DirectoryServices.PropertyValueCollection targetValues)
	{
		targetValues.Clear();
		if (string.IsNullOrWhiteSpace(srcValue) == false)
		{
			string[] values = srcValue.Split(';');
			for (int i = values.Length - 1; i >= 0; i--)
			{
				if (string.IsNullOrWhiteSpace(values[i]) == false)
					targetValues.Add(values[i]);
			}
		}
	}
 public void logout(bool invalidateSession, HttpRequest request, HttpResponse response, System.Web.SessionState.HttpSessionState session)
 {
     if(!String.IsNullOrEmpty(request.Params["remoteLogout"])){
         session["userAttributes"] = null;
         if(invalidateSession) {
             System.Web.Security.FormsAuthentication.SignOut();
             session.Abandon();
             session.Clear();
         }
     } else {
         if(!String.IsNullOrEmpty(request.Params["ReturnUrl"]))
             response.Redirect(request.Params["ReturnUrl"]);
     }
 }
Example #15
0
        public void ClearTestCase()
        {
            Array array = new[]
            {
                "0",
                "1",
                "2"
            };
            array.Clear( 0, 2 );

            Assert.AreEqual( null, array.GetValue( 0 ) );
            Assert.AreEqual( null, array.GetValue( 1 ) );
            Assert.AreEqual( "2", array.GetValue( 2 ) );
        }
Example #16
0
 private static void GetStringsFromBuffer(Byte[] buffer, long bufLen, System.Collections.Specialized.StringCollection Strings)
 {
     Strings.Clear();
     if (bufLen != 0)
     {
         int start = 0;
         for (int i = 0; i < bufLen; i++)
         {
             if ((buffer[i] == 0) && ((i - start) > 0))
             {
                 String s = Encoding.GetEncoding(0).GetString(buffer, start, i - start);
                 Strings.Add(s);
                 start = i + 1;
             }
         }
     }
 }
 public override void ModifyWizardPages(object source, GXPropertyPageType type, System.Collections.Generic.List<Control> pages)
 {
     if (type == GXPropertyPageType.Device)
     {
         pages.Insert(1, new GXDLT645DeviceWizardDlg());
     }
     else if (type == GXPropertyPageType.Property ||
         type == GXPropertyPageType.Table)
     {
         //Remove default pages.
         pages.Clear();
         pages.Add(new AddressDlg());
     }
     else if (type == GXPropertyPageType.Import)
     {
         pages.Insert(1, new DeviceImportForm());
     }
 }
Example #18
0
        public override int GetErrors(int pageIndex, int pageSize, System.Collections.IList errorEntryList)
        {
            //return base.GetErrors(pageIndex, pageSize, errorEntryList);

            var count =  base.GetErrors(pageIndex, pageSize, errorEntryList);

            List<ErrorLogEntry> filterErrorEntryList = new List<ErrorLogEntry>();

            foreach (ErrorLogEntry item in errorEntryList)
            {
                if (item.Error.Type == "System.Runtime.InteropServices.COMException")
                {
                    filterErrorEntryList.Add(item);
                }
            }

            errorEntryList.Clear();
            filterErrorEntryList.ForEach(y => errorEntryList.Add(y));

            return errorEntryList.Count;
        }
Example #19
0
        private void AdjustOffsets(object sender, EventArgs e)
        {
            var zone = (TimeZoneInfo) timeZones.SelectedValue;
            var offsetList = new[] { new { Utc = "", Offset = "", Local = "", IsDST = "" } }.ToList();
            offsetList.Clear();
            var start = DateTime.SpecifyKind(offsetsFrom.Value, DateTimeKind.Utc);
            var end = DateTime.SpecifyKind(offsetsTo.Value, DateTimeKind.Utc);
            // Limit it to 100 values... it could be very large temporarily while changing from/to
            for (DateTime utc = start; utc <= end && offsetList.Count < 100; utc = utc.AddHours(1))
            {
                var local = TimeZoneInfo.ConvertTimeFromUtc(utc, zone);
                offsetList.Add(new {
                    Utc = utc.ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture),
                    Offset = FormatOffset(zone.GetUtcOffset(utc)),
                    Local = local.ToString("yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture),
                    IsDST = zone.IsDaylightSavingTime(utc) ? "Yes" : "No"
                });
            }

            utcOffsets.DataSource = offsetList;
            utcOffsets.ClearSelection();
        }
Example #20
0
 public string GetCompetition(System.Collections.Generic.List<string> competitors)
 {
     string response = "";
     for (int i = 0; i < competitors.Count; i++)
     {
         string requestURL = "http://api.semrush.com/?type=domain_organic&key="
             + key + "&domain=" +competitors[i] + "&database=" + locale
             + "&display_limit=" + 20
             + "&export_columns=Ph,Pp,Nq&display_sort=pp_desc&display_filter=-|Pp|Gt|10";
         using (WebClient client = new WebClient())
         {
             string webresp = client.DownloadString(requestURL);
             if (!webresp.Contains("::"))
             {
                 response +=competitors[i]+System.Environment.NewLine + webresp.Substring(webresp.IndexOf(System.Environment.NewLine))+System.Environment.NewLine;
             }
             else { response += "По домену " + competitors[i] + " ничего не найдено" + System.Environment.NewLine; }
         }
     }
     competitors.Clear();
     return response;
 }
Example #21
0
        public static bool Render(System.Web.HttpResponseBase Response, 
            Excel.IWorkbookBase workbook, string fileName)
        {
            // AiLib.Report.Excel.IWorkbookBase workbook

            // http://dotnetslackers.com/articles/aspnet/Create-Excel-Spreadsheets-Using-NPOI.aspx
            // Save the Excel spreadsheet to a MemoryStream and return it to the client

            using (var exportData = new MemoryStream())
            {
                workbook.Write(exportData);

                string saveAsFileName = fileName;
                Response.ContentType = ContentExcel;
                Response.AddHeader("Content-Disposition", string.Format("attachment;filename={0}", saveAsFileName));
                Response.Clear();
                Response.BinaryWrite(exportData.GetBuffer());
                Response.End();
            }

            return true;
        }
Example #22
0
 public static void PrintXmlAudiobookToTextBoxForFrankie(System.Windows.Forms.RichTextBox txtArea, AudioBooker.classes.XmlIlyaParagraph xmlPara)
 {
     txtArea.Clear();
     if (xmlPara == null)
         return;
     var shit = xmlPara.Sentences
         .SelectMany(x => x.Lang2Segments)
         .Select(x => new ToStringTuple {
             Text = String.Format("{0}: {1}", "Segment", x.Filename),
             TimeIn = x.TimeIn,
         });
     foreach (var sss in shit) {
         txtArea.SelectionColor = sss.SelectionColor;
         txtArea.SelectionBackColor = sss.SelectionBackColor;
         //if (sss.State == XmlSegmentState.Pending)
         //    txtArea.SelectionBackColor = Color.Orange;
         //if (sss.IsCurrent) {
         //    txtArea.SelectionBackColor = Color.Black;
         //    txtArea.SelectionColor = Color.White;
         //}
         txtArea.AppendText(sss.Text + "\n");
     }
 }
Example #23
0
        public static void ToExcel(DataTable dataTable, System.Web.HttpResponseBase response)
        {
            using (StringWriter sw = new StringWriter())
            {
                List<string> headers = getTableHeaders(dataTable);
                string sHeaders = getHeadersString(headers);

                sw.WriteLine(sHeaders);

                foreach (DataRow dr in dataTable.Rows)
                {
                    string sRow = getRowString(dr, headers);
                    sw.WriteLine(sRow);
                }

                response.Clear();
                response.Buffer = true;
                response.AddHeader("Content-Disposition", "attachment;filename=Teest.xls");
                response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
                response.ContentType = "application/vnd.ms-excel";
                response.Write(sw);
                response.End();
            }
        }
Example #24
0
 /// <summary>
 /// 将日志信息显示在文本框
 /// </summary>
 /// <param name="tb">文本框</param>
 /// <param name="logLV">日志等级</param>
 public static void DisplayLog(System.Windows.Forms.TextBox tb, LogLevel logLV)
 {
     tb.Invoke(new Action(() =>
         {
             tb.Clear();
             switch (logLV)
             {
                 case LogLevel.Normal:
                     foreach (string str in NormalInfo)
                     {
                         tb.AppendText(str + "\r\n");
                         tb.AppendText("==============================================================\r\n");
                     }
                     NormalInfo.Clear();
                     break;
                 case LogLevel.Warn:
                     foreach (string str in WarnInfo)
                     {
                         tb.AppendText(str + "\r\n");
                         tb.AppendText("==============================================================\r\n");
                     }
                     WarnInfo.Clear();
                     break;
                 case LogLevel.Error:
                     foreach (string str in ErrorInfo)
                     {
                         tb.AppendText(str + "\r\n");
                         tb.AppendText("==============================================================\r\n");
                     }
                     ErrorInfo.Clear();
                     break;
                 default:
                     break;
             }
         }));
 }
Example #25
0
 public void ICollectionClearWorks()
 {
     IList<string> l = new[] { "x", "y", "z" };
     l.Clear();
     Assert.AreEqual(l, new string[0]);
 }
Example #26
0
        /// <summary>
        /// Copy elements from a Python mapping of dict environment variables to a StringDictionary.
        /// </summary>
        private static void SetEnvironment(System.Collections.Specialized.StringDictionary currentEnvironment, object newEnvironment) {
            PythonDictionary env = newEnvironment as PythonDictionary;
            if (env == null) {
                throw PythonOps.TypeError("env argument must be a dict");
            }

            currentEnvironment.Clear();

            string strKey, strValue;
            foreach (object key in env.keys()) {
                if (!Converter.TryConvertToString(key, out strKey)) {
                    throw PythonOps.TypeError("env dict contains a non-string key");
                }
                if (!Converter.TryConvertToString(env[key], out strValue)) {
                    throw PythonOps.TypeError("env dict contains a non-string value");
                }
                currentEnvironment[strKey] = strValue;
            }
        }
Example #27
0
 /// <summary>
 /// Gets row as Hashtable
 /// </summary>
 /// <param name="row">int - row index</param>
 /// <param name="data">Hashtable reference</param>
 public void RowAsHashtable(int row, ref System.Collections.Hashtable data)
 {
     data.Clear();
     for (int i = 0; i < this.Cols; i++)
     {
         data[i] = this.Data[row][i];
     }
 }
Example #28
0
        private static void PopulateMemberInfos(StructMapping structMapping, MemberMapping[] memberMappings, System.Collections.Generic.Dictionary<string, MemberInfo> memberInfos)
        {
            memberInfos.Clear();
            for (int i = 0; i < memberMappings.Length; ++i)
            {
                memberInfos[memberMappings[i].Name] = memberMappings[i].MemberInfo;
                if (memberMappings[i].ChoiceIdentifier != null)
                    memberInfos[memberMappings[i].ChoiceIdentifier.MemberName] = memberMappings[i].ChoiceIdentifier.MemberInfo;
                if (memberMappings[i].CheckSpecifiedMemberInfo != null)
                    memberInfos[memberMappings[i].Name + "Specified"] = memberMappings[i].CheckSpecifiedMemberInfo;
            }

            // The scenario here is that user has one base class A and one derived class B and wants to serialize/deserialize an object of B.
            // There's one virtual property defined in A and overrided by B. Without the replacing logic below, the code generated will always
            // try to access the property defined in A, rather than B.
            // The logic here is to:
            // 1) Check current members inside memberInfos dictionary and figure out whether there's any override or new properties defined in the derived class.
            //    If so, replace the one on the base class with the one on the derived class.
            // 2) Do the same thing for the memberMapping array. Note that we need to create a new copy of MemberMapping object since the old one could still be referenced
            //    by the StructMapping of the baseclass, so updating it directly could lead to other issues.
            Dictionary<string, MemberInfo> replaceList = null;
            MemberInfo replacedInfo = null;
            foreach (KeyValuePair<string, MemberInfo> pair in memberInfos)
            {
                if (ShouldBeReplaced(pair.Value, structMapping.TypeDesc.Type, out replacedInfo))
                {
                    if (replaceList == null)
                    {
                        replaceList = new Dictionary<string, MemberInfo>();
                    }

                    replaceList.Add(pair.Key, replacedInfo);
                }
            }

            if (replaceList != null)
            {
                foreach (KeyValuePair<string, MemberInfo> pair in replaceList)
                {
                    memberInfos[pair.Key] = pair.Value;
                }
                for (int i = 0; i < memberMappings.Length; i++)
                {
                    MemberInfo mi;
                    if (replaceList.TryGetValue(memberMappings[i].Name, out mi))
                    {
                        MemberMapping newMapping = memberMappings[i].Clone();
                        newMapping.MemberInfo = mi;
                        memberMappings[i] = newMapping;
                    }
                }
            }
        }
Example #29
0
        private void LlenarVencimientos()
        {
            Cargando.Mostrar();

            DateTime dAhora = DateTime.Now;
            var oVentasC = Datos.GetListOf<VentasACreditoView>(c => dAhora > c.Vencimiento && c.Restante > 0).OrderBy(o => o.Cliente);
            this.dgvVencimientos.Rows.Clear();

            int iClienteID = 0;
            string sCliente = "";
            decimal mSem1, mSem2, mSem3, mSem4, mMes;
            mSem1 = mSem2 = mSem3 = mSem4 = mMes = 0;
            bool bPrimeraVuelta = true;
            foreach (var oVenta in oVentasC)
            {
                // Se verifica si es la primera vuelta, para no agregar nada pues falta ver si la siguiente es el mismo cliente
                if (bPrimeraVuelta)
                {
                    iClienteID = oVenta.ClienteID;
                    sCliente = oVenta.Cliente;
                    bPrimeraVuelta = false;
                }
                //
                if (oVenta.ClienteID != iClienteID)
                {
                    // Se agrega el cliente al grid
                    this.dgvVencimientos.Rows.Add(iClienteID, sCliente, (mSem1 + mSem2 + mSem3 + mSem4 + mMes), mSem1, mSem2, mSem3, mSem4, mMes);
                    // Se restauran los valores con el siguiente cliente
                    iClienteID = oVenta.ClienteID;
                    sCliente = oVenta.Cliente;
                    mSem1 = mSem2 = mSem3 = mSem4 = mMes = 0;
                }
                // Se calculan los importes de vencimiento por períodos de tiempo
                int iDiasVencido = (dAhora - oVenta.Vencimiento.Valor()).Days;
                if (iDiasVencido < 8)
                    mSem1 += oVenta.Restante;
                else if (iDiasVencido < 15)
                    mSem2 += oVenta.Restante;
                else if (iDiasVencido < 22)
                    mSem3 += oVenta.Restante;
                else if (iDiasVencido < 29)
                    mSem4 += oVenta.Restante;
                else
                    mMes += oVenta.Restante;
            }
            // Se agrega el último cliente, si aplica
            if (iClienteID > 0)
                this.dgvVencimientos.Rows.Add(iClienteID, sCliente, (mSem1 + mSem2 + mSem3 + mSem4 + mMes), mSem1, mSem2, mSem3, mSem4, mMes);

            // Se ordena según
            var oListaGrid = new[] { new { ClienteID = 1, Cliente = "uno", Vencido = 1.1
                , UnaSem = 1.1, DosSem = 1.1, TresSem = 1.1, CuatroSem = 1.1, MasMes = 1.1 } }.ToList();
            oListaGrid.Clear();
            foreach (DataGridViewRow oFila in this.dgvVencimientos.Rows)
                oListaGrid.Add(new
                {
                    ClienteID = Util.Entero(oFila.Cells["ClienteID"].Value),
                    Cliente = Util.Cadena(oFila.Cells["colCliente"].Value),
                    Vencido = Util.Doble(oFila.Cells["Vencido"].Value),
                    UnaSem = Util.Doble(oFila.Cells["UnaSem"].Value),
                    DosSem = Util.Doble(oFila.Cells["DosSem"].Value),
                    TresSem = Util.Doble(oFila.Cells["TresSem"].Value),
                    CuatroSem = Util.Doble(oFila.Cells["CuatroSem"].Value),
                    MasMes = Util.Doble(oFila.Cells["MasMes"].Value)
                });
            oListaGrid = oListaGrid.OrderByDescending(c => c.MasMes).ThenByDescending(c => c.CuatroSem).ThenByDescending(c => c.TresSem)
                .ThenByDescending(c => c.DosSem).ThenByDescending(c => c.UnaSem).ToList();

            // Se llenan los totales
            for (int iCol = 1; iCol < this.dgvVencimientosTotales.Columns.Count; iCol++)
                this.dgvVencimientosTotales[iCol, 0].Value = 0;
            if (oListaGrid.Count > 0)
            {
                this.dgvVencimientosTotales["tvVencido", 0].Value = oListaGrid.Sum(c => c.Vencido);
                this.dgvVencimientosTotales["tvUnaSem", 0].Value = oListaGrid.Sum(c => c.UnaSem);
                this.dgvVencimientosTotales["tvDosSem", 0].Value = oListaGrid.Sum(c => c.DosSem);
                this.dgvVencimientosTotales["tvTresSem", 0].Value = oListaGrid.Sum(c => c.TresSem);
                this.dgvVencimientosTotales["tvCuatroSem", 0].Value = oListaGrid.Sum(c => c.CuatroSem);
                this.dgvVencimientosTotales["tvMasMes", 0].Value = oListaGrid.Sum(c => c.MasMes);
            }

            // var oDatos = this.dgvVencimientos.ADataTable();
            this.dgvVencimientos.Rows.Clear();
            foreach (var oReg in oListaGrid)
            {
                this.dgvVencimientos.Rows.Add(oReg.ClienteID, oReg.Cliente, oReg.Vencido, oReg.UnaSem, oReg.DosSem, oReg.TresSem, oReg.CuatroSem, oReg.MasMes);
            }

            Cargando.Cerrar();
        }
Example #30
0
 public void TrySCIList(System.Collections.IList list)
 {
     // Should be called with a C5.IList<B> which is not a WrappedArray
       Assert.AreEqual(0, list.Count);
       list.CopyTo(new A[0], 0);
       list.CopyTo(new B[0], 0);
       list.CopyTo(new C[0], 0);
       Assert.IsTrue(!list.IsFixedSize);
       Assert.IsFalse(list.IsReadOnly);
       Assert.IsFalse(list.IsSynchronized);
       Assert.AreNotEqual(null, list.SyncRoot);
       Object b1 = new B(), b2 = new B(), c1 = new C(), c2 = new C();
       Assert.AreEqual(0, list.Add(b1));
       Assert.AreEqual(1, list.Add(c1));
       Assert.AreEqual(2, list.Count);
       Assert.IsTrue(list.Contains(c1));
       Assert.IsFalse(list.Contains(b2));
       list[0] = b2;
       Assert.AreEqual(b2, list[0]);
       list[1] = c2;
       Assert.AreEqual(c2, list[1]);
       Assert.IsTrue(list.Contains(b2));
       Assert.IsTrue(list.Contains(c2));
       Array arrA = new A[2], arrB = new B[2];
       list.CopyTo(arrA, 0);
       list.CopyTo(arrB, 0);
       Assert.AreEqual(b2, arrA.GetValue(0));
       Assert.AreEqual(b2, arrB.GetValue(0));
       Assert.AreEqual(c2, arrA.GetValue(1));
       Assert.AreEqual(c2, arrB.GetValue(1));
       Assert.AreEqual(0, list.IndexOf(b2));
       Assert.AreEqual(-1, list.IndexOf(b1));
       list.Remove(b1);
       list.Remove(b2);
       Assert.IsFalse(list.Contains(b2));
       Assert.AreEqual(1, list.Count); // Contains c2 only
       list.Insert(0, b2);
       list.Insert(2, b1);
       Assert.AreEqual(b2, list[0]);
       Assert.AreEqual(c2, list[1]);
       Assert.AreEqual(b1, list[2]);
       list.Remove(c2);
       Assert.AreEqual(b2, list[0]);
       Assert.AreEqual(b1, list[1]);
       list.RemoveAt(1);
       Assert.AreEqual(b2, list[0]);
       list.Clear();
       Assert.AreEqual(0, list.Count);
       list.Remove(b1);
 }