Ejemplo n.º 1
0
 public FormBatch(SqlStructure structure, string[] folders = null)
 {
     this.structure          = structure;
     _currentProjectRootPath = DTEHelper.GetSelectedProjectPath();;
     _currentProject         = DTEHelper.GetSelectedProject();
     InitializeComponent();
 }
Ejemplo n.º 2
0
        private void InitailData()
        {
            if (this.DesignMode == false && _sqlSource != null && _sqlSource.UsingConfig)//配置语句
            {
                SqlConnection _SqlConnection1 = SqlStructure.GetSqlConncetion();

                if (_SqlConnection1 == null || _SqlConnection1.State != ConnectionState.Open)
                {
                    MessageBox.Show("连接错误");
                    return;
                }
                SqlCommand thisCommand = _SqlConnection1.CreateCommand();
                thisCommand.CommandText = _sqlSource.ConfigSql;

                //PMS.Libraries.ToolControls.PMSPublicInfo.Message.Info(PMS.Libraries.ToolControls.PMSPublicInfo.CurrentPrjInfo.CurrentLoginUserID, thisCommand.CommandText, false);
                SqlDataReader thisReader = null;
                try
                {
                    thisReader = thisCommand.ExecuteReader();
                    thisCommand.Dispose();
                }
                catch (Exception ec)
                {
                    MessageBox.Show(ec.Message);
                    thisCommand.Dispose();
                    thisReader.Close();
                    return;
                }
                Series series1 = new Series();
                series1.Name      = _sqlSource.XAixsies[0];
                series1.ChartArea = "ChartArea1";
                base.Series.Add(series1);
                //base.Series[_sqlSource.XAixsies[0]].Points.DataBindXY(thisReader, , thisReader, _sqlSource.YAixs[0]);
                base.DataSource = thisReader;
                base.Series[_sqlSource.XAixsies[0]].XValueMember  = _sqlSource.XAixsies[0];
                base.Series[_sqlSource.XAixsies[0]].YValueMembers = _sqlSource.YAixs[0];
                base.DataBind();

                thisReader.Close();
            }
        }
Ejemplo n.º 3
0
 public FormBatchView(SqlStructure structure)
 {
     this.structure = structure;
     InitializeComponent();
 }
Ejemplo n.º 4
0
        private int ConnectSqlServer(string myServerName
                                     , string myDBName
                                     , string userId
                                     , string passWord)
        {
            if (string.IsNullOrEmpty(myServerName))
            {
                string strText    = GetStringFromPublicResourceClass.GetStringFromPublicResource("PMSDBServerNULL");
                string strCaption = GetStringFromPublicResourceClass.GetStringFromPublicResource("PMS_Warnning");
                MessageBox.Show(strText, strCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(0);
            }

            if (string.IsNullOrEmpty(myDBName))
            {
                string strText    = GetStringFromPublicResourceClass.GetStringFromPublicResource("PMSDBDBNameNULL");
                string strCaption = GetStringFromPublicResourceClass.GetStringFromPublicResource("PMS_Warnning");
                MessageBox.Show(strText, strCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(0);
            }

            if (string.IsNullOrEmpty(userId))
            {
                string strText    = GetStringFromPublicResourceClass.GetStringFromPublicResource("PMSDBUserIDNULL");
                string strCaption = GetStringFromPublicResourceClass.GetStringFromPublicResource("PMS_Warnning");
                MessageBox.Show(strText, strCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(0);
            }

            ConnectType iProtocolType = (ConnectType)(1);

            string portID = "1433";

            //string strConnect = "Data Source=" + myServerName +
            //        ";Initial Catalog=" + myDBName +
            //        ";User Id=" + userId +
            //        ";Password="******";";

            try
            {
                //SqlStructure sqlStructure = new SqlStructure(myServerName, myDBName, userId, passWord, iProtocolType, portID);
                SqlStructure.InitSqlStructure(myServerName, myDBName, userId, passWord, iProtocolType, portID);

                SqlConnection _conn = SqlStructure.GetSqlConncetion();
                if (_conn == null)
                {
                    return(0);
                }
                if (!SqlStructure.ConnectSMOServer())
                {
                    return(0);
                }
            }
            catch (System.Data.SqlClient.SqlException ex)
            {
                MessageBox.Show(ex.ToString());
                return(0);
            }

            return(1);
        }