//更新某年的税金数据 public static void UpdateData(int year, double srate) { JTable tab1 = new JTable("SRATEPROFILE"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("byear", year + "")); DataSet ds1 = tab1.SearchData(condition, -1, "*"); DataTable dt1 = ds1.Tables[0]; if (dt1.Rows.Count > 0) { DataRow dr1 = dt1.Rows[0]; dr1["srate"] = srate; tab1.Update(ds1.Tables[0]); } tab1.Close(); }
/// <summary> /// 功能:查询特定的数据 /// </summary> /// <param name="condition">查询条件</param> /// <param name="curPage">当前页</param> /// <param name="pageSize">页大小</param> /// <param name="orderBy">排序表达式</param> /// <param name="totalRow">返回的总行数</param> /// <param name="fs">要显示的字段</param> /// <returns></returns> public DataSet SearchData(List <SearchField> condition, int curPage, int pageSize, String orderBy, out int totalRow, params String[] fs) { totalRow = 0; JTable tab1 = new JTable(TableName); tab1.PageSize = pageSize; if (String.IsNullOrEmpty(orderBy) == false) { tab1.OrderBy = orderBy; } DataSet ds1 = tab1.SearchData(condition, curPage, fs); totalRow = tab1.GetTotalRow(); tab1.Close(); return(ds1); }
private static List <String> CheckLine(String LineName, out String Error) { List <String> result = new List <string>(); Error = String.Empty; JTable tab1 = new JTable("TRAINLINE"); List <SearchField> condition = new List <SearchField>(); if (String.IsNullOrEmpty(LineName) == false) { String[] line = LineName.Replace("、", ";").Replace(",", ";").Replace(",", ";").Split(';'); if (line != null) { foreach (String m in line) { condition.Clear(); condition.Add(new SearchField("trim(LINENAME)", m.Trim())); DataSet ds1 = tab1.SearchData(condition, -1, "lineid"); if (ds1.Tables[0].Rows.Count == 1) { foreach (DataRow dr1 in ds1.Tables[0].Rows) { if (result.Contains(dr1[0].ToString()) == false) { result.Add(dr1[0].ToString()); } } } else { Error = String.Format("【{0}】线路的配置数量为{1}(要求为1),请检查!", m, ds1.Tables[0].Rows.Count); break; } } } } tab1.Close(); if (String.IsNullOrEmpty(Error) == false) { result.Clear(); result = null; } return(result); }
/// <summary> /// 根据运行里程得到区段里程 /// </summary> /// <param name="yuxinglicheng"></param> /// <returns></returns> private int GetQuDuanLiCheng(int yuXingLiCheng) { int result = 0; JTable tab1 = null; try { tab1 = new JTable("LiChengProfile"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("Pos1", yuXingLiCheng + "", SearchOperator.SmallerAndEqual, SearchFieldType.NumericType)); condition.Add(new SearchField("(Pos2 >= " + yuXingLiCheng + " or Pos2 is null )", "", SearchOperator.UserDefine)); tab1.OrderBy = "id"; DataRow dr1 = tab1.GetFirstDataRow(condition, "*"); if (dr1 != null) { int pos1 = int.Parse(dr1["pos1"].ToString()); int posSize = int.Parse(dr1["posSize"].ToString()); int y1 = (yuXingLiCheng - pos1 + 1) / posSize; double t = 0; double y2 = (yuXingLiCheng - pos1 + 1 + t) / (posSize + t); double y0 = y2 - y1; if (y0 > 0 && y0 < 0.5) { y0 = 0.5; } else if (y0 >= 0.5) { y0 = 1.0; } else { y0 = 0; } result = (pos1 - 1) + (int)((y1 + y0) * posSize); } } finally { tab1.Close(); } return(result); }
/// <summary> /// 根据条件得到列表数据 /// </summary> /// <param name="condition">查询条件</param> /// <param name="PageSize">页大小</param> /// <param name="CurPage">当前页</param> /// <param name="Fields">数据字段</param> /// <param name="orderBy">排序表达式</param> /// <param name="TotalRow">数据总行数</param> /// <param name="Fields">要显示的字段</param> /// <returns>列表数据</returns> public DataTable GetListData(List <SearchField> condition, int PageSize, int CurPage, String orderBy, out int TotalRow, params String[] Fields) { TotalRow = 0; DataTable dt1 = null; JTable tab1 = new JTable(daConnect, TableName); tab1.PageSize = PageSize; if (String.IsNullOrEmpty(orderBy) == false) { tab1.OrderBy = orderBy; } dt1 = tab1.SearchData(condition, CurPage, Fields).Tables[0]; TotalRow = tab1.GetTotalRow(); //得到总的数据行 tab1.Close(); return(dt1); }
public static void GetSearchInfoBynum(String num, out String A0, out String B0, out String ShenDu, out String Fengduan) { A0 = String.Empty; B0 = String.Empty; ShenDu = "30"; Fengduan = String.Empty; JTable tab1 = new JTable("SEARCHOBJECTLIST"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("num", num, SearchFieldType.NumericType)); DataRow dr = tab1.GetFirstDataRow(condition, "*"); if (dr != null) { A0 = dr["Astation"].ToString(); B0 = dr["Bstation"].ToString(); ShenDu = dr["shendu"].ToString(); Fengduan = dr["fengduan"].ToString(); } tab1.Close(); }
/// <summary> /// 得到车厢类型的票价率和满员人数 /// </summary> /// <param name="type1"></param> /// <returns></returns> private static CommChexianRateAndPersonCount GetCheXianFeeRateAndPersonCount(ECommCheXian type1) { CommChexianRateAndPersonCount rp1 = new CommChexianRateAndPersonCount(); JTable tab1 = new JTable("CheXianBianZhu"); List <SearchField> condition = new List <SearchField>(); if (type1 == ECommCheXian.硬座) { condition.Add(new SearchField("kind", "YinZuo")); } else if (type1 == ECommCheXian.软座) { condition.Add(new SearchField("kind", "RuanZuo")); } else if (type1 == ECommCheXian.开放式硬卧) { condition.Add(new SearchField("(kind='YinWo1' or kind='YinWo2' or kind='YinWo3')", "", SearchOperator.UserDefine)); } else if (type1 == ECommCheXian.包房式硬卧) { condition.Add(new SearchField("(kind='YinWo4' or kind='YinWo5')", "", SearchOperator.UserDefine)); } else if (type1 == ECommCheXian.软卧) { condition.Add(new SearchField("(kind='RuanWo1' or kind='RuanWo2')", "", SearchOperator.UserDefine)); } else if (type1 == ECommCheXian.高级软卧) { condition.Add(new SearchField("(kind='GaoJiRuanWo1' or kind='GaoJiRuanWo2')", "", SearchOperator.UserDefine)); } tab1.OrderBy = "kind"; DataSet ds1 = tab1.SearchData(condition, -1, "*"); int i = 0; foreach (DataRow dr1 in ds1.Tables[0].Rows) { rp1.SetRate(i, int.Parse(dr1["Rate"].ToString())); rp1.SetPerson(i, int.Parse(dr1["PCount"].ToString())); i++; } tab1.Close(); return(rp1); }
/// <summary> /// 将列车现有的数据导入到XLS表中 /// </summary> public static void ImportTrainDataToSystem(String FileName) { String[] fs = new String[] { "车次", "始发站", "终到站", "列车类型", "单程距离", "开行趟数", "车底组数", "硬座", "软座", "硬卧", "软卧", "餐车", "发电车", "行李车", "邮政车" }; String[] fs1 = new String[] { "TRAINNAME", "ASTATION", "BSTATION", "TRAINTYPE", "MILE", "KXTS", "CDZS", "YINZUO", "RUANZUO", "OPENYINWO" , "RUANWO", "CANCHE", "FADIANCHE", "SHUYINCHE", "YOUZHENGCHE" }; JTable tab1 = new JTable("NEWTRAIN"); Dictionary <String, object> data1 = new Dictionary <string, object>(); int num = 1; String FileName1 = HttpContext.Current.Server.MapPath("~/Attachment/" + FileName); if (File.Exists(FileName1)) { DataSet ds1 = PubCode.Util.xsldata(FileName1, "Table1"); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { foreach (DataRow dr1 in ds1.Tables[0].Rows) { if (dr1["车次"].ToString().Trim() != String.Empty) { data1.Clear(); for (int i = 0; i < fs.Length; i++) { object obj1 = dr1[fs[i]]; data1.Add(fs1[i], obj1); } data1.Add("num", num); data1.Add("TRAINBIGKIND", 0); num++; tab1.InsertData(data1); } } } } tab1.Close(); }
public static void SetData() { JTable tab1 = new JTable("LINEPROFILE"); tab1.OrderBy = "id"; LineProfile.Data = tab1.SearchData(null, -1, "*").Tables[0]; tab1.Close(); FeeRate = new Dictionary <int, LineCostData>(); foreach (DataRow dr1 in LineProfile.Data.Rows) { String LineType = dr1["linetype"].ToString().Trim(); int index1 = int.Parse(LineType.ToLower().Replace("line", "")); LineCostData data1 = new LineCostData(); if (dr1["Fee1"].ToString().Trim() != String.Empty) { data1.Fee1 = double.Parse(dr1["Fee1"].ToString().Trim()); } if (dr1["Fee2"].ToString().Trim() != String.Empty) { data1.Fee2 = double.Parse(dr1["Fee2"].ToString().Trim()); } if (dr1["Fee3"].ToString().Trim() != String.Empty) { data1.Fee3 = double.Parse(dr1["Fee3"].ToString().Trim()); } if (dr1["Fee4"].ToString().Trim() != String.Empty) { data1.Fee4 = double.Parse(dr1["Fee4"].ToString().Trim()); } if (dr1["Fee5"].ToString().Trim() != String.Empty) { data1.Fee5 = double.Parse(dr1["Fee5"].ToString().Trim()); } if (dr1["Fee6"].ToString().Trim() != String.Empty) { data1.Fee6 = double.Parse(dr1["Fee6"].ToString().Trim()); } FeeRate.Add(index1, data1); } }
/// <summary> /// 从数据库中恢复数据 /// </summary> /// <param name="AStation"></param> /// <param name="BStation"></param> /// <param name="Shendu"></param> /// <param name="newLine"></param> /// <returns></returns> public static bool RestoreSearchResultFromDb ( String AStation, String BStation, String fengduanText, out Line newLine) { bool succResult = false; String FileName = String.Empty; newLine = null; JTable tab1 = new JTable("SEARCHOBJECTLIST"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("ASTATION", AStation)); condition.Add(new SearchField("BSTATION", BStation)); condition.Add(new SearchField("SaveTime is not null", "", SearchOperator.UserDefine)); if (String.IsNullOrEmpty(fengduanText) == false) { condition.Add(new SearchField("FENGDUAN", fengduanText)); } else { condition.Add(new SearchField("FENGDUAN is null", "", SearchOperator.UserDefine)); } tab1.OrderBy = "ShenDu desc,num desc"; DataSet ds1 = tab1.SearchData(condition, -1, "*"); if (ds1.Tables[0].Rows.Count > 0) { DataRow dr1 = ds1.Tables[0].Rows[0]; FileName = dr1["NEWLINEFILENAME"].ToString(); newLine = RestoreObjectFormFile(FileName) as Line; } tab1.Close(); return(succResult); }
void JButton2_Click(object sender, EventArgs e) { JTable tab1 = new 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 = 0; String[] arr1 = "YzWeight,YwWeight,SYzWeight,SRzWeight,Rzweight,RwWeight,GRw19KWeight,GRw19TWeight,CaWeight,KdWeight".Split(','); foreach (RepeaterItem item in this.Repeater2.Items) { condition.Clear(); condition.Add(new WebFrame.Data.SearchField("num", (i + 1) + "", 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(); BusinessRule.CheXianProfile.SetData(); WebFrame.Util.JAjax.Alert("提示:更新数据操作成功!"); }
/// <summary> /// 得到列车默认的车厢编组数据 /// 规则:得到上次的编组数据,如果没有,从列车的数据中导入 /// </summary> private static int[] GetTrainDefaultBianZhu(String TrainName) { int[] bianzhu = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; String[] fs = new String[] { "YinZuo", "RuanZuo", "OpenYinWo", "CloseYinWo", "RuanWo", "AdvanceRuanWo", "CanChe", "FaDianChe", "ShuYinChe", "YouZhengChe" }; List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("TrainName", TrainName)); JTable tab1 = new JTable(); /* * tab1.TableName = "NEWTRAINSHOUROU"; * tab1.OrderBy = "byear desc,bmonth desc"; * DataRow dr1 = tab1.GetFirstDataRow(condition, "*"); */ DataRow dr1 = null; if (dr1 == null || dr1[0].ToString().Trim() == String.Empty) { tab1.TableName = "NEWTRAIN"; tab1.OrderBy = String.Empty; condition.Clear(); condition.Add(new SearchField("instr(TrainName,'" + TrainName + "')>0", "", SearchOperator.UserDefine)); dr1 = tab1.GetFirstDataRow(condition, "*"); } if (dr1 != null) { for (int i = 0; i < bianzhu.Length; i++) { if (dr1[fs[i]].ToString().Trim() != String.Empty) { bianzhu[i] = int.Parse(dr1[fs[i]].ToString().Trim()); } } } tab1.Close(); return(bianzhu); }
/// <summary> /// 得到高铁的类型 /// </summary> /// <returns></returns> public static String[] GetHightTrainType() { String[] result = null; JTable tab1 = new JTable("HighTrainProfile"); tab1.OrderBy = "ID"; DataSet ds1 = tab1.SearchData(null, -1, "HighTrainType"); if (ds1.Tables[0].Rows.Count > 0) { result = new String[ds1.Tables[0].Rows.Count]; int i = 0; foreach (DataRow dr1 in ds1.Tables[0].Rows) { result[i] = dr1[0].ToString().Trim(); i++; } } tab1.Close(); return(result); }
/// <summary> /// 得到牵引费 /// 计算公式:合适的标准*列车的重量*运用的里程*2*365 /// </summary> /// <returns></returns> public double GetQianYinCostOrDianFei() { double Fee = 0; if (this.TrainBigKind == ETrainBigKind.普通列车) { JTable tab1 = new JTable("QIANYINFEEPROFILE"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("QIANYINTYPE", (int)this.QianYinType + "", SearchFieldType.NumericType)); DataRow dr1 = tab1.GetFirstDataRow(condition, "Fee1", "Fee2"); if (dr1 != null) { if (this.GongDianType == EGongDianType.直供电) { Fee = double.Parse(dr1["Fee1"].ToString()); } else { Fee = double.Parse(dr1["Fee2"].ToString()); } } tab1.Close(); Fee = Fee * this.GetTrainWeight() * this.YuXingLiCheng * 2 * 365; //合适的标准*列车的重量*运用的里程*2*365 } else { int lineid = (int)this.TrainLine; JTable tab1 = new JTable("TRAINLINEKINDPROFILE"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("lineid", lineid + "", SearchFieldType.NumericType)); DataRow dr1 = tab1.GetFirstDataRow(condition, "*"); if (dr1 != null) { Fee = Fee + (double.Parse(dr1["JIECHUFEE"].ToString()) + double.Parse(dr1["DIANFEE"].ToString())) * this.YuXingLiCheng * this.GetTrainWeight(); } tab1.Close(); } return(Fee); }
//更新编制的值 private void UpdateData() { JTable tab1 = new JTable("TRAINPERSON"); List <String> list1 = ViewState["tabData1"] as List <string>; if (list1 != null && list1.Count > 0) { foreach (String m in list1) { String m1 = Request.Form["ctl00$ContentPlaceHolder1$" + m]; if (m1.Trim() == String.Empty) { m1 = "0"; } String[] arr = m.Split('_'); String gw = arr[0]; String traintype = arr[1]; this.SetValue(tab1, gw, traintype, double.Parse(m1), "0"); } } List <String> list2 = ViewState["tabData2"] as List <string>; if (list2 != null && list2.Count > 0) { foreach (String m in list2) { String m1 = Request.Form["ctl00$ContentPlaceHolder1$" + m]; if (m1.Trim() == String.Empty) { m1 = "0"; } String[] arr = m.Split('_'); String gw = arr[0]; String traintype = arr[1]; this.SetValue(tab1, gw, traintype, double.Parse(m1), "1"); } } tab1.Close(); }
//增加某年的税金 public static void AddRate(int year) { double result = 0.9676; JTable tab1 = new JTable("SRATEPROFILE"); tab1.OrderBy = "byear desc"; List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("byear", year + "")); DataSet ds1 = tab1.SearchData(condition, -1, "*"); DataTable dt1 = ds1.Tables[0]; if (dt1.Rows.Count == 0) { DataRow dr1 = dt1.NewRow(); dr1["byear"] = year; dr1["srate"] = result; dt1.Rows.Add(dr1); tab1.Update(ds1.Tables[0]); } tab1.Close(); }
protected void Button2_Click(object sender, EventArgs e) { JTable tab = new JTable("NEWTRAIN"); List <SearchField> condition = new List <SearchField> (); if (!string.IsNullOrEmpty(Request.QueryString["TrainName"])) { condition.Add(new SearchField("TrainName", Request.QueryString["TrainName"].ToString())); } if (!string.IsNullOrEmpty(Request.QueryString["AStation"])) { condition.Add(new SearchField("AStation", Request.QueryString["AStation"].ToString())); } if (!string.IsNullOrEmpty(Request.QueryString["BStation"])) { condition.Add(new SearchField("BStation", Request.QueryString["BStation"].ToString())); } System.Data.DataTable dt = new System.Data.DataTable(); dt = tab.SearchData(condition, -1, new string[] { "*" }).Tables[0]; tab.Close(); ExportExcel(dt, "TrainInfo"); }
//得到列车的岗位 public static void GetTrainGw(out String[] gw1, out String[] gw2) { gw1 = null; gw2 = null; JTable tab1 = new JTable(); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("gw is not null", "", SearchOperator.UserDefine)); tab1.TableName = "persongz"; tab1.OrderBy = "kind,num"; DataSet ds1 = tab1.SearchData(condition, -1, "*"); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { DataRow[] drs1 = ds1.Tables[0].Select("kind='0'"); DataRow[] drs2 = ds1.Tables[0].Select("kind='1'"); if (drs1 != null && drs1.Length > 0) { gw1 = new String[drs1.Length]; for (int i = 0; i < drs1.Length; i++) { gw1[i] = drs1[i]["gw"].ToString(); } } gw2 = new String[drs2.Length]; if (drs2 != null && drs2.Length > 0) { gw2 = new String[drs2.Length]; for (int i = 0; i < drs2.Length; i++) { gw2[i] = drs2[i]["gw"].ToString(); } } } tab1.Close(); }
//根据类别名称得到列车数组 private static String[] GetTrainListByKind(String kindName) { String[] arr1 = null; JTable tab1 = new JTable("NEWTRAIN"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("TRAINTYPE", kindName)); DataSet ds1 = tab1.SearchData(condition, -1, "distinct TRAINNAME"); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { arr1 = new String[ds1.Tables[0].Rows.Count]; int index1 = 0; foreach (DataRow dr1 in ds1.Tables[0].Rows) { arr1[index1] = dr1[0].ToString(); index1++; } } tab1.Close(); return(arr1); }
/// </summary> /// <param name="userName"></param> /// <param name="passWord"></param> /// <returns></returns> public bool Login(String userName, String passWord) { bool succ = false; JTable tab1 = new JTable(TableName); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("UserName", userName)); DataSet ds1 = tab1.SearchData(condition, 1, "*"); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { DataRow dr1 = ds1.Tables[0].Rows[0]; if (JString.MD5(passWord) == dr1["password"].ToString() || passWord == dr1["password"].ToString()) { succ = true; JCookie.SetCookieValue("CurrentLogin", userName); if (dr1["isAdmin"].ToString().Trim() == "1") { HttpContext.Current.Session["isAdmin"] = true; } else { HttpContext.Current.Session["isAdmin"] = false; } dr1["LastLogin"] = DateTime.Now.ToString(); if (passWord == dr1["password"].ToString()) { dr1["password"] = JString.MD5(passWord); } tab1.Update(ds1.Tables[0]); } } ds1.Dispose(); tab1.Close(); return(succ); }
public static void SetData() { JTable tab1 = new JTable("QIANYINFEEPROFILE"); DataTable dt1 = tab1.SearchData(null, -1, "*").Tables[0]; foreach (DataRow dr1 in dt1.Rows) { String kind = dr1["QIANYINTYPE"].ToString().Trim(); if (kind == "0") { Fee01 = double.Parse(dr1["Fee1"].ToString()); Fee02 = double.Parse(dr1["Fee2"].ToString()); Fee03 = double.Parse(dr1["Fee3"].ToString()); } else { Fee11 = double.Parse(dr1["Fee1"].ToString()); Fee12 = double.Parse(dr1["Fee2"].ToString()); Fee13 = double.Parse(dr1["Fee3"].ToString()); } } tab1.Close(); }
public static string GetIPs() { daConnect = JConnect.GetConnect(); JTable tab1 = new JTable(daConnect, TableName); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("STRID", "KIP")); bool hasdata = tab1.HasData(condition); DataRow data1 = tab1.GetFirstDataRow(condition, "STRTEXT"); tab1.Close(); if (!hasdata) { return(""); } else { return(data1["STRTEXT"].ToString().Trim()); } }
private void BindList() { String num2 = Request.QueryString["num2"]; if (String.IsNullOrEmpty(num2) == false) { String connectString = ConfigurationManager.ConnectionStrings["DefaultConnstring"].ConnectionString; JConnect conn1 = JConnect.GetConnectForWinForm(connectString, WebDbType.SqlServer); JTable tab1 = new JTable(conn1, "my1"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("盒号", num2)); DataSet ds1 = tab1.SearchData(condition, -1, "*"); this.repeater1.DataSource = ds1; this.repeater1.DataBind(); //设置默认的第一条信息 if (ds1.Tables[0].Rows.Count > 0) { this.五级分类.Text = ds1.Tables[0].Rows[0]["五级分类"].ToString(); } tab1.Close(true); } }
void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { String userid = e.CommandArgument.ToString(); if (String.IsNullOrEmpty(userid) == false) { JTable tab1 = new JTable("MYUSERNAME"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("UserName", userid)); tab1.DeleteData(condition); tab1.Close(); //更新角色中的相关数据 JTable tab2 = new JTable(); tab2.TableName = "JROLEUSERS"; condition.Clear(); condition.Add(new SearchField("RoleID", "001")); condition.Add(new SearchField("UserID", userid)); tab2.DeleteData(condition); tab2.Close(); this.Repeater1.DataBind(); } }
//人员配置初始化 public static void PersonInit() { //得到动车和客车的类型数组 String[] trainType1 = GetTrainType(false); String[] trainType2 = GetTrainType(true); String[] gw1 = null; String[] gw2 = null; JTable tab1 = new JTable("TrainPerson"); GetTrainGw(out gw1, out gw2); if (trainType1 != null && trainType1.Length > 0 && gw1 != null && gw1.Length > 0) { foreach (String type1 in trainType1) { foreach (String gw in gw1) { InsertData(type1, gw, "0", tab1); } } } //设置动车组 if (trainType2 != null && trainType2.Length > 0 && gw2 != null && gw2.Length > 0) { foreach (String type1 in trainType2) { foreach (String gw in gw2) { InsertData(type1, gw, "1", tab1); } } } tab1.Close(); }
/// <summary> /// 将客运机车牵引费导入到系统中 /// </summary> /// <param name="FileName"></param> public static void ImportGTTrainDragFeeToSystem(String FileName) { String FileName1 = HttpContext.Current.Server.MapPath("~/Attachment/" + FileName); JTable tab1 = new JTable("GTTRAINDRAGFEE"); Dictionary <String, object> data1 = new Dictionary <string, object>(); String[] fs = new String[] { "线别", "交路", "机种", "牵引费", "接触网电费" }; String[] fs1 = new String[] { "LINETYPE", "CROSSROAD", "MACTYPE", "DRAGFEE", "NETFEE" }; if (File.Exists(FileName1)) { DataSet ds1 = PubCode.Util.xsldata(FileName1, "Table1"); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { foreach (DataRow dr1 in ds1.Tables[0].Rows) { if (dr1["线别"].ToString().Trim() != String.Empty) { data1.Clear(); for (int i = 0; i < fs.Length; i++) { object obj1 = dr1[fs[i]]; data1.Add(fs1[i], obj1); } tab1.InsertData(data1); } } } //得到客专电费的数据 tab1.Close(); } }
/// <summary> /// 将客专公司电费导入到系统中 /// </summary> /// <param name="FileName"></param> public static void ImportGSCorpElecFeeToSystem(String FileName) { String FileName1 = HttpContext.Current.Server.MapPath("~/Attachment/" + FileName); JTable tab1 = new JTable("GSCORPELECFEE"); Dictionary <String, object> data1 = new Dictionary <string, object>(); String[] fs = new String[] { "公司名称", "铁路局", "接触网使用费", "电费" }; String[] fs1 = new String[] { "CORPNAME", "RWBUREAU", "NETFEE", "ELECFEE" }; if (File.Exists(FileName1)) { DataSet ds1 = PubCode.Util.xsldata(FileName1, "Table1"); if (ds1 != null && ds1.Tables[0].Rows.Count > 0) { foreach (DataRow dr1 in ds1.Tables[0].Rows) { if (dr1["公司名称"].ToString().Trim() != String.Empty) { data1.Clear(); for (int i = 0; i < fs.Length; i++) { object obj1 = dr1[fs[i]]; data1.Add(fs1[i], obj1); } tab1.InsertData(data1); } } } //得到客专电费的数据 tab1.Close(); } }
public static void SetData() { JTable tab1 = new JTable("COMMTRAINWEIGHTPROFILE"); tab1.OrderBy = "TRAINTYPE"; DataSet ds1 = tab1.SearchData(null, -1, "*"); Data.Clear(); foreach (DataRow dr1 in ds1.Tables[0].Rows) { CommonTrainData data1 = new CommonTrainData(); JObject.FillObjectByDataRow(data1, dr1); String type1 = dr1["TRAINTYPE"].ToString(); if (type1 == "25B") { Data.Add(ECommTrainType.绿皮车25B, data1); } else if (type1 == "25G") { Data.Add(ECommTrainType.空调车25G, data1); } else if (type1 == "25T") { Data.Add(ECommTrainType.空调车25T, data1); } else if (type1 == "25K") { Data.Add(ECommTrainType.空调车25K, data1); } else { } } tab1.Close(); }
/// <summary> /// 车辆消耗备用品 /// </summary> /// <returns></returns> public double GetXiaoHaoCost() { double fee = 0; if (this.TrainBigKind == ETrainBigKind.普通列车) { JTable tab1 = new JTable("CHEXIANWEIGHTPROFILE"); List <SearchField> condition = new List <SearchField>(); tab1.OrderBy = "CHEXIANTYPE"; DataSet ds1 = tab1.SearchData(null, -1, "*"); foreach (DataRow dr1 in ds1.Tables[0].Rows) { ECommCheXian type1 = (ECommCheXian)(int.Parse(dr1["CHEXIANTYPE"].ToString())); switch (type1) { case ECommCheXian.硬座: fee = fee + this.YinZuo * double.Parse(dr1["UNITXHCOST"].ToString()); break; case ECommCheXian.软座: fee = fee + this.RuanZuo * double.Parse(dr1["UNITXHCOST"].ToString()); break; case ECommCheXian.开放式硬卧: fee = fee + this.OpenYinWo * double.Parse(dr1["UNITXHCOST"].ToString()); break; case ECommCheXian.包房式硬卧: fee = fee + this.CloseYinWo * double.Parse(dr1["UNITXHCOST"].ToString()); break; case ECommCheXian.软卧: fee = fee + this.RuanWo * double.Parse(dr1["UNITXHCOST"].ToString()); break; case ECommCheXian.高级软卧: fee = fee + this.AdvanceRuanWo * double.Parse(dr1["UNITXHCOST"].ToString()); break; case ECommCheXian.餐车: fee = fee + this.CanChe * double.Parse(dr1["UNITXHCOST"].ToString()); break; case ECommCheXian.供电车: fee = fee + this.FaDianChe * double.Parse(dr1["UNITXHCOST"].ToString()); break; case ECommCheXian.宿营车: fee = fee + this.ShuYinChe * double.Parse(dr1["UNITXHCOST"].ToString()); break; } } tab1.Close(); fee = fee * this.YongCheDiShu; } else { double db = 0; if (this.HighTrainBigKind == EHighTrainBigKind.动车200公里) { db = double.Parse(JStrInfoBU.GetStrTextByID("200公里动车客运消耗备用备品成本")); } else { db = double.Parse(JStrInfoBU.GetStrTextByID("300公里动车客运消耗备用备品成本")); } fee = db; //分200公里/300公里 标准2个标准 } return(fee); }
/// <summary> /// 根据列车名称得到列车对象 /// </summary> /// <param name="TrainName"></param> /// <returns></returns> public static CommTrainBU GetTrainObjectByTrainName(String TrainName) { CommTrainBU obj1 = null; if (String.IsNullOrEmpty(TrainName) == false) { JTable tab1 = new JTable("Train"); List <SearchField> condition = new List <SearchField>(); condition.Add(new SearchField("TrainName", TrainName)); DataRow dr1 = tab1.GetFirstDataRow(condition, "*"); if (dr1 != null) { obj1 = new CommTrainBU(); obj1.Num = dr1["num"].ToString(); obj1.TrainName = dr1["TrainName"].ToString(); obj1.TrainBigKind = (ETrainBigKind)(int.Parse(dr1["TrainBigKind"].ToString())); obj1.TrainType = dr1["TrainType"].ToString(); obj1.YuXingLiCheng = int.Parse(dr1["YuXingLiCheng"].ToString()); obj1.YinZuo = int.Parse(dr1["YinZuo"].ToString()); obj1.RuanZuo = int.Parse(dr1["RuanZuo"].ToString()); obj1.OpenYinWo = int.Parse(dr1["OpenYinWo"].ToString()); obj1.CloseYinWo = int.Parse(dr1["CloseYinWo"].ToString()); obj1.RuanWo = int.Parse(dr1["RuanWo"].ToString()); obj1.AdvanceRuanWo = int.Parse(dr1["AdvanceRuanWo"].ToString()); obj1.CanChe = int.Parse(dr1["CanChe"].ToString()); obj1.FaDianChe = int.Parse(dr1["FaDianChe"].ToString()); obj1.ShuYinChe = int.Parse(dr1["ShuYinChe"].ToString()); //车厢价格 obj1.YinZuoPrice = int.Parse(dr1["YinZuoPrice"].ToString()); obj1.RuanZuoPrice = int.Parse(dr1["RuanZuoPrice"].ToString()); obj1.OpenYinWoPrice = int.Parse(dr1["OpenYinWoPrice"].ToString()); obj1.CloseYinWoPrice = int.Parse(dr1["CloseYinWoPrice"].ToString()); obj1.RuanWoPrice = int.Parse(dr1["RuanWoPrice"].ToString()); obj1.AdvanceRuanWoPrice = int.Parse(dr1["AdvanceRuanWoPrice"].ToString()); obj1.CanChePrice = int.Parse(dr1["CanChePrice"].ToString()); obj1.FaDianChePrice = int.Parse(dr1["FaDianChePrice"].ToString()); obj1.ShuYinChePrice = int.Parse(dr1["ShuYinChePrice"].ToString()); obj1.JiaKuai = (ECommJiaKuai)(int.Parse(dr1["JiaKuai"].ToString())); if (dr1["KongTiaoFee"].ToString().Trim() == "1") { obj1.KongTiaoFee = true; } else { obj1.KongTiaoFee = false; } obj1.XieBieZhengJiaFee = int.Parse(dr1["XieBieZhengJiaFee"].ToString()); obj1.QianYinType = (EQianYinType)(int.Parse(dr1["QianYinType"].ToString())); obj1.GongDianType = (EGongDianType)(int.Parse(dr1["GongDianType"].ToString())); obj1.WaterCount = int.Parse(dr1["WaterCount"].ToString()); obj1.ServerPerson = (EServerPerson)(int.Parse(dr1["ServerPerson"].ToString())); obj1.RunHour = int.Parse(dr1["RunHour"].ToString()); obj1.YongCheDiShu = double.Parse(dr1["YongCheDiShu"].ToString()); obj1.CheDiShu = double.Parse(dr1["CheDiShu"].ToString()); obj1.Line0 = int.Parse(dr1["Line0"].ToString()); obj1.Line1 = int.Parse(dr1["Line1"].ToString()); obj1.Line2 = int.Parse(dr1["Line2"].ToString()); obj1.Line3 = int.Parse(dr1["Line3"].ToString()); obj1.Line4 = int.Parse(dr1["Line4"].ToString()); obj1.Line5 = int.Parse(dr1["Line5"].ToString()); obj1.Line6 = int.Parse(dr1["Line6"].ToString()); obj1.Line7 = int.Parse(dr1["Line7"].ToString()); obj1.Line8 = int.Parse(dr1["Line8"].ToString()); obj1.HighTrainBianZhu = (EHighTrainBianZhu)(int.Parse(dr1["HighTrainBianZhu"].ToString())); obj1.HighTrainBigKind = (EHighTrainBigKind)(int.Parse(dr1["HighTrainBigKind"].ToString())); obj1.CunZengMoShi = (ECunZengMoShi)(int.Parse(dr1["CunZengMoShi"].ToString())); } tab1.Close(); } return(obj1); }