コード例 #1
0
ファイル: GNLB.cs プロジェクト: LGpan/myGit
        //删除2016-12-19
        private void button3_Click(object sender, EventArgs e)
        {
            //List<string> list = new List<string>();
            string        code     = string.Empty;
            string        lsSql    = string.Empty;
            StringBuilder loString = new StringBuilder();

            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if (dataGridView1.Rows[i].Cells["SC"].Value == null)  //第一次 都是null
                {
                    dataGridView1.Rows[i].Cells["SC"].Value = "0";
                }
                if (dataGridView1.Rows[i].Cells["SC"].Value.ToString() == "1")
                {
                    //MessageBox.Show(dataGridView1.Rows[i].Cells["Code"].Value.ToString());
                    code = dataGridView1.Rows[i].Cells["Code"].Value.ToString();
                    //list.Add(code);
                    lsSql = "Delete PMP000101 where Code='" + code + "' ";
                    loString.AppendLine(lsSql);
                }
            }

            lsSql = loString.ToString();
            if (!string.IsNullOrEmpty(lsSql))
            {
                SqlHelperXhf loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom);
                loSqlHelperXhf.ExecuteNonQuery(lsSql);
            }
            else
            {
                MessageBox.Show("没有任何选中数据!");
            }
            button1_Click(null, null);
        }
コード例 #2
0
ファイル: SJKZD.cs プロジェクト: LGpan/myGit
        private void showZD()
        {
            ZDEntity zdEntity = new ZDEntity();

            tbTB.Text   = tb;
            zdEntity.tb = tbTB.Text.Trim();
            StringBuilder sql            = new StringBuilder();
            string        lsSql          = string.Empty;
            SqlHelperXhf  loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom);

            //gnlb.name = tbName.Text.Trim();
            //gnlb.zygn = tbZYGN.Text.Trim();
            //gnlb.pt = tbPT.Text.Trim();
            //gnlb.xt = cbXT.Text.Trim();
            sql.Append("Select t10.XT,t10.SJK,t10.TB,t10.TBMS,t10.ZD,t10.ZDMS,t10.ISKEY,t10.KJLX,,t10.SM,,t10.DATATYPE,,t10.SFWK from PMP000901 t10 where 1=1 ");
            if (!string.IsNullOrEmpty(zdEntity.tb))
            {
                sql.Append(" and TB like '%" + zdEntity.tb + "%'");
            }
            DataTable loDt = loSqlHelperXhf.ExecuteDataTable(lsSql);

            SJKZDGrid.Columns["jkdgXT"].DataPropertyName     = "XT";
            SJKZDGrid.Columns["jkdgGN"].DataPropertyName     = "GNDM";
            SJKZDGrid.Columns["jkdgGNMC"].DataPropertyName   = "GNMC";
            SJKZDGrid.Columns["jkdgJKDM"].DataPropertyName   = "JKDM";
            SJKZDGrid.Columns["jkgdJKMC"].DataPropertyName   = "JKMC";
            SJKZDGrid.Columns["jkgdJKGNMS"].DataPropertyName = "JKGNMS";
            SJKZDGrid.Columns["resquest"].DataPropertyName   = "REQUEST";
            SJKZDGrid.Columns["response"].DataPropertyName   = "RESPONSE";
            SJKZDGrid.Columns["jkdgFWLJ"].DataPropertyName   = "FWLJ";
            SJKZDGrid.Columns["jkdgJKDYR"].DataPropertyName  = "JKDYR";
            SJKZDGrid.Columns["jkdgCZPT"].DataPropertyName   = "PT";
            SJKZDGrid.AutoGenerateColumns = false;
            SJKZDGrid.DataSource          = loDt;
        }
コード例 #3
0
ファイル: GNLB.cs プロジェクト: LGpan/myGit
        /// <summary>
        /// 绑定系统下拉框
        /// </summary>
        private void BindXT()
        {
            DataTable    dtXT           = new DataTable();
            string       sql            = "select XTDM from PMP000301";
            SqlHelperXhf loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom);

            dtXT = loSqlHelperXhf.ExecuteDataTable(sql);
            cmb_Temp.ValueMember = "XTDM";
            //cmb_Temp.DisplayMember = "Name";
            cmb_Temp.DataSource    = dtXT;
            cmb_Temp.DropDownStyle = ComboBoxStyle.DropDownList;
        }
コード例 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string lsPassWord, lsUserId;

            lsUserId   = textBox1.Text;
            lsPassWord = textBox2.Text;
            if (!string.IsNullOrEmpty(lsUserId))
            {
                lsUserId = lsUserId.Trim();
            }
            if (string.IsNullOrEmpty(lsUserId))
            {
                MessageBox.Show("用户名不能为空");
                return;
            }
            if (!string.IsNullOrEmpty(lsPassWord))
            {
                lsPassWord = lsPassWord.Trim();
            }
            if (string.IsNullOrEmpty(lsPassWord))
            {
                MessageBox.Show("密码不能为空");
                return;
            }
            Comm.login = this;
            Comm.isDL  = true;
            //用户登陆2016-12-19
            string lsSql;

            lsSql = "SELECT *  from PMP000201 where YHMD='" + lsUserId + "' and MM='" + lsPassWord + "'";
            SqlHelperXhf  loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom);
            SqlDataReader rd             = loSqlHelperXhf.ExecuteReader(lsSql);

            if (rd.Read())
            {
                Main loMain = new Main();
                loMain.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("用户名或密码错误", "警告", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            rd.Close();
        }
コード例 #5
0
ファイル: GNLB.cs プロジェクト: LGpan/myGit
        //private string code = null;
        //private string name = null;
        //private string zygn = null;
        //private string pt = null;
        //private string lx = null;
        //private string createDate = null;
        //private string cjyh = null;
        //private string updateDate = null;
        //private string gxyh = null;
        //private string xt = null;

        //查询
        private void button1_Click(object sender, EventArgs e)
        {
            GNLBEntity    gnlb = new GNLBEntity();
            string        lsSql;
            StringBuilder sql = new StringBuilder();

            gnlb.code = tbCode.Text.Trim();
            gnlb.name = tbName.Text.Trim();
            gnlb.zygn = tbZYGN.Text.Trim();
            gnlb.pt   = tbPT.Text.Trim();
            gnlb.xt   = cbTX.Text.Trim();
            //createDate = tbCode.Text.Trim();
            //cjyh = tbCode.Text.Trim();
            //updateDate = tbCode.Text.Trim();
            gnlb.gxyh = tbGXYH.Text.Trim();
            sql.Append("Select t10.XT,t10.Code,t10.Name,t10.ZYGN,t10.PT,t10.LX,t10.CreateDate,t10.CJYH,t10.UpdateDate,t10.GXYH from PMP000101 t10 where 1=1 ");
            //lsSql = "Select t10.XT,t10.Code,t10.Name,t10.ZYGN,t10.PT,t10.LX,t10.CreateDate,t10.CJYH,t10.UpdateDate,t10.GXYH from PMP000101 t10";
            if (!string.IsNullOrEmpty(gnlb.code))
            {
                sql.Append(" and Code like '%" + gnlb.code + "%'");
            }
            if (!string.IsNullOrEmpty(gnlb.name))
            {
                sql.Append(" and Name like '%" + gnlb.name + "%'");
            }
            if (!string.IsNullOrEmpty(gnlb.zygn))
            {
                sql.Append(" and ZYGN like '%" + gnlb.zygn + "%'");
            }
            if (!string.IsNullOrEmpty(gnlb.pt))
            {
                sql.Append(" and PT like '%" + gnlb.pt + "%'");
            }
            if (!string.IsNullOrEmpty(gnlb.createDate))
            {
                sql.Append(" and CreateDate like '%" + gnlb.createDate + "%'");
            }
            if (!string.IsNullOrEmpty(gnlb.gxyh))
            {
                sql.Append(" and GXYH like '%" + gnlb.gxyh + "%'");
            }
            if (!string.IsNullOrEmpty(gnlb.xt))
            {
                sql.Append(" and GXYH like '%" + gnlb.xt + "%'");
            }
            SqlHelperXhf loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom);

            lsSql = sql.ToString();
            DataTable loDt = loSqlHelperXhf.ExecuteDataTable(lsSql);

            dataGridView1.Columns["XT"].DataPropertyName         = "XT";
            dataGridView1.Columns["Code"].DataPropertyName       = "Code";
            dataGridView1.Columns["U_Name"].DataPropertyName     = "Name";
            dataGridView1.Columns["ZYGN"].DataPropertyName       = "ZYGN";
            dataGridView1.Columns["PT"].DataPropertyName         = "PT";
            dataGridView1.Columns["GNLX"].DataPropertyName       = "LX";
            dataGridView1.Columns["CreateDate"].DataPropertyName = "CreateDate";
            dataGridView1.Columns["CJYH"].DataPropertyName       = "CJYH";
            dataGridView1.Columns["UpdateDate"].DataPropertyName = "UpdateDate";
            dataGridView1.Columns["GXYH"].DataPropertyName       = "GXYH";

            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = loDt;
        }
コード例 #6
0
ファイル: GNLB.cs プロジェクト: LGpan/myGit
        //保存
        private void button2_Click(object sender, EventArgs e)
        {
            GNLBEntity    gnlb     = new GNLBEntity();
            string        lsSql    = string.Empty;
            StringBuilder loString = new StringBuilder();

            try
            {
                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    if (dataGridView1.Rows[i].Cells["SC"].Value == null)  //第一次 都是null
                    {
                        dataGridView1.Rows[i].Cells["SC"].Value = "0";
                    }
                    if (dataGridView1.Rows[i].Cells["SC"].Value.ToString() == "1")
                    {
                        gnlb.code       = dataGridView1.Rows[i].Cells["Code"].Value.ToString();
                        gnlb.name       = dataGridView1.Rows[i].Cells["U_Name"].Value.ToString();
                        gnlb.zygn       = dataGridView1.Rows[i].Cells["ZYGN"].Value.ToString();
                        gnlb.xt         = dataGridView1.Rows[i].Cells["XT"].Value.ToString();
                        gnlb.pt         = dataGridView1.Rows[i].Cells["PT"].Value.ToString();
                        gnlb.lx         = dataGridView1.Rows[i].Cells["GNLX"].Value.ToString();
                        gnlb.createDate = dataGridView1.Rows[i].Cells["CreateDate"].Value.ToString();
                        gnlb.cjyh       = dataGridView1.Rows[i].Cells["CJYH"].Value.ToString();
                        gnlb.gxyh       = dataGridView1.Rows[i].Cells["GXYH"].Value.ToString();
                        if (string.IsNullOrEmpty(gnlb.code))
                        {
                            throw new Exception("功能代码不能为空");
                        }
                        if (string.IsNullOrEmpty(gnlb.name))
                        {
                            throw new Exception("功能名称不能为空");
                        }
                        if (string.IsNullOrEmpty(gnlb.pt))
                        {
                            throw new Exception("平台不能为空");
                        }
                        if (string.IsNullOrEmpty(gnlb.cjyh))
                        {
                            throw new Exception("创建用户不能为空");
                        }
                        string       sql            = "Select count(*) from PMP000101 t10 where Code='" + gnlb.code + "' ";
                        SqlHelperXhf loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom);

                        if (Convert.ToInt32(loSqlHelperXhf.ExecuteScalar(sql)) == 0)
                        {
                            lsSql = @"Insert into PMP000101(Code,Name,XT,ZYGN,PT,LX,CreateDate,UpdateDate,CJYH,GXYH) values
                          ('" + gnlb.code + "','" + gnlb.name + "','" + gnlb.xt + "','" + gnlb.zygn + "','" + gnlb.pt + "','" + gnlb.lx + "','" + System.DateTime.Now + "','','" + gnlb.cjyh + "','" + gnlb.gxyh + "')";
                        }
                        else
                        {
                            lsSql = "update PMP000101 set Name='" + gnlb.name + "',XT='" + gnlb.xt + "',ZYGN='" + gnlb.zygn + "',PT='" + gnlb.pt + "',LX='" + gnlb.lx + "',CreateDate='" + gnlb.createDate + "',UpdateDate='" + System.DateTime.Now + "',CJYH='" + gnlb.cjyh + "',GXYH='" + gnlb.gxyh + "' where Code='" + gnlb.code + "' ";
                        }

                        loString.AppendLine(lsSql);
                    }
                }
                lsSql = loString.ToString();
                if (!string.IsNullOrEmpty(lsSql))
                {
                    SqlHelperXhf loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom);
                    loSqlHelperXhf.ExecuteNonQuery(lsSql);
                }
                else
                {
                    MessageBox.Show("没有任何选中数据!");
                }
                button1_Click(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #7
0
        public void ShowGNZSJ()
        {
            tbCode.Text = code;
            TableEntity   tableEntity = new TableEntity();
            string        lsSql;
            string        lsSql2;
            string        lsSql3;
            StringBuilder sql  = new StringBuilder();
            StringBuilder sql2 = new StringBuilder();
            StringBuilder sql3 = new StringBuilder();

            tableEntity.gndm = tbCode.Text.Trim();
            //gnlb.name = tbName.Text.Trim();
            //gnlb.zygn = tbZYGN.Text.Trim();
            //gnlb.pt = tbPT.Text.Trim();
            //gnlb.xt = cbXT.Text.Trim();
            sql.Append("Select t10.XT,t10.GNDM,t10.GNMC,t10.SJK,t10.TABLENAME,t10.TB,t10.ZYGN,t10.PT from PMP000401 t10 where 1=1 ");
            sql2.Append("Select t10.XT,t10.GNDM,t10.GNMC,t10.YMDM,t10.YMLJ,t10.YMGNMS from PMP000501 t10 where 1=1 ");
            sql3.Append("Select t10.XT,t10.GNDM,t10.GNMC,t10.JKDM,t10.JKMC,t10.JKGNMS,t10.REQUEST,t10.RESPONSE,t10.FWLJ,t10.JKDYR,t10.PT from PMP000601 t10 where 1=1 ");
            //lsSql = "Select t10.XT,t10.Code,t10.Name,t10.ZYGN,t10.PT,t10.LX,t10.CreateDate,t10.CJYH,t10.UpdateDate,t10.GXYH from PMP000101 t10";
            if (!string.IsNullOrEmpty(tableEntity.gndm))
            {
                sql.Append(" and GNDM like '%" + tableEntity.gndm + "%'");
                sql2.Append(" and GNDM like '%" + tableEntity.gndm + "%'");
                sql3.Append(" and GNDM like '%" + tableEntity.gndm + "%'");
            }
            //if (!string.IsNullOrEmpty(gnlb.name))
            //    sql.Append(" and GNMC like '%" + gnlb.name + "%'");
            //if (!string.IsNullOrEmpty(gnlb.zygn))
            //    sql.Append(" and SJK like '%" + gnlb.zygn + "%'");
            //if (!string.IsNullOrEmpty(gnlb.pt))
            //    sql.Append(" and TABLENAME like '%" + gnlb.pt + "%'");
            //if (!string.IsNullOrEmpty(gnlb.createDate))
            //    sql.Append(" and TB like '%" + gnlb.createDate + "%'");
            //if (!string.IsNullOrEmpty(gnlb.gxyh))
            //    sql.Append(" and ZYGN like '%" + gnlb.gxyh + "%'");
            //if (!string.IsNullOrEmpty(gnlb.xt))
            //    sql.Append(" and PT like '%" + gnlb.xt + "%'");
            SqlHelperXhf loSqlHelperXhf = new SqlHelperXhf(Comm.ConnStringFrom);

            lsSql  = sql.ToString();
            lsSql2 = sql2.ToString();
            lsSql3 = sql3.ToString();
            DataTable loDt  = loSqlHelperXhf.ExecuteDataTable(lsSql);
            DataTable loDt2 = loSqlHelperXhf.ExecuteDataTable(lsSql2);
            DataTable loDt3 = loSqlHelperXhf.ExecuteDataTable(lsSql3);

            dataGridView1.Columns["XT"].DataPropertyName       = "XT";
            dataGridView1.Columns["gn"].DataPropertyName       = "GNDM";
            dataGridView1.Columns["GNMC"].DataPropertyName     = "GNMC";
            dataGridView1.Columns["DataBase"].DataPropertyName = "SJK";
            dataGridView1.Columns["BMC"].DataPropertyName      = "TABLENAME";
            dataGridView1.Columns["Table1"].DataPropertyName   = "TB";
            dataGridView1.Columns["dgZYGN"].DataPropertyName   = "ZYGN";
            dataGridView1.Columns["dgPT"].DataPropertyName     = "PT";
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = loDt;

            dataGridView2.Columns["pgdgXT"].DataPropertyName     = "XT";
            dataGridView2.Columns["pgdgGN"].DataPropertyName     = "GNDM";
            dataGridView2.Columns["pgdgGNMC"].DataPropertyName   = "GNMC";
            dataGridView2.Columns["pgdgYMDM"].DataPropertyName   = "YMDM";
            dataGridView2.Columns["pgdgYMLJ"].DataPropertyName   = "YMLJ";
            dataGridView2.Columns["pgdgYMGNMS"].DataPropertyName = "YMGNMS";
            dataGridView2.AutoGenerateColumns = false;
            dataGridView2.DataSource          = loDt2;

            dataGridView3.Columns["jkdgXT"].DataPropertyName     = "XT";
            dataGridView3.Columns["jkdgGN"].DataPropertyName     = "GNDM";
            dataGridView3.Columns["jkdgGNMC"].DataPropertyName   = "GNMC";
            dataGridView3.Columns["jkdgJKDM"].DataPropertyName   = "JKDM";
            dataGridView3.Columns["jkgdJKMC"].DataPropertyName   = "JKMC";
            dataGridView3.Columns["jkgdJKGNMS"].DataPropertyName = "JKGNMS";
            dataGridView3.Columns["resquest"].DataPropertyName   = "REQUEST";
            dataGridView3.Columns["response"].DataPropertyName   = "RESPONSE";
            dataGridView3.Columns["jkdgFWLJ"].DataPropertyName   = "FWLJ";
            dataGridView3.Columns["jkdgJKDYR"].DataPropertyName  = "JKDYR";
            dataGridView3.Columns["jkdgCZPT"].DataPropertyName   = "PT";
            dataGridView3.AutoGenerateColumns = false;
            dataGridView3.DataSource          = loDt3;
        }