protected bool Log(out int total) { bool hasLoged = false; total = 0; try { DataRow drLog = TableDAL.GetNewNullRow("DownloadLog"); drLog["IPAddress"] = this.Request.UserHostAddress; drLog["Url"] = this.Request.Url.ToString(); drLog["UserId"] = Convert.ToInt32(this.Session["userId"]); drLog["CreatedTime"] = System.DateTime.Now; int count = TableDAL.InsertDataTable(drLog.Table, "DownloadLog"); if (0 < count) { hasLoged = true; } string condition = "url='" + this.Request.Url.ToString() + "'"; total = TableDAL.GetTableCount("DownloadLog", condition); } catch { } return(hasLoged); }
protected void Page_Load(object sender, EventArgs e) { if (!Right.IsAdmmin()) { Response.Redirect("Login.aspx"); return; } try { this.strTitle = TableDAL.GetTable("Config", "DataType=100").Rows[0]["Literal"].ToString(); } catch { } try { Id = Convert.ToInt32(Request["Id"]); } catch { } if (!IsPostBack) { if (0 != this.Id) { Bind(Id); } } }
protected void BindData() { DataTable dt = TableDAL.GetTable("UpInfo", ""); this.rptrList.DataSource = dt; this.rptrList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { try { this.strTitle = TableDAL.GetTable("Config", "DataType=100").Rows[0]["Literal"].ToString(); } catch { } bool logined = false; try { logined = Convert.ToBoolean(this.Session["logined"]); } catch { } if (!logined) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { string condition = "Status <> -1 AND ApployTime <= '" + System.DateTime.Now.ToShortDateString() + " 23:59:59'"; DataTable dtList = TableDAL.GetTable("ApployInfo", condition); this.rptrList.DataSource = dtList; this.rptrList.DataBind(); } Utility.RegisterTypeForAjax(typeof(dlist)); }
protected void BindData() { DataTable dt = TableDAL.GetTable("ApployInfo", "Status<>-1"); this.rptrList.DataSource = dt; this.rptrList.DataBind(); }
public static bool IpIsAllowed(HttpContext context) { bool allow = false; bool enabled = false; try { enabled = Convert.ToBoolean(ConfigurationManager.AppSettings["enableIpAllow"]); } catch { } if (enabled) { string ipAddress = context.Request.UserHostAddress; string sqlWhere = " type=0 and Address = '" + ipAddress + "'"; int bkCount = TableDAL.GetTableCount("IPAllowList", sqlWhere); if (bkCount > 0) { allow = false; } sqlWhere = " type=1 and Address = '" + ipAddress + "'"; int whCount = TableDAL.GetTableCount("IPAllowList", sqlWhere); if (whCount > 0) { allow = true; } } else { allow = true; } return(allow); }
void ImportMapModify_Loaded(object sender, RoutedEventArgs e) { if (DataScript.FileType == "mdb") { AccessImportHelper helper = new AccessImportHelper(sourceFile); columnConnection.Source = helper.getDataTable(); } else if (DataScript.FileType == "db") { columnConnection.Source = SQLiteImportHelper.GetDataTable(sourceFile); } else if (DataScript.FileType == "xls/xlsx") { columnConnection.Source = ExcelImportHelper.GetDataTable(sourceFile); } else { columnConnection.Source = TextImportHelper.GetDataTable(sourceFile, this.DataScriptRule.getColSeperatorChar()); } columnConnection.Target = TableDAL.getTableStructure(this.DataScriptRule.DesTable); columnConnection.BusinessPK = DataScriptRule.DesBusinessPk; columnConnection.FID = FID; columnConnection.ShowComplete += columnConnection_ShowComplete; }
void DataScriptMapModify_Loaded(object sender, RoutedEventArgs e) { // columnConnection.Source = TextImportHelper.GetDataTable(@"G:\workspace\动控实现数据管理\src\TestData\data.txt", ','); //columnConnection.Target = TableDAL.getTableStructure("MDS_IMP_DATA_TEST"); if (DataScript.FileType == "mdb") { AccessImportHelper helper = new AccessImportHelper(this.DataScriptRule.DesFile); columnConnection.Source = helper.getDataTable(); } else if (DataScript.FileType == "db") { columnConnection.Source = SQLiteImportHelper.GetDataTable(this.DataScriptRule.DesFile); } else if (DataScript.FileType == "xls/xlsx") { columnConnection.Source = ExcelImportHelper.GetDataTable(this.DataScriptRule.DesFile); } else { columnConnection.Source = TextImportHelper.GetDataTable(this.DataScriptRule.DesFile, this.DataScriptRule.getColSeperatorChar()); } columnConnection.FID = FID; columnConnection.BusinessPK = this.DataScriptRule.DesBusinessPk; columnConnection.Target = TableDAL.getTableStructure(this.DataScriptRule.DesTable); }
private void dropColumn(string tableName, string[] txtColumnNames, List <Structure> structList) { foreach (var structure in structList) { switch (structure.ColumnName) { case "PROJECTID": case "CREATED_BY": case "CREATION_DATE": case "LAST_UPDATED_BY": case "LAST_UPDATE_DATE": case "TASKTIMES": case "COLUMN0": continue; } switch (structure.Comments) { case "时间": continue; } if (!txtColumnNames.Contains(structure.Comments)) { TableDAL.dropColumn(tableName, structure.ColumnName); } else if (!columnMap.Keys.Contains(structure.ColumnName)) { TableDAL.dropColumn(tableName, structure.ColumnName); } } }
private void Comments() { foreach (DataColumn column in sourceDt.Columns) { if (structures.FirstOrDefault(it => it.Comments == column.ColumnName) == null) { var st = structures.FirstOrDefault(it => string.IsNullOrEmpty(it.Comments)); TableDAL.Comment(dataScript.TableName, st.ColumnName, column.ColumnName); st.Comments = column.ColumnName; if (update.IsChecked.Value) { DataScriptMap map = new DataScriptMap(); map.FID = Guid.NewGuid().ToString().Replace("-", ""); map.MdsImpDataScriptRuleID = dataScript.FID; map.TableColName = st.ColumnName; map.FileColName = column.ColumnName; map.TransferType = "02"; map.CreatedBy = MainWindow.UserID; map.LastUpdatedBy = MainWindow.UserID; map.LastUpdateIp = "127.0.0.1"; DataScriptMapDAL.Insert(map); } } } }
public void LoadTable() { TableDAL tbDAL = new TableDAL(); List <Table> lsTable = tbDAL.getListTable(); foreach (Table table in lsTable) { Button bt = new Button() { Width = 100, Height = 100 }; bt.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; // tu zoom image bt.Text = table.TableName; bt.TextAlign = System.Drawing.ContentAlignment.BottomCenter; if (table.Status == 0) { bt.BackgroundImage = Image.FromFile(Application.StartupPath + "\\IMAGE\\table0.png"); } else { bt.BackgroundImage = Image.FromFile(Application.StartupPath + "\\IMAGE\\table1.png"); } bt.Tag = table; bt.Click += btTable_Click; flpTable.Controls.Add(bt); } }
/// <summary> /// 动态计算对应关系 /// </summary> private void calColumnMap(DataTable dt) { // 获取文件表头 List <string> headers = getHeaders(dt); List <Structure> structures = TableDAL.getTableStructure(this.dataScriptRule.DesTable); foreach (string colName in headers) { // 文件字段在对应关系里面不存在 if (!this.columnMap.ContainsValue(colName)) { var structure = structures.FirstOrDefault(it => it.Comments == colName); if (structure == null) { // 文件字段在表备注中不存在 modifyComment(structures, colName); } else { this.columnMap[structure.ColumnName] = structure.Comments; } } } }
private void btnsua_Click(object sender, EventArgs e) { int key = 0; TableDAL tbmenuDAL = new TableDAL(); DataTable dtmenu = tbmenuDAL.getTableMenu(); Table tbmenu = new Table(); tbmenu.Area = cbxarea.SelectedItem.ToString(); string filterExpression = string.Format("Area='{0}'", tbmenu.Area); DataRow[] rows = dtmenu.Select(filterExpression); if (rows.Length == 0) { tbmenu.TableName = tbtablename.Text; } else { key++; lbloitablename.Text = "*Tên bàn bị trùng"; } tbmenu.Status = 0; if (key == 0) { tbmenuDAL.insertTableMenu(tbmenu); lbnotice1.Text = "sửa thành công"; dgvtable.DataSource = tbmenuDAL.getTableMenu(); } else { lbnotice1.Text = "sửa thất bại"; } }
public void HienthiDanhsachBan() { dgvtable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; TableDAL tbmenuDAL = new TableDAL(); dgvtable.DataSource = tbmenuDAL.getListTable(2); }
private void checkStruct(DataTable dt, DataScript script) { f**k.Visibility = System.Windows.Visibility.Hidden; update.Visibility = System.Windows.Visibility.Hidden; structures = TableDAL.getTableStructure(script.TableName); List <string> difference = new List <string>(); sourceDt = dt; string error = ""; bool havePk = false; foreach (DataColumn column in dt.Columns) { if (structures.FirstOrDefault(it => it.Comments == column.ColumnName) == null) { difference.Add(column.ColumnName); error += column.ColumnName + "\r\n"; } if (column.ColumnName == System.Configuration.ConfigurationManager.AppSettings["pk"]) { havePk = true; } } if (!havePk) { error += string.Format("数据文件中缺少默认主键列({0}),请重新选择正确数据文件!\r\n", ConfigurationManager.AppSettings["pk"]); } var dsms = DataScriptMapDAL.getList(script.FID); if (difference.Count * 10 / dsms.Count >= 6) { string msg = "您选择的数据文件与解析器严重不匹配,请重新选择数据文件!\r\n差异字段:\r\n"; msg += error; MessageBox.Show(msg); f**k.Visibility = System.Windows.Visibility.Visible; update.Visibility = System.Windows.Visibility.Visible; btNext.Visibility = System.Windows.Visibility.Collapsed; } else if (difference.Count > 0) { string msg = "您选择的数据文件与解析器不匹配,差异字段:\r\n"; msg += error; MessageBox.Show(msg); f**k.Visibility = System.Windows.Visibility.Visible; update.Visibility = System.Windows.Visibility.Visible; btNext.Visibility = System.Windows.Visibility.Collapsed; } }
/// <summary> /// searches for all tables within associated building by ID via TableDAL.LoadTableList(buildingID); /// Returns list of TableModels /// </summary> public static List <TableModel> FillTableList(int buildingID) { List <TableModel> tables = new List <TableModel>(); tables = TableDAL.LoadTableList(buildingID); return(tables); }
public static List <TableModel> fillTableList(int id) { List <TableModel> tables = new List <TableModel>(); tables = TableDAL.loadTableList(id); return(tables); }
//hiển thị danh sách bàn trống public void loadTable() { TableDAL tableDAL = new TableDAL(); cbTable.DataSource = tableDAL.getListTable(0); cbTable.DisplayMember = "TableName"; cbTable.ValueMember = "id"; }
/// <summary> /// searches for a table by tableID via TableDAL.LoadTableByID(tableID); /// returns tableModel /// </summary> public static TableModel GetTableByID(int tableID) { TableModel table = new TableModel(); table = TableDAL.LoadTableByID(tableID); return(table); }
private void btThanhToan_Click(object sender, EventArgs e) { MessageBox.Show(table.TableName + " đã thanh toán số tiền là : " + total, "Thông báo"); // gọi proc thanh toan TableDAL tableDAL = new TableDAL(); tableDAL.ThanhToan(this.table.Id, this.table.Status); }
protected void searchButton_Click(Object sender, EventArgs e) { string tableID = inptable.Value; List <string> record = new List <string>(); record = TableDAL.LoadTable(tableID); lblTableID.Text = record[0]; INroomID.Value = record[1]; inpersonCapacity.Value = record[2]; inCatagory.Value = record[3]; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { this.LoginTitle = TableDAL.GetTable("Config", "DataType=100").Rows[0]["Literal"].ToString(); } catch { } } }
/// <summary> /// checks avalibility of table by tableID, Hour and Date via TableDAL.CheckTableHourAvailability(TableID, Hour, dateTime); /// returns bool if avaliable or not /// </summary> public static bool CheckTableHourAvailability(int TableID, int Hour, DateTime dateTime) { bool bCheckHour = TableDAL.CheckTableHourAvailability(TableID, Hour, dateTime); if (bCheckHour == true) { return(true); } return(false); }
public static bool HasRole(int roleId, int userId) { bool has = false; string condition = "UserID=" + userId + " AND RoleID=" + roleId; int count = TableDAL.GetTableCount("UserRole", condition); if (0 < count) { has = true; } return has; }
// action button ChuyenBan private void btChuyenBan_Click(object sender, EventArgs e) { int idNewTable = Convert.ToInt32(cbTable.SelectedValue.ToString()); TableDAL tableDAL = new TableDAL(); tableDAL.ChuyenBan(this.table.Id, idNewTable); this.table = tableDAL.getTableById(idNewTable); lbTableName.Text = this.table.TableName; }
/// <summary> /// adds a new table by tableModel via TableDAL.AddNewTable(table); /// </summary> public static void ProcessAddNewTable(TableModel table) { TableModel newTable = table; try { TableDAL.AddNewTable(table); } catch { } }
private void btnthem_Click(object sender, EventArgs e) { int key = 0; TableDAL tablemenuDAL = new TableDAL(); Table tablemenu = new Table(); if (tbid.TextLength != 0) { key++; lbloiid.Text = "không cần nhập Id"; } if (tbArea.TextLength != 0) { tablemenu.Area = tbArea.Text; } else { key++; lbloiArea.Text = "Chưa Nhập Khu Vực"; } DataTable tablemenu_Area = tablemenuDAL.getTableMenu_Area(tablemenu.Area); string filterExpression = string.Format("TableName='{0}'", tbtablename.Text); DataRow[] rows = tablemenu_Area.Select(filterExpression); if (rows.Length == 0) { tablemenu.TableName = tbtablename.Text; } else { key++; lbloitablename.Text = "*Tên bàn bị trùng"; } if (tbstatus.TextLength != 0) { tablemenu.Status = Convert.ToInt16(tbstatus.Text); } else { tablemenu.Status = 0; } if (key == 0) { tablemenuDAL.insertTableMenu(tablemenu); lbnotice1.Text = "Thêm bàn thành công"; dgvtable.DataSource = tablemenuDAL.getTableMenu(); } else { lbnotice1.Text = "Thêm bàn thất bại"; } }
public FrmOrder(int idtable) { InitializeComponent(); TableDAL tbDAL = new TableDAL(); this.table = tbDAL.getTableById(idtable); lbTableName.Text = this.table.TableName; loadTable(); loadCategory(); loadBill(this.table.Status); }
private string getTableName(string projectcode, int index) { string tablename = string.Format("TBL_{0}_DATA{1}", projectcode, index).Replace('-', '_').ToUpper(); if (TableDAL.getTableStructure(tablename).Count > 0) { return(getTableName(projectcode, index + 1)); } else { return(tablename); } }
/// <summary> /// 当试验次数重复时候,是更新逻辑这里为true,那么注意一下表名,用临时表名 /// </summary> /// <returns></returns> private bool checkTestTimes() { int count = TableDAL.removeDataRow(this.dataScriptRule.DesTable, this.taskInfo.id, this.times); return(false); // 判断本次试验,有没有解析器执行过 if (DataLogDAL.getList(this.taskInfo.id).Count(it => Convert.ToInt32(it.Version) == this.times) > 0) { return(false); } return(false); }