Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
    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);
            }
        }
    }
Exemplo n.º 3
0
    protected void BindData()
    {
        DataTable dt = TableDAL.GetTable("UpInfo", "");

        this.rptrList.DataSource = dt;
        this.rptrList.DataBind();
    }
Exemplo n.º 4
0
    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));
    }
Exemplo n.º 5
0
    protected void BindData()
    {
        DataTable dt = TableDAL.GetTable("ApployInfo", "Status<>-1");

        this.rptrList.DataSource = dt;
        this.rptrList.DataBind();
    }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 9
0
        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);
                }
            }
        }
Exemplo n.º 10
0
        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);
                    }
                }
            }
        }
Exemplo n.º 11
0
        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);
            }
        }
Exemplo n.º 12
0
        /// <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;
                    }
                }
            }
        }
Exemplo n.º 13
0
        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";
            }
        }
Exemplo n.º 14
0
        public void HienthiDanhsachBan()
        {
            dgvtable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
            TableDAL tbmenuDAL = new TableDAL();

            dgvtable.DataSource = tbmenuDAL.getListTable(2);
        }
Exemplo n.º 15
0
        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;
            }
        }
Exemplo n.º 16
0
        /// <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);
        }
Exemplo n.º 17
0
        public static List <TableModel> fillTableList(int id)
        {
            List <TableModel> tables = new List <TableModel>();

            tables = TableDAL.loadTableList(id);

            return(tables);
        }
Exemplo n.º 18
0
        //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";
        }
Exemplo n.º 19
0
        /// <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);
        }
Exemplo n.º 20
0
        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);
        }
Exemplo n.º 21
0
        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];
        }
Exemplo n.º 22
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         try
         {
             this.LoginTitle = TableDAL.GetTable("Config", "DataType=100").Rows[0]["Literal"].ToString();
         }
         catch { }
     }
 }
Exemplo n.º 23
0
        /// <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);
        }
Exemplo n.º 24
0
 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;
 }
Exemplo n.º 25
0
        // 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;
        }
Exemplo n.º 26
0
        /// <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
            { }
        }
Exemplo n.º 27
0
        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";
            }
        }
Exemplo n.º 28
0
        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);
        }
Exemplo n.º 29
0
        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);
            }
        }
Exemplo n.º 30
0
        /// <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);
        }