/// <summary> /// Initializes a new instance of the HeaderMouseEventArgs class with /// the specified source Column, Table, column index, column header bounds /// and MouseEventArgs /// </summary> /// <param name="column">The Column that Raised the event</param> /// <param name="table">The Table the Column belongs to</param> /// <param name="index">The index of the Column</param> /// <param name="headerRect">The column header's bounding rectangle</param> /// <param name="mea">The MouseEventArgs that contains data about the /// mouse event</param> public HeaderMouseEventArgs(Column column, HTable table, int index, Gdk.Rectangle headerRect, Gtk.MotionNotifyEventArgs mea) { this.column = column; this.table = table; this.index = index; this.headerRect = headerRect; }
private void BuildFormCRUDCode(List <HField> m_Datas, HTable table, string rootFolder) { StringBuilder sb = new StringBuilder(); sb.Append("Detail窗体,Form_Load代码" + Environment.NewLine); sb.Append("" + Environment.NewLine); //txtFBFBM.Text = tFBF.FBFBM; foreach (HField field in m_Datas) { sb.Append("txt" + field.ENName + ".Text = t" + HOther.RemoveSystemName(table.ClassName) + "." + field.ENName + ";" + Environment.NewLine); } sb.Append("" + Environment.NewLine); sb.Append("Detail窗体,保存实体代码" + Environment.NewLine); sb.Append("" + Environment.NewLine); //tFBF.FBFBM = txtFBFBM.Text; foreach (HField field in m_Datas) { sb.Append("t" + HOther.RemoveSystemName(table.ClassName) + "." + field.ENName + "=txt" + field.ENName + ".Text;" + Environment.NewLine); } sb.Append("" + Environment.NewLine); HOther.SaveStringToFile(sb.ToString(), rootFolder + "\\" + table.ClassName + "Detail窗体代码,复制使用.txt"); }
/// <summary> /// Initializes a new instance of the HeaderMouseEventArgs class with /// the specified source Column, Table, column index, column header bounds /// and MouseEventArgs /// </summary> /// <param name="column">The Column that Raised the event</param> /// <param name="table">The Table the Column belongs to</param> /// <param name="index">The index of the Column</param> /// <param name="headerRect">The column header's bounding rectangle</param> /// <param name="mea">The MouseEventArgs that contains data about the /// mouse event</param> public HeaderMouseEventArgs(Column column, HTable table, int index, Gdk.Rectangle headerRect, Gtk.MotionNotifyEventArgs mea) { this.column = column; this.table = table; this.index = index; this.headerRect = headerRect; }
private void BuildFormCRUDCode(List<HField> m_Datas, HTable table, string rootFolder) { StringBuilder sb = new StringBuilder(); sb.Append("Detail窗体,Form_Load代码" + Environment.NewLine); sb.Append("" + Environment.NewLine); //txtFBFBM.Text = tFBF.FBFBM; foreach (HField field in m_Datas) { sb.Append("txt" + field.ENName + ".Text = t" + HOther.RemoveSystemName(table.ClassName) + "." + field.ENName + ";" + Environment.NewLine); } sb.Append("" + Environment.NewLine); sb.Append("Detail窗体,保存实体代码" + Environment.NewLine); sb.Append("" + Environment.NewLine); //tFBF.FBFBM = txtFBFBM.Text; foreach (HField field in m_Datas) { sb.Append("t" + HOther.RemoveSystemName(table.ClassName) + "." + field.ENName + "=txt" + field.ENName + ".Text;" + Environment.NewLine); } sb.Append("" + Environment.NewLine); HOther.SaveStringToFile(sb.ToString(), rootFolder + "\\" + table.ClassName + "Detail窗体代码,复制使用.txt"); }
protected override void BuildHBM(List<HField> m_Datas, HTable table, string rootFolder) { string templateString = HOther.ReadTemplate(m_TemplatePath, "hbm.xml"); templateString = templateString.Replace("{||ClassName||}", table.ClassName); templateString = templateString.Replace("{||TableName||}", table.ENName); StringBuilder sb = new StringBuilder(); //FieldList foreach (HField field in m_Datas) { //private decimal m_ID; //固定第一个字段是主键 if (field == m_Datas[0]) { sb.Append("<id name=\"" + field.ENName + "\" column=\"" + field.ENName + "\" type=\"Decimal\" unsaved-value=\"0\">" + Environment.NewLine); sb.Append("<generator class=\"identity\" />" + Environment.NewLine); sb.Append("</id>" + Environment.NewLine); } else { string f1 = GetHBMCSType(field); sb.Append("<property column=\"" + field.ENName + "\" type=\"" + f1 + "\" name=\"" + field.ENName + "\" />" + Environment.NewLine); } } templateString = templateString.Replace("{||FieldList||}", sb.ToString()); HOther.SaveStringToFile(templateString, rootFolder + "\\" + table.ClassName + ".hbm.xml"); }
protected virtual void BuildHBM(List <HField> m_Datas, HTable table, string rootFolder) { string templateString = HOther.ReadTemplate(m_TemplatePath, "hbm.xml"); templateString = templateString.Replace("{||ClassName||}", table.ClassName); templateString = templateString.Replace("{||TableName||}", table.ENName); StringBuilder sb = new StringBuilder(); //FieldList foreach (HField field in m_Datas) { //private decimal m_ID; //固定第一个字段是主键 if (field == m_Datas[0]) { sb.Append("<id name=\"" + field.ENName + "\" column=\"" + field.ENName + "\" type=\"Decimal\" unsaved-value=\"0\">" + Environment.NewLine); sb.Append("<generator class=\"increment\" />" + Environment.NewLine); sb.Append("</id>" + Environment.NewLine); } else { string f1 = GetHBMCSType(field); sb.Append("<property column=\"" + field.ENName + "\" type=\"" + f1 + "\" name=\"" + field.ENName + "\" />" + Environment.NewLine); } } templateString = templateString.Replace("{||FieldList||}", sb.ToString()); HOther.SaveStringToFile(templateString, rootFolder + "\\" + table.ClassName + ".hbm.xml"); }
/// <summary> /// Initializes a new instance of the CellMouseEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="cellRect">The Cell's bounding rectangle</param> public CellMouseEventArgs(Cell cell, HTable table, int row, int column, Gdk.Rectangle cellRect) { this.cell = cell; this.table = table; this.row = row; this.column = column; this.cellRect = cellRect; }
/// <summary> /// Initializes a new instance of the CellMouseEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="cellPos"></param> /// <param name="cellRect">The Cell's bounding rectangle</param> public CellMouseEventArgs(Cell cell, HTable table, CellPos cellPos, Gdk.Rectangle cellRect) { this.cell = cell; this.table = table; this.row = cellPos.Row; this.column = cellPos.Column; this.cellRect = cellRect; }
public ActionResult <HTable> PostHTableItem(HTable hTabel) { _context.HTable.Add(hTabel); _context.SaveChanges(); return(CreatedAtAction("GetHTableItem", new HTable { tabId = hTabel.tabId }, hTabel)); }
/// <summary> /// Initializes a new instance of the CellEventArgs class with /// the specified Cell source, column index and row index /// </summary> /// <param name="source">The Cell that Raised the event</param> /// <param name="editor">The CellEditor used to edit the Cell</param> /// <param name="table">The Table that the Cell belongs to</param> /// <param name="row">The Column index of the Cell</param> /// <param name="column">The Row index of the Cell</param> /// <param name="cellRect"></param> public CellEditEventArgs(Cell source, ICellEditor editor, HTable table, int row, int column, Gdk.Rectangle cellRect) : base(source, column, row) { this.editor = editor; this.table = table; this.cellRect = cellRect; this.cancel = false; }
/// <summary> /// Initializes a new instance of the CellKeyEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="cellPos"></param> /// <param name="cellRect">The Cell's bounding rectangle</param> /// <param name="kea"></param> public CellKeyEventArgs(Cell cell, HTable table, CellPos cellPos, Gdk.Rectangle cellRect, Gtk.KeyReleaseEventArgs kea) { this.cell = cell; this.table = table; this.row = cellPos.Row; this.column = cellPos.Column; this.cellRect = cellRect; }
/// <summary> /// Initializes a new instance of the CellKeyEventArgs class with /// the specified source Cell, table, row index, column index, cell /// bounds and KeyEventArgs /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="cellRect">The Cell's bounding rectangle</param> /// <param name="kea"></param> public CellKeyEventArgs(Cell cell, HTable table, int row, int column, Gdk.Rectangle cellRect, Gtk.KeyReleaseEventArgs kea) { this.cell = cell; this.table = table; this.row = row; this.column = column; this.cellRect = cellRect; }
/// <summary> /// Initializes a new instance of the CellMouseEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="cellPos"></param> /// <param name="cellRect">The Cell's bounding rectangle</param> public CellMouseEventArgs(Cell cell, HTable table, CellPos cellPos, Gdk.Rectangle cellRect) { this.cell = cell; this.table = table; this.row = cellPos.Row; this.column = cellPos.Column; this.cellRect = cellRect; }
/// <summary> /// Initialise default settings /// </summary> private void Init() { this.rows = null; this.selection = new Selection(this); this.table = null; this.rowHeight = TableModel.DefaultRowHeight; }
/// <summary> /// Initializes a new instance of the CellKeyEventArgs class with /// the specified source Cell, table, row index, column index, cell /// bounds and KeyEventArgs /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="cellRect">The Cell's bounding rectangle</param> /// <param name="kea"></param> public CellKeyEventArgs(Cell cell, HTable table, int row, int column, Gdk.Rectangle cellRect, Gtk.KeyReleaseEventArgs kea) { this.cell = cell; this.table = table; this.row = row; this.column = column; this.cellRect = cellRect; }
/// <summary> /// Initializes a new instance of the CellEventArgs class with /// the specified Cell source, column index and row index /// </summary> /// <param name="source">The Cell that Raised the event</param> /// <param name="editor">The CellEditor used to edit the Cell</param> /// <param name="table">The Table that the Cell belongs to</param> /// <param name="row">The Column index of the Cell</param> /// <param name="column">The Row index of the Cell</param> /// <param name="cellRect"></param> public CellEditEventArgs(Cell source, ICellEditor editor, HTable table, int row, int column, Gdk.Rectangle cellRect) : base(source, column, row) { this.editor = editor; this.table = table; this.cellRect = cellRect; this.cancel = false; }
public virtual void BuildCode(List<HField> m_Datas, HTable table, string rootFolder) { //实体类 BuildEntity(m_Datas, table, rootFolder); //实体类 BuildHBM(m_Datas, table, rootFolder); MessageBox.Show("导出成功"); }
private void loadWorker_DoWork(object sender, DoWorkEventArgs e) { // Create new tree string[] parsedData = null; int TableNumber = 0; try { // Get list of websites string[][] AllSites = new string[5][]; TableNumber = GetNumberOfKeys() + 1; int sitesRemaining = 1531 - TableNumber; for (int i = 0; i < AllSites.Length; ++i) { AddMessage($"Getting site list for '{Enum.GetName(typeof (WebCompareModel.SitesEnum), i)}' cluster"); AllSites[i] = WebCompareModel.GetSiteList(WebCompareModel.Websites[i], (sitesRemaining / 5)); } // Build frequency tables from 1000+ sites int sitecateg = 1, statusCount = 1, scx = 1; foreach (string[] sites in AllSites) { AddMessage("Building frequency tables for cluster.. " + sitecateg); foreach (string site in sites) { // Status display if (statusCount == 100) { AddMessage($"Sites to go..{sites.Count() * 5 - scx + 70}"); statusCount = 0; } ++statusCount; ++scx; // Get data from website and parse parsedData = WebCompareModel.GetWebDataAgility(site); // Fill a new HTable (frequency table) HTable table = new HTable(); table.URL = site; table.Name = site.Substring(30); if (parsedData != null) { for (int w = 0; w < parsedData.Length; ++w) { table.Put(parsedData[w], 1); } } // Write HTable to file table.SaveTable(TableNumber); // Add HTable to BTree, including write to file Session.Instance.Tree.Insert(TableNumber, table.Name); ++TableNumber; } AddMessage("Completed building frequency table " + sitecateg); ++sitecateg; } // End AllSites foreach } catch (Exception err) { MessageBox.Show("Exception caught: " + err, "Exception:Loader:loaderWorker_DoWork()", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public virtual void BuildCode(List <HField> m_Datas, HTable table, string rootFolder) { //实体类 BuildEntity(m_Datas, table, rootFolder); //实体类 BuildHBM(m_Datas, table, rootFolder); MessageBox.Show("导出成功"); }
/// <summary> /// Initializes a new instance of the PaintHeaderEventArgs class with /// the specified graphics, column, table, column index, header style /// and clipping rectangle /// </summary> /// <param name="g">The Graphics used to paint the Column header</param> /// <param name="column">The Column to be painted</param> /// <param name="table">The Table the Column's ColumnModel belongs to</param> /// <param name="columnIndex">The index of the Column in the Table's ColumnModel</param> /// <param name="headerStyle">The style of the Column's header</param> /// <param name="headerRect">The Rectangle that represents the rectangle /// in which to paint</param> public PaintHeaderEventArgs(Gdk.Drawable g, Column column, HTable table, int columnIndex, ColumnHeaderStyle headerStyle, Gdk.Rectangle headerRect) { this.column = column; this.table = table; this.columnIndex = columnIndex; this.column = column; this.headerStyle = headerStyle; this.headerRect = headerRect; this.handled = false; }
private void MergeCells(HTable htable, Table table) { for (int j = htable.ColumnCount - 1; j >= 0; j--) { for (int i = htable.RowCount - 1; i >= 0; i--) { TryMergeCells(htable, table, i, j); } } }
public override void BuildCode(List<HField> m_Datas, HTable table, string rootFolder) { //实体类 BuildEntity(m_Datas, table, rootFolder); //实体类 BuildHBM(m_Datas, table, rootFolder); //Detail窗体代码 BuildFormCRUDCode(m_Datas, table, rootFolder); MessageBox.Show("导出成功"); }
public override void BuildCode(List <HField> m_Datas, HTable table, string rootFolder) { //实体类 BuildEntity(m_Datas, table, rootFolder); //实体类 BuildHBM(m_Datas, table, rootFolder); //Detail窗体代码 BuildFormCRUDCode(m_Datas, table, rootFolder); MessageBox.Show("导出成功"); }
public ActionResult PutHTableItem(int id, HTable hTabel) { if (id != hTabel.tabId) { return(BadRequest()); } _context.Entry(hTabel).State = EntityState.Modified; _context.SaveChanges(); return(CreatedAtAction("GetHTableItem", new HTable { tabId = hTabel.tabId }, hTabel)); }
/// <summary> /// Initialise default settings /// </summary> private void Init() { this.columns = null; this.table = null; this.headerHeight = ColumnModel.DefaultHeaderHeight; this.cellRenderers = new Hashtable(); this.SetCellRenderer("TEXT", new TextCellRenderer()); this.cellEditors = new Hashtable(); this.SetCellEditor("TEXT", new TextCellEditor()); }
/// <summary> /// Initializes a new instance of the PaintCellEventArgs class with /// the specified graphics, table, row index, column index, selected value, /// focused value, mouse value and clipping rectangle /// </summary> /// <param name="g">The Graphics used to paint the Cell</param> /// <param name="cell">The Cell to be painted</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="selected">Specifies whether the Cell is selected</param> /// <param name="focused">Specifies whether the Cell has focus</param> /// <param name="sorted">Specifies whether the Cell's Column is sorted</param> /// <param name="editable">Specifies whether the Cell is able to be edited</param> /// <param name="enabled">Specifies whether the Cell is enabled</param> /// <param name="cellRect">The rectangle in which to paint the Cell</param> public PaintCellEventArgs(Gtk.ExposeEventArgs g, Cell cell, HTable table, int row, int column, bool selected, bool focused, bool sorted, bool editable, bool enabled, Gdk.Rectangle cellRect) { this.cell = cell; this.table = table; this.row = row; this.column = column; this.selected = selected; this.focused = focused; this.sorted = sorted; this.editable = editable; this.enabled = enabled; this.cellRect = cellRect; this.handled = false; }
private static bool TryMergeCells(HTable htable, Table table, int rowIndex, int columnIndex) { Rectangle rect; if (!htable.GetCell(rowIndex, columnIndex, out rect)) { return(false); } int width = htable.GetColumnWidth(columnIndex); int height = htable.GetRowHeight(rowIndex); if (rect.Width == width && rect.Height == height) { return(false); } int endColumn = columnIndex; if (width < rect.Width) { for (int j = columnIndex + 1; j < htable.ColumnCount; j++) { width += htable.GetColumnWidth(j); if (width >= rect.Width) { endColumn = j; break; } } } int endRow = rowIndex; if (height < rect.Height) { for (int i = rowIndex + 1; i < htable.RowCount; i++) { height += htable.GetRowHeight(i); if (height >= rect.Height) { endRow = i; break; } } } Debug.WriteLine("Merge cells: (" + rowIndex.ToString() + "," + columnIndex.ToString() + "),(" + endRow.ToString() + "," + endColumn.ToString() + ")"); MergeCells(table, rowIndex, columnIndex, endRow, endColumn); return(true); }
public void UpdateTable(ref HTable ht) { AddMessage("\nUpdtating frequency table.."); // Get data from websit and parse ht.Table = null; // Clear current table ht.TableSize = 32; ht.Table = new Model.HTable.HEntry[32]; string[] parsedData = WebCompareModel.GetWebDataAgility(ht.URL); // ReFill HTable for (int w = 0; w < parsedData.Length; ++w) { ht.Put(parsedData[w], 1); } AddMessage("\nCOMPLETED updating frequency table.."); }
private HElement GetDebugResponse(SessionData sessionData) { HMultipleElements ret = new HMultipleElements(); ret += new HText($"Currently Enqueued tasks: {TaskCount}"); ret += new HText($"Worker Count: {WorkerCount}"); if (TaskCount > 0) { using (_writeLock.LockRead()) { ret += new HTable((from x in _tasks select new object[] { x.Task.Method?.Name, x.Task.Target?.GetType().Name, x.Parameters.ToSeparatedValueString(), x.State, x.ExceptionThrown?.GetType().Name, x.ReturnedValue?.GetType().Name }).ToList()) { TableHeader = new string[] { "Method Name", "Target Type", "Parameters", "State", "Thrown Exception", "Returned Value" } }; } } return(ret); }
public override Expression.EvalResult Run(MakeState s, List <Expression.EvalResult> passed_args) { var name = passed_args[0].strval; var key = passed_args[1].arrval; var value = passed_args[2].arrval; /* Coerce key and value to byte arrays */ var key_b = ToByteArray(key); var value_b = ToByteArray(value); /* Get hash code */ var hc = Hash(key_b); /* Get hash table */ HTable ht; if (tables.TryGetValue(name, out ht) == false) { ht = new HTable(); tables[name] = ht; } /* Build table entry */ HTable.KeyIndex k = new HTable.KeyIndex(); k.hc = hc; k.idx = ht.data.Count; k.key = key_b; ht.keys.Add(k); /* Add data entry */ if (key_b.Count > 255) { throw new Exception("key too large"); } ht.data.Add((byte)key_b.Count); ht.data.AddRange(key_b); ht.data.AddRange(value_b); return(new Expression.EvalResult()); }
/// <summary> /// Get table from disk /// </summary> /// <param name="num"></param> /// <returns></returns> public HTable LoadTable(int num) { string FileName = $"tablebin\\table{num}.bin"; HTable loadedTable = null; try { if (File.Exists(FileName)) { using (Stream filestream = File.OpenRead(FileName)) { BinaryFormatter deserializer = new BinaryFormatter(); loadedTable = (HTable)deserializer.Deserialize(filestream); } } else { MessageBox.Show("Table does not exist", "Error", MessageBoxButton.OK, MessageBoxImage.Warning); } } catch (Exception e) { Console.WriteLine("Error in LoadTable: " + e); } return(loadedTable); }
/// <summary> /// Initializes a new instance of the CellFocusEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="source">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="cellRect">The Cell's bounding rectangle</param> public CellFocusEventArgs(Cell source, HTable table, int row, int column, Rectangle cellRect) : base(source, column, row) { this.table = table; this.cellRect = cellRect; }
/// <summary> /// [数据更新] by CSS/[email protected],2001~2008 /// 1.自动根据内存表生存相应的新增、修改、删除等SQL语句并自动发送更新(根据行状态判断Add\Delete\Modify); /// 2.自动产生主从表的主键ID(不包装成事务)、相关的业务单据号(包装成事务) /// 3.支持多表多条记录同时更新、主从表、辅助更新表都自动封装成事务 /// 4.会自动判断是否有相关的:新增、修改、删除权限 /// 5.允许设置是否允许更新、新增、删除 资料; /// 6.更新的时候自动根据条件SelectWhere过滤数据(前提是过滤的条件数据字段必须存在内存表中); /// /// [注意事项]: /// 1.主表有且只有一个并且是this.mHTableList中的第一个; /// 2.主表主键限制一个字段; /// 3.主表可以多行记录同时更新,但如果同时有主表、明细表,这时主表只能有一条记录(要动态生成主表的主键值并自动更新明细表主键值); /// 4.新增明细表记录时其主键值会同步于主表,但明细表对应的主键应位于主键列表中的第1个,主从表主键名称可不相同 /// 5.更新顺序为:先辅助表/明细表、后主表 /// </summary> /// <returns>成功返回更新后的DataSet,失败null</returns> public DataSet Save(DataSet dsData) { bool lACLNew = this.CheckUserFuncAccess("新增"); bool lACLModify = this.CheckUserFuncAccess("修改"); bool lACLDelete = this.CheckUserFuncAccess("删除"); //若第一次调用没DefineHTable则调用 if (this.mHTableList == null) { this.DefineHTable(); } //若继承类没实现DefineHTable则throw exception if (dsData == null || this.mHTableList == null) { throw new Exception("服务端-未提供更新的数据源或表结构未定义"); } if (!dsData.HasChanges() || dsData.Tables[this.mHTableList[0].CursorTableName].Rows.Count == 0) { throw new Exception("服务端-没有需要更新的数据"); } try { this.BeforeSave(dsData); #region 权限 foreach (HTable hTable in this.mHTableList) { //DataTable dtUpdate = dsData.Tables[hTable.CursorTableName].GetChanges(); DataTable dtUpdate = dsData.Tables[hTable.CursorTableName]; if (dtUpdate.Rows.Count > 0 && hTable.SendUpdate) { foreach (DataRow drUpdate in dtUpdate.Rows) //暂时禁止DEBUG_HUHM:tUpdate.Select(hTable.SelectWhere) { //权限 if (hTable.TableType == HTableType.Master && drUpdate.RowState == DataRowState.Added) { if (!this.mAllowAddNew) { throw new Exception("服务端-不允许新增资料"); } if (!lACLNew) { throw new Exception("服务端-您没有新增资料的权限"); } } if (drUpdate.RowState == DataRowState.Modified) { if (!this.mAllowModify) { throw new Exception("服务端-不允许修改资料"); } if (!lACLModify) { throw new Exception("服务端-您没有修改资料的权限"); } } if (hTable.TableType == HTableType.Master && drUpdate.RowState == DataRowState.Deleted) { if (!this.mAllowAddNew) { throw new Exception("服务端-不允许删除资料"); } if (!lACLNew) { throw new Exception("服务端-您没有删除资料的权限"); } } //自动检查非法修改 if (this.mEnableCheckCompanyID && drUpdate.RowState != DataRowState.Unchanged) { if (dtUpdate.Columns.Contains("CompanyID")) { object companyID; if (drUpdate.RowState == DataRowState.Deleted) { companyID = drUpdate["CompanyID", DataRowVersion.Original]; } else { companyID = drUpdate["CompanyID"]; if (drUpdate.RowState == DataRowState.Modified) { if (companyID.ToString() != drUpdate["CompanyID", DataRowVersion.Original].ToString()) { throw new Exception("服务端-禁止更改共用资料或其他公司资料。"); } } } if (this.mUserInfo.CompanyID != Convert.ToInt32(companyID)) { throw new Exception("服务端-禁止更改共用资料或其他公司资料。"); } } } } // end of foreach } // end of if (dtUpdate.Rows.Count > 0 ... } //end of foreach (HTable hTable in this.mHTableList) #endregion #region 主键 //轮循主表 //Notes:主表只能有一个并且是Dataset中的第一个 foreach (DataRow drMain in dsData.Tables[this.mHTableList[0].CursorTableName].Rows) { //新增主表主键 //Notes:主表主键限制一个字段 object billID = null; if (drMain.RowState == DataRowState.Added) { billID = drMain[this.mHTableList[0].KeyFieldList2[0]]; if (billID == null || billID.ToString().Trim() == "0" || billID.ToString() == string.Empty) { billID = this.GetIdentity(this.mHTableList[0].SqlTableName); if (billID == null || billID.ToString() == "-1") { throw new Exception("主键ID产生失败。"); } drMain[this.mHTableList[0].KeyFieldList2[0]] = billID; } } else //Modify&Delete&UnChanged { if (drMain.RowState != DataRowState.Deleted) { billID = drMain[this.mHTableList[0].KeyFieldList2[0]]; } else { billID = drMain[this.mHTableList[0].KeyFieldList2[0], DataRowVersion.Original]; } } //明细表主键,明细表的主键可以多个,但列表第一个必须与主表相同 //Notes:主表可以多行记录同时更新,但如果有明细表时主表只能有一条记录 if (billID != null) { foreach (HTable hTable in this.mHTableList) { if (hTable.TableType == HTableType.Detail) { foreach (DataRow drDetail in dsData.Tables[hTable.CursorTableName].Rows) { //主表删除记录,同时删除明细表 if (drMain.RowState == DataRowState.Deleted) //主表删除 { drDetail.Delete(); //自动删除明细表相关记录(不判断条件、全部删除明细表) } else if (drDetail.RowState == DataRowState.Added) { object dBillID = drDetail[hTable.KeyFieldList2[0]]; if (dBillID == null || dBillID.ToString().Trim() == "0" || dBillID.ToString() == string.Empty) { drDetail[hTable.KeyFieldList2[0]] = billID; //Notes:明细表的主键值来源于主表,且必须是第1个 } } } } } } //end of if (billID!=null) } // end of foreach主表 #endregion #region Update数据 Database db = DatabaseFactory.CreateDatabase(); TransactionOptions option = new TransactionOptions(); option.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, option)) { //Notes: 先明细后主 for (int i = this.mHTableList.Length - 1; i >= 0; i--) //倒排序,保证主表最后一个更新 { HTable hTable = this.mHTableList[i]; //DataTable dtUpdate = dsData.Tables[hTable.CursorTableName].GetChanges(); DataTable dtUpdate = dsData.Tables[hTable.CursorTableName]; //准备更新数据库 if (dtUpdate.Rows.Count > 0 && hTable.SendUpdate) { //发送更新 //Notes: 更新的时候自动根据条件SelectWhere过滤数据(前提是过滤的条件数据字段必须存在内存表中); foreach (DataRow drUpdate in dtUpdate.Rows) //暂时禁止DEBUG_HUHM:tUpdate.Select(hTable.SelectWhere) { //产生BillNo单据号 if (drUpdate.RowState == DataRowState.Added) //remark by huhm,2011/9/29 { if (hTable.BillNoFieldName != "" && string.IsNullOrEmpty(drUpdate[hTable.BillNoFieldName].ToString())) { object cBillNo = this.GetBillNo(); if (cBillNo == null || string.IsNullOrEmpty(cBillNo.ToString().Trim())) { throw new Exception("单据号产生失败。"); } drUpdate[hTable.BillNoFieldName] = cBillNo; } } //自动产生SQL语句 //HUHM_DEBUG-后期考虑Cache dbCommand if (drUpdate.RowState == DataRowState.Added) { if (hTable.InsertDbCommand == null) { hTable.InsertDbCommand = DataHelper.GetSqlInsDbCommand(db, dtUpdate, hTable.SqlTableName, hTable.NoUpdateFieldList); } DataHelper.SetDbParameterValue(hTable.InsertDbCommand, drUpdate); db.ExecuteNonQuery(hTable.InsertDbCommand); } if (drUpdate.RowState == DataRowState.Modified) { if (hTable.UpdateDbCommand == null) { hTable.UpdateDbCommand = DataHelper.GetSqlUpdDbCommand(db, dtUpdate, hTable.SqlTableName, hTable.KeyFieldList2, hTable.NoUpdateFieldList); } DataHelper.SetDbParameterValue(hTable.UpdateDbCommand, drUpdate); db.ExecuteNonQuery(hTable.UpdateDbCommand); } if (drUpdate.RowState == DataRowState.Deleted) { if (hTable.DeleteDbCommand == null) { hTable.DeleteDbCommand = DataHelper.GetSqlDelDbCommand(db, dtUpdate, hTable.SqlTableName, hTable.KeyFieldList2); } DataHelper.SetDbParameterValue(hTable.DeleteDbCommand, drUpdate); db.ExecuteNonQuery(hTable.DeleteDbCommand); } } //end of foreach (DataRow drUpdate in dtUpdate.Rows) } // end of if (dtUpdate.Rows.Count > 0 && hTable.TableType != HTableType.Aux) } //end of for (int i = this.mHTableList.Count - 1; i >= 0; i--) scope.Complete(); } // end of using(scope) dsData.AcceptChanges(); #endregion this.AfterSave(dsData); } // end of try catch { throw; } return(dsData); }
/// <summary> /// Initializes a new instance of the PaintCellEventArgs class with /// the specified graphics, table, row index, column index, selected value, /// focused value, mouse value and clipping rectangle /// </summary> /// <param name="g">The Graphics used to paint the Cell</param> /// <param name="cell">The Cell to be painted</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="selected">Specifies whether the Cell is selected</param> /// <param name="focused">Specifies whether the Cell has focus</param> /// <param name="sorted">Specifies whether the Cell's Column is sorted</param> /// <param name="editable">Specifies whether the Cell is able to be edited</param> /// <param name="enabled">Specifies whether the Cell is enabled</param> /// <param name="cellRect">The rectangle in which to paint the Cell</param> public PaintCellEventArgs(Gtk.ExposeEventArgs g, Cell cell, HTable table, int row, int column, bool selected, bool focused, bool sorted, bool editable, bool enabled, Gdk.Rectangle cellRect) { this.cell = cell; this.table = table; this.row = row; this.column = column; this.selected = selected; this.focused = focused; this.sorted = sorted; this.editable = editable; this.enabled = enabled; this.cellRect = cellRect; this.handled = false; }
protected virtual void BuildEntity(List <HField> m_Datas, HTable table, string rootFolder) { string templateString = HOther.ReadTemplate(m_TemplatePath, "entity.cs"); templateString = templateString.Replace("{||ClassName||}", table.ClassName); templateString = templateString.Replace("{||CnName||}", table.CHName); HField fieldPK = m_Datas[0]; templateString = templateString.Replace("{||m_ID||}", "m_" + fieldPK.ENName); templateString = templateString.Replace("{||ID||}", fieldPK.ENName); StringBuilder sb = new StringBuilder(); //FieldListPrivate foreach (HField field in m_Datas) { //protected decimal m_ID; //固定第一个字段是主键 if (field == m_Datas[0]) { sb.Append("private " + " decimal m_" + field.ENName + ";" + Environment.NewLine); } else { string f1 = GetCSType(field); sb.Append("private " + f1 + " m_" + field.ENName + ";" + Environment.NewLine); } } templateString = templateString.Replace("{||FieldListPrivate||}", sb.ToString()); //FieldListInit sb = new StringBuilder(); foreach (HField field in m_Datas) { //m_DATASET_ID = null; //固定第一个字段是主键 if (field == m_Datas[0]) { sb.Append("m_" + field.ENName + "=0;" + Environment.NewLine); } else { sb.Append("m_" + field.ENName + "=null;" + Environment.NewLine); } } templateString = templateString.Replace("{||FieldListInit||}", sb.ToString()); //FieldListPublic sb = new StringBuilder(); foreach (HField field in m_Datas) { sb.Append(@"/// <summary>" + Environment.NewLine); sb.Append(@"/// " + field.CHName + Environment.NewLine); sb.Append(@"/// </summary> "+ Environment.NewLine); //固定第一个字段是主键 if (field == m_Datas[0]) { sb.Append(@"public virtual decimal " + field.ENName + Environment.NewLine); sb.Append(@"{" + Environment.NewLine); sb.Append(@"get { return m_" + field.ENName + "; }" + Environment.NewLine); sb.Append(@"set { m_IsChanged |= (m_" + field.ENName + " != value); m_" + field.ENName + " = value; }" + Environment.NewLine); sb.Append(@"}" + Environment.NewLine); } else { if (field.Type == HFieldType.NVARCHAR2) { sb.Append(@"public virtual string " + field.ENName + Environment.NewLine); sb.Append(@"{" + Environment.NewLine); sb.Append(@"get { return m_" + field.ENName + "; }" + Environment.NewLine); sb.Append(@"set " + Environment.NewLine); sb.Append(@"{" + Environment.NewLine); sb.Append(@"if ( value != null)" + Environment.NewLine); if (field.Length > 0) { sb.Append(@"if( value.Length > " + field.Length + ")" + Environment.NewLine); sb.Append("throw new ArgumentOutOfRangeException(\"Invalid value for " + field.ENName + "\", value, value.ToString());" + Environment.NewLine); } sb.Append(@"m_IsChanged |= (m_" + field.ENName + " != value); m_" + field.ENName + " = value;" + Environment.NewLine); sb.Append(@"}" + Environment.NewLine); sb.Append(@"}" + Environment.NewLine); } else { string f1 = GetCSType(field); sb.Append(@"public virtual " + f1 + " " + field.ENName + Environment.NewLine); sb.Append(@"{" + Environment.NewLine); sb.Append(@"get { return m_" + field.ENName + "; }" + Environment.NewLine); sb.Append(@"set { m_IsChanged |= (m_" + field.ENName + " != value); m_" + field.ENName + " = value; }" + Environment.NewLine); sb.Append(@"}" + Environment.NewLine); } } } templateString = templateString.Replace("{||FieldListPublic||}", sb.ToString()); HOther.SaveStringToFile(templateString, rootFolder + "\\" + table.ClassName + ".cs"); }
/// <summary> /// Initializes a new instance of the CellKeyEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="cellPos"></param> /// <param name="cellRect">The Cell's bounding rectangle</param> /// <param name="kea"></param> public CellKeyEventArgs(Cell cell, HTable table, CellPos cellPos, Gdk.Rectangle cellRect, Gtk.KeyReleaseEventArgs kea) { this.cell = cell; this.table = table; this.row = cellPos.Row; this.column = cellPos.Column; this.cellRect = cellRect; }
/// <summary> /// Initialise default settings /// </summary> private void Init() { this.columns = null; this.table = null; this.headerHeight = ColumnModel.DefaultHeaderHeight; this.cellRenderers = new Hashtable(); this.SetCellRenderer("TEXT", new TextCellRenderer()); this.cellEditors = new Hashtable(); this.SetCellEditor("TEXT", new TextCellEditor()); }
/// <summary> /// Initializes a new instance of the CellMouseEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="cell">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="cellRect">The Cell's bounding rectangle</param> public CellMouseEventArgs(Cell cell, HTable table, int row, int column, Gdk.Rectangle cellRect) { this.cell = cell; this.table = table; this.row = row; this.column = column; this.cellRect = cellRect; }
/// <summary> /// Initializes a new instance of the CellEventArgs class with /// the specified Cell source, column index and row index /// </summary> /// <param name="source">The Cell that Raised the event</param> /// <param name="editor">The CellEditor used to edit the Cell</param> /// <param name="table">The Table that the Cell belongs to</param> public CellEditEventArgs(Cell source, ICellEditor editor, HTable table) : this(source, editor, table, -1, -1, Gdk.Rectangle.Zero) { }
private HElement GetDebugResponse(SessionData sessionData) { HMultipleElements ret = new HMultipleElements(); ret += new HText($"Current Response Count: {StringResponses.Count} ({CurrentStringResponseCacheSize * sizeof(char)} bytes)."); if (MaximumStringResponseCacheSize > 0) { ret += new HText($"Cache Fillrate: {CurrentStringResponseCacheSize} / {MaximumStringResponseCacheSize} = {((CurrentStringResponseCacheSize / MaximumStringResponseCacheSize) * 100f):0.000}%."); string request; using (StringResponseLock.LockRead()) { if (sessionData.HttpHeadVariables.TryGetValue("key", out request)) { ret += new HButton("Back to all entries", "?all=true"); ResponseCacheEntry <string> response; if (StringResponses.TryGetValue(request, out response)) { ret += new HHeadline($"Entry '{request}'", 2); ret += new HText("Requested Times: " + response.Count); ret += new HText("Response Length: " + response.Response.Length); ret += new HText("Last Requested: " + response.LastRequestedDateTime); ret += new HText("Last Updated Times: " + response.LastUpdatedDateTime); ret += new HText("Lifetime: " + response.RefreshTime); ret += new HLine(); ret += new HText("Contents:"); ret += new HText(response.Response) { Class = "code" }; } else { ret += new HText($"The requested entry '{request}' could not be found.") { Class = "error" }; } } else if (sessionData.HttpHeadVariables.ContainsKey("all")) { ret += new HTable((from e in StringResponses select new object[] { e.Key, e.Value.Count, e.Value.Response.Length, e.Value.LastRequestedDateTime, e.Value.LastUpdatedDateTime, e.Value.RefreshTime, new HLink("Show Contents", "?key=" + e.Key.EncodeUrl()) } ).OrderByDescending(e => (int)(ulong)e[1] * (int)e[2])) { TableHeader = new string[] { "Key", "Request Count", "Response Length", "Last Request Time", "Last Updated Time", "Lifetime", "Contents" } }; } else { ret += new HButton("Show all entries (might take a long time to load)", HButton.EButtonType.button, "?all=true"); } } } return(ret); }
/// <summary> /// Initializes a new instance of the PaintHeaderEventArgs class with /// the specified graphics, column, table, column index, header style /// and clipping rectangle /// </summary> /// <param name="g">The Graphics used to paint the Column header</param> /// <param name="column">The Column to be painted</param> /// <param name="table">The Table the Column's ColumnModel belongs to</param> /// <param name="columnIndex">The index of the Column in the Table's ColumnModel</param> /// <param name="headerStyle">The style of the Column's header</param> /// <param name="headerRect">The Rectangle that represents the rectangle /// in which to paint</param> public PaintHeaderEventArgs(Gdk.Drawable g, Column column, HTable table, int columnIndex, ColumnHeaderStyle headerStyle, Gdk.Rectangle headerRect) { this.column = column; this.table = table; this.columnIndex = columnIndex; this.column = column; this.headerStyle = headerStyle; this.headerRect = headerRect; this.handled = false; }
protected virtual void BuildEntity(List<HField> m_Datas, HTable table, string rootFolder) { string templateString = HOther.ReadTemplate(m_TemplatePath, "entity.cs"); templateString = templateString.Replace("{||ClassName||}", table.ClassName); templateString = templateString.Replace("{||CnName||}", table.CHName); HField fieldPK = m_Datas[0]; templateString = templateString.Replace("{||m_ID||}", "m_" + fieldPK.ENName); templateString = templateString.Replace("{||ID||}", fieldPK.ENName); StringBuilder sb = new StringBuilder(); //FieldListPrivate foreach (HField field in m_Datas) { //protected decimal m_ID; //固定第一个字段是主键 if (field == m_Datas[0]) { sb.Append("private " + " decimal m_" + field.ENName + ";" + Environment.NewLine); } else { string f1 = GetCSType(field); sb.Append("private " + f1 + " m_" + field.ENName + ";" + Environment.NewLine); } } templateString = templateString.Replace("{||FieldListPrivate||}", sb.ToString()); //FieldListInit sb = new StringBuilder(); foreach (HField field in m_Datas) { //m_DATASET_ID = null; //固定第一个字段是主键 if (field == m_Datas[0]) { sb.Append("m_" + field.ENName + "=0;" + Environment.NewLine); } else { sb.Append("m_" + field.ENName + "=null;" + Environment.NewLine); } } templateString = templateString.Replace("{||FieldListInit||}", sb.ToString()); //FieldListPublic sb = new StringBuilder(); foreach (HField field in m_Datas) { sb.Append(@"/// <summary>" + Environment.NewLine); sb.Append(@"/// " + field.CHName + Environment.NewLine); sb.Append(@"/// </summary> " + Environment.NewLine); //固定第一个字段是主键 if (field == m_Datas[0]) { sb.Append(@"public virtual decimal " + field.ENName + Environment.NewLine); sb.Append(@"{" + Environment.NewLine); sb.Append(@"get { return m_" + field.ENName + "; }" + Environment.NewLine); sb.Append(@"set { m_IsChanged |= (m_" + field.ENName + " != value); m_" + field.ENName + " = value; }" + Environment.NewLine); sb.Append(@"}" + Environment.NewLine); } else { if (field.Type == HFieldType.NVARCHAR2) { sb.Append(@"public virtual string " + field.ENName + Environment.NewLine); sb.Append(@"{" + Environment.NewLine); sb.Append(@"get { return m_" + field.ENName + "; }" + Environment.NewLine); sb.Append(@"set " + Environment.NewLine); sb.Append(@"{" + Environment.NewLine); sb.Append(@"if ( value != null)" + Environment.NewLine); if (field.Length > 0) { sb.Append(@"if( value.Length > " + field.Length + ")" + Environment.NewLine); sb.Append("throw new ArgumentOutOfRangeException(\"Invalid value for " + field.ENName + "\", value, value.ToString());" + Environment.NewLine); } sb.Append(@"m_IsChanged |= (m_" + field.ENName + " != value); m_" + field.ENName + " = value;" + Environment.NewLine); sb.Append(@"}" + Environment.NewLine); sb.Append(@"}" + Environment.NewLine); } else { string f1 = GetCSType(field); sb.Append(@"public virtual " + f1 + " " + field.ENName + Environment.NewLine); sb.Append(@"{" + Environment.NewLine); sb.Append(@"get { return m_" + field.ENName + "; }" + Environment.NewLine); sb.Append(@"set { m_IsChanged |= (m_" + field.ENName + " != value); m_" + field.ENName + " = value; }" + Environment.NewLine); sb.Append(@"}" + Environment.NewLine); } } } templateString = templateString.Replace("{||FieldListPublic||}", sb.ToString()); HOther.SaveStringToFile(templateString, rootFolder + "\\" + table.ClassName + ".cs"); }
/// <summary> /// /// </summary> /// <param name="table"></param> internal void SetTable(HTable table) { this.table = table; }
/// <summary> /// Initializes a new instance of the CellFocusEventArgs class with /// the specified source Cell, table, row index, column index and /// cell bounds /// </summary> /// <param name="source">The Cell that Raised the event</param> /// <param name="table">The Table the Cell belongs to</param> /// <param name="row">The Row index of the Cell</param> /// <param name="column">The Column index of the Cell</param> /// <param name="cellRect">The Cell's bounding rectangle</param> public CellFocusEventArgs(Cell source, HTable table, int row, int column, Rectangle cellRect) : base(source, column, row) { this.table = table; this.cellRect = cellRect; }
private void worker_DoWork(object sender, DoWorkEventArgs e) { // Setup table for user entered url for (int t = 0; t < tables.Length; ++t) { tables[t] = new HTable(); if (t < WebCompareModel.Websites.Length) { tables[t].URL = WebCompareModel.Websites[t]; } else { tables[t].URL = wcViewModel.UserURL; } } // if nothings entered in url return if (wcViewModel.UserURL == "") { AddMessage("\nPlease enter a valid URL"); return; } //string[] test = GetWebDataAgility(wcViewModel.UserURL); AddMessage(""); string[] data = null; string[] parsedMessages = null; // Get Data from Websites for (int w = 0; w <= WebCompareModel.Websites.Length; ++w) { if (w != WebCompareModel.Websites.Length) { // Get data AddMessage("\nGETTING data from: " + WebCompareModel.Websites[w]); data = GetWebDataAgility(WebCompareModel.Websites[w]); // Parse each message into AddMessage("\nPARSING data from: " + WebCompareModel.Websites[w]); parsedMessages = WebCompareModel.Parser(data); // Fill respective table AddMessage("\nFILLING TABLE from: " + WebCompareModel.Websites[w] + "\n"); FillTables(data, parsedMessages, w); } else // We are at the last table, aka the User entered table { // Get data AddMessage("\nGETTING data from USER entered webpage"); data = GetWebDataAgility(wcViewModel.UserURL); // Parse each message into AddMessage("\nPARSING data from USER entered webpage"); parsedMessages = WebCompareModel.Parser(data); // Fill respective AddMessage("\nFILLING TABLE from USER entered webpage\n"); FillTables(data, parsedMessages, w); } } // End get data from websites // Calculate cosine vectors AddMessage("\nCALCULATING cosine vectors\n"); for (int tab = 0; tab < tables.Length - 1; ++tab) { // get vector, last table is the user entered table List <object>[] vector = WebCompareModel.BuildVector(tables[tab], tables[tables.Length - 1]); // Calcualte similarity tables[tab].Similarity = WebCompareModel.CosineSimilarity(vector); } // Compare to the entered URL by the user // and display results in order wcViewModel.Results = GetResults(); }
/// <summary> /// Initialise default settings /// </summary> private void Init() { this.rows = null; this.selection = new Selection(this); this.table = null; this.rowHeight = TableModel.DefaultRowHeight; }
/// <summary> /// /// </summary> /// <param name="table"></param> internal void SetTable(HTable table) { this.table = table; }
/// <summary> /// Initializes a new instance of the CellEventArgs class with /// the specified Cell source, column index and row index /// </summary> /// <param name="source">The Cell that Raised the event</param> /// <param name="editor">The CellEditor used to edit the Cell</param> /// <param name="table">The Table that the Cell belongs to</param> public CellEditEventArgs(Cell source, ICellEditor editor, HTable table) : this(source, editor, table, -1, -1, Gdk.Rectangle.Zero) { }