protected void Page_Load(object sender, EventArgs e) { conn = new Connection(); string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString; conn.Open(connectionstring); Rs1 = new Recordset(); Rs2 = new Recordset(); Rs3 = new Recordset(); Rs4 = new Recordset(); StationID = Request["StationID"]; UserID = Session["UserID"]; SecLevel = Session["SecLevel"]; Barcode = Request["Barcode"]; ProductType = Request["ProductType"]; CarPlate = Request["CarPlate"]; Response.Write(StationID); Response.Write(UserID); Response.Write(SecLevel); Response.End(); iMessage = null; Rs1.Open(("Exec Checkrange '" + Barcode + "'"), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1); //Response.write ("Exec Checkrange '"&Barcode&"'") //Response.end if (Rs1.Eof) { Message = "Check Range ���ҥ��� - §��L��!"; Response.Redirect("CouponVerification.aspx?Message=" + Message); } else { if (Convert.ToDateTime(Rs1.Fields["Expiry_Date"].Value) < DateTime.Parse(Convert.ToString(DateTime.Now))) { Message = "���ҥ��� - §��L��!"; Response.Redirect("CouponVerification.aspx?Message=" + Message); } } Rs1.Close(); Rs1 = null; Rs2.Open(("Exec CheckCouponExist '" + Barcode + "'"), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1); //Response.write ("Exec CheckCouponExist '"&Barcode&"'") iCount = Rs2.Fields["iCount"].Value; Rs2.Close(); Rs2 = null; if (Convert.ToInt32(iCount) > 0) { Message = "���ҥ��� - ���ƨϥ�!"; } else { Session.Add("SecLevel", SecLevel); Session.Add("UserID", UserID); Session.Add("StationID", StationID); Response.Redirect("Insert.aspx?ProductType=" + ProductType + "&Barcode=" + Barcode + "&CarPlate=" + CarPlate); } Session.Add("SecLevel", SecLevel); Session.Add("UserID", UserID); Session.Add("StationID", StationID); Response.Redirect("CouponVerification.aspx?Message=" + Message + "&Coupon_Number=" + Convert.ToString(Coupon_Number)); }
protected void Page_Load(object sender, EventArgs e) { conn = new Connection(); string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString; conn.Open(connectionstring); UserID = Request["UserID"]; Password = Request["Password"]; if (Session["StationID"] != null) { StationID = Session["StationID"].ToString(); } Rs1 = new Recordset(); Rs1.Open(("Exec CheckLoginPwd '" + UserID + "', '" + Password + "' "), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1); if (!(Rs1.Eof)) { Session.Add("SecLevel", Rs1.Fields["SecLevel"].Value); Session.Add("UserID", UserID); Session.Add("StationID", StationID); Response.Redirect("CouponVerification.aspx"); } else { Response.Redirect("Default.aspx?Message=Fail"); } }
protected void Page_Load(object sender, EventArgs e) { conn = new Connection(); string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString; conn.Open(connectionstring); Recordset Rs1 = null; object StationID = null; object UserID = null; object SecLevel = null; string Barcode = ""; string ProductType = ""; string CarPlate = ""; string Message = ""; Rs1 = new Recordset(); StationID = Session["StationID"]; UserID = Session["UserID"]; SecLevel = Session["SecLevel"]; Barcode = Request["Barcode"]; ProductType = Request["ProductType"]; CarPlate = Request["CarPlate"]; Message = "ÅçÃÒ¦¨¥\\!"; Rs1.Open(("Exec InsertCoupon '" + Barcode + "', '" + Convert.ToString(StationID) + "','" + ProductType + "','" + CarPlate + "','" + Convert.ToString(UserID) + "' "), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1); Response.Redirect("CouponVerification.aspx?Message=" + Message + "&CarPlate=" + CarPlate + "&ProductType=" + ProductType); }
public static string ExecuteCoupon(string StationID, string Barcode, string CarPlate, string ProductType, string UserID) //public static string ExecuteCoupon( string Barcode) { conn = new Connection(); string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString; conn.Open(connectionstring); Recordset Rs1 = null; Recordset Rs2 = null; Recordset Rs3 = null; Recordset Rs4 = null; object SecLevel = null; object iMessage = null; string Message = ""; object iCount = null; string Face_Value = ""; string Coupon_Type = ""; string Coupon_batch = ""; string Coupon_Number = ""; string Sql = ""; object UnitPrice = null; string Sql1 = ""; Rs1 = new Recordset(); Rs2 = new Recordset(); Rs3 = new Recordset(); Rs4 = new Recordset(); // Stationid = StationID; // UserID = HttpContext.Current.Session["UserID"]; // SecLevel = HttpContext.Current.Session["SecLevel"]; iMessage = null; Rs1.Open(("Exec VerifyCoupon '" + Barcode + "','" + StationID + "','" + ProductType + "','" + CarPlate + "','" + UserID + "'"), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1); // Rs1.Open(("Exec VerifyCoupon '" + Barcode + "'"), conn, (nce.adodb.CursorType)3, (nce.adodb.LockType)1); string result = Rs1.Fields["result"].Value.ToString(); string coupon_number = ""; string date = ""; if(Rs1.Fields["coupon_number"] != null) { coupon_number = Rs1.Fields["coupon_number"].Value.ToString(); } if (Rs1.Fields["Present_Date"] != null) { date = Rs1.Fields["Present_Date"].Value.ToString(); //DateTime d1; //DateTime d = DateTime.TryParse(date,out d1); DateTime? d = null; DateTime d2; bool success = DateTime.TryParse(date, out d2); if (success) d = d2; date = d2.ToString("MM/dd/yyyy HH:mm:ss"); } // Response.Redirect("CouponVerification.aspx?Message=" + Message + "&Coupon_Number=" + Coupon_Number); return result + "@" + coupon_number + "@" + date; }
protected void Page_Load(object sender, EventArgs e) { try { conn = new Connection(); string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString; conn.Open(connectionstring); Message = Request["Message"]; UserIPAddress = GetIPAddress(); //For Demo // UserIPAddress = "192.168.1.12"; Rs1 = new Recordset(); sql1 = "Select Station From Station Where IPAddress ='" + UserIPAddress + "'"; Rs1 = conn.Execute(sql1); if (!(Rs1.Eof)) { StationID = Rs1.Fields["Station"].Value; Session["StationID"] = StationID; conn.Close(); } else { Alert = "編號未設置, 請提供此電腦的 IP 地址 [ " + UserIPAddress + " ] 給系統管理員"; } } catch (Exception ex) { } }
public Recordset ToRecordSet() { var recordSet = new Recordset(); foreach (var field in _metaData.Fields) { recordSet.Fields.Append(field.Name, field.AdodbDataType, field.DefinedSize, field.Attribute, null); } recordSet.Open(Missing.Value, Missing.Value, CursorTypeEnum.adOpenUnspecified, LockTypeEnum.adLockUnspecified, 0); for (var i = 0; i < _records.Count; i++) { recordSet.AddNew(Missing.Value, Missing.Value); for (var j = 0; j < _metaData.Fields.Length; j++) { recordSet.Fields[j].Value = _records[i][j]; } if (i == _records.Count - 1) recordSet.MoveFirst(); else recordSet.MoveNext(); } return recordSet; }
protected void Page_Load(object sender, EventArgs e) { conn = new Connection(); string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString; conn.Open(connectionstring); //For Demo UserIPAddress = GetIPAddress(); //UserIPAddress = Request.ServerVariables["REMOTE_ADDR"]; Rs1 = new Recordset(); sql1 = "Select Station From Station Where IPAddress ='" + UserIPAddress + "'"; Rs1 = conn.Execute(sql1); StationID = Rs1.Fields["Station"].Value; UserID = Session["UserID"]; SecLevel = Session["SecLevel"]; CarPlate = Request["CarPlate"]; ProductType = Request["ProductType"]; Message = ""; if (Convert.ToString(SecLevel) == "") { Response.Redirect("Default.aspx"); } Session.Add("SecLevel", SecLevel); Session.Add("UserID", UserID); Session.Add("StationID", StationID); }
public void Write_CSV_From_Recordset(Recordset RS) { Regex RX = null; object i = null; object Field = null; string Separator = ""; if (RS.Eof) { // //There is no data to be written // return ; } //RX = new System.Text.RegularExpressions.Regex(); //RX.Pattern = "\\r|\\n|,|\""; // //Writing the header row (header row contains field names) // Separator = ","; Response.Write("Present Date and Time"); Response.Write(Separator); Response.Write("Period"); Response.Write(Separator); Response.Write("Number"); Response.Write(Separator); Response.Write("Type"); Response.Write(Separator); Response.Write("Product"); Response.Write(Separator); Response.Write("Litre"); Response.Write(Separator); Response.Write("Amount"); Response.Write(Separator); Response.Write("Car"); Response.Write("\r\n"); // //Writing the data rows // while(!(RS.Eof)) { Response.Write(RS.Fields["Present_Date"].Value); Response.Write(Separator); Response.Write(RS.Fields["Period"].Value); Response.Write(Separator); Response.Write(RS.Fields["Coupon_Number"].Value); Response.Write(Separator); Response.Write(RS.Fields["Coupon_Type"].Value); Response.Write(Separator); Response.Write(RS.Fields["Product_Type"].Value); Response.Write(Separator); Response.Write(RS.Fields["SaleLitre"].Value); Response.Write(Separator); Response.Write(RS.Fields["SaleAmount"].Value); Response.Write(Separator); Response.Write(RS.Fields["Car_ID"].Value); Response.Write("\r\n"); RS.MoveNext(); } }
public ActionResult TagListEditor_Post(HttpPostedFileBase fileupload) { OleDbDataAdapter _odbAdapter = new OleDbDataAdapter(); DataTable _dtable = new DataTable(); if (fileupload != null && fileupload.ContentLength > 0) { string _filename = Path.GetFileName(fileupload.FileName); string _fileExtension = Path.GetExtension(fileupload.FileName); string _path = Path.Combine(Server.MapPath("~/App_Data"), _filename); string _newFile = Path.Combine(Server.MapPath("~/App_Data"), _filename.Replace(_fileExtension,".txt")); if (_fileExtension == ".rs") { fileupload.SaveAs(_path); fileupload.SaveAs(_newFile); Recordset _recordset = new Recordset(); _recordset.Open(_path); _odbAdapter.Fill(_dtable, _recordset); _dtable.Columns.Add("Actions",typeof(string)); //foreach (DataRow dt in _dtable.Rows) //{ // dt["Actions"] = ""; //} //_dtable.AcceptChanges(); StreamWriter _sWriter = new StreamWriter(_newFile, false); foreach (DataRow drow in _dtable.Rows) { for (int i = 0; i < _dtable.Columns.Count; i++) { if (!Convert.IsDBNull(drow[i])) { if (i == 1) { _sWriter.Write("|" + drow[i].ToString()); } else { _sWriter.Write(drow[i].ToString()); } } } _sWriter.Write(_sWriter.NewLine); } _sWriter.Close(); } } return View(_dtable); }
/// <summary> /// Preenche um ComboBox com os dados de uma query. /// </summary> /// <param name="comboBox"></param> /// <param name="recordset">O Recordset a ser utilizado para obter os dados.</param> /// <param name="query">A query a ser utilizada para obter os dados.</param> /// <param name="fieldValue">O nome do Field que contém o valor para ComboBox.</param> /// <param name="fieldDescription">O nome do Field que contém a descrição para o ComboBox.</param> /// <param name="noLock">Indica se a query deve ser executada na forma de apenas leiura, isto é, se houver alguma escrita no momento não vai esperar a conclusão desta para continuar.</param> public static Recordset AddValuesFromQuery(this ComboBox comboBox, Recordset recordset, string query, string fieldValue = null, string fieldDescription = null, bool noLock = true) { if (recordset == null) throw new ArgumentNullException("recordset"); if (query == null) throw new ArgumentNullException("query"); recordset.DoQuery(noLock ? " SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED " + query : query); return AddValuesFromRecordset(comboBox, recordset, fieldValue, fieldDescription); }
/// <summary> /// Preenche um ComboBox com os dados de um Recordset. /// </summary> /// <param name="comboBox">O ComboBox a ser preenchido.</param> /// <param name="recordset">O Recordset com os dados.</param> /// <param name="fieldValue">O nome do Field que contém o valor para ComboBox.</param> /// <param name="fieldDescription">O nome do Field que contém a descrição para o ComboBox.</param> public static Recordset AddValuesFromRecordset(this ComboBox comboBox, Recordset recordset, string fieldValue = null, string fieldDescription = null) { if (comboBox == null) throw new ArgumentNullException("comboBox"); if (recordset == null) throw new ArgumentNullException("recordset"); recordset.MoveFirst(); if (fieldDescription == null) { if (fieldValue == null) { var fields = recordset.Fields; if (fields.Count > 1) { fieldValue = fields.Item(0).Name; fieldDescription = fields.Item(1).Name; } else { fieldValue = fieldDescription = fields.Item(0).Name; } } else { var fields = recordset.Fields; if (fields.Count > 1) { fieldDescription = fields.Item(0).Name == fieldValue ? fields.Item(1).Name : fields.Item(0).Name; } else { fieldDescription = fieldValue; } } } var validValues = comboBox.ValidValues; while (!recordset.EoF) { var value = recordset.Fields.Item(fieldValue); var description = recordset.Fields.Item(fieldDescription); validValues.Add(value.Value.ToString(), description.Value.ToString()); recordset.MoveNext(); } return recordset; }
private void btnLoad_Click(object sender, EventArgs e) { _con = new SapConnectionOld(); _con.Connect(); _oItens = _con.Comany.GetBusinessObject(BoObjectTypes.oItems); _recordSet = _con.Comany.GetBusinessObject(BoObjectTypes.BoRecordset); _recordSet.DoQuery("select ItemCode from OITM"); _oItens.Browser.Recordset = _recordSet; _oItens.Browser.MoveFirst(); SetFields(); }
public string InyectarPedidoEnTango(Recordset rsEncabezadoPedido, Recordset rsRenglonesPedido) { try { Recordset rsResultado = new Recordset(); if (LogInXTango()) { Log.logFileDEBUG(app_XTango, "Inyectando pedido a Tango, ID_SAVX: " + rsEncabezadoPedido.Fields["ID_Pedido"].Value + " " + rsEncabezadoPedido.Fields["Leyenda_4"].Value + " en Tango."); if (xtango.Add_Pedidos(rsEncabezadoPedido, rsRenglonesPedido, ref rsResultado, controlCredito, controlClienteInhabilitado, controlTipoTalonario, controlListaPrecioHabilitada, descargaStock) == 0) { if (rsResultado.Fields["Estado_OK"].Value) { Log.logFileDEBUG(app_Tango, "Chequeando el ingreso del Pedido en la BD."); if (CheckPedidoIngresado(rsResultado.Fields["Nro_Pedido"].Value)) { Log.logFileDEBUG(app_Tango, "Pedido ingresado correctamente: " + rsResultado.Fields["Nro_Pedido"].Value + "."); return rsResultado.Fields["Nro_Pedido"].Value; } else { Log.logFileERROR(Tango.app_XTango, "CheckPedidoIngresado()", "XTango informo exito al inyectar el pedido con numero " + rsResultado.Fields["Nro_Pedido"].Value + ", pero no existe en la BD."); return null; } } else { Log.logFileERROR(Tango.app_XTango, "Add_Pedidos()", rsResultado.Fields["Msg_Error"].Value); return null; } } else { Log.logFileERROR(Tango.app_XTango, "Add_Pedidos()", "No se ha podido ingresar a Tango el pedido."); return null; } } else { Log.logFileERROR(Tango.app_XTango, "LogInXTango()", "El inicio de sesion de XTango ha fallado."); return null; } } catch (Exception ex) { Log.logFileTRAP(Tango.app_XTango, "InyectarPedidoEnTango()", ex.ToString()); return null; } }
public Recordset ReadSalesOrders() { Recordset salesOrders=null; //Caching: best to use with master tables not transactional tables ObjectCache cache = MemoryCache.Default; salesOrders = cache["salesorders"] as Recordset; if(salesOrders == null) { salesOrders = new Recordset(); DataSet ds = fillDataset(USP_SALESORDERS,TBL_SALESORDERS,new object[] { }); salesOrders.Merge(ds); //CacheItemPolicy policy = new CacheItemPolicy(); //policy.ChangeMonitors.Add(new SqlChangeMonitor(new SqlDependency(new SqlCommand()))); DateTimeOffset policy = new DateTimeOffset(DateTime.Now.AddMinutes(5)); cache.Set("salesorders",salesOrders,policy); } return salesOrders; }
public static DataTable RecordsetToDataTable(Recordset rs,LayerInfo layerInfo) { var dt = CreateDataTableByLayerInfo(layerInfo); if (rs.IsEmpty) return dt; while (!rs.IsEOF) { var row = dt.NewRow(); foreach (var fieldInfo in layerInfo.FieldInfos) { var value = rs.GetFieldValue(fieldInfo.FieldName); row[fieldInfo.FieldName] = value; } dt.Rows.Add(row); rs.MoveNext(); } return dt; }
public void ShowDataTable(Recordset rs) { this.dataGridView1.Rows.Clear(); this.dataGridView1.Columns.Clear(); for (int i = 0; i < rs.Fields.Length; i++) { DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn(); column.Name = rs.FieldCaptions[i]; dataGridView1.Columns.Add(column); } this.dataGridView1.Rows.Clear(); for (int i = 0; i < rs.Features.Length; i++) { int index = this.dataGridView1.Rows.Add(rs.Features[i].FieldValues); DataGridViewRow row = this.dataGridView1.Rows[index]; row.Tag = rs.Features[i].Geometry; } }
protected void Page_Load(object sender, EventArgs e) { try { conn = new Connection(); string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString; conn.Open(connectionstring); UserID = (Request["UserID"]).Trim(); Level = (Request["SecLevel"]).Trim(); StationID = (Request["StationID"]).Trim(); UserID = (Request["UserID"]).TrimEnd(); SDay = Request["SDay"]; SMonth = Request["SMonth"]; SYear = Request["SYear"]; NDay = Request["NDay"]; NMonth = Request["NMonth"]; NYear = Request["NYear"]; // Search_Date = Strings.FormatDateTime(new DateTime(Convert.ToInt32(SYear), Convert.ToInt32(SMonth), Convert.ToInt32(SDay)), (DateFormat)2); //Search_NDate = Strings.FormatDateTime(new DateTime(Convert.ToInt32(NYear), Convert.ToInt32(NMonth), Convert.ToInt32(NDay)), (DateFormat)2); Search_Date = SDay + "/" + SMonth + "/" + SYear; Search_NDate = NDay + "/" + NMonth + "/" + NYear; fsql = "select * from MasterCoupon where RequestedID = " + StationID + " and Present_Date >= Convert(datetime, '" + Search_Date + "', 105) " + " and Present_Date < DATEADD(dd,DATEDIFF(dd,0, Convert(datetime, '" + Search_NDate + "', 105)),0) + 1 " + " order by id desc"; //response.write fsql //response.end RS1 = conn.Execute(fsql); //Today = Strings.FormatDateTime(DateTime.Now, (DateFormat)2); Today = DateTime.Now.ToString("dd-MM-yyyy"); Response.ContentType = "application/pdf"; Response.AddHeader("content-disposition", "attachment;filename=§¨é¬ö¿ý(" + Today + ").pdf"); // Write_CSV_From_Recordset(RS1); ExportToPDF(RS1, true, StationID); } catch (Exception ex) { } }
public ArrayList listOfCatalogs(out string errorMessage) { try { listCatalogs.Clear(); rsSchema = dbConn.OpenSchema(ADODB.SchemaEnum.adSchemaCatalogs, Missing.Value, Missing.Value); while (!rsSchema.EOF) { listCatalogs.Add(rsSchema.Fields[0].Value); rsSchema.MoveNext(); } errorMessage = ""; } catch (Exception e) { errorMessage = e.Source + " " + e.Message; MessageBox.Show(e.Source + " " + e.Message); } return listCatalogs; }
protected void Page_Load(object sender, EventArgs e) { conn = new Connection(); string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString; conn.Open(connectionstring); UserIPAddress = GetIPAddress(); //For Demo //UserIPAddress = "192.168.1.12"; //UserIPAddress = Request.ServerVariables["REMOTE_ADDR"]; Rs1 = new Recordset(); sql1 = "Select Station , LoginUser From Station Where IPAddress ='" + UserIPAddress + "'"; Rs1 = conn.Execute(sql1); StationID = Rs1.Fields["Station"].Value; UserID = Rs1.Fields["LoginUser"].Value; CarPlate = Request["CarPlate"]; ProductType = Request["ProductType"]; Message = ""; }
/// <summary> /// 拷贝的构造函数。 /// </summary> /// <param name="recordset">Recordset 对象实例。</param> public Recordset(Recordset recordset) { if (recordset == null) throw new ArgumentNullException("recordset", Resources.ArgumentIsNotNull); this.DatasetName = recordset.DatasetName; if (recordset.FieldCaptions != null) { this.FieldCaptions = new string[recordset.FieldCaptions.Length]; for (int i = 0; i < recordset.FieldCaptions.Length; i++) { this.FieldCaptions[i] = recordset.FieldCaptions[i]; } } if (recordset.Features != null) { this.Features = new Feature[recordset.Features.Length]; for (int i = 0; i < recordset.Features.Length; i++) { if (recordset.Features[i] != null) { this.Features[i] = new Feature(recordset.Features[i]); } } } if (recordset.Fields != null) { this.Fields = new string[recordset.Fields.Length]; for (int i = 0; i < recordset.Fields.Length; i++) { this.Fields[i] = recordset.Fields[i]; } } if (recordset.FieldTypes != null) { this.FieldTypes = new FieldType[recordset.FieldTypes.Length]; for (int i = 0; i < recordset.FieldTypes.Length; i++) { this.FieldTypes[i] = recordset.FieldTypes[i]; } } }
public static SO_HEADER GetData(SAPbobsCOM.Company oCompany, int id) { Utils control = new Utils(); List <SO_DETAIL> details = new List <SO_DETAIL>(); XDocument xDoc = new XDocument(); XDocument xDocDetail = new XDocument(); string sql = "select U_PrimaryNumberingPOS, U_DocumentNumberingPOS, docentry, docnum, CardCode, " + "CardName, DocDate, DocDueDate, TaxDate, DocTotal, t0.slpcode, slpname from ordr t0 " + "join oslp t1 on t0.slpcode = t1.slpcode where docentry = " + id; Recordset rs = control._IDU_Recordset(oCompany, sql); xDoc = XDocument.Parse(rs.GetAsXML()); sql = "select t1.LineNum, ItemCode, dscription, UomEntry, UomCode, Quantity,Price, t2.WhsCode, t2.WhsName, t1.DiscPrcnt from rdr1 t1 " + "join owhs t2 on t1.WhsCode = t2.WhsCode where t1.docentry = " + id; rs = control._IDU_Recordset(oCompany, sql); xDocDetail = XDocument.Parse(rs.GetAsXML()); XElement xEle = xDoc.Element("BOM").Element("BO").Element("ordr").Element("row"); XElement xEleDetail = xDocDetail.Element("BOM").Element("BO").Element("rdr1"); foreach (var item in xEleDetail.Elements("row")) { SO_DETAIL model_detail = new SO_DETAIL() { LineNum = Convert.ToInt32(item.Element("LineNum").Value), ItemCode = item.Element("ItemCode").Value, Description = item.Element("dscription").Value, UomEntry = Convert.ToInt32(item.Element("UomEntry").Value), UomCode = item.Element("UomCode").Value, Quantity = Convert.ToDouble(item.Element("Quantity").Value), Price = Convert.ToDouble(item.Element("Price").Value), WarehouseCode = item.Element("WhsCode").Value, WarehouseName = item.Element("WhsName").Value, DiscountPercent = Convert.ToDouble(item.Element("DiscPrcnt").Value) }; details.Add(model_detail); } SO_HEADER model = new SO_HEADER() { PrimaryNumberingPOS = xEle.Element("U_PrimaryNumberingPOS").Value, DocumentNumberingPOS = xEle.Element("U_DocumentNumberingPOS").Value, DocEntry = xEle.Element("docentry").Value, DocNum = xEle.Element("docnum").Value, CardCode = xEle.Element("CardCode").Value, CardName = xEle.Element("CardName").Value, SalesPersonCode = xEle.Element("slpcode").Value, SalesPersonName = xEle.Element("slpname").Value, PostingDate = DateTime.ParseExact(xEle.Element("DocDate").Value, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None), DocDueDate = DateTime.ParseExact(xEle.Element("DocDueDate").Value, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None), TaxDate = DateTime.ParseExact(xEle.Element("TaxDate").Value, "yyyyMMdd", CultureInfo.InvariantCulture, DateTimeStyles.None), TotalTransaction = Convert.ToDouble(xEle.Element("DocTotal").Value), Lines = details }; return(model); }
private void button4_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "导出建新地块信息文件(*.xml)|*.xml"; sfd.FileName = "建新地块信息导出文件" + DateTime.Now.ToString("yyyyMMddhhmmss"); if (sfd.ShowDialog() == DialogResult.OK) { FileStream fs = new FileStream(sfd.FileName, FileMode.Create); StreamWriter sw = new StreamWriter(fs); if (dataGridView2.CurrentRow == null) { MessageBox.Show("请点击地块表行头,选择地块信息!"); return; } DataGridViewRow dgvr = dataGridView2.CurrentRow; //取得当前行项目名称值 string strProjectName = dgvr.Cells["项目名称"].Value.ToString(); //取得当前行地块编号该编号为用户输入的 string strDkbh = dgvr.Cells["地块逻辑编号"].Value.ToString(); string tableName = gkfqd.Common.DbUse.GetTownCodeByProjectNameJx(strProjectName); sqlQuery.Clear(); sqlQuery.Append("SELECT DKBH AS 建新地块编号, "); sqlQuery.Append(" DKWZ AS 位置, "); sqlQuery.Append(" DKMC AS 地块名称, "); sqlQuery.Append(" DKMJ AS 地块面积, "); sqlQuery.Append(" ZBX AS 坐标系, "); sqlQuery.Append(" JDFD AS 几度分带, "); sqlQuery.Append(" TYLX AS 投影类型, "); sqlQuery.Append(" JLDW AS 计量单位, "); sqlQuery.Append(" JD AS 精度, "); sqlQuery.Append(" JZDS AS 界址点数, "); sqlQuery.Append(" JLTCSX AS 记录图形属性 "); sqlQuery.Append(" FROM " + tableName); sqlQuery.Append(" WHERE FKXMMC = '" + strProjectName + "'"); sqlQuery.Append(" AND DKBH = '" + strDkbh + "'"); gkfqd.Common.DbUse.GetOleDbconnection().Close(); gkfqd.Common.DbUse.GetOleDbconnection().Open(); dataSetOutPut.Clear(); OleDbDataAdapter MyAdapter = new OleDbDataAdapter(sqlQuery.ToString(), gkfqd.Common.DbUse.GetOleDbconnection()); MyAdapter.Fill(dataSetOutPut); gkfqd.Common.DbUse.GetOleDbconnection().Close(); sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>"); sw.WriteLine("<CL_BUILD_NEW_BLOCK>"); sw.WriteLine(" <BUILDNLANDNO name=\"建新地块编号\">" + dataSetOutPut.Tables[0].Rows[0]["建新地块编号"].ToString() + "</BUILDNLANDNO>"); sw.WriteLine(" <BLOCATION name=\"位置\"> " + dataSetOutPut.Tables[0].Rows[0]["位置"].ToString() + "</BLOCATION>"); sw.WriteLine(" <LANDNAME name=\"地块名称\">" + dataSetOutPut.Tables[0].Rows[0]["地块名称"].ToString() + "</LANDNAME>"); sw.WriteLine(" <LANDAREA name=\"地块面积\">" + dataSetOutPut.Tables[0].Rows[0]["地块面积"].ToString() + "</LANDAREA>"); sw.WriteLine(" <COORSYSTEM name=\"坐标系\">" + dataSetOutPut.Tables[0].Rows[0]["坐标系"].ToString() + "</COORSYSTEM>"); sw.WriteLine(" <CUTNU name=\"几度分带\">" + dataSetOutPut.Tables[0].Rows[0]["几度分带"].ToString() + "</CUTNU>"); sw.WriteLine(" <SHADOWTYPE name=\"投影类型\">" + dataSetOutPut.Tables[0].Rows[0]["投影类型"].ToString() + "</SHADOWTYPE>"); sw.WriteLine(" <MEASUREMENT name=\"计量单位\">" + dataSetOutPut.Tables[0].Rows[0]["计量单位"].ToString() + "</MEASUREMENT>"); sw.WriteLine(" <PRECISION name=\"精度\">" + dataSetOutPut.Tables[0].Rows[0]["精度"].ToString() + "</PRECISION>"); sw.WriteLine(" <DROPNU name=\"界址点数\">" + dataSetOutPut.Tables[0].Rows[0]["界址点数"].ToString() + "</DROPNU>"); sw.WriteLine(" <DRAWINGPROPERTY name=\"记录图形属性\"> " + dataSetOutPut.Tables[0].Rows[0]["记录图形属性"].ToString() + "</DRAWINGPROPERTY>"); sw.Write(" <param ZB=\"@1$"); //"1,3795840.7720,39534660.2200;2,3795836.7200,39534645.9400;3,3795824.1590,39534648.6700;4,3795780.9330,39534495.1600;5,3796003.2890,39534435.7600;6,3796049.6000,39534601.4200;7,3795840.7720,39534660.2200;" />"); DataGridViewRow dgvr1 = dataGridView2.CurrentRow; string strSmid = dgvr1.Cells["地块编号"].Value.ToString(); // 构造一个查询参数对象,查询选中的记录 QueryParameter para = new QueryParameter(); para.AttributeFilter = "SMID =" + strSmid; para.CursorType = CursorType.Dynamic; DatasetVector importResultShp = null; SuperMap.Data.Workspace workspace1; workspace1 = new SuperMap.Data.Workspace(); /*WorkspaceconnectionInfo workspaceconnectionInfo = new WorkspaceconnectionInfo(); * workspaceconnectionInfo.Type = WorkspaceType.Oracle; * workspaceconnectionInfo.Server = "ORCL"; * workspaceconnectionInfo.Database = ""; * workspaceconnectionInfo.Name = "workspace"; * workspaceconnectionInfo.User = "******"; * workspaceconnectionInfo.Password = "******"; * workspace1.Open(workspaceconnectionInfo);*/ workspace1.Open(gkfqd.Common.Tool.GetConnectionInfo()); importDatasource = workspace1.Datasources[gkfqd.Common.Tool.GetWorkspaceDataDatasources()]; importResultShp = importDatasource.Datasets[tableName] as DatasetVector; Recordset recordset = null; try { recordset = importResultShp.Query(para); while (!recordset.IsEOF) { Geometry geometry = recordset.GetGeometry(); GeoRegion region = geometry as GeoRegion; for (int i = 0; i < region.PartCount; i++) { Point2Ds point2ds = region[i]; for (int k = 0; k < point2ds.Count; k++) { Point2D point2d = point2ds[k]; sw.Write((k + 1).ToString() + "," + point2d.X.ToString() + "," + point2d.Y.ToString() + ";"); } } recordset.MoveNext(); } } catch (Exception ex) { Trace.WriteLine(ex.Message); } finally { recordset.Dispose(); } sw.WriteLine(" \" />"); sw.WriteLine("</CL_BUILD_NEW_BLOCK>"); //清空缓冲区 sw.Flush(); //关闭流 sw.Close(); fs.Close(); MessageBox.Show("建新地块信息导出成功!"); } }
void gv_RowClick(object sender, RowClickEventArgs e) { var gv = sender as GridView; var rowHandle = e.RowHandle; var smId = Convert.ToInt32(gv.GetRowCellValue(rowHandle, "SMID")); var layerInfo = gv.Tag as LayerInfo; var dataset = WorkspaceService.Instance.GetDataset(ConfigHelper.GetConfig("StationDatasourceName"), layerInfo.LayerName) as DatasetVector; var rs = dataset.Query(new[] {smId}, CursorType.Static); var centerPt = rs.GetGeometry().InnerPoint; _currentMapCtl.Map.Center = centerPt; _currentMapCtl.Map.Pan(0, 0); _blinkRs = rs; timer_Blink.Enabled = true; timer_Blink.Interval = 500; _blinkCount = 1; timer_Blink.Start(); }
/// <summary> /// Action to be executd for calculating indicator /// </summary> /// <returns>for future usage. Must be ignored at this time.</returns> protected override bool TrueAction() { // Validate int iSize = _chartPanel._chartX.RecordCount; if (iSize == 0) { return(false); } int paramInt1 = ParamInt(1); if (paramInt1 < 1 || paramInt1 > iSize / 2) { ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } IndicatorType param2 = (IndicatorType)ParamInt(2); if (param2 < Constants.MA_START || param2 > Constants.MA_END) { ProcessError("Invalid Moving Average Type for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } double paramDbl3 = ParamDbl(3); if (paramDbl3 < 0 || paramDbl3 > 100) { ProcessError("Invalid Band Shift Percentage for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } // Get the data string paramStr0 = ParamStr(0); Field pSource = SeriesToField("Source", paramStr0, iSize); if (!EnsureField(pSource, paramStr0)) { return(false); } Navigator pNav = new Navigator(); Recordset pRS = new Recordset(); pRS.AddField(pSource); pNav.Recordset_ = pRS; // Calculate the indicator Bands ta = new Bands(); Recordset pInd = ta.MovingAverageEnvelope(pNav, pSource, paramInt1, param2, paramDbl3); // Output the indicator values Clear(); TwinIndicator sTop = (TwinIndicator)EnsureSeries(FullName + " Top"); sTop.SetStrokeColor(StrokeColor.Invert(), false); sTop.SetStrokeThickness(StrokeThickness, false); _title = FullName + " Bottom"; for (int n = 0; n < iSize; ++n) { double?top; double?bottom; if (n < paramInt1 * 2) { top = null; bottom = null; } else { top = pInd.Value("Envelope Top", n + 1); bottom = pInd.Value("Envelope Bottom", n + 1); } AppendValue(DM.TS(n), bottom); sTop.AppendValue(DM.TS(n), top); } return(_calculateResult = PostCalculate()); }
private IEnumerable<ImportEntity> MapMasterDataList(Recordset rs) { rs.MoveFirst(); while (!(rs.EoF)) { var imports = new ImportEntity(); var list = new List<string>(); for (int i = 0; i < rs.Fields.Count; i++) { string field = rs.Fields.Item(i).Value.ToString(); list.Add(field); } imports.Fields = list.ToArray(); imports.MasterDataCollective = masterdataEntity; MasterDataList.Add(imports); rs.MoveNext(); } return MasterDataList; }
protected void ExportToPDF(Recordset Recordset, bool LandScape, string StationID) { try { DataTable MasterCouponTable = new DataTable("MasterCoupon"); MasterCouponTable.Columns.Add("日期 / 時間", typeof(String)); MasterCouponTable.Columns.Add("更期", typeof(String)); MasterCouponTable.Columns.Add("禮券編號", typeof(String)); MasterCouponTable.Columns.Add("類型", typeof(String)); MasterCouponTable.Columns.Add("產品", typeof(String)); MasterCouponTable.Columns.Add("升數", typeof(String)); MasterCouponTable.Columns.Add("銀碼", typeof(String)); MasterCouponTable.Columns.Add("車牌", typeof(String)); while (!(Recordset.Eof)) { //MasterCouponTable.Rows.Add(Recordset.Fields["Present_Date"].Value); //MasterCouponTable.Rows.Add(Recordset.Fields["Period"].Value); DataRow trow = MasterCouponTable.NewRow(); trow[0] = Recordset.Fields["Present_Date"].Value; // trow[1] = Recordset.Fields["Period"].Value; if (Convert.ToInt32(Recordset.Fields["Period"].Value) == 11) { // Response.Write("早"); trow[1] = "早"; } else if (Convert.ToInt32(Recordset.Fields["Period"].Value) == 12) { // Response.Write("中"); trow[1] = "中"; } else if (Convert.ToInt32(Recordset.Fields["Period"].Value) == 13) { //Response.Write("晚"); trow[1] = "晚"; } trow[2] = Recordset.Fields["Coupon_Number"].Value; trow[3] = Recordset.Fields["Coupon_type"].Value; trow[4] = Recordset.Fields["Product_Type"].Value; trow[5] = String.Format("{0:0.00}", Recordset.Fields["SaleLitre"].Value); trow[6] = Recordset.Fields["SaleAmount"].Value; trow[7] = Recordset.Fields["Car_ID"].Value; MasterCouponTable.Rows.Add(trow); Recordset.MoveNext(); } GridView gvReport = new GridView(); gvReport.DataSource = MasterCouponTable; gvReport.DataBind(); int noOfColumns = 0, noOfRows = 0; DataTable tbl = new DataTable(); tbl = gvReport.DataSource as DataTable; noOfColumns = tbl.Columns.Count; noOfRows = gvReport.Rows.Count; float HeaderTextSize = 8; float ReportNameSize = 10; float ReportTextSize = 8; float ApplicationNameSize = 7; // Creates a PDF document Document document = null; FontSelector selector = new FontSelector(); selector.AddFont(FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12)); selector.AddFont(FontFactory.GetFont("MSung-Light", "UniCNS-UCS2-H", BaseFont.NOT_EMBEDDED)); string fontpath = System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "include\\fonts\\SimSun.ttf"; //"simsun.ttf" file was downloaded from web and placed in the folder BaseFont bf = BaseFont.CreateFont(fontpath, BaseFont.IDENTITY_H, BaseFont.EMBEDDED); //create new font based on BaseFont Font fontContent = new Font(bf, 11); Font fontHeader = new Font(bf, 12); Font simsunBold = new Font(bf, 14, Font.BOLD, Color.BLACK); Font simsunNormal = new Font(bf, 11, Font.NORMAL, Color.BLACK); if (LandScape == true) { // Sets the document to A4 size and rotates it so that the orientation of the page is Landscape. document = new Document(PageSize.A4.Rotate(), 0, 0, 15, 5); } else { document = new Document(PageSize.A4, 0, 0, 15, 5); } // Creates a PdfPTable with column count of the table equal to no of columns of the gridview or gridview datasource. iTextSharp.text.pdf.PdfPTable mainTable = new iTextSharp.text.pdf.PdfPTable(noOfColumns); // Sets the first 4 rows of the table as the header rows which will be repeated in all the pages. mainTable.HeaderRows = 4; // Creates a PdfPTable with 2 columns to hold the header in the exported PDF. iTextSharp.text.pdf.PdfPTable headerTable = new iTextSharp.text.pdf.PdfPTable(2); // Creates a phrase to hold the application name at the left hand side of the header. Phrase phApplicationName = new Phrase(DateTime.Now.Date.ToString("dd/MM/yyyy"), FontFactory.GetFont("Arial", ApplicationNameSize, iTextSharp.text.Font.NORMAL)); // Creates a PdfPCell which accepts a phrase as a parameter. PdfPCell clApplicationName = new PdfPCell(phApplicationName); // Sets the border of the cell to zero. clApplicationName.Border = PdfPCell.NO_BORDER; // Sets the Horizontal Alignment of the PdfPCell to left. clApplicationName.HorizontalAlignment = Element.ALIGN_LEFT; // Creates a phrase to show the current date at the right hand side of the header. Phrase phDate = new Phrase("油站 : " + StationID, simsunNormal); // Creates a PdfPCell which accepts the date phrase as a parameter. PdfPCell clDate = new PdfPCell(phDate); // Sets the Horizontal Alignment of the PdfPCell to right. clDate.HorizontalAlignment = Element.ALIGN_RIGHT; // Sets the border of the cell to zero. clDate.Border = PdfPCell.NO_BORDER; // Adds the cell which holds the application name to the headerTable. headerTable.AddCell(clApplicationName); // Adds the cell which holds the date to the headerTable. headerTable.AddCell(clDate); // Sets the border of the headerTable to zero. headerTable.DefaultCell.Border = PdfPCell.NO_BORDER; // Creates a PdfPCell that accepts the headerTable as a parameter and then adds that cell to the main PdfPTable. PdfPCell cellHeader = new PdfPCell(headerTable); cellHeader.Border = PdfPCell.NO_BORDER; // Sets the column span of the header cell to noOfColumns. cellHeader.Colspan = noOfColumns; // Adds the above header cell to the table. mainTable.AddCell(cellHeader); // Creates a phrase which holds the file name. Phrase phHeader = new Phrase("禮券驗證系統",simsunNormal); PdfPCell clHeader = new PdfPCell(phHeader); clHeader.Colspan = noOfColumns; clHeader.Border = PdfPCell.NO_BORDER; clHeader.HorizontalAlignment = Element.ALIGN_CENTER; mainTable.AddCell(clHeader); // Creates a phrase for a new line. Phrase phSpace = new Phrase("\n"); PdfPCell clSpace = new PdfPCell(phSpace); clSpace.Border = PdfPCell.NO_BORDER; clSpace.Colspan = noOfColumns; mainTable.AddCell(clSpace); PdfPCell hc; PdfPCell fc; // Sets the gridview column names as table headers. for (int i = 0; i < noOfColumns; i++) { Phrase ph = null; if (gvReport.AutoGenerateColumns) { ph = new Phrase(tbl.Columns[i].ColumnName, simsunNormal); } else { ph = new Phrase(gvReport.Columns[i].HeaderText, simsunNormal); } hc = new PdfPCell(new Phrase(ph)); hc.Top = 5f; hc.FixedHeight = 20f; hc.HorizontalAlignment =1 ; hc.BackgroundColor = iTextSharp.text.Color.LIGHT_GRAY;// new BaseColor(221,221,221,1); // BaseColor objBaseColor = new BaseColor(System.Drawing.ColorTranslator.FromHtml("#008000")); mainTable.AddCell(hc); } // Reads the gridview rows and adds them to the mainTable for (int rowNo = 0; rowNo < noOfRows; rowNo++) { for (int columnNo = 0; columnNo < noOfColumns; columnNo++) { if (gvReport.AutoGenerateColumns) { string s = gvReport.Rows[rowNo].Cells[columnNo].Text.Trim(); Phrase ph = new Phrase(s, simsunNormal); hc = new PdfPCell(new Phrase(ph)); hc.Left =2f; mainTable.AddCell(hc); } else { if (gvReport.Columns[columnNo] is TemplateField) { DataBoundLiteralControl lc = gvReport.Rows[rowNo].Cells[columnNo].Controls[0] as DataBoundLiteralControl; string s = lc.Text.Trim(); Phrase ph = new Phrase(s, simsunNormal); hc = new PdfPCell(new Phrase(ph)); hc.Top = 0f; hc.FixedHeight = 7f; hc.HorizontalAlignment = 1; hc.BackgroundColor = iTextSharp.text.Color.LIGHT_GRAY; ((Chunk)(hc.Phrase[0])).Font = new iTextSharp.text.Font(((Chunk)(hc.Phrase[0])).Font.Family, 5f); mainTable.AddCell(hc); } else { string s = gvReport.Rows[rowNo].Cells[columnNo].Text.Trim(); Phrase ph = new Phrase(s, simsunNormal); hc = new PdfPCell(new Phrase(ph)); hc.Left = 2f; mainTable.AddCell(hc); } } } // Tells the mainTable to complete the row even if any cell is left incomplete. mainTable.CompleteRow(); } // Gets the instance of the document created and writes it to the output stream of the Response object. PdfWriter.GetInstance(document, Response.OutputStream); // Creates a footer for the PDF document. HeaderFooter pdfFooter = new HeaderFooter(new Phrase(), true); pdfFooter.Alignment = Element.ALIGN_CENTER; pdfFooter.Border = iTextSharp.text.Rectangle.NO_BORDER; // Sets the document footer to pdfFooter. document.Footer = pdfFooter; // Opens the document. document.Open(); // Adds the mainTable to the document. document.Add(mainTable); // Closes the document. document.Close(); } catch(Exception ex) { } }
public static void DoQueryFormat(this Recordset recordset, string format, params object[] args) { recordset.DoQuery(string.Format(format, args)); }
/// <summary> /// Uploads the report file to SharePoint /// </summary> /// <param name="fileName">The absolute path to the file</param> /// <param name="fileType">The file type</param> /// <param name="url">URL for the document management file</param> /// <param name="docMgmtFileName">Filename for the document management file</param> /// <returns>Boolean indicating status</returns> public bool UploadReport(string fileName, string fileType, ref string url, ref string docMgmtFileName) { bool bReturnValue = false; try { m_Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ConstantsDT.MESSAGE_REPORT_UPLOADING); m_Application.BeginWaitCursor(); string tmpQry = "select param_name, param_value from sys_generalparameter " + "where SUBSYSTEM_NAME = ?"; Recordset tmpRs = m_Application.DataContext.OpenRecordset(tmpQry, CursorTypeEnum.adOpenDynamic, LockTypeEnum.adLockReadOnly, (int)CommandTypeEnum.adCmdText, "Doc_Management"); if (!(tmpRs.BOF && tmpRs.EOF)) { tmpRs.MoveFirst(); OncDocManage.OncDocManage rptToSave = new OncDocManage.OncDocManage(); while (!tmpRs.EOF) { if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "JOBWO_REL_PATH") { rptToSave.SPRelPath = tmpRs.Fields["PARAM_VALUE"].Value.ToString(); } if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "SP_URL") { rptToSave.SPSiteURL = tmpRs.Fields["PARAM_VALUE"].Value.ToString(); } if (tmpRs.Fields["PARAM_NAME"].Value.ToString() == "ROOT_PATH") { rptToSave.SPRootPath = tmpRs.Fields["PARAM_VALUE"].Value.ToString(); } tmpRs.MoveNext(); } rptToSave.SrcFilePath = fileName; rptToSave.WrkOrd_Job = m_Application.DataContext.ActiveJob; rptToSave.SPFileName = fileName.Substring(fileName.LastIndexOf("\\") + 1); rptToSave.SPFileType = fileType; bool bSpFileAdded = rptToSave.AddSPFile(true); if (bSpFileAdded == false) { MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_REPORT_SAVING + ": " + "Error adding " + rptToSave.SPFileName + " to SharePoint.", ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); bReturnValue = false; } else { bReturnValue = true; } url = rptToSave.RetFileURL; docMgmtFileName = rptToSave.RetFileName; tmpRs = null; } else { MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_REPORT_SAVING + ": " + "Error finding General Parameters JOBWO_REL_PATH or 'SP_URL", ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); bReturnValue = false; } } catch (Exception ex) { MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_REPORT_SAVING + ": " + ex.Message, ConstantsDT.APPLICATION_NAME, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); bReturnValue = false; } m_Application.EndWaitCursor(); m_Application.SetStatusBarText(GTStatusPanelConstants.gtaspcMessage, ""); return(bReturnValue); }
public void run() { Recordset rc = dv.GetRecordset(false, CursorType.Dynamic); Dictionary <int, Feature> feas = rc.GetAllFeatures(); foreach (KeyValuePair <int, Feature> item in feas) { GeoModel gm = item.Value.GetGeometry() as GeoModel; Console.WriteLine("==" + gm.Position + "=="); GeoModel model = new GeoModel(); model.Position = gm.Position; foreach (Mesh m in gm.Meshes) { if (m.Material.TextureFile.Length > 1) { //Console.WriteLine(m.Material.TextureFile.ToString()); Point3Ds p3ds = new Point3Ds(); for (int i = 0; i < m.Vertices.Length; i += 3) { bool repition = false; foreach (Point3D p in p3ds) { if (p.X == m.Vertices[i] && p.Y == m.Vertices[i + 1] && p.Z == m.Vertices[i + 2]) { repition = true; } } if (!repition) { p3ds.Add(new Point3D(m.Vertices[i], m.Vertices[i + 1], m.Vertices[i + 2])); } } foreach (Point3D p3d in p3ds) { Console.WriteLine(string.Format(" {0},{1},{2}", p3d.X, p3d.Y, p3d.Z)); scene.TrackingLayer.Add(new GeoPoint3D(p3d.X, p3d.Y, p3d.Z), ""); } //model.Meshes.Add(MakeMeshPot(p3ds)); Mesh mesh = new Mesh(m); mesh.Material.TextureFile = @".\78310a55b319ebc41f7810198326cffc1e171629.png"; model.Meshes.Add(mesh); #region 写属性表 Dictionary <string, double> fields = new Dictionary <string, double>(); fields.Add("FaceMeshCenterX", model.Position.X); fields.Add("FaceMeshCenterY", model.Position.Y); fields.Add("FaceMeshCenterZ", model.Position.Z); fields.Add("FaceMeshLx", p3ds.leftbottom().X); fields.Add("FaceMeshLy", p3ds.leftbottom().Y); fields.Add("FaceMeshLz", p3ds.leftbottom().Z); fields.Add("FaceMeshUx", p3ds.rightup().X); fields.Add("FaceMeshUy", p3ds.rightup().Y); fields.Add("FaceMeshUz", p3ds.rightup().Z); foreach (KeyValuePair <string, double> field in fields) { if (dv.FieldInfos.IndexOf(field.Key) < 0) { FieldInfo fieldInf = new FieldInfo(field.Key, FieldType.Double); dv.FieldInfos.Add(fieldInf); } string fieldName = field.Key; double fieldValue = field.Value; try { rc.SeekID(item.Value.GetID()); rc.Edit(); rc.SetFieldValue(fieldName, fieldValue); rc.Update(); } catch { Console.WriteLine("error!"); } //Console.WriteLine(string.Format("{0},{1},{2}", item.GetID(), fieldName, fieldValue)); } #endregion } } Console.WriteLine(""); model.ComputeBoundingBox(); scene.TrackingLayer.Add(model, gm.Position.ToString()); scene.Refresh(); } }
/// <summary> /// Inserts named view data into the tables ASSET_HISTORY_VIEW,ASSET_HISTORY_VIEWFILTER,ASSET_HISTORY_VIEWSORT /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { int viewId = 0; Recordset rs = null; try { string sql = ""; if (!string.IsNullOrEmpty(txtViewname.Text)) { sql = "select max(view_id)+1 from ASSET_HISTORY_VIEW"; rs = m_gTDataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, null); if (rs != null && rs.RecordCount > 0) { rs.MoveFirst(); if (string.IsNullOrEmpty(Convert.ToString(rs.Fields[0].Value))) { viewId = 1; } else { viewId = Convert.ToInt32(rs.Fields[0].Value); } } rs = null; sql = "select count(*) from ASSET_HISTORY_VIEW where view_nm = :1"; rs = m_gTDataContext.OpenRecordset(sql, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockReadOnly, (int)ADODB.CommandTypeEnum.adCmdText, new object[] { txtViewname.Text }); if (rs != null && rs.RecordCount > 0) { rs.MoveFirst(); if (Convert.ToInt32(rs.Fields[0].Value) > 0) { if (MessageBox.Show(GTClassFactory.Create <IGTApplication>().ApplicationWindow, "View name already exist in database. Do you want to replace it?", "G/Technology", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { sql = null; sql = string.Format("DELETE FROM ASSET_HISTORY_VIEWFILTER where VIEW_ID = (SELECT VIEW_ID FROM ASSET_HISTORY_VIEW WHERE VIEW_NM='{0}')", txtViewname.Text); ExecuteCommand(sql); sql = string.Format("DELETE FROM ASSET_HISTORY_VIEWSORT where VIEW_ID = (SELECT VIEW_ID FROM ASSET_HISTORY_VIEW WHERE VIEW_NM='{0}')", txtViewname.Text); ExecuteCommand(sql); sql = string.Format("DELETE FROM ASSET_HISTORY_VIEW where VIEW_NM = '{0}'", txtViewname.Text); ExecuteCommand(sql); sql = string.Format("commit", txtViewname.Text); ExecuteCommand(sql); sql = SaveViewWithGivenName(viewId); this.DialogResult = DialogResult.OK; } else { this.DialogResult = DialogResult.None; } } else { sql = SaveViewWithGivenName(viewId); this.DialogResult = DialogResult.OK; } } } else { MessageBox.Show("View name should not be empty.", "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.None; } } catch (Exception ex) { MessageBox.Show("Error during execution of Review Asset History custom command." + Environment.NewLine + ex.Message, "G/Techonology", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { if (rs != null) { rs.Close(); rs = null; } } }
/// <summary> /// Action to be executd for calculating indicator /// </summary> /// <returns>for future usage. Must be ignored at this time.</returns> protected override bool TrueAction() { // Validate int size = _chartPanel._chartX.RecordCount; if (size == 0) { return(false); } int paramInt2 = ParamInt(2); if (paramInt2 < 1 || paramInt2 > size / 2) { ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } // Get the data string paramStr0 = ParamStr(0); string paramStr1 = ParamStr(1); Field pOpen = SeriesToField("Open", paramStr0 + ".open", size); if (!EnsureField(pOpen, paramStr0 + ".open")) { return(false); } Field pHigh = SeriesToField("High", paramStr0 + ".high", size); if (!EnsureField(pHigh, paramStr0 + ".high")) { return(false); } Field pLow = SeriesToField("Low", paramStr0 + ".low", size); if (!EnsureField(pLow, paramStr0 + ".low")) { return(false); } Field pClose = SeriesToField("Close", paramStr0 + ".close", size); if (!EnsureField(pClose, paramStr0 + ".close")) { return(false); } Field pVolume = SeriesToField("Volume", paramStr1, size); if (!EnsureField(pVolume, paramStr1)) { return(false); } Navigator pNav = new Navigator(); Recordset pRS = new Recordset(); pRS.AddField(pOpen); pRS.AddField(pHigh); pRS.AddField(pLow); pRS.AddField(pClose); pRS.AddField(pVolume); pNav.Recordset_ = pRS; // Calculate the indicator Index ta = new Index(); Recordset pInd = ta.ChaikinMoneyFlow(pNav, pRS, paramInt2, FullName); // Output the indicator values Clear(); for (int n = 0; n < size; ++n) { AppendValue(DM.GetTimeStampByIndex(n), n < paramInt2 ? null : pInd.Value(FullName, n + 1)); } return(_calculateResult = PostCalculate()); }
public void Execute() { string city = string.Empty; string county = string.Empty; string zipCode = string.Empty; string insideCityLimits = string.Empty; try { Recordset premiseAttributesRs = Components[ComponentName].Recordset; if (premiseAttributesRs != null && premiseAttributesRs.RecordCount > 0) { premiseAttributesRs.MoveFirst(); } while (!premiseAttributesRs.EOF) { city = Convert.ToString(premiseAttributesRs.Fields["CITY_C"].Value); county = Convert.ToString(premiseAttributesRs.Fields["COUNTY_C"].Value); zipCode = Convert.ToString(premiseAttributesRs.Fields["ZIP_C"].Value); insideCityLimits = Convert.ToString(premiseAttributesRs.Fields["INSIDE_CITY_LIMITS_YN"].Value); if (Convert.ToInt16(premiseAttributesRs.Fields["G3E_CID"].Value) == 1) { if (string.IsNullOrEmpty(city) && string.IsNullOrEmpty(county) && string.IsNullOrEmpty(zipCode) && string.IsNullOrEmpty(insideCityLimits)) { CopyValuesFromBoundaries(premiseAttributesRs); } if (!string.IsNullOrEmpty(city) || !string.IsNullOrEmpty(county) || !string.IsNullOrEmpty(zipCode) || !string.IsNullOrEmpty(insideCityLimits)) { m_City = city; m_CountyCode = county; m_ZipCode = zipCode; m_CityLimits = insideCityLimits; } premiseAttributesRs.MoveNext(); } else { if (!string.IsNullOrEmpty(city) || !string.IsNullOrEmpty(county) || !string.IsNullOrEmpty(zipCode) || !string.IsNullOrEmpty(insideCityLimits)) { m_City = city; m_CountyCode = county; m_ZipCode = zipCode; m_CityLimits = insideCityLimits; } if (string.IsNullOrEmpty(city) && string.IsNullOrEmpty(county) && string.IsNullOrEmpty(zipCode) && string.IsNullOrEmpty(insideCityLimits)) { premiseAttributesRs.Fields["CITY_C"].Value = m_City; premiseAttributesRs.Fields["COUNTY_C"].Value = m_CountyCode; premiseAttributesRs.Fields["ZIP_C"].Value = m_ZipCode; premiseAttributesRs.Fields["INSIDE_CITY_LIMITS_YN"].Value = m_CityLimits; } premiseAttributesRs.MoveNext(); } } } catch (Exception ex) { GUIMode guiMode = new GUIMode(); if (guiMode.InteractiveMode) { MessageBox.Show("Error during execution of Set Premise Location By Boundary FI. " + ex.Message, "G/Technology"); } else { int tmpRecModified = 0; string tmpQry = string.Empty; tmpQry = "begin insert into gis_stg.interface_log " + "(SUB_INTERFACE_NAME,INTERFACE_NAME,COMPONENT_NAME,CORRELATION_ID,LOG_DETAIL) " + "values ('ccGISAutomationBroker','ccGISAutomationBroker','fiSetPremiseLocationByBoundary',0," + "'Error during execution of Set Premise Location By Boundary FI. " + ex.Message + "'); end;"; m_DataContext.Execute(tmpQry, out tmpRecModified, (int)CommandTypeEnum.adCmdText); } } }
private void CopyValuesFromBoundaries(Recordset premiseAttributesRs) { short fNo = 0; int fId = 0; string city = string.Empty; string county = string.Empty; string zipCode = string.Empty; string insideCityLimits = string.Empty; string tmpQry = string.Empty; try { short cityFNO = Convert.ToInt16(m_Arguments.GetArgument(0)); int cityANO = Convert.ToInt32(m_Arguments.GetArgument(1)); short countyFNO = Convert.ToInt16(m_Arguments.GetArgument(2)); int countyANO = Convert.ToInt32(m_Arguments.GetArgument(3)); short zipFNO = Convert.ToInt16(m_Arguments.GetArgument(4)); int zipANO = Convert.ToInt32(m_Arguments.GetArgument(5)); Recordset commonComponentRs = Components.GetComponent(1).Recordset; if (commonComponentRs != null && commonComponentRs.RecordCount > 0) { commonComponentRs.MoveFirst(); fNo = Convert.ToInt16(commonComponentRs.Fields["G3E_FNO"].Value); fId = Convert.ToInt32(commonComponentRs.Fields["G3E_FID"].Value); } short primaryGraphicCno = GetPrimaryGraphicCno(fNo); if (primaryGraphicCno == 0) { return; } IGTKeyObject servicePointFeature = m_DataContext.OpenFeature(fNo, fId); IGTOrientedPointGeometry geometry = (IGTOrientedPointGeometry)servicePointFeature.Components.GetComponent(primaryGraphicCno).Geometry; if (geometry == null) { return; } IGTPoint point = GTClassFactory.Create <IGTPoint>(); point.X = geometry.FirstPoint.X; point.Y = geometry.FirstPoint.Y; // City customBoundaryQuery objCustomBoundaryQuery = new customBoundaryQuery(point, cityFNO); Recordset rs = objCustomBoundaryQuery.PerformPointInPolygon(); if (rs != null && rs.RecordCount > 0) { IGTKeyObject cityFeature = DataContext.OpenFeature(Convert.ToInt16(rs.Fields["G3E_FNO"].Value), Convert.ToInt32(rs.Fields["G3E_FID"].Value)); Recordset tempRs = m_DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "G3E_ANO = " + cityANO); if (tempRs != null && tempRs.RecordCount > 0) { tempRs.MoveFirst(); string field = Convert.ToString(tempRs.Fields["G3E_FIELD"].Value); short cno = 0; if (!string.IsNullOrEmpty(Convert.ToString(tempRs.Fields["G3E_CNO"].Value))) { cno = Convert.ToInt16(tempRs.Fields["G3E_CNO"].Value); } if (!string.IsNullOrEmpty(field)) { if ((string.IsNullOrEmpty(Convert.ToString(premiseAttributesRs.Fields["CITY_C"].Value))) && cno > 0) { Recordset cityRs = cityFeature.Components.GetComponent(cno).Recordset; if (cityRs != null && cityRs.RecordCount > 0) { cityRs.MoveFirst(); city = Convert.ToString(cityRs.Fields[field].Value); } if (!string.IsNullOrEmpty(city)) { //premiseAttributesRs.Fields["CITY_C"].Value = city; m_City = city; //premiseAttributesRs.Fields["INSIDE_CITY_LIMITS_YN"].Value = "Y"; m_CityLimits = "Y"; } } } } } // County objCustomBoundaryQuery = new customBoundaryQuery(point, countyFNO); Recordset rs1 = objCustomBoundaryQuery.PerformPointInPolygon(); if (rs1 != null && rs1.RecordCount > 0) { IGTKeyObject countyFeature = DataContext.OpenFeature(Convert.ToInt16(rs1.Fields["G3E_FNO"].Value), Convert.ToInt32(rs1.Fields["G3E_FID"].Value)); Recordset tempRs1 = m_DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "G3E_ANO = " + countyANO); if (tempRs1 != null && tempRs1.RecordCount > 0) { tempRs1.MoveFirst(); string field = Convert.ToString(tempRs1.Fields["G3E_FIELD"].Value); short cno = 0; if (!string.IsNullOrEmpty(Convert.ToString(tempRs1.Fields["G3E_CNO"].Value))) { cno = Convert.ToInt16(tempRs1.Fields["G3E_CNO"].Value); } if (!string.IsNullOrEmpty(field)) { if ((string.IsNullOrEmpty(Convert.ToString(premiseAttributesRs.Fields["COUNTY_C"].Value))) && cno > 0) { Recordset countyRs = countyFeature.Components.GetComponent(cno).Recordset; if (countyRs != null && countyRs.RecordCount > 0) { countyRs.MoveFirst(); county = Convert.ToString(countyRs.Fields[field].Value); } if (!string.IsNullOrEmpty(county)) { //premiseAttributesRs.Fields["COUNTY_C"].Value = county; m_CountyCode = county; } } } } } // Zip Code objCustomBoundaryQuery = new customBoundaryQuery(point, zipFNO); Recordset rs2 = objCustomBoundaryQuery.PerformPointInPolygon(); if (rs2 != null && rs2.RecordCount > 0) { IGTKeyObject zipCodeFeature = DataContext.OpenFeature(Convert.ToInt16(rs2.Fields["G3E_FNO"].Value), Convert.ToInt32(rs2.Fields["G3E_FID"].Value)); Recordset tempRs2 = m_DataContext.MetadataRecordset("G3E_ATTRIBUTEINFO_OPTABLE", "G3E_ANO = " + zipANO); if (tempRs2 != null && tempRs2.RecordCount > 0) { tempRs2.MoveFirst(); string field = Convert.ToString(tempRs2.Fields["G3E_FIELD"].Value); short cno = 0; if (!string.IsNullOrEmpty(Convert.ToString(tempRs2.Fields["G3E_CNO"].Value))) { cno = Convert.ToInt16(tempRs2.Fields["G3E_CNO"].Value); } if (!string.IsNullOrEmpty(field)) { if ((string.IsNullOrEmpty(Convert.ToString(premiseAttributesRs.Fields["ZIP_C"].Value))) && cno > 0) { Recordset zipRs = zipCodeFeature.Components.GetComponent(cno).Recordset; if (zipRs != null && zipRs.RecordCount > 0) { zipRs.MoveFirst(); zipCode = Convert.ToString(zipRs.Fields[field].Value); } if (!string.IsNullOrEmpty(zipCode)) { //premiseAttributesRs.Fields["ZIP_C"].Value = zipCode; m_ZipCode = zipCode; } } } } try { premiseAttributesRs.Fields["CITY_C"].Value = m_City; premiseAttributesRs.Fields["INSIDE_CITY_LIMITS_YN"].Value = m_CityLimits; premiseAttributesRs.Fields["COUNTY_C"].Value = m_CountyCode; premiseAttributesRs.Fields["ZIP_C"].Value = m_ZipCode; } catch (Exception ex) { if (ex.Message == "Operation was canceled.") { int tmpRecModified = 0; tmpQry = "begin update premise_n set CITY_C = '" + m_City + "', INSIDE_CITY_LIMITS_YN = '" + m_CityLimits + "', COUNTY_C = '" + m_CountyCode + "', ZIP_C = '" + m_ZipCode + "' where g3e_fid = " + premiseAttributesRs.Fields["G3E_FID"].Value.ToString() + " and g3e_cid = " + premiseAttributesRs.Fields["G3E_CID"].Value.ToString() + "; end;"; m_DataContext.Execute(tmpQry, out tmpRecModified, (int)CommandTypeEnum.adCmdText); } else { throw; } } } } catch (Exception) { throw; } }
/// <summary> /// Method to re-own child features to replaced feature /// </summary> private void ReOwnToNewFeatureAndSetActivity() { try { if (m_childFeatureInfoList != null) { string structureId = Convert.ToString(oFeatureCreator.m_newFeature.Components.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value); foreach (ChildFeatureInfo info in m_childFeatureInfoList) { IGTKeyObject childKeyObject = m_dataContext.OpenFeature(info.GtKeyObject.FNO, info.GtKeyObject.FID); Recordset tempRs = childKeyObject.Components.GetComponent(1).Recordset; tempRs.MoveFirst(); if (info.Owner1IdExists) { tempRs.Fields["OWNER1_ID"].Value = oFeatureCreator.m_newG3eId; } else if (info.Owner2IdExists) { tempRs.Fields["OWNER2_ID"].Value = oFeatureCreator.m_newG3eId; } // ALM-1993-ONCORDEV-2572 - Update same structure id to each of the non-linear child features if (!IsActiveFeatureIsLinear(info.GtKeyObject.FNO)) { tempRs.Fields["STRUCTURE_ID"].Value = structureId; } tempRs.Update(Type.Missing, Type.Missing); } // Set activity foreach (ChildFeatureInfo info in m_childFeatureInfoList) { if (info.GtKeyObject.Components.GetComponent(21) != null) { Recordset rs = info.GtKeyObject.Components.GetComponent(21).Recordset; if (rs != null && rs.RecordCount > 0) { rs.MoveFirst(); } if (oHelper.CheckForCorrectionModeProperty() || m_jobType == "WR-MAPCOR") { while (!rs.EOF) { rs.Fields["ACTIVITY_C"].Value = "TC"; rs.MoveNext(); } } else { while (!rs.EOF) { rs.Fields["ACTIVITY_C"].Value = "T"; rs.MoveNext(); } } } if (info.GtKeyObject.Components.GetComponent(22) != null) { Recordset rs1 = info.GtKeyObject.Components.GetComponent(22).Recordset; if (rs1 != null && rs1.RecordCount > 0) { rs1.MoveFirst(); } if (oHelper.CheckForCorrectionModeProperty() || m_jobType == "WR-MAPCOR") { while (!rs1.EOF) { if (Convert.ToString(rs1.Fields["RETIREMENT_C"].Value).Equals("1") || Convert.ToString(rs1.Fields["RETIREMENT_C"].Value).Equals("2")) { rs1.Fields["ACTIVITY_C"].Value = "TC"; } rs1.MoveNext(); } } else { while (!rs1.EOF) { if (Convert.ToString(rs1.Fields["RETIREMENT_C"].Value).Equals("1") || Convert.ToString(rs1.Fields["RETIREMENT_C"].Value).Equals("2")) { rs1.Fields["ACTIVITY_C"].Value = "T"; } rs1.MoveNext(); } } } } } } catch (Exception) { m_TransactionManager.Rollback(); throw; } }
//Interface public SalesOrderDetailTableModule(Recordset salesOrderDetail) { //Constructor this.mSalesOrderDetail = salesOrderDetail.SalesOrderDetailTable; }
/// <summary> /// Action to be executd for calculating indicator /// </summary> /// <returns>for future usage. Must be ignored at this time.</returns> protected override bool TrueAction() { // Validate int iSize = _chartPanel._chartX.RecordCount; if (iSize == 0) { return(false); } int paramInt1 = ParamInt(1); int paramInt2 = ParamInt(2); if (paramInt1 > paramInt2 || paramInt1 < 1) { ProcessError("Invalid Short Term Period for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } if (paramInt2 < 8) { ProcessError("Invalid Long Term Period (min 8) for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } int paramInt3 = ParamInt(3); if (paramInt3 != 1 && paramInt3 != 2) { ProcessError("Invalid Points or Percent for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } // Get the data string paramStr0 = ParamStr(0); Field pVolume = SeriesToField("Volume", paramStr0, iSize); if (!EnsureField(pVolume, paramStr0)) { return(false); } Navigator pNav = new Navigator(); Recordset pRS = new Recordset(); pRS.AddField(pVolume); pNav.Recordset_ = pRS; // Calculate the indicator Oscillator ta = new Oscillator(); Recordset pInd = ta.VolumeOscillator(pNav, pVolume, paramInt1, paramInt2, paramInt3, FullName); // Output the indicator values Clear(); for (int n = 0; n < iSize; ++n) { AppendValue(DM.TS(n), n < paramInt2 ? null : pInd.Value(FullName, n + 1)); } return(_calculateResult = PostCalculate()); }
protected void Page_Load(object sender, EventArgs e) { conn = new Connection(); string connectionstring = ConfigurationManager.ConnectionStrings["connectionstring"].ConnectionString; conn.Open(connectionstring); UserIPAddress = GetIPAddress(); //For Demo //UserIPAddress = "192.168.1.12"; //UserIPAddress = Request.ServerVariables["REMOTE_ADDR"]; Rs1 = new Recordset(); sql1 = "Select * From Station s Left Join CVSUser u on "; sql1 = sql1 + " s.LoginUser = u.UserName Where IPAddress ='" + UserIPAddress + "'"; Rs1 = conn.Execute(sql1); StationID = (Rs1.Fields["Station"].Value).ToString().Trim(); UserID = (Rs1.Fields["LoginUser"].Value).ToString().Trim(); SecLevel = (Rs1.Fields["SecLevel"].Value).ToString().Trim(); if (UserID == "") { Response.Redirect("Default.aspx"); } Message = Request["Message"]; Coupon_Number = Request["Coupon_Number"]; Car_No = Request["Car_No"]; Face_Value = Request["Face_Value"]; Period = Request["Period"]; //search by date if (Request["SDay"] != null) { SDay = Request["SDay"]; SMonth = Request["SMonth"]; SYear = Request["SYear"]; } else { SDay = Convert.ToString(DateTime.Now.Day); SMonth = Convert.ToString(DateTime.Now.Month); SYear = Convert.ToString(DateTime.Now.Year); } if (Request["NDay"] != null) { NDay = Request["NDay"]; NMonth = Request["NMonth"]; NYear = Request["NYear"]; } else { NDay = Convert.ToString(DateTime.Now.Day); NMonth = Convert.ToString(DateTime.Now.Month); NYear = Convert.ToString(DateTime.Now.Year); } //Search_Date = Formatdatetime(DateSerial(SYear, SMonth, SDay),2) //Search_NDate = Formatdatetime(DateSerial(NYear, NMonth, NDay),2) Search_Date = SDay + "/" + SMonth + "/" + SYear; Search_NDate = NDay + "/" + NMonth + "/" + NYear; //Response.write search_date //response.write SecLevel & "<br>" //response.write UserID if (Request.Form["pageid"] != null) pageid = (Request.Form["pageid"]).Trim(); if (pageid == "") { pageid = "1"; } if (Request.Form["Barcode"] != null) { Barcode = (Request.Form["Barcode"]).Trim().Replace("%", "%"); Barcode = Barcode.Replace("'", "''"); if (Barcode.Length == 15) { Face_Value = Barcode.Substring(0, 3); Coupon_Type = Barcode.Substring(5 - 1, 2); Coupon_batch = Barcode.Substring(7 - 1, 3); Coupon_Number = Barcode.Substring(10 - 1, 6); } } fsql = "select * from MasterCoupon where RequestedID = " + Convert.ToString(StationID); //Search Coupon Number //******************** if (Barcode != "") { if (Barcode.Length == 15) { fsql = fsql + " and Coupon_Number = '" + Coupon_Number + "'"; fsql = fsql + " and Face_Value = '" + Face_Value + "'"; fsql = fsql + " and Coupon_Type = '" + Coupon_Type + "'"; fsql = fsql + " and Coupon_Batch = '" + Coupon_batch + "'"; } else { fsql = fsql + " and Coupon_Number LIKE '%" + Barcode + "%' "; } } fsql = fsql + " and Present_Date >= Convert(datetime, '" + Convert.ToString(Search_Date) + "', 105) "; fsql = fsql + " and Present_Date < DATEADD(dd,DATEDIFF(dd,0, Convert(datetime, '" + Convert.ToString(Search_NDate) + "', 105)),0) + 1 "; //By UserID if (Convert.ToString(SecLevel).Trim() == "1") { fsql = fsql + " and Period = '" + Convert.ToString(UserID) + "' "; } fsql = fsql + " order by id desc"; frs = new Recordset(); frs.CursorType = (nce.adodb.CursorType)1; frs.LockType = (nce.adodb.LockType)1; Rs1.Close(); frs.Open(fsql, conn); }
/// <summary> /// Action to be executd for calculating indicator /// </summary> /// <returns>for future usage. Must be ignored at this time.</returns> protected override bool TrueAction() { // Validate int iSize = _chartPanel._chartX.RecordCount; if (iSize == 0) { return(false); } int paramInt1 = ParamInt(1); if (paramInt1 < 1 || paramInt1 > iSize / 2) { ProcessError("Invalid Periods for indicator " + FullName, IndicatorErrorType.ShowErrorMessage); return(false); } // Get the data string paramStr0 = ParamStr(0); Field pHigh = SeriesToField("High", paramStr0 + ".high", iSize); if (!EnsureField(pHigh, paramStr0 + ".high")) { return(false); } Field pLow = SeriesToField("Low", paramStr0 + ".low", iSize); if (!EnsureField(pLow, paramStr0 + ".low")) { return(false); } Field pClose = SeriesToField("Close", paramStr0 + ".close", iSize); if (!EnsureField(pClose, paramStr0 + ".close")) { return(false); } Navigator pNav = new Navigator(); Recordset pRS = new Recordset(); pRS.AddField(pHigh); pRS.AddField(pLow); pRS.AddField(pClose); pNav.Recordset_ = pRS; // Calculate the indicator Oscillator ta = new Oscillator(); Recordset pInd = ta.WilliamsPctR(pNav, pRS, paramInt1, FullName); // Output the indicator values Clear(); for (int n = 0; n < iSize; ++n) { AppendValue(DM.TS(n), n < paramInt1 ? null : pInd.Value(FullName, n + 1)); } return(_calculateResult = PostCalculate()); }
// Methods public RecordsetWapper(Company oCompany, string strSQL) { this.strSQL = strSQL; this.oCompany = oCompany; this.oRecordset = (Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); }
//public string node1Structure public bool ProcessSelectSet() { bool bReturnValue = false; try { m_aSortedPoints = new CablePullPoint[1]; m_aSegments = new CablePullSegment[1]; IGTDDCKeyObjects oGTDCKeys = GTClassFactory.Create <IGTDDCKeyObjects>(); oGTDCKeys = m_Application.SelectedObjects.GetObjects(); relationshipService.DataContext = m_Application.DataContext; int index = 0; m_SelectedFID = oGTDCKeys[index].FID; m_SelectedFNO = oGTDCKeys[index].FNO; relationshipService.ActiveFeature = m_Application.DataContext.OpenFeature(m_SelectedFNO, m_SelectedFID); if (relationshipService.ActiveFeature.Components.GetComponent(1).Recordset.Fields["FEATURE_STATE_C"].Value != null) { m_featureState = relationshipService.ActiveFeature.Components.GetComponent(1).Recordset.Fields["FEATURE_STATE_C"].Value.ToString(); } if (relationshipService.ActiveFeature.Components.GetComponent(21).Recordset.RecordCount > 0) { relationshipService.ActiveFeature.Components.GetComponent(21).Recordset.MoveFirst(); m_CU = relationshipService.ActiveFeature.Components.GetComponent(21).Recordset.Fields["CU_C"].Value.ToString(); } if (CommonDT.AllowCUEdit(relationshipService.ActiveFeature)) { m_AllowCUEdit = true; } else { m_AllowCUEdit = false; } int ductBankFID = 0; try { IGTKeyObjects relatedDuctKOs = relationshipService.GetRelatedFeatures(6); if (relatedDuctKOs.Count > 0) { relationshipService.ActiveFeature = relatedDuctKOs[0]; IGTKeyObjects relatedFormationKOs = relationshipService.GetRelatedFeatures(6); if (relatedFormationKOs.Count > 0) { relationshipService.ActiveFeature = relatedFormationKOs[0]; IGTKeyObjects relatedDuctBankKOs = relationshipService.GetRelatedFeatures(3); if (relatedDuctBankKOs.Count > 0) { ductBankFID = relatedDuctBankKOs[0].FID; relationshipService.ActiveFeature = relatedDuctBankKOs[0]; IGTKeyObjects structure1 = relationshipService.GetRelatedFeatures(122, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal1); IGTKeyObjects structure2 = relationshipService.GetRelatedFeatures(122, GTRelationshipOrdinalConstants.gtrelRelationshipOrdinal2); if (structure1.Count > 0) { IGTKeyObject thing = structure1[0]; thing.Components.GetComponent(1).Recordset.MoveFirst(); if (!thing.Components.GetComponent(1).Recordset.BOF&& !thing.Components.GetComponent(1).Recordset.EOF) { m_node1Stucture = thing.Components.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value.ToString(); } } if (structure2.Count > 0) { IGTKeyObject thing = structure2[0]; thing.Components.GetComponent(1).Recordset.MoveFirst(); if (!thing.Components.GetComponent(1).Recordset.BOF&& !thing.Components.GetComponent(1).Recordset.EOF) { m_node2Stucture = thing.Components.GetComponent(1).Recordset.Fields["STRUCTURE_ID"].Value.ToString(); } } } } } else { MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_CPT_NO_RELATED_DUCTBANK, ConstantsDT.COMMAND_NAME_CABLE_PULL_TENSION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(false); } } catch { } // Get the primary geographic and primary detail componentviews from metadata // Get the selected object matching the primary geographic or primary detail componentviews in that order Recordset metadataRS = m_Application.DataContext.MetadataRecordset("G3E_FEATURES_OPTABLE", "g3e_fno = " + ConstantsDT.FNO_DUCTBANK); short primaryGeographicCNO = 0; short primaryDetailCNO = 0; if (metadataRS.RecordCount > 0) { if (!Convert.IsDBNull(metadataRS.Fields["G3E_PRIMARYGEOGRAPHICCNO"].Value)) { primaryGeographicCNO = Convert.ToInt16(metadataRS.Fields["G3E_PRIMARYGEOGRAPHICCNO"].Value); } if (!Convert.IsDBNull(metadataRS.Fields["G3E_PRIMARYDETAILCNO"].Value)) { primaryDetailCNO = Convert.ToInt16(metadataRS.Fields["G3E_PRIMARYDETAILCNO"].Value); } } IGTDDCKeyObjects oDuctBankGTDCKeys = GTClassFactory.Create <IGTDDCKeyObjects>(); oDuctBankGTDCKeys = m_Application.DataContext.GetDDCKeyObjects(ConstantsDT.FNO_DUCTBANK, ductBankFID, GTComponentGeometryConstants.gtddcgAllPrimary); metadataRS = m_Application.DataContext.MetadataRecordset("G3E_COMPONENTVIEWS_OPTABLE"); string filter = "(g3e_fno = " + ConstantsDT.FNO_DUCTBANK + " and g3e_cno = " + primaryGeographicCNO + ") or (g3e_fno = " + ConstantsDT.FNO_DUCTBANK + " and g3e_cno = " + primaryDetailCNO + ")"; metadataRS.Filter = filter; if (metadataRS.RecordCount > 0) { metadataRS.Sort = "g3e_detail"; while (!metadataRS.EOF) { if (metadataRS.Fields["G3E_VIEW"].Value.ToString() == oDuctBankGTDCKeys[index].ComponentViewName) { //m_SelectedFID = oGTDCKeys[index].FID; //m_SelectedFNO = oGTDCKeys[index].FNO; break; } metadataRS.MoveNext(); index++; } IGTGeometry oGeometry = oDuctBankGTDCKeys[index].Geometry; IGTPolylineGeometry oPolyLineGeom = GTClassFactory.Create <IGTPolylineGeometry>(); if (oGeometry.Type == GTGeometryTypeConstants.gtgtPolylineGeometry || oGeometry.Type == GTGeometryTypeConstants.gtgtLineGeometry) { // Geometry is okay to use as it is. oPolyLineGeom = (IGTPolylineGeometry)oGeometry; bReturnValue = true; } else if (oGeometry.Type == GTGeometryTypeConstants.gtgtCompositePolylineGeometry) { // Any arcs must be stroked to line segments oPolyLineGeom = (IGTPolylineGeometry)oGeometry.Stroke(); bReturnValue = true; } else { // Invalid geometry type. MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_CPT_INVALID_GEOMETRY, ConstantsDT.COMMAND_NAME_CABLE_PULL_TENSION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); bReturnValue = false; } if (bReturnValue) { // Store each point of the line in the feature's geometry StoreLinePoints(oPolyLineGeom, m_SelectedFNO, m_SelectedFID); //Compute the included angles for each set of three points in the sorted array ComputeIncludedAngles(); //Build the arrays for the segments and bends that will comprise the pull if (!BuildSegmentsAndBends()) { bReturnValue = false; } } } else { MessageBox.Show(m_Application.ApplicationWindow, ConstantsDT.ERROR_CPT_INVALID_COMPONENT_SELECTED, ConstantsDT.COMMAND_NAME_CABLE_PULL_TENSION, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); bReturnValue = false; } } catch (Exception e) { m_aSegments = new CablePullSegment[1]; m_aBends = new double[1]; m_aSortedPoints = new CablePullPoint[1]; } return(bReturnValue); }
public static void ReleaseComObject(this Recordset recordset) { Marshal.ReleaseComObject(recordset); }
public 属性表(Recordset dataset) { this.dataset = dataset; InitializeComponent(); }
protected virtual SyncBasicResponse DampToFolder(Recordset rs, string filename = "") { try { if (string.IsNullOrEmpty(filename)) filename = FileUtility.GetSApFile(masterdataEntity); DumpExportFilesAsync(MapForCSVFile(MapMasterDataList(rs)).ToCsv(), filename); return new SyncBasicResponse{Status=true}; } catch (Exception ex) { FileUtility.LogError(ex.Message); return new SyncBasicResponse{Status = false,Info = ex.Message}; } }
private void 属性表_Load(object sender, EventArgs e) { Recordset recordset = dataset; this.skinDataGridView1.Columns.Clear(); this.skinDataGridView1.Rows.Clear(); for (int i = 0; i < recordset.FieldCount; i++) { String fieldName = recordset.GetFieldInfos()[i].Name; this.skinDataGridView1.Columns.Add(fieldName, fieldName); } DataGridViewRow row = null; row = new DataGridViewRow(); bool tt = true; while (!recordset.IsEOF) { tt = true; row = new DataGridViewRow(); if (this.skinDataGridView1.Rows[0].Cells["SmID"].Value != null) { for (int j = 0; j < this.skinDataGridView1.Rows.Count; j++) { if (this.skinDataGridView1.Rows[j].Cells["SmID"].Value != null) { if (this.skinDataGridView1.Rows[j].Cells["SmID"].Value.ToString() == recordset.GetFieldValue("SmID").ToString()) { tt = false; break; } } } } for (int i = 0; i < recordset.FieldCount; i++) { if (tt == false) { break; } Object fieldValue = recordset.GetFieldValue(i); DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell(); if (fieldValue != null) { cell.ValueType = fieldValue.GetType(); cell.Value = fieldValue; } row.Cells.Add(cell); } if (tt == true) { this.skinDataGridView1.Rows.Add(row); } recordset.MoveNext(); } this.skinDataGridView1.Update(); recordset.Dispose(); }
private void button5_Click(object sender, EventArgs e) { SaveFileDialog sfd = new SaveFileDialog(); sfd.Filter = "导出txt坐标文件(*.txt)|*.txt"; sfd.FileName = "坐标导出文件" + DateTime.Now.ToString("yyyyMMddhhmmss"); if (sfd.ShowDialog() == DialogResult.OK) { FileStream fs = new FileStream(sfd.FileName, FileMode.Create); StreamWriter sw = new StreamWriter(fs); if (dataGridView2.CurrentRow == null) { return; } DataGridViewRow dgvr = dataGridView2.CurrentRow; string strSmid = dgvr.Cells["地块编号"].Value.ToString();//获取smid值 // 构造一个查询参数对象,查询选中的记录 QueryParameter para = new QueryParameter(); para.AttributeFilter = "SMID =" + strSmid; para.CursorType = CursorType.Dynamic; // DataGridViewRow dgvr1 = dataGridView2.CurrentRow; //取得当前行项目名称值 string strProjectName = dgvr.Cells["项目名称"].Value.ToString(); //取得当前行地块编号该编号为用户输入的 string strDkbh = dgvr.Cells["地块逻辑编号"].Value.ToString(); string tableName = gkfqd.Common.DbUse.GetTownCodeByProjectNameJx(strProjectName); DatasetVector importResultShp = null; SuperMap.Data.Workspace workspace1; workspace1 = new SuperMap.Data.Workspace(); workspace1.Open(gkfqd.Common.Tool.GetConnectionInfo()); importDatasource = workspace1.Datasources[gkfqd.Common.Tool.GetWorkspaceDataDatasources()]; importResultShp = importDatasource.Datasets[tableName] as DatasetVector; Recordset recordset = null; //取系统时间 DateTime dt = DateTime.Now; if (dataGridView2.CurrentRow == null) { MessageBox.Show("请点击地块表行头,选择地块信息!"); return; } sqlQuery.Clear(); sqlQuery.Append("SELECT DKMC AS 地块名称, "); sqlQuery.Append(" DKMJ AS 地块面积, "); sqlQuery.Append(" ZBX AS 坐标系, "); sqlQuery.Append(" JZDS AS 界址点数, "); sqlQuery.Append(" JDFD AS 几度分带, "); sqlQuery.Append(" JD AS 精度, "); sqlQuery.Append(" JLDW AS 计量单位, "); sqlQuery.Append(" JLTCSX AS 记录图形属性, "); sqlQuery.Append(" TYLX AS 投影类型 "); sqlQuery.Append(" FROM " + tableName); sqlQuery.Append(" WHERE FKXMMC = '" + strProjectName + "'"); sqlQuery.Append(" AND DKBH = '" + strDkbh + "'"); gkfqd.Common.DbUse.GetOleDbconnection().Close(); gkfqd.Common.DbUse.GetOleDbconnection().Open(); dataSetOutPutZb.Clear(); OleDbDataAdapter MyAdapter = new OleDbDataAdapter(sqlQuery.ToString(), gkfqd.Common.DbUse.GetOleDbconnection()); MyAdapter.Fill(dataSetOutPutZb); gkfqd.Common.DbUse.GetOleDbconnection().Close(); sw.WriteLine("[属性描述]"); sw.WriteLine("格式版本号=1.01版本"); sw.WriteLine("数据产生单位=国土资源部"); sw.WriteLine("数据产生日期=" + dt.ToLongDateString().ToString()); sw.WriteLine("坐标系=" + dataSetOutPutZb.Tables[0].Rows[0]["坐标系"].ToString()); sw.WriteLine("几度分带=" + dataSetOutPutZb.Tables[0].Rows[0]["几度分带"].ToString()); sw.WriteLine("投影类型=" + dataSetOutPutZb.Tables[0].Rows[0]["投影类型"].ToString()); sw.WriteLine("计量单位=" + dataSetOutPutZb.Tables[0].Rows[0]["计量单位"].ToString()); sw.WriteLine("带号=" + dataSetOutPutZb.Tables[0].Rows[0]["几度分带"].ToString()); sw.WriteLine("精度=" + dataSetOutPutZb.Tables[0].Rows[0]["精度"].ToString()); sw.WriteLine("转换参数=0,0,0,0,0,0,0"); sw.WriteLine("[地块坐标]"); //保留该行记录导出结果,界址点数,地块面积,地块编号,地块名称,记录图形属性(点、线、面),图幅号,地块用途,地类编码,@ //以上记录信息如界址点数、地块面积、地块用途、地类编码需进一步编码取得 //sw.WriteLine("9,0.018,2003-10,双桥乡地块1,面,I-50-77-(22),公共基础设施,,@"); try { recordset = importResultShp.Query(para); while (!recordset.IsEOF) { Geometry geometry = recordset.GetGeometry(); GeoRegion region = geometry as GeoRegion; for (int i = 0; i < region.PartCount; i++) { Point2Ds point2ds = region[i]; for (int k = 0; k < point2ds.Count; k++) { Point2D point2d = point2ds[k]; //点号,地块圈号,X坐标,Y坐标 sw.WriteLine((k + 1).ToString() + "," + (i + 1).ToString() + "," + point2d.X.ToString() + "," + point2d.Y.ToString()); } } recordset.MoveNext(); } } catch (Exception ex) { Trace.WriteLine(ex.Message); } finally { recordset.Dispose(); } //清空缓冲区 sw.Flush(); //关闭流 sw.Close(); fs.Close(); MessageBox.Show("建新属性坐标信息导出成功!"); } }
public static object GetValue(this Recordset recordset, string fieldName) { return(recordset.Fields.Item(fieldName).Value); }
private void BlinkLayer() { var dt = WorkspaceService.Instance.GetDataset(ConfigHelper.GetConfig("StationDatasourceName"), _blinkLayerName) as DatasetVector; if (dt == null) return; var rs = dt.GetRecordset(false, CursorType.Static); _blinkRs = rs; timer_Blink.Enabled = true; timer_Blink.Interval = 500; _blinkCount = 1; timer_Blink.Start(); }
public static string GetValueAsString(this Recordset recordset, string fieldName) { return(Convert.ToString(recordset.Fields.Item(fieldName).Value)); }
/// <summary> /// Returns the Primary geometry of the feature /// </summary> /// <param name="feature"></param> /// <returns></returns> private void GetPrimaryGeometry(IGTKeyObject feature, ref IGTGeometry primaryGeometry) { IGTComponent component = null; try { Recordset oRSFeature = DataContext.MetadataRecordset("G3E_FEATURES_OPTABLE", "G3E_FNO=" + feature.FNO); // oRSFeature.Filter = "G3E_FNO=" + feature.FNO; if (!(oRSFeature.Fields["G3E_PRIMARYGEOGRAPHICCNO"].Value is DBNull)) { component = feature.Components.GetComponent(Convert.ToInt16(oRSFeature.Fields["G3E_PRIMARYGEOGRAPHICCNO"].Value)); if (component != null && component.Recordset != null && component.Recordset.RecordCount == 1) { primaryGeometry = component.Geometry; } else if (component != null && component.Recordset != null && component.Recordset.RecordCount > 1) { throw new DuplicateIdentifierException(string.Format("More than one feature exists with the same feature identifier {0}. Please contact system administrator.", feature.FID)); } else { if (!(oRSFeature.Fields["G3E_PRIMARYDETAILCNO"].Value is DBNull)) { component = feature.Components.GetComponent(Convert.ToInt16(oRSFeature.Fields["G3E_PRIMARYDETAILCNO"].Value)); if (component != null && component.Recordset != null && component.Recordset.RecordCount > 0) { primaryGeometry = component.Geometry; } } } } else if (!(oRSFeature.Fields["G3E_PRIMARYDETAILCNO"].Value is DBNull)) { component = feature.Components.GetComponent(Convert.ToInt16(oRSFeature.Fields["G3E_PRIMARYDETAILCNO"].Value)); if (component != null && component.Recordset != null && component.Recordset.RecordCount > 0) { primaryGeometry = component.Geometry; } else { if (!(oRSFeature.Fields["G3E_PRIMARYGEOGRAPHICCNO"].Value is DBNull)) { component = feature.Components.GetComponent(Convert.ToInt16(oRSFeature.Fields["G3E_PRIMARYGEOGRAPHICCNO"].Value)); if (component != null && component.Recordset != null && component.Recordset.RecordCount > 0) { primaryGeometry = component.Geometry; } } } } } catch (DuplicateIdentifierException ex) { throw ex; } catch { throw; } }
public static double GetValueAsDouble(this Recordset recordset, string fieldName) { return(Convert.ToDouble(recordset.Fields.Item(fieldName).Value)); }
/// <summary> /// Adds the default pic. /// </summary> /// <param name="databasePath">The database path.</param> /// <param name="id">The identifier.</param> /// <param name="applicationPath"></param> /// <param name="defaultPic"></param> /// <param name="errOut">The error out.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public static bool AddDefaultPic(string databasePath, long id, string applicationPath, string defaultPic, out string errOut) { bool bAns = false; errOut = @""; try { string sFileName = Path.Combine(applicationPath, defaultPic); string sThumbName = Path.Combine(applicationPath, @"\mgc_thumb.jpg"); // ---Start Function to convert picture to database format----- FileStream st = new FileStream(sFileName, FileMode.Open, FileAccess.Read); BinaryReader mbr = new BinaryReader(st); byte[] buffer = new byte[st.Length + 1]; mbr.Read(buffer, 0, Convert.ToInt32(st.Length)); st.Close(); // ---End Function to convert picture to database format----- // --Start Function to convert picture to thumbnail for database format-- int intPicHeight = 64; int intPicWidth = 64; var myBitmap = Image.FromFile(sFileName); Image.GetThumbnailImageAbort myPicCallback = null /* TODO Change to default(_) if this is not a reference type */; var myNewPic = myBitmap.GetThumbnailImage(intPicWidth, intPicHeight, myPicCallback, IntPtr.Zero); myBitmap.Dispose(); File.Delete(sThumbName); myNewPic.Save(sThumbName, ImageFormat.Jpeg); myNewPic.Dispose(); FileStream stT = new FileStream(sThumbName, FileMode.Open, FileAccess.Read); BinaryReader mbrT = new BinaryReader(stT); byte[] bufferT = new byte[stT.Length + 1]; mbrT.Read(bufferT, 0, Convert.ToInt32(stT.Length)); stT.Close(); // --End Function to convert picture to thumbnail for database format-- Connection myConn = new Connection(); myConn.Open(Database.ConnectionString(databasePath, out errOut)); Recordset rs = new Recordset(); rs.Open("Gun_Collection_Pictures", myConn, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockPessimistic); rs.AddNew(); rs.Fields["CID"].Value = id; rs.Fields["PICTURE"].AppendChunk(buffer); rs.Fields["THUMB"].AppendChunk(bufferT); rs.Fields["ISMAIN"].Value = 1; rs.Fields["sync_lastupdate"].Value = DateTime.Now; rs.Update(); rs.Close(); //OleDbConnection myConn = new OleDbConnection(Database.ConnectionString(databasePath, out errOut)); //string sql = $"INSERT INTO Gun_Collection_Pictures(CID, PICTURE, THUMB, ISMAIN,sync_lastupdate VALUES({id},@Image,@Thumb,{1},Now());"; //OleDbCommand cmd = new OleDbCommand(); //OleDbParameter param1 = new OleDbParameter(); //param1.ParameterName = "Image"; //param1.Value = buffer; //cmd.Parameters.Add(param1); //OleDbParameter param2 = new OleDbParameter(); //param2.ParameterName = "Thumb"; //param2.Value = buffer; //cmd.Parameters.Add(param2); //cmd.Connection = myConn; //cmd.ExecuteScalar(); bAns = true; } catch (Exception e) { errOut = ErrorMessage("AddDefaultPic", e); } return(bAns); }
public static int GetValueAsInt(this Recordset recordset, string fieldName) { return(Convert.ToInt32(recordset.Fields.Item(fieldName).Value)); }
//Interface public SalesOrderTableModule(Recordset salesOrder) { //Constructor this.mSalesOrder = salesOrder.SalesOrderTable; }
public static void SetValue(this Recordset recordset, string fieldName, object fieldValue) { recordset.Fields.Item(fieldName).Value = fieldValue; }
protected DatasetSpatialAnalystResult(SerializationInfo info, StreamingContext context) : base(info, context) { this.Dataset = info.GetString("Dataset"); this.Recordset = (Recordset)info.GetValue("Recordset", typeof(Recordset)); }
public static void DoQueryFormat(this Recordset recordset, string format, object arg1, object arg2) { recordset.DoQuery(string.Format(format, arg1, arg2)); }
private void CreateSPValidation() { string qCustomSPValidation = string.Empty; string qSPValidation = string.Empty; Recordset oRec = oSBOCompany.GetBusinessObject(BoObjectTypes.BoRecordset); try { string dir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string dirPathSP = dir + @"\SP\"; string dirPathMain = dir + @"\"; if (oSBOCompany.DbServerType == BoDataServerTypes.dst_HANADB) { #region HANA if (File.Exists(Path.Combine(dirPathSP, Path.GetFileName("HANA - SBO_SP_TransactionNotification.sql")))) { string fileName = Path.Combine(dirPathSP, Path.GetFileName("HANA - SBO_SP_TransactionNotification.sql")); using (StreamReader sr = new StreamReader(fileName)) { qCustomSPValidation = sr.ReadToEnd(); } } else if (File.Exists(Path.Combine(dirPathMain, Path.GetFileName("HANA - SBO_SP_TransactionNotification.sql")))) { string fileName = Path.Combine(dirPathMain, Path.GetFileName("HANA - SBO_SP_TransactionNotification.sql")); using (StreamReader sr = new StreamReader(fileName)) { qCustomSPValidation = sr.ReadToEnd(); } } oRec.DoQuery("SELECT DEFINITION FROM SYS.PROCEDURES WHERE SCHEMA_NAME = '" + oSBOCompany.CompanyDB + "' AND UPPER(PROCEDURE_NAME) = 'SBO_SP_TRANSACTIONNOTIFICATION'"); if (oRec.RecordCount > 0) { qSPValidation = oRec.Fields.Item("DEFINITION").Value; qCustomSPValidation = qCustomSPValidation.Trim(); qSPValidation = qSPValidation.Trim(); if (qSPValidation.ToLower().Contains("-- Add-On Sales Promotion (SOLTIUS)".ToLower()) == false) { string a = "-- Select the return values"; string b = "select :error, :error_message FROM dummy"; qSPValidation = qSPValidation.Replace("CREATE PROCEDURE", "ALTER PROCEDURE"); qCustomSPValidation = qCustomSPValidation + System.Environment.NewLine; qCustomSPValidation = qCustomSPValidation + System.Environment.NewLine + a; qCustomSPValidation = qCustomSPValidation + System.Environment.NewLine + b; if (qSPValidation.ToLower().Contains(a.ToLower())) { qSPValidation = qSPValidation.Substring(0, qSPValidation.ToLower().LastIndexOf(a.ToLower())) + qSPValidation.Substring(qSPValidation.ToLower().LastIndexOf(a.ToLower()) + a.Length); } qSPValidation = qSPValidation.Substring(0, qSPValidation.ToLower().LastIndexOf(b.ToLower())) + qCustomSPValidation + qSPValidation.Substring(qSPValidation.ToLower().LastIndexOf(b.ToLower()) + b.Length); oRec.DoQuery(qSPValidation); } } #endregion } else { #region SQL string fileName = Path.Combine(dirPathSP, Path.GetFileName("SQL - SBO_SP_TransactionNotification.sql")); if (File.Exists(fileName)) { using (StreamReader sr = new StreamReader(fileName)) { qCustomSPValidation = sr.ReadToEnd(); } } oRec.DoQuery("SELECT definition FROM sys.sql_modules WHERE objectproperty(object_id, 'IsProcedure') = 1 AND UPPER(OBJECT_NAME(object_id)) = 'SBO_SP_TRANSACTIONNOTIFICATION'"); if (oRec.RecordCount > 0) { qSPValidation = oRec.Fields.Item("definition").Value; qCustomSPValidation = qCustomSPValidation.Trim(); qSPValidation = qSPValidation.Trim(); if (qSPValidation.ToLower().Contains("-- Add-On Sales Promotion (SOLTIUS)".ToLower()) == false) { string a = "-- Select the return values"; string b = "select @error, @error_message"; qSPValidation = qSPValidation.ToLower().Replace("create procedure", "alter procedure"); qSPValidation = qSPValidation.ToLower().Replace("create proc", "alter proc"); qCustomSPValidation = qCustomSPValidation + System.Environment.NewLine; qCustomSPValidation = qCustomSPValidation + System.Environment.NewLine + a; qCustomSPValidation = qCustomSPValidation + System.Environment.NewLine + b; if (qSPValidation.ToLower().Contains(a.ToLower())) { qSPValidation = qSPValidation.Substring(0, qSPValidation.ToLower().LastIndexOf(a.ToLower())) + qSPValidation.Substring(qSPValidation.ToLower().LastIndexOf(a.ToLower()) + a.Length); } qSPValidation = qSPValidation.Substring(0, qSPValidation.ToLower().LastIndexOf(b.ToLower())) + qCustomSPValidation + qSPValidation.Substring(qSPValidation.ToLower().LastIndexOf(b.ToLower()) + b.Length); oRec.DoQuery(qSPValidation); } } #endregion } } catch (Exception ex) { oSBOApplication.MessageBox(ex.Message); } finally { Utils.releaseObject(oRec); } }
public void PluginServiceToXmlExpectedSerializesProperties() { var expected = new PluginService { Source = new PluginSource { ResourceID = Guid.NewGuid(), ResourceName = "TestWebSource", }, Namespace = "abc.pqr", }; expected.Method.Parameters.AddRange( new[] { new MethodParameter { Name = "Param1", DefaultValue = "123" }, new MethodParameter { Name = "Param2", DefaultValue = "456" } }); var rs1 = new Recordset { Name = "Recordset1()" }; rs1.Fields.AddRange(new[] { new RecordsetField { Name = "Field1", Alias = "Alias1" }, new RecordsetField { Name = "Field2", Alias = "Alias2", Path = new XmlPath("actual", "display", "outputExpression", "sampleData") }, new RecordsetField { Name = "Field3", Alias = null } }); expected.Recordsets.Add(rs1); var xml = expected.ToXml(); var actual = new PluginService(xml); Assert.AreEqual(expected.Source.ResourceType, actual.Source.ResourceType); Assert.AreEqual(expected.Source.ResourceID, actual.Source.ResourceID); Assert.AreEqual(expected.Source.ResourceName, actual.Source.ResourceName); Assert.AreEqual(expected.ResourceType, actual.ResourceType); Assert.AreEqual(expected.Namespace, actual.Namespace); foreach (var expectedParameter in expected.Method.Parameters) { var actualParameter = actual.Method.Parameters.First(p => p.Name == expectedParameter.Name); Assert.AreEqual(expectedParameter.DefaultValue, actualParameter.DefaultValue); } foreach (var expectedRecordset in expected.Recordsets) { // expect actual to have removed recordset notation ()... var actualRecordset = actual.Recordsets.First(rs => rs.Name == expectedRecordset.Name.Replace("()", "")); foreach (var expectedField in expectedRecordset.Fields) { var actualField = actualRecordset.Fields.FirstOrDefault(f => expectedField.Name == null ? f.Name == "" : f.Name == expectedField.Name); Assert.IsNotNull(actualField); Assert.AreEqual(expectedField.Alias ?? "", actualField.Alias); if (actualField.Path != null) { Assert.AreEqual(expectedField.Path.ActualPath, actualField.Path.ActualPath); Assert.AreEqual(expectedField.Path.DisplayPath, actualField.Path.DisplayPath); Assert.AreEqual(string.Format("[[{0}]]", expectedField.Alias), actualField.Path.OutputExpression); Assert.AreEqual(expectedField.Path.SampleData, actualField.Path.SampleData); } } } }
/// <summary> /// 显示子信息 /// </summary> /// <param name="strNodeTag">子标示</param> /// <param name="index">索引号</param> /// <param name="parantIndex">父索引号</param> /// <param name="layerName">数据集名称</param> private void ShowNodeMessage(int index) { this.TreeFrame.SelectedNode = this.TreeFrame.Nodes[index]; m_recordSet = new Recordset(); m_resultSet = new QueryResult(); m_resultSet = m_listRecordSet[index]; if (m_resultSet != null && m_resultSet.Recordsets != null) { if (m_resultSet.Recordsets != null) { m_recordSet = m_resultSet.Recordsets[index]; DataFrame.DataSource = m_recordSet.ToDataTable(); DataFrame.AllowUserToAddRows = false; DataFrame.ClearSelection(); } } }
public void Delete() { _isEdit = false; Recordset.Delete(); _isMove = true; }