void button2_Click(object sender, EventArgs e) { WebFrame.Data.JTable tab1 = new WebFrame.Data.JTable("COMMTRAINWEIGHTPROFILE"); System.Collections.Generic.List <WebFrame.Data.SearchField> condition = new System.Collections.Generic.List <WebFrame.Data.SearchField>(); System.Collections.Generic.Dictionary <String, object> data1 = new System.Collections.Generic.Dictionary <string, object>(); int i = 1; String[] arr1 = "Speed,YzPrice,RzPrice,SYzPrice,SRzPrice,YwPrice,RwPrice,GRw19KPrice,GRw19TPrice,CaPrice,KdPrice".Split(','); foreach (RepeaterItem item in this.Repeater2.Items) { condition.Clear(); condition.Add(new WebFrame.Data.SearchField("num", i + "", WebFrame.SearchFieldType.NumericType)); data1.Clear(); foreach (String m in arr1) { TextBox t1 = item.FindControl(m) as TextBox; if (t1 != null) { data1[m] = t1.Text; } } tab1.EditData(data1, condition); i++; } tab1.Close(); BusinessRule.CheXianProfile.SetData(); WebFrame.Util.JAjax.Alert("提示:更新数据操作成功!"); }
//Submit Data void button1_Click(object sender, EventArgs e) { WebFrame.Data.JTable tab1 = new WebFrame.Data.JTable("CHEXIANBIANZHU"); System.Collections.Generic.List <WebFrame.Data.SearchField> condition = new System.Collections.Generic.List <WebFrame.Data.SearchField>(); System.Collections.Generic.Dictionary <String, object> data1 = new System.Collections.Generic.Dictionary <string, object>(); for (int i = 1; i <= 17; i++) { condition.Clear(); condition.Add(new WebFrame.Data.SearchField("id", i + "", WebFrame.SearchFieldType.NumericType)); data1.Clear(); TextBox t1 = Rate1.Parent.FindControl("Rate" + i) as TextBox; if (t1 != null) { data1["Rate"] = t1.Text; } TextBox t2 = Person1.Parent.FindControl("Person" + i) as TextBox; if (t2 != null) { data1["Person"] = t2.Text; } tab1.EditData(data1, condition); } tab1.Close(); ChexianBianZhuData.SetData(); WebFrame.Util.JAjax.Alert("提示:更新数据操作成功!"); }
private void UpdateOil() { WebFrame.Data.JTable tab1 = new WebFrame.Data.JTable("COMMTRAINWEIGHTPROFILE"); System.Collections.Generic.List <WebFrame.Data.SearchField> condition = new System.Collections.Generic.List <WebFrame.Data.SearchField>(); System.Collections.Generic.Dictionary <String, object> data1 = new System.Collections.Generic.Dictionary <string, object>(); int i = 2; String[] arr1 = "Oil".Split(','); foreach (RepeaterItem item in this.Repeater2.Items) { condition.Clear(); condition.Add(new WebFrame.Data.SearchField("num", i + "", WebFrame.SearchFieldType.NumericType)); data1.Clear(); foreach (String m in arr1) { TextBox t1 = item.FindControl(m) as TextBox; if (t1 != null) { data1[m] = t1.Text; } } tab1.EditData(data1, condition); i = i + 1; } tab1.Close(); BusinessRule.CheXianProfile.SetData(); WebFrame.Util.JAjax.Alert("提示:更新数据操作成功!"); }
void button1_Click(object sender, EventArgs e) { WebFrame.Data.JTable tab1 = new WebFrame.Data.JTable("TRAINLINEKINDPROFILE"); System.Collections.Generic.List <WebFrame.Data.SearchField> condition = new System.Collections.Generic.List <WebFrame.Data.SearchField>(); System.Collections.Generic.Dictionary <String, object> data1 = new System.Collections.Generic.Dictionary <string, object>(); int i = 0; String[] arr1 = "JieChuFee,DianFee".Split(','); foreach (RepeaterItem item in this.Repeater1.Items) { condition.Clear(); condition.Add(new WebFrame.Data.SearchField("LineID", i + "", WebFrame.SearchFieldType.NumericType)); data1.Clear(); foreach (String m in arr1) { TextBox t1 = item.FindControl(m) as TextBox; if (t1 != null) { data1[m] = t1.Text; } } tab1.EditData(data1, condition); i++; } tab1.Close(); BusinessRule.TrainLineKindProfile.SetData(); WebFrame.Util.JAjax.Alert("提示:更新数据操作成功!"); }
//更新列车的定员 void JButton2_Click(object sender, EventArgs e) { WebFrame.Data.JTable tab1 = new WebFrame.Data.JTable("HIGHTRAINPROFILE"); System.Collections.Generic.List <WebFrame.Data.SearchField> condition = new System.Collections.Generic.List <WebFrame.Data.SearchField>(); System.Collections.Generic.Dictionary <String, object> data1 = new System.Collections.Generic.Dictionary <string, object>(); int i = 1; String[] arr1 = "PCount5,PCount4,PCount1,PCount2,PCount3".Split(','); foreach (RepeaterItem item in this.Repeater2.Items) { condition.Clear(); condition.Add(new WebFrame.Data.SearchField("ID", i + "", WebFrame.SearchFieldType.NumericType)); data1.Clear(); foreach (String m in arr1) { TextBox t1 = item.FindControl(m) as TextBox; if (t1 != null) { if (t1.Text.Trim() != String.Empty) { data1[m] = t1.Text; } else { data1[m] = "0"; } } } tab1.EditData(data1, condition); i++; } tab1.Close(); HighTrainProfile.SetData(); WebFrame.Util.JAjax.Alert("提示:更新数据操作成功!"); }
//导出数据到Excel void butExportData_Click(object sender, EventArgs e) { XlsDocument xls = new XlsDocument(); //新建一个xls文档 xls.FileName = "train.xls"; //设定文件名 List <String> lineNameList = BusinessRule.Line.GetTrainLindName(); JTable tab1 = new WebFrame.Data.JTable(); tab1.TableName = "linestationview"; foreach (String m in lineNameList) { string sheetName = m; Worksheet sheet = xls.Workbook.Worksheets.Add(sheetName); //填加名为"chc 实例"的sheet页 Cells cells = sheet.Cells; //Cells实例是sheet页中单元格(cell)集合 ////设置列的宽度 #region 设置列的宽度 ColumnInfo colInfo = new ColumnInfo(xls, sheet); //生成列格式对象 //设定colInfo格式的起作用的列为第2列到第5列(列格式为0-base) colInfo.ColumnIndexStart = 0; //起始列为第一列,ColumnIndexStart是从0开始 colInfo.Width = 15 * 256; //列的宽度计量单位为 1/256 字符宽 sheet.AddColumnInfo(colInfo); //把格式附加到sheet页上(注:AddColumnInfo方法有点小问题,不给把colInfo对象多次附给sheet页) ColumnInfo colInfo1 = new ColumnInfo(xls, sheet); //生成列格式对象 //设定colInfo格式的起作用的列为第2列到第5列(列格式为0-base) colInfo1.ColumnIndexStart = 1; //起始列为第一列,ColumnIndexStart是从0开始 colInfo1.Width = 20 * 256; //列的宽度计量单位为 1/256 字符宽 sheet.AddColumnInfo(colInfo1); //把格式附加到sheet页上(注:AddColumnInfo方法有点小问题,不给把colInfo对象多次附给sheet页) ColumnInfo colInfo2 = new ColumnInfo(xls, sheet); //生成列格式对象 //设定colInfo格式的起作用的列为第2列到第5列(列格式为0-base) colInfo2.ColumnIndexStart = 2; //起始列为第一列,ColumnIndexStart是从0开始 colInfo2.Width = 15 * 256; //列的宽度计量单位为 1/256 字符宽 sheet.AddColumnInfo(colInfo2); //把格式附加到sheet页上(注:AddColumnInfo方法有点小问题,不给把colInfo对象多次附给sheet页) ColumnInfo colInfo3 = new ColumnInfo(xls, sheet); //生成列格式对象 //设定colInfo格式的起作用的列为第2列到第5列(列格式为0-base) colInfo3.ColumnIndexStart = 3; //起始列为第一列,ColumnIndexStart是从0开始 colInfo3.Width = 15 * 256; //列的宽度计量单位为 1/256 字符宽 sheet.AddColumnInfo(colInfo3); //把格式附加到sheet页上(注:AddColumnInfo方法有点小问题,不给把colInfo对象多次附给sheet页) ColumnInfo colInfo4 = new ColumnInfo(xls, sheet); //生成列格式对象 //设定colInfo格式的起作用的列为第2列到第5列(列格式为0-base) colInfo4.ColumnIndexStart = 4; //起始列为第一列,ColumnIndexStart是从0开始 colInfo4.Width = 15 * 256; //列的宽度计量单位为 1/256 字符宽 sheet.AddColumnInfo(colInfo4); //把格式附加到sheet页上(注:AddColumnInfo方法有点小问题,不给把colInfo对象多次附给sheet页) ColumnInfo colInfo5 = new ColumnInfo(xls, sheet); //生成列格式对象 //设定colInfo格式的起作用的列为第2列到第5列(列格式为0-base) colInfo5.ColumnIndexStart = 5; //起始列为第一列,ColumnIndexStart是从0开始 colInfo5.Width = 15 * 256; //列的宽度计量单位为 1/256 字符宽 sheet.AddColumnInfo(colInfo5); //把格式附加到sheet页上(注:AddColumnInfo方法有点小问题,不给把colInfo对象多次附给sheet页) ColumnInfo colInfo6 = new ColumnInfo(xls, sheet); //生成列格式对象 //设定colInfo格式的起作用的列为第2列到第5列(列格式为0-base) colInfo6.ColumnIndexStart = 6; //起始列为第一列,ColumnIndexStart是从0开始 colInfo6.Width = 15 * 256; //列的宽度计量单位为 1/256 字符宽 sheet.AddColumnInfo(colInfo6); //把格式附加到sheet页上(注:AddColumnInfo方法有点小问题,不给把colInfo对象多次附给sheet页) ColumnInfo colInfo7 = new ColumnInfo(xls, sheet); //生成列格式对象 //设定colInfo格式的起作用的列为第2列到第5列(列格式为0-base) colInfo7.ColumnIndexStart = 7; //起始列为第一列,ColumnIndexStart是从0开始 colInfo7.Width = 15 * 256; //列的宽度计量单位为 1/256 字符宽 sheet.AddColumnInfo(colInfo7); //把格式附加到sheet页上(注:AddColumnInfo方法有点小问题,不给把colInfo对象多次附给sheet页) ColumnInfo colInfo8 = new ColumnInfo(xls, sheet); //生成列格式对象 //设定colInfo格式的起作用的列为第2列到第5列(列格式为0-base) colInfo8.ColumnIndexStart = 8; //起始列为第一列,ColumnIndexStart是从0开始 colInfo8.Width = 15 * 256; //列的宽度计量单位为 1/256 字符宽 sheet.AddColumnInfo(colInfo8); //把格式附加到sheet页上(注:AddColumnInfo方法有点小问题,不给把colInfo对象多次附给sheet页) #endregion XF cellXFColumnText = xls.NewXF(); cellXFColumnText.HorizontalAlignment = HorizontalAlignments.Centered; //设定文字居中 cells.Add(1, 1, "线名代码", cellXFColumnText); //设定第一行,第一列单元格的值 cells.Add(1, 2, "线名", cellXFColumnText); //设定第一行,第二列单元格的值 cells.Add(1, 3, "站名代码", cellXFColumnText); //设定第一行,第三列单元格的值 cells.Add(1, 4, "始发站", cellXFColumnText); //设定第一行,第四列单元格的值 cells.Add(1, 5, "到达站", cellXFColumnText); //设定第一行,第四列单元格的值 cells.Add(1, 6, "里程", cellXFColumnText); cells.Add(1, 7, "局内", cellXFColumnText); cells.Add(1, 8, "电气化", cellXFColumnText); cells.Add(1, 9, "轮渡标志", cellXFColumnText); int currentRow = 2; DataTable dt = BusinessRule.Line.GetTrainLindData(tab1, m); foreach (DataRow dr in dt.Rows) { String jnFlag = dr["jnflag"].ToString().Trim(); if (jnFlag != String.Empty) { jnFlag = "是"; } String dqh = dr["dqh"].ToString().Trim(); if (dqh != String.Empty) { dqh = "是"; } String shipFlag = dr["shipflag"].ToString().Trim(); if (shipFlag != String.Empty) { shipFlag = "是"; } cells.Add(currentRow, 1, Convert.ToString(dr["lineid"]), cellXFColumnText); cells.Add(currentRow, 2, Convert.ToString(dr["linename"]), cellXFColumnText); cells.Add(currentRow, 3, Convert.ToString(""), cellXFColumnText); cells.Add(currentRow, 4, Convert.ToString(dr["Astation"]), cellXFColumnText); cells.Add(currentRow, 5, Convert.ToString(dr["bstation"]), cellXFColumnText); cells.Add(currentRow, 6, Convert.ToString(dr["miles"]), cellXFColumnText); cells.Add(currentRow, 7, jnFlag, cellXFColumnText); cells.Add(currentRow, 8, dqh, cellXFColumnText); cells.Add(currentRow, 9, shipFlag, cellXFColumnText); currentRow++; } } tab1.Close(); xls.Send(XlsDocument.SendMethods.Inline); }