Exemple #1
0
 private void buttonX1_Click(object sender, EventArgs e)
 {
     try
     {
         //textName.Text = "ADMIN";
         //textPassword.Text = "ADMIN";
         string sql = string.Format("select * from tb_Login where  Name='{0}' and password='******' and Authority='{2}'",
                                    textName.Text.Trim(), textPassword.Text.Trim(), Authority.Text.Trim());
         DataTable dt = SqlServerHelp.Query(sql).Tables[0];
         if (dt.Rows.Count > 0 && dt != null)
         {
             SySetHeip.LoginInfo = Authority.SelectedItem.ToString();
             if (dt.Rows[0]["Authority"].ToString().Trim() == "操作员")
             {
                 SySetHeip.Operate = true;
             }
             else if (dt.Rows[0]["Authority"].ToString().Trim() == "管理员")
             {
                 SySetHeip.Admin = true;
             }
             else if (dt.Rows[0]["Authority"].ToString().Trim() == "工程师")
             {
                 SySetHeip.Engineer = true;
             }
             frm_Authoring f = new frm_Authoring();
             this.Hide();
             f.Show();
         }
         else
         {
             Common.Msg.ShowError("未找到登录的相关信息");
         }
     }
     catch {}
 }
        /// <summary>
        /// 查询数据库已经出站第几个小车
        /// </summary>
        /// <param name="Door"></param>
        /// <returns></returns>
        //10=已经入站,15=已经出站一个小车,20=已经全部出站完
        public static string RunOutInfo(string Door)
        {
            string    Sql = string.Format(@"SELECT * FROM [db_ND10L].[dbo].[dbo.tb_RnuInfo] WHERE Door ='{0}'", Door);
            DataTable dt  = SqlServerHelp.Query(Sql).Tables[0];

            return(dt.Rows[0]["OutAndInInfo"].ToString().Trim());
        }
 public frm_TimeQuery()
 {
     InitializeComponent();
     try
     {
         string sql = string.Format(@"SELECT * FROM [db_ND10L].[dbo].[dbo.tb_RnuInfo]");
         dgvmain.DataSource = SqlServerHelp.Query(sql).Tables[0];
     }
     catch { }
 }
Exemple #4
0
        private void button2_Click(object sender, EventArgs e)
        {
            string sql = string.Format("DELETE FROM[db_ND10L].[dbo].[tb_Login] WHERE ID ='{0}'", Order.Text.Trim());

            SqlServerHelp.ExecuteSql(sql);

            //删除用户
            ControlHelp.ControlHelp.SqlErrorInfo("删除用户" + SetName.Text.Trim() + " " + "权限:" + Authority.Text.Trim() + " " + "序列号:" + Order.Text.Trim());

            string sql1 = string.Format("select * from tb_Login ");

            dgvmain.DataSource = SqlServerHelp.Query(sql1).Tables[0];
        }
Exemple #5
0
        private void Revise_Click(object sender, EventArgs e)
        {
            string sql = string.Format(@"UPDATE [db_ND10L].[dbo].[tb_Login] set Name='{0}' ,password='******',Authority='{2}' where ID='{3}'",
                                       SetName.Text.Trim(), SetPwodr.Text.Trim(), Authority.Text.Trim(), Order.Text.Trim());

            SqlServerHelp.ExecuteSql(sql);

            //修改用户
            ControlHelp.ControlHelp.SqlErrorInfo("修改用户" + SetName.Text.Trim() + " " + "权限:" + Authority.Text.Trim());

            string sql1 = string.Format("select * from tb_Login ");

            dgvmain.DataSource = SqlServerHelp.Query(sql1).Tables[0];
        }
        public DataSet Query(string tableNameSQL, string orderSQL, string conditionSQL)
        {
            DataSet ds = new DataSet();

            string[] names      = tableNameSQL.Split(_separator);
            string[] orders     = null;
            string[] conditions = null;
            if (orderSQL != null)
            {
                orders = orderSQL.Split(_separator);
            }
            if (conditionSQL != null)
            {
                conditions = conditionSQL.Split(_separator);
            }
            for (int i = 0; i < names.Count(); ++i)
            {
                string tableName = TableNamePrex + names[i];
                string strCmd    = "";

                if (conditions != null && i < conditions.Count())
                {
                    string cond = conditions[i];
                    strCmd = getSelectCmd(tableName, cond);
                }
                else
                {
                    strCmd = "SELECT * FROM " + tableName + "";
                }
                if (orders != null && i < orders.Count())
                {
                    strCmd += OrderSQL(orders[i]);
                }
                DataSet _ds = SqlServerHelp.Query(strCmd);
                if (_ds.Tables.Count > 0)
                {
                    DataTable dt = _ds.Tables[0];
                    _ds.Tables.RemoveAt(0);
                    dt.TableName = tableName;
                    ds.Tables.Add(dt);
                }
            }
            return(ds);
        }
Exemple #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(SetName.Text.Trim()) && !string.IsNullOrEmpty(SetPwodr.Text.Trim()) && !string.IsNullOrEmpty(Authority.Text.Trim()))
            {
                string sql = string.Format(@"INSERT INTO [db_ND10L].[dbo].[tb_Login](Name,[password],Authority  ) VALUES('{0}','{1}','{2}')",
                                           SetName.Text.Trim(), SetPwodr.Text.Trim(), Authority.Text.Trim());
                SqlServerHelp.ExecuteSql(sql);

                //增加用户
                ControlHelp.ControlHelp.SqlErrorInfo("增加用户" + SetName.Text.Trim() + " " + "权限:" + Authority.Text.Trim());

                string sql1 = string.Format("select * from tb_Login ");
                dgvmain.DataSource = SqlServerHelp.Query(sql1).Tables[0];
            }
            else
            {
                Common.Msg.Warning("增加的用户,密码,权限,三者之间不能有一个为空");
            }
        }
        /// <summary>
        /// 查询第二个的条形码
        /// </summary>
        /// <param name="door">炉门条件</param>
        /// <returns></returns>
        public static List <string> QueryBarcodeInfo2(string door)
        {
            string    Sql = string.Format(@"SELECT * FROM[db_ND10L].[dbo].[dbo.tb_RnuInfo] WHERE Door = '{0}'", door);
            DataTable bt  = SqlServerHelp.Query(Sql).Tables[0];

            Barcode2 = bt.Rows[0]["Barcode2"].ToString();
            string[]      list     = InterceptStringHelp.SingleCharacter(bt.Rows[0]["BarcodeInclude2"].ToString().Trim());
            List <string> listTemp = new List <string>();

            foreach (string s in list)
            {
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }
                listTemp.Add(s);
            }
            return(listTemp);
        }
Exemple #9
0
        private void Query_Click(object sender, EventArgs e)
        {
            string sql = string.Format("select * from tb_Login ");

            dgvmain.DataSource = SqlServerHelp.Query(sql).Tables[0];
        }