public void init(tableData data) { index = data.index; string msg = data.name + ": "; foreach (string name in data.memberNames) { msg += name + ","; } txt.text = msg; }
public List <tableData> GetPatforView(List <PatBasicInfor> Patlist) { List <tableData> dataset = new List <tableData>(); var count = Patlist.Count; for (int i = 0; i < count; i++) { tableData rd = new tableData(); rd.Name = Patlist[i].Name; rd.Sex = Patlist[i].Sex; rd.Age = Patlist[i].Age; rd.ListID = Convert.ToString(i + 1); rd.PatBasicInforId = Patlist[i].Id; var record = from p in container.VisitRecordSet.ToList() where (p.PatBasicInfor.Id == Patlist[i].Id) select p; var num = record.Count(); if (num != 0) { VisitRecord vt = record.First(); rd.Date = vt.VisitDate.ToString("yyyy-MM-dd"); if (vt.DiagnosisResult1 != null || vt.DiagnosisResult2 != null || vt.DiagnosisResult3 != null) { if (vt.DiagnosisResult1.Contains("慢性每日头痛")) { var style = vt.DiagnosisResult1.Split(new Char[] { ':' }); if (style.Length > 1) { rd.HeadacheStyle = style[1]; } else { rd.HeadacheStyle = vt.DiagnosisResult1 + vt.DiagnosisResult2 + vt.DiagnosisResult3; } } else { rd.HeadacheStyle = vt.DiagnosisResult1 + vt.DiagnosisResult2 + vt.DiagnosisResult3; } } } dataset.Add(rd); } return(dataset); }
public tableData GetPatinfo(PatBasicInfor pat) { tableData rd = new tableData(); rd.Name = pat.Name; rd.Sex = pat.Sex; rd.Age = pat.Age; //rd.ListID = Convert.ToString(i + 1); rd.PatBasicInforId = pat.Id; var record = from p in container.VisitRecordSet.ToList() where (p.PatBasicInfor.Id == pat.Id) select p; var num = record.Count(); if (num != 0) { VisitRecord vt = record.First(); rd.Date = vt.VisitDate.ToString("yyyy-MM-dd"); if (vt.DiagnosisResult1 != null || vt.DiagnosisResult2 != null || vt.DiagnosisResult3 != null) { if (vt.DiagnosisResult1.Contains("慢性每日头痛")) { var style = vt.DiagnosisResult1.Split(new Char[] { ':' }); if (style.Length > 1) { rd.HeadacheStyle = style[1]; } else { rd.HeadacheStyle = vt.DiagnosisResult1 + vt.DiagnosisResult2 + vt.DiagnosisResult3; } } else { rd.HeadacheStyle = vt.DiagnosisResult1 + vt.DiagnosisResult2 + vt.DiagnosisResult3; } } } return(rd); }
public void init(tableData data, withNone callback) { init(data); afterClick += callback; }
/// <summary> /// PB_TongHopNganSach_TheoNganh /// </summary> /// <param name="NamLamViec"></param> /// <param name="DotPhanBo"></param> /// <param name="Nganh"></param> /// <param name="LuyKe"></param> /// <param name="opDonViNganh"></param> /// <returns></returns> public tableData PB_TongHopNganSach_TheoNganh(String MaND, String iID_MaTrangThaiDuyet, String DotPhanBo, String Nganh, String LuyKe, String opDonViNganh) { tableData _tableData = new tableData(); DataTable dtPhanBo; DataTable dtChiTieu; DataTable dtDotPhanBo = PhanBo_ReportModels.LayDSDotPhanBo2(MaND, iID_MaTrangThaiDuyet); String DK = ""; if (opDonViNganh == "DonVi") { if (LuyKe == "on") { DK += "iID_MaDotPhanBo in (SELECT iID_MaDotPhanBo FROM PB_DotPhanBo WHERE dNgayDotPhanBo <=(SELECT dNgayDotPhanBo FROM PB_DotPhanBo WHERE iID_MaDotPhanBo=@iID_MaDotPhanBo))"; } else { DK += "iID_MaDotPhanBo in (SELECT iID_MaDotPhanBo FROM PB_DotPhanBo WHERE dNgayDotPhanBo =(SELECT dNgayDotPhanBo FROM PB_DotPhanBo WHERE iID_MaDotPhanBo=@iID_MaDotPhanBo))"; } //thêm điều kiện đã duyệt String DK_Duyet = ReportModels.DieuKien_TrangThaiDuyet; if (String.IsNullOrEmpty(iID_MaTrangThaiDuyet) || iID_MaTrangThaiDuyet == "0") { DK_Duyet = ""; } else { DK += DK_Duyet; } String SQL = "SELECT SUBSTRING(sLNS,1,1) as NguonNS,sLNS,sL,sK,sM,sTM,sTTM,sNG,PB_PhanBoChiTiet.sMoTa"; SQL += ",NS_DonVi.sTen"; SQL += ",NS_DonVi.iID_MaDonVi"; SQL += ",SUM(rTuChi_ChiTieu) as rTuChi_ChiTieu,SUM(rHienVat_ChiTieu) as rHienVat_ChiTieu, SUM(rTuChi) as rTuChi,SUM(rHienVat) as rHienVat"; SQL += " FROM PB_PhanBoChiTiet"; SQL += " INNER JOIN (SELECT iID_MaDonVi,sTen FROM NS_DonVi WHERE iTrangThai=1 AND iNamLamViec_DonVi=@iNamLamViec) as NS_DonVi ON NS_DonVi.iID_MaDonVi=PB_PhanBoChiTiet.iID_MaDonVi"; SQL += " WHERE PB_PhanBoChiTiet.iTrangThai=1 AND {0} {1} AND sNG IN (SELECT iID_MaNganhMLNS FROM NS_MucLucNganSach_Nganh WHERE iTrangThai=1 AND iID_MaNganh=@Nganh)"; SQL += " GROUP BY SUBSTRING(sLNS,1,1),sLNS,sL,sK,sM,sTM,sTTM,sNG,PB_PhanBoChiTiet.sMoTa,NS_DonVi.sTen,NS_DonVi.iID_MaDonVi"; SQL += " HAVING SUM(rTuChi) <> 0 OR SUM(rHienVat)<>0"; SQL += " ORDER BY sLNS asc,sL asc,sK asc,sM asc,sTM asc,sTTM asc,sNG asc"; SQL = String.Format(SQL, DK, ReportModels.DieuKien_NganSach(MaND, "PB_PhanBoChiTiet")); SqlCommand cmd = new SqlCommand(SQL); cmd.Parameters.AddWithValue("@iNamLamViec", NguoiDungCauHinhModels.iNamLamViec); cmd.Parameters.AddWithValue("@iID_MaDotPhanBo", DotPhanBo); cmd.Parameters.AddWithValue("@Nganh", Nganh); cmd.Parameters.AddWithValue("@iID_MaTrangThaiDuyet", iID_MaTrangThaiDuyet); dtPhanBo = Connection.GetDataTable(cmd); cmd.Dispose(); //Tạo dt chi tiêu String SQLChiTieu = String.Format(@"SELECT SUBSTRING(sLNS,1,1) as NguonNS,sLNS,sL,sK,sM,sTM,sTTM,sNG,sMoTa, SUM(rTuChi) as TuChiChiTieu,SUM(rHienVat) as HienVatChiTieu FROM PB_ChiTieuChiTiet WHERE ({0}) AND sNG<>'' {1} {2} AND sNG IN (SELECT iID_MaNganhMLNS FROM NS_MucLucNganSach_Nganh WHERE iTrangThai=1 AND iID_MaNganh=@Nganh) GROUP BY SUBSTRING(sLNS,1,1),sLNS,sL,sK,sM,sTM,sTTM,sNG,sMoTa HAVING SUM(rTuChi)<>0 OR SUM(rHienVat)<>0 ORDER BY sLNS asc,sL asc,sK asc,sM asc,sTM asc,sTTM asc,sNG asc", DK, ReportModels.DieuKien_ChiTieu(MaND),DK_Duyet); SqlCommand cmdChiTieu = new SqlCommand(SQLChiTieu); cmdChiTieu.Parameters.AddWithValue("@Nganh", Nganh); cmdChiTieu.Parameters.AddWithValue("@iID_MaTrangThaiDuyet", iID_MaTrangThaiDuyet); cmdChiTieu.Parameters.AddWithValue("@iID_MaDotPhanBo", DotPhanBo); dtChiTieu = Connection.GetDataTable(cmdChiTieu); cmdChiTieu.Dispose(); } else { if (LuyKe == "on") { DK += "iID_MaDotPhanBo in (SELECT iID_MaDotPhanBo FROM PB_DotPhanBo WHERE dNgayDotPhanBo <=(SELECT dNgayDotPhanBo FROM PB_DotPhanBo WHERE iID_MaDotPhanBo=@iID_MaDotPhanBo))"; } else { DK += "iID_MaDotPhanBo in (SELECT iID_MaDotPhanBo FROM PB_DotPhanBo WHERE dNgayDotPhanBo =(SELECT dNgayDotPhanBo FROM PB_DotPhanBo WHERE iID_MaDotPhanBo=@iID_MaDotPhanBo))"; } String DK_Duyet = ReportModels.DieuKien_TrangThaiDuyet; if (String.IsNullOrEmpty(iID_MaTrangThaiDuyet) || iID_MaTrangThaiDuyet == "0") { DK_Duyet = ""; } String SQLLuyKe = String.Format(@"SELECT SUBSTRING(sLNS,1,1) as NguonNS,sLNS,sL,sK,sM,sTM,sTTM,sNG,sMoTa,SUM(rTuChi) as rTuChi,SUM(rHienVat) as rHienVat FROM PB_PhanBoChiTiet WHERE {0} {2} AND sNG<>'' AND iTrangThai=1 {1} AND sNG IN (SELECT iID_MaNganhMLNS FROM NS_MucLucNganSach_Nganh WHERE iTrangThai=1 AND iID_MaNganh=@Nganh) GROUP BY SUBSTRING(sLNS,1,1),sLNS,sL,sK,sM,sTM,sTTM,sNG,sMoTa HAVING SUM(rTuChi)<>0 OR SUM(rHienVat)<>0 ORDER BY sLNS asc,sL asc,sK asc,sM asc,sTM asc,sTTM asc,sNG asc", DK,DK_Duyet,ReportModels.DieuKien_NganSach(MaND)); SqlCommand cmdLuyKe = new SqlCommand(SQLLuyKe); cmdLuyKe.Parameters.AddWithValue("@Nganh", Nganh); cmdLuyKe.Parameters.AddWithValue("@iID_MaDotPhanBo", DotPhanBo); cmdLuyKe.Parameters.AddWithValue("@iID_MaTrangThaiDuyet", iID_MaTrangThaiDuyet); dtPhanBo = Connection.GetDataTable(cmdLuyKe); cmdLuyKe.Dispose(); //Tạo dt chi tiêu String SQLChiTieu = String.Format(@"SELECT SUBSTRING(sLNS,1,1) as NguonNS,sLNS,sL,sK,sM,sTM,sTTM,sNG,sMoTa, SUM(rTuChi) as TuChiChiTieu,SUM(rHienVat) as HienVatChiTieu FROM PB_ChiTieuChiTiet WHERE ({0}) {2} AND sNG<>'' {1} AND sNG IN (SELECT iID_MaNganhMLNS FROM NS_MucLucNganSach_Nganh WHERE iTrangThai=1 AND iID_MaNganh=@Nganh) GROUP BY SUBSTRING(sLNS,1,1),sLNS,sL,sK,sM,sTM,sTTM,sNG,sMoTa HAVING SUM(rTuChi)<>0 OR SUM(rHienVat)<>0 ORDER BY sLNS asc,sL asc,sK asc,sM asc,sTM asc,sTTM asc,sNG asc", DK,DK_Duyet,ReportModels.DieuKien_ChiTieu(MaND)); SqlCommand cmdChiTieu = new SqlCommand(SQLChiTieu); cmdChiTieu.Parameters.AddWithValue("@iID_MaTrangThaiDuyet", iID_MaTrangThaiDuyet); cmdChiTieu.Parameters.AddWithValue("@iID_MaDotPhanBo", DotPhanBo); cmdChiTieu.Parameters.AddWithValue("@Nganh", Nganh); dtChiTieu = Connection.GetDataTable(cmdChiTieu); cmdChiTieu.Dispose(); #region //ghép dtphanbo vao dtchitieu DataRow addR, R2; String sCol = "NguonNS,sLNS,sL,sK,sM,sTM,sTTM,sNG,sMoTa,rTuChi,rHienVat"; String[] arrCol = sCol.Split(','); dtChiTieu.Columns.Add("rTuChi", typeof(Decimal)); dtChiTieu.Columns.Add("rHienVat", typeof(Decimal)); for (int i = 0; i < dtPhanBo.Rows.Count; i++) { String xauTruyVan = String.Format(@"NguonNS='{7}' AND sLNS='{0}' AND sL='{1}' AND sK='{2}' AND sM='{3}' AND sTM='{4}' AND sTTM='{5}' AND sNG='{6}'", dtPhanBo.Rows[i]["sLNS"], dtPhanBo.Rows[i]["sL"], dtPhanBo.Rows[i]["sK"], dtPhanBo.Rows[i]["sM"], dtPhanBo.Rows[i]["sTM"], dtPhanBo.Rows[i]["sTTM"], dtPhanBo.Rows[i]["sNG"], dtPhanBo.Rows[i]["NguonNS"] ); DataRow[] R = dtChiTieu.Select(xauTruyVan); if (R == null || R.Length == 0) { addR = dtChiTieu.NewRow(); for (int j = 0; j < arrCol.Length; j++) { addR[arrCol[j]] = dtPhanBo.Rows[i][arrCol[j]]; } dtChiTieu.Rows.Add(addR); } else { foreach (DataRow R1 in dtPhanBo.Rows) { for (int j = 0; j < dtChiTieu.Rows.Count; j++) { Boolean okTrung = true; R2 = dtChiTieu.Rows[j]; for (int c = 0; c < arrCol.Length - 2; c++) { if (R2[arrCol[c]].Equals(R1[arrCol[c]]) == false) { okTrung = false; break; } } if (okTrung) { dtChiTieu.Rows[j]["rTuChi"] = R1["rTuChi"]; dtChiTieu.Rows[j]["rHienVat"] = R1["rHienVat"]; break; } } } } } //sắp xếp datatable sau khi ghép DataView dv = dtChiTieu.DefaultView; dv.Sort = "NguonNS,sLNS,sL,sK,sM,sTM,sTTM,sNG"; dtChiTieu = dv.ToTable(); #endregion } _tableData.dtPhanBo = dtPhanBo; _tableData.dtChiTieu = dtChiTieu; return _tableData; }
public ActionResult Index() { //asigning the lowestRate object in the qureies to the current instance LowestRate USD = Queries.queries.lowestUSD(); ViewBag.USDBR = USD.BuyingRate; ViewBag.USDSR = USD.SellingRate; ViewBag.USDBank = USD.BankName; ViewBag.USDLogo = USD.BankLogo; LowestRate AD = Queries.queries.lowestAD(); ViewBag.ADBR = AD.BuyingRate; ViewBag.ADSR = AD.SellingRate; ViewBag.ADBank = AD.BankName; ViewBag.ADLogo = AD.BankLogo; LowestRate ER = Queries.queries.lowestEuro(); ViewBag.ERBR = ER.BuyingRate; ViewBag.ERSR = ER.SellingRate; ViewBag.ERBank = ER.BankName; ViewBag.ERLogo = ER.BankLogo; LowestRate NOR = Queries.queries.lowestNOR(); ViewBag.NORBR = NOR.BuyingRate; ViewBag.NORSR = NOR.SellingRate; ViewBag.NORBank = NOR.BankName; ViewBag.NORLogo = NOR.BankLogo; //all data table List <tableData> list = new List <tableData>(); //using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDbConn"].ToString())) //{ // connection.Open(); //Server = OBHASHA\\SQLEXPRESS; Database = currency; User Id = sa; Password = intel@123; myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["MyDbConn"].ConnectionString); myConnection.Open(); Debug.WriteLine("Connection " + myConnection.ConnectionString); using (SqlCommand command = new SqlCommand("SELECT * FROM [currency].[dbo].[exchangeRates]", myConnection)) { SqlDataReader rdr = command.ExecuteReader(); while (rdr.Read()) { var data = new tableData(); data.BankName = rdr.GetString(2); data.ADBR = rdr.GetDouble(3); data.ADSR = rdr.GetDouble(4); data.USBR = rdr.GetDouble(9); data.USSR = rdr.GetDouble(10); data.EUBR = rdr.GetDouble(5); data.EUSR = rdr.GetDouble(6); data.NORBR = rdr.GetDouble(7); data.NORSR = rdr.GetDouble(8); data.siteUpdated = rdr.GetString(0); list.Add(data); } } return(View(list)); }
private void inputTableValues() { tableDef = new tableData(); dataItem = new tableDataItem { StockSymbol = "TEA", StockTypeValue = tableDataItem.StockType.Common, LastDividend = 0, FixedDividend = 0, ParValue = 100, TickerPrice = 10, TradePrice = 11 }; tableDef.Add(dataItem); dataItem = new tableDataItem { StockSymbol = "POP", StockTypeValue = tableDataItem.StockType.Common, LastDividend = 8, FixedDividend = 0, ParValue = 100, TickerPrice = 12, TradePrice = 13 }; tableDef.Add(dataItem); dataItem = new tableDataItem { StockSymbol = "ALE", StockTypeValue = tableDataItem.StockType.Common, LastDividend = 23, FixedDividend = 0, ParValue = 60, TickerPrice = 14, TradePrice = 15 }; tableDef.Add(dataItem); dataItem = new tableDataItem { StockSymbol = "GIN", StockTypeValue = tableDataItem.StockType.Preferred, LastDividend = 8, FixedDividend = 0.02f, ParValue = 100, TickerPrice = 16, TradePrice = 17 }; tableDef.Add(dataItem); dataItem = new tableDataItem { StockSymbol = "JOE", StockTypeValue = tableDataItem.StockType.Common, LastDividend = 13, FixedDividend = 0, ParValue = 100, TickerPrice = 18, TradePrice = 19 }; tableDef.Add(dataItem); GridView1.DataSource = tableDef; GridView1.DataBind(); //DropDownList1.DataSource = tableDef; //DropDownList1.DataTextField = "StockSymbol"; //DropDownList1.DataValueField = "StockSymbol"; //DropDownList1.DataBind(); }
public void readMsg(string msg) { string[] orders = msg.Split('|'); foreach (string order in orders) { if (order != "") //split會切出"" { string[] part = order.Split('~'); //使用~切分action code 和 action arg if (part.Length != 2) { textShow.Log("order:" + order + "格式錯誤,不予處理"); continue; } int code; if (int.TryParse(part[0], out code)) { switch (code) { case 0: { textShow.Log("table 列表:" + part[1]); Dictionary <string, object> args = new Dictionary <string, object>(); List <tableData> list = new List <tableData>(); string[] tables = part[1].Split(':'); foreach (string table in tables) { string[] infs = table.Split(';'); tableData data = new tableData(); int idx; if (!int.TryParse(infs[0], out idx)) { textShow.Log("table data:" + table + "不符合格式"); break; } data.index = idx; data.name = infs[2]; string inf = infs[3]; string[] names = inf.Split('/'); List <string> nlist = new List <string>(names); data.memberNames = nlist; list.Add(data); } args["tables"] = list; order newone = new order(0, args); panel.handle(newone); break; } case 1: { string[] subs = part[1].Split(','); int id; if (!int.TryParse(subs[0], out id)) { textShow.Log("解析greeting request 錯誤的id:" + subs[0] + "不是數字"); } else { idInTable = id; password = subs[1]; textShow.Log("登入tableServer完成,收到id:" + idInTable + "password:"******"收到Connect Requst"); Console.WriteLine(">>>連接請求 ip:" + ip + " port:" + port); gEndPoint.conncetRemoteEndPoint(ip, port); } break; } case 3: { string[] subs = part[1].Split(';'); int c; if (!int.TryParse(subs[0], out c)) { textShow.Log("解析創建房間錯誤的code:" + subs[0] + "不是數字"); } else { if (c == 1) { Dictionary <string, object> args = new Dictionary <string, object>(); List <string> names = new List <string>(subs[1].Split('/')); args["roles"] = names; panel.handle(new order(3, args)); } else { textShow.Log("創建房間失敗,返回code" + c); } } break; } case 4: //linked_requst { int result; textShow.Log("收到linked result"); if (int.TryParse(part[1], out result)) { if (result == 1) //連接成功 { LinkedOk = true; gEndPoint.startWaiting(); } } else { textShow.Log("錯誤的linked requst code"); } break; } } } else { textShow.Log("order:" + order + " order code不是數字,不予處理"); continue; } } } }
public JsonResult Delete(string id) { tableData data = new tableData(); return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Query(string name, string sex, string date, string diagnosis) { string user = HttpContext.Request.Cookies["username"].Value.ToString(); //找到region账号对应的医生列表。 UserOperation uo = new UserOperation(); List <userInfo> SelectedDocs = uo.SelectedDocs(user); VisitDataOperation visitop = new VisitDataOperation(); List <PatBasicInfor> Patlist = new List <PatBasicInfor>(); List <tableData> patlistforre = new List <tableData>(); RegionViewData regionViewData = new RegionViewData(); var allpats = from s in DataContainer.PatBasicInforSet.ToList() select s; var allvisitRecord = from s in DataContainer.VisitRecordSet.ToList() select s; var docnum = SelectedDocs.Count; List <int> docIDS = new List <int> (); foreach (userInfo doc in SelectedDocs) { docIDS.Add(doc.id); } var patlist = allpats.Where(p => docIDS.Contains(p.DoctorAccountId)).ToList(); var patinfoList = (from ps in patlist.Where(p => (string.IsNullOrEmpty(name) ? true : p.Name == name) && (string.IsNullOrEmpty(sex) ? true : p.Sex == sex)) from r in allvisitRecord.Where(r => (r.PatBasicInforId == ps.Id) && (string.IsNullOrEmpty(diagnosis) ? true : (r.DiagnosisResult1.Contains(diagnosis) || r.DiagnosisResult2.Contains(diagnosis) || r.DiagnosisResult3.Contains(diagnosis))) && (string.IsNullOrEmpty(date) ? true : r.VisitDate.Date == DateTime.Parse(date))) select new { Name = ps.Name, Sex = ps.Sex, Age = ps.Age, Date = r.VisitDate, DiagnosisResult1 = r.DiagnosisResult1, DiagnosisResult2 = r.DiagnosisResult2, DiagnosisResult3 = r.DiagnosisResult3, PatBasicInforId = ps.Id }).OrderByDescending(x => x.Date).DistinctBy(x => x.PatBasicInforId).ToList(); int i = 1; foreach (var patient in patinfoList) { tableData td = new tableData(); td.Name = patient.Name; td.Sex = patient.Sex; td.Age = patient.Age; td.ListID = i.ToString(); td.Date = patient.Date.ToString("yyyy-MM-dd"); td.PatBasicInforId = patient.PatBasicInforId; if (patient.DiagnosisResult1 != null || patient.DiagnosisResult2 != null || patient.DiagnosisResult3 != null) { if (patient.DiagnosisResult1.Contains("慢性每日头痛")) { var style = patient.DiagnosisResult1.Split(new Char[] { ':' }); if (style.Length > 1) { td.HeadacheStyle = style[1]; } else { td.HeadacheStyle = patient.DiagnosisResult1 + patient.DiagnosisResult2 + patient.DiagnosisResult3; } } else { td.HeadacheStyle = patient.DiagnosisResult1 + patient.DiagnosisResult2 + patient.DiagnosisResult3; } } i++; patlistforre.Add(td); } /* int i,j; * List<string> query = new List<string>(); * query.Add(name); * query.Add(sex); * query.Add(date); * query.Add(diagnosis); * for (i = 0; i < docnum; i++) * { * string docname = SelectedDocs[i].userName; * query.Add(docname); * var pts= visitop.GetPatforDoc(query); * query.Remove(docname); * var patnum = pts.Count; * * for (j = 0; j < patnum; j++) * { * var patID=pts[j].Id ; * var selectedpat = allpats.Where(s => s.Id == patID).FirstOrDefault(); * List<string> patientIds = new List<string>(); * Patlist.Add(selectedpat); * } * } * patlistforre = regionViewData.GetPatforView(Patlist);*/ return(Json(patlistforre, JsonRequestBehavior.AllowGet)); // return PartialView("PatlistForRe", patlistforre); }