当前位置: 首页>>代码示例>>C#>>正文


C# Connection.Connect方法代码示例

本文整理汇总了C#中Scheduler.BusinessLayer.Connection.Connect方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.Connect方法的具体用法?C# Connection.Connect怎么用?C# Connection.Connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scheduler.BusinessLayer.Connection的用法示例。


在下文中一共展示了Connection.Connect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CalendarExists

        public bool CalendarExists()
        {
            string strSql = "";
            SqlCommand com = null;
            Connection con = null;
            try {
                strSql = "Select Count(*) From [CalendarEvent] " +
                    "WHERE [EventID][email protected] ";

                con = new Connection();
                con.Connect();
                com = new SqlCommand();
                com.Connection = con.SQLCon;
                com.CommandText = strSql;

                com.Parameters.Add(new SqlParameter("@EventID", SqlDbType.Int));
                com.Parameters["@EventID"].Value = EventID;

                object o = com.ExecuteScalar();
                if (Convert.ToInt32(o) > 0) {
                    return true;
                }

                return false;
            } catch (SqlException ex) {
                Message = ex.Message;
                return false;
            } finally {
                if (com != null) {
                    com.Dispose();
                    com = null;
                    con.DisConnect();
                }
            }
        }
开发者ID:gregggdavis,项目名称:schedww2,代码行数:35,代码来源:clsEvnets.cs

示例2: GetData

        public void GetData(DateTime startdate, DateTime enddate, bool isnull,DataSet1 ds)
        {
            string strSql = "";
            SqlCommand com = null;
            Connection con = null;
            try
            {
                strSql = "GetPayrollByInstructor";

                con = new Connection();
                con.Connect();
                com = new SqlCommand();
                com.CommandType = CommandType.StoredProcedure;
                com.Connection = con.SQLCon;
                com.CommandText = strSql;

                com.Parameters.Add(new SqlParameter("StartDateTime", SqlDbType.DateTime));
                if (isnull)
                    com.Parameters["StartDateTime"].Value = DBNull.Value;
                else
                    com.Parameters["StartDateTime"].Value = startdate;
                com.Parameters.Add(new SqlParameter("EndDateTime", SqlDbType.DateTime));
                if (isnull)
                    com.Parameters["EndDateTime"].Value = DBNull.Value;
                else
                    com.Parameters["EndDateTime"].Value = enddate;
                SqlDataReader reader = com.ExecuteReader();
                ds.GetPayrollByInstructor.Clear();
                ds.GetPayrollByInstructor.Load(reader, LoadOption.OverwriteChanges);
                DataSet1.GetPayrollByInstructorDataTable table = new DataSet1.GetPayrollByInstructorDataTable();
                foreach (DataSet1.GetPayrollByInstructorRow row in ds.GetPayrollByInstructor.Rows)
                {
                    #region Adding to temptable
                    System.Data.DataRow[] olddr = ds.GetPayrollByInstructor.Select("TeacherID = " + row.TeacherID);
                    System.Data.DataRow[] newdr = table.Select("TeacherID = " + row.TeacherID);
                    if (olddr.Length != 4)
                    {
                        int total = newdr.Length + olddr.Length;
                        if(total != 4)
                        {
                            bool evefound = false, morfound = false, dayfound = false, satfound = false;
                            foreach (DataSet1.GetPayrollByInstructorRow srow in olddr)
                            {
                                switch (srow.DayType)
                                {
                                    case "Evening":
                                        evefound = true;
                                        break;
                                    case "Morning":
                                        morfound = true;
                                        break;
                                    case "Saturday":
                                        satfound = true;
                                        break;
                                    case "Daytime":
                                        dayfound = true;
                                        break;
                                }

                            }
                            foreach (DataSet1.GetPayrollByInstructorRow srow in newdr)
                            {
                                switch (srow.DayType)
                                {
                                    case "Evening":
                                        evefound = true;
                                        break;
                                    case "Morning":
                                        morfound = true;
                                        break;
                                    case "Saturday":
                                        satfound = true;
                                        break;
                                    case "Daytime":
                                        dayfound = true;
                                        break;
                                }
                            }
                            if (!dayfound)
                                table.AddGetPayrollByInstructorRow(row.TeacherID, row.InstructorName, Convert.ToDecimal(0.00), Convert.ToDecimal(1.0), row.BasePayField, Convert.ToDecimal(0.00), "Daytime");
                            if (!satfound)
                                table.AddGetPayrollByInstructorRow(row.TeacherID, row.InstructorName, Convert.ToDecimal(0.00), Convert.ToDecimal(1.2), row.BasePayField, Convert.ToDecimal(0.00), "Saturday");
                            if (!morfound)
                                table.AddGetPayrollByInstructorRow(row.TeacherID, row.InstructorName, Convert.ToDecimal(0.00), Convert.ToDecimal(1.1), row.BasePayField, Convert.ToDecimal(0.00), "Morning");
                            if (!evefound)
                                table.AddGetPayrollByInstructorRow(row.TeacherID, row.InstructorName, Convert.ToDecimal(0.00), Convert.ToDecimal(1.2), row.BasePayField, Convert.ToDecimal(0.00), "Evening");

                        }
                    }
                    #endregion
                }
                foreach (DataSet1.GetPayrollByInstructorRow row in table)
                {
                    ds.GetPayrollByInstructor.AddGetPayrollByInstructorRow(row.TeacherID, row.InstructorName, row.TotalHours, row.HourlyRate, row.BasePayField, row.Total, row.DayType);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
//.........这里部分代码省略.........
开发者ID:gregggdavis,项目名称:schedww2,代码行数:101,代码来源:clsPayrollByInstructor.cs

示例3: getOccurrenceCount

        public string getOccurrenceCount(int eventid)
        {
            SqlCommand com = null;
            Connection con = null;
            //SqlDataReader Reader = null;
            string strSQL = string.Empty;
            string strResult = string.Empty;
            int result1;
            int result2;
            try
            {
                strSQL = "Select Count(*) from [CalendarEvent] WHERE [email protected] AND StartDateTime < GetDate() AND CalendarEventStatus = 0;";
                con = new Connection();
                con.Connect();
                com = new SqlCommand(strSQL, con.SQLCon);
                com.Parameters.Add(new SqlParameter("@EventId", SqlDbType.Int));
                com.Parameters["@EventId"].Value = eventid;
                result1 = (int)com.ExecuteScalar();

                //strSQL = "Select Count(*) from [CalendarEvent] WHERE [email protected] AND EndDateTime >= GetDate() AND CalendarEventStatus = 0;";
                strSQL = "Select Count(*) from [CalendarEvent] WHERE [email protected] AND CalendarEventStatus = 0;";
                com.CommandText = strSQL;
                //com.Parameters["@EventId"].Value = eventid;
                result2 = (int)com.ExecuteScalar();

                //strResult = result1.ToString() + " / " + (result1 + result2).ToString();
                strResult = result1.ToString() + " / " + (result2).ToString();

                return strResult;
            }
            catch (SqlException ex)
            {
                Message = ex.Message;
                return "Error!";
            }
            finally
            {
                if (com != null)
                {
                    com.Dispose();
                    com = null;
                    con.DisConnect();
                }
            }
        }
开发者ID:gregggdavis,项目名称:schedww2,代码行数:45,代码来源:clsCourse.cs

示例4: getEventText

        public string getEventText(int eventid, bool Start,bool getInstructor,ref string instructorName)
        {
            string startdate = "", enddate = "";
            string Result = "";
            string strSql = "";

            SqlCommand com = null;
            Connection con = null;
            SqlDataReader Reader = null;
            DateTime dtStart = Convert.ToDateTime(null);
            DateTime dtEnd = Convert.ToDateTime(null);

            if (Start)
                dtStart = Convert.ToDateTime(null);
            else
                dtEnd = Convert.ToDateTime(null);

            try
            {
                if (Start)
                {
                    strSql = "Select Top 1 StartDateTime,ScheduledTeacherID From [CalendarEvent] ";
                    strSql += "WHERE [email protected] Order By CalendarEventID";
                }
                else
                {
                    strSql = "Select Top 1 EndDateTime From [CalendarEvent] ";
                    strSql += "WHERE [email protected] Order by CalendarEventID DESC";
                }

                con = new Connection();
                con.Connect();
                com = new SqlCommand();
                com.Connection = con.SQLCon;
                com.CommandText = strSql;

                com.Parameters.Add(new SqlParameter("@EventID", SqlDbType.BigInt));
                com.Parameters["@EventID"].Value = eventid;

                Reader = com.ExecuteReader();
                string id = "";
                bool IsRecord = false;
                if (Reader.Read())
                {
                    IsRecord = true;
                    if (Start)
                    {
                        if (Reader["StartDateTime"] != System.DBNull.Value)
                        {
                            dtStart = Convert.ToDateTime(Reader["StartDateTime"].ToString());
                        }
                    }
                    else
                    {
                        if (Reader["EndDateTime"] != System.DBNull.Value)
                        {
                            dtEnd = Convert.ToDateTime(Reader["EndDateTime"].ToString());
                        }
                    }
                    if(getInstructor)
                    {
                        if (Reader["ScheduledTeacherID"] != System.DBNull.Value)
                        {
                            id = Convert.ToString(Reader["ScheduledTeacherID"]);
                            //instructorName = getInstructorName(id);
                        }
                        else
                        {
                            instructorName = "None";
                        }
                    }
                    if (id == "0")
                        instructorName = "None";
                }
                Reader.Close();
                if (IsRecord)
                {
                    if (Start)
                    {
                        if (dtStart != Convert.ToDateTime(null))
                        {
                            Result = dtStart.ToShortDateString() + " " + dtStart.ToShortTimeString();
                            if (Result.IndexOf("(") > 0)
                            {
                                Result = Result.Substring(0, Result.IndexOf("(") + 1);
                            }
                            startdate = Result;
                        }
                    }
                    else
                    {
                        if (dtEnd != Convert.ToDateTime(null))
                        {
                            Result = dtEnd.ToShortDateString() + " " + dtEnd.ToShortTimeString();
                            if (Result.IndexOf("(") > 0)
                            {
                                Result = Result.Substring(0, Result.IndexOf("(") + 1);
                            }
                            enddate = Result;
                        }
//.........这里部分代码省略.........
开发者ID:gregggdavis,项目名称:schedww2,代码行数:101,代码来源:clsCourse.cs

示例5: DeleteData

        public bool DeleteData()
        {
            string strSql="";
            SqlCommand com=null;
            Connection con=null;
            try
            {
                con=new Connection();
                con.Connect();
                com = new SqlCommand();
                com.Connection=con.SQLCon;

                com.Parameters.Add(new SqlParameter("@CourseId", SqlDbType.Int));
                com.Parameters["@CourseId"].Value = _courseid;

                //Test Initial Event ID
                strSql =  "Delete From [Event] " +
                    "WHERE EventID IN (Select TestInitialEventID From [Course] " +
                    "WHERE [email protected])  ";
                com.CommandText=strSql;
                com.ExecuteNonQuery();

                strSql =  "Delete From [CalendarEvent] " +
                    "WHERE EventID IN (Select TestInitialEventID From [Course] " +
                    "WHERE [email protected])  ";
                com.CommandText=strSql;
                com.ExecuteNonQuery();

                //Test MidTerm Event ID
                strSql =  "Delete From [Event] " +
                    "WHERE EventID IN (Select TestMidTermEventID From [Course] " +
                    "WHERE [email protected])  ";
                com.CommandText=strSql;
                com.ExecuteNonQuery();

                strSql =  "Delete From [CalendarEvent] " +
                    "WHERE EventID IN (Select TestMidTermEventID From [Course] " +
                    "WHERE [email protected])  ";
                com.CommandText=strSql;
                com.ExecuteNonQuery();

                //Test Final Event ID
                strSql =  "Delete From [Event] " +
                    "WHERE EventID IN (Select TestFinalEventID From [Course] " +
                    "WHERE [email protected])  ";
                com.CommandText=strSql;
                com.ExecuteNonQuery();

                strSql =  "Delete From [CalendarEvent] " +
                    "WHERE EventID IN (Select TestFinalEventID From [Course] " +
                    "WHERE Cour[email protected])  ";
                com.CommandText=strSql;
                com.ExecuteNonQuery();

                //Event ID
                strSql =  "Delete From [Event] " +
                    "WHERE EventID IN (Select EventID From [Course] " +
                    "WHERE [email protected])  ";
                com.CommandText=strSql;
                com.ExecuteNonQuery();

                strSql =  "Delete From [CalendarEvent] " +
                    "WHERE EventID IN (Select EventID From [Course] " +
                    "WHERE [email protected])  ";
                com.CommandText=strSql;
                com.ExecuteNonQuery();

                strSql =  "Delete From [Course] " +
                    "WHERE [email protected] ";
                com.CommandText=strSql;
                com.ExecuteNonQuery();

                return true;
            }
            catch(SqlException ex)
            {
                Message=ex.Message;
                return false;
            }
            finally
            {
                if(com!=null)
                {
                    com.Dispose();
                    com=null;
                    con.DisConnect();
                }
            }
        }
开发者ID:gregggdavis,项目名称:schedww2,代码行数:89,代码来源:clsCourse.cs

示例6: CloneData

        public static int CloneData(int CourseId)
        {
            string strSql = "";
            SqlCommand com = null;
            Connection con = null;
            try
            {
                strSql = "usp_CourseClone";

                con = new Connection();
                con.Connect();
                com = new SqlCommand();
                com.CommandType = CommandType.StoredProcedure;
                com.Connection = con.SQLCon;
                com.CommandText = strSql;

                com.Parameters.Add(new SqlParameter("CourseId", SqlDbType.Int));
                com.Parameters["CourseId"].Value = CourseId;
                com.Parameters.Add(new SqlParameter("creatorID", SqlDbType.Int));
                com.Parameters["creatorID"].Value = Common.LogonID;
                com.Parameters.Add(new SqlParameter("insertedID", SqlDbType.Int));
                com.Parameters["insertedID"].Direction = ParameterDirection.Output;

                com.ExecuteNonQuery();

                return (int)com.Parameters["insertedID"].Value;
            }
            finally
            {
                if (com != null)
                {
                    com.Dispose();
                    com = null;
                    con.DisConnect();
                }
            }
        }
开发者ID:gregggdavis,项目名称:schedww2,代码行数:37,代码来源:clsCourse.cs

示例7: LoadOtherEvents

        //Loads Other Events (Events with 'EventType' fields set to anything but ZERO.
        /* Event Type Field Values:
         * 'Class' =  Repeating or Single Occurence
         * 'Test Initial', 'Test Mid', 'Test Final', 'Extra Class'
         */
        public DataTable LoadOtherEvents(bool IsRecurring)
        {
            string strSql = "";
            SqlDataReader Reader = null;
            SqlCommand com = null;
            Connection con = null;

            try
            {
                //Here we need to make sure that we use different commands for selecting Tests and Extra Classes
                //because extra classes only exist for repeating class events and NOT single occuring class events!

                //Loading Positive Exceptions first
                _dtbl = new DataTable();
                /*
                strSql = "Select Count(*) from Event WHERE RecurrenceText IS NOT NULL AND EventId=" + _eventid + ";";
                con = new Connection();
                con.Connect();
                com = new SqlCommand(strSql, con.SQLCon);
                int result = (int)com.ExecuteScalar();
                */
                con = new Connection();
                con.Connect();
                //Means the class event exists and class reocurrs alright
                if (_eventid > 0 && IsRecurring)
                {
                    strSql = "Select * from [CalendarEvent] WHERE EventId=" + _eventid + " AND EventType='Extra Class';";
                    com = new SqlCommand(strSql, con.SQLCon);
                    Reader = com.ExecuteReader();
                    if (Reader.HasRows)
                        _dtbl.Load(Reader);
                    Reader.Close();
                }

                //Now, Loading the Test Events (if any)
                strSql = "Select TestInitialEventId,TestMidtermEventId,TestFinalEventId from [Course] WHERE [email protected]";
                com = new SqlCommand(strSql, con.SQLCon);
                com.Parameters.Add(new SqlParameter("@CourseId", SqlDbType.Int));
                com.Parameters["@CourseId"].Value = _courseid;
                Reader = com.ExecuteReader();

                string[] temp = new string[3];
                Reader.Read();
                temp[0] = Reader[0].ToString();
                temp[1] = Reader[1].ToString();
                temp[2] = Reader[2].ToString();
                Reader.Close();

                string temp2 = "";
                if (temp[0] != null && temp[0] != "")
                    temp2 = temp[0];
                if (temp[1] != null && temp[1] != "")
                    temp2 += "," + temp[1];
                if (temp[2] != null && temp[2] != "")
                    temp2 += "," + temp[2];

                strSql = "SELECT * from [CalendarEvent] WHERE EventType LIKE 'Test%' AND EventId IN (" + temp2 + ");";
                //com = new SqlCommand(strSql, con.SQLCon);
                com.CommandText = strSql;
                Reader = com.ExecuteReader();

                if (Reader.HasRows)
                {
                    if (_dtbl.Rows.Count==0) _dtbl.Load(Reader);
                    else
                    {
                        DataTable _temp = new DataTable();
                        _temp.Load(Reader);
                        _dtbl.Merge(_temp);
                    }
                }

                Reader.Close();

                return _dtbl;
            }
            catch (SqlException ex)
            {
                Message = ex.Message;
                return null;
            }
            finally
            {
                if (com != null)
                {
                    com.Dispose();
                    com = null;
                    con.DisConnect();
                }
            }
        }
开发者ID:gregggdavis,项目名称:schedww2,代码行数:96,代码来源:clsCourse.cs

示例8: LoadData

        public bool LoadData()
        {
            string strSql="";
            SqlDataReader Reader=null;
            SqlCommand com=null;
            Connection con=null;
            try
            {
                if(_courseid<=0)
                {
                    strSql += "Select C.*, CASE " +
                        "WHEN C.NickName IS NULL THEN C.Name " +
                        "WHEN C.NickName = '' THEN C.Name " +
                        "ELSE C.NickName " +
                        "END AS BrowseName,  " +
                        "P.ProgramID, " +
                        "CASE " +
                        "WHEN P.NickName IS NULL THEN P.Name " +
                        "WHEN P.NickName = '' THEN P.Name " +
                        "ELSE P.NickName " +
                        "END AS Program,  " +
                        "CASE " +
                        "WHEN CO.NickName IS NULL THEN CO.CompanyName " +
                        "WHEN CO.NickName = '' THEN CO.CompanyName " +
                        "ELSE CO.NickName " +
                        "END AS Department,  " +
                        "CASE " +
                        "WHEN CO1.NickName IS NULL THEN CO1.CompanyName " +
                        "WHEN CO1.NickName = '' THEN CO1.CompanyName " +
                        "ELSE CO1.NickName " +
                        "END AS Client  " +
                        "from Course C " +
                        "Left Join Program P on (C.ProgramID=P.ProgramID) " +
                        "Left Join Department D on (P.DepartmentID=D.DepartmentID) " +
                        "Left Join Contact CO on (D.ContactID=CO.ContactID) " +
                        "Left Join Contact CO1 on (D.ClientID=CO1.ContactID) " +
                        "Order By BrowseName ";
                }
                else
                {
                    strSql += "Select C.*, CASE " +
                        "WHEN C.NickName IS NULL THEN C.Name " +
                        "WHEN C.NickName = '' THEN C.Name " +
                        "ELSE C.NickName " +
                        "END AS BrowseName,  " +
                        "P.ProgramID, " +
                        "P.NickName, CASE " +
                        "WHEN P.NickName IS NULL THEN P.Name " +
                        "WHEN P.NickName = '' THEN P.Name " +
                        "ELSE P.NickName " +
                        "END AS Program,  " +
                        "CASE " +
                        "WHEN CO.NickName IS NULL THEN CO.CompanyName " +
                        "WHEN CO.NickName = '' THEN CO.CompanyName " +
                        "ELSE CO.NickName " +
                        "END AS Department,  " +
                        "CASE " +
                        "WHEN CO1.NickName IS NULL THEN CO1.CompanyName " +
                        "WHEN CO1.NickName = '' THEN CO1.CompanyName " +
                        "ELSE CO1.NickName " +
                        "END AS Client  " +
                        "from Course C " +
                        "Left Join Program P on (C.ProgramID=P.ProgramID) " +
                        "Left Join Department D on (P.DepartmentID=D.DepartmentID) " +
                        "Left Join Contact CO on (D.ContactID=CO.ContactID) " +
                        "Left Join Contact CO1 on (D.ClientID=CO1.ContactID) " +
                        "Where C.CourseId=" + _courseid.ToString() + " ";
                }

                BuildDataTable();

                con=new Connection();
                con.Connect();
                com = new SqlCommand();
                com.Connection=con.SQLCon;
                com.CommandText = strSql;
                Reader = com.ExecuteReader();

                string strstatus="";
                while(Reader.Read())
                {
                    strstatus="";

                    if(Convert.ToInt16(Reader["CourseStatus"].ToString())==0)
                    {
                        strstatus = "Active";
                    }
                    else
                    {
                        strstatus = "Inactive";
                    }

                    _courseid = Convert.ToInt32(Reader["CourseId"].ToString());
                    _name = Reader["Name"].ToString();
                    _namephonetic = Reader["NamePhonetic"].ToString();
                    _nameromaji = Reader["NameRomaji"].ToString();
                    if(Reader["ProgramID"]!=System.DBNull.Value)
                    {
                        _programid = Convert.ToInt32(Reader["ProgramID"].ToString());
                    }
//.........这里部分代码省略.........
开发者ID:gregggdavis,项目名称:schedww2,代码行数:101,代码来源:clsCourse.cs

示例9: InsertData

        public bool InsertData()
        {
            string sql="";
            SqlCommand com=null;
            Connection con=null;
            SqlDataReader Reader=null;

            try
            {
                sql = "Insert into [Contact] (";
                sql += "RefID, ";
                sql += "LastName, ";
                sql += "LastNamePhonetic, ";
                sql += "LastNameRomaji, ";
                sql += "FirstName, ";
                sql += "FirstNamePhonetic, ";
                sql += "FirstNameRomaji, ";
                sql += "NickName, ";
                sql += "CompanyName, ";
                sql += "CompanyNamePhonetic, ";
                sql += "CompanyNameRomaji, ";
                sql += "TitleForName, ";
                sql += "TitleForJob, ";
                sql += "Street1, ";
                sql += "Street2, ";
                sql += "Street3, ";
                sql += "City, ";
                sql += "State, ";
                sql += "PostalCode, ";
                sql += "Country, ";
                sql += "ContactType, ";
                sql += "BlockCode, ";
                sql += "Email1, ";
                sql += "Email2, ";
                sql += "AccountRepLastName, ";
                sql += "AccountRepLastNamePhonetic, ";
                sql += "AccountRepLastNameRomaji, ";
                sql += "AccountRepFirstName, ";
                sql += "AccountRepFirstNamePhonetic, ";
                sql += "AccountRepFirstNameRomaji, ";
                sql += "Phone1, ";
                sql += "Phone2, ";
                sql += "PhoneMobile1, ";
                sql += "PhoneMobile2, ";
                sql += "PhoneBusiness1, ";
                sql += "PhoneBusiness2, ";
                sql += "PhoneFax1, ";
                sql += "PhoneFax2, ";
                sql += "PhoneOther, ";
                sql += "Url, ";
                sql += "DateBirth, ";
                sql += "DateJoined, ";
                sql += "DateEnded, ";
                sql += "TimeStatus, ";
                sql += "Nationality, ";
                sql += "Married, ";
                sql += "NumberDependents, ";
                sql += "VisaStatus, ";
                sql += "VisaFromDate, ";
                sql += "VisaUntilDate, ";
                sql += "ClosestStation1, ";
                sql += "ClosestLine1, ";
                sql += "MinutesToStation1, ";
                sql += "ClosestStation2, ";
                sql += "ClosestLine2, ";
                sql += "MinutesToStation2, ";
                sql += "ContactStatus, ";
                sql += "CreatedByUserId, ";
                sql += "DateCreated, ";
                sql += "DateLastModified, ";
                sql += "LastModifiedByUserID, ";
                sql += "BasePayField ";
                sql += ")";
                sql += "Values( ";
                sql += "@RefID, ";
                sql += "@LastName, ";
                sql += "@LastNamePhonetic, ";
                sql += "@LastNameRomaji, ";
                sql += "@FirstName, ";
                sql += "@FirstNamePhonetic, ";
                sql += "@FirstNameRomaji, ";
                sql += "@NickName, ";
                sql += "@CompanyName, ";
                sql += "@CompanyNamePhonetic, ";
                sql += "@CompanyNameRomaji, ";
                sql += "@TitleForName, ";
                sql += "@TitleForJob, ";
                sql += "@Street1, ";
                sql += "@Street2, ";
                sql += "@Street3, ";
                sql += "@City, ";
                sql += "@State, ";
                sql += "@PostalCode, ";
                sql += "@Country, ";
                sql += "@ContactType, ";
                sql += "@BlockCode, ";
                sql += "@Email1, ";
                sql += "@Email2, ";
                sql += "@AccountRepLastName, ";
                sql += "@AccountRepLastNamePhonetic, ";
//.........这里部分代码省略.........
开发者ID:gregggdavis,项目名称:schedww2,代码行数:101,代码来源:clsContact.cs

示例10: Exists

        public bool Exists(string strComp, int ClientID, int ContactType)
        {
            string strSql="";
            SqlCommand com=null;
            Connection con=null;
            try
            {
                strSql =  "Select Count(*) as cnt From [Contact] C, Department D " +
                          "Where C.ContactID=D.ContactID and " +
                          "[email protected] and " +
                          "[email protected] and " +
                          "[email protected] ";

                con=new Connection();
                con.Connect();
                com = new SqlCommand();
                com.Connection=con.SQLCon;
                com.CommandText = strSql;

                com.Parameters.Add(new SqlParameter("@CompanyName", SqlDbType.NVarChar));
                com.Parameters["@CompanyName"].Value = strComp;
                com.Parameters.Add(new SqlParameter("@ContactType", SqlDbType.NVarChar));
                com.Parameters["@ContactType"].Value = ContactType;
                com.Parameters.Add(new SqlParameter("@ClientID", SqlDbType.BigInt));
                com.Parameters["@ClientID"].Value = ClientID;

                object o = com.ExecuteScalar();
                if(Convert.ToInt32(o)>0)
                {
                    return true;
                }

                return false;
            }
            catch(SqlException ex)
            {
                Message=ex.Message;
                return false;
            }
            finally
            {
                if(com!=null)
                {
                    com.Dispose();
                    com=null;
                    con.DisConnect();
                }
            }
        }
开发者ID:gregggdavis,项目名称:schedww2,代码行数:49,代码来源:clsContact.cs

示例11: DeleteContactFromProgram

        public void DeleteContactFromProgram()
        {
            string strSql = "";
            SqlCommand com = null;
            Connection con = null;
            try
            {
                strSql = "Update [Program] SET Contact1ID=0 WHERE [email protected];";
                strSql += "Update [Program] SET Contact2ID=0 WHERE [email protected];";

                con = new Connection();
                con.Connect();
                com = new SqlCommand();
                com.Connection = con.SQLCon;
                com.CommandText = strSql;

                com.Parameters.Add(new SqlParameter("@ContactID", SqlDbType.Int));
                com.Parameters["@ContactID"].Value = _contactid;
                com.ExecuteNonQuery();
                /*
                strSql = "Delete from contact where [email protected] AND ContactType=4";
                com.Parameters["@ContactID"].Value = _contactid;
                com.CommandText = strSql;
                com.ExecuteNonQuery();
                */
                return;
            }
            catch (SqlException ex)
            {
                Message = ex.Message;
                return;
            }
            finally
            {
                if (com != null)
                {
                    com.Dispose();
                    com = null;
                    con.DisConnect();
                }
            }
        }
开发者ID:gregggdavis,项目名称:schedww2,代码行数:42,代码来源:clsContact.cs

示例12: ContactExists

        public bool ContactExists(int refid, string fname, string lname)
        {
            string strSql="";
            SqlCommand com=null;
            Connection con=null;
            try
            {
                strSql =  "Select Count(*) From [Contact] " +
                    "WHERE [email protected] AND [email protected] AND [email protected] and [email protected] ";

                con=new Connection();
                con.Connect();
                com = new SqlCommand();
                com.Connection=con.SQLCon;
                com.CommandText = strSql;

                com.Parameters.Add(new SqlParameter("@FName", SqlDbType.NVarChar));
                com.Parameters["@FName"].Value = fname;
                com.Parameters.Add(new SqlParameter("@LName", SqlDbType.NVarChar));
                com.Parameters["@LName"].Value = lname;
                com.Parameters.Add(new SqlParameter("@ContactType", SqlDbType.NVarChar));
                com.Parameters["@ContactType"].Value = ContactType;
                com.Parameters.Add(new SqlParameter("@RefID", SqlDbType.Int));
                com.Parameters["@RefID"].Value = refid;

                object o = com.ExecuteScalar();
                if(Convert.ToInt32(o)>0)
                {
                    return true;
                }

                return false;
            }
            catch(SqlException ex)
            {
                Message=ex.Message;
                return false;
            }
            finally
            {
                if(com!=null)
                {
                    com.Dispose();
                    com=null;
                    con.DisConnect();
                }
            }
        }
开发者ID:gregggdavis,项目名称:schedww2,代码行数:48,代码来源:clsContact.cs

示例13: UpdateRefID

        public bool UpdateRefID(int randomno)
        {
            string sql="";
            SqlCommand com=null;
            Connection con=null;

            try
            {
                sql = "Update [Contact] Set RefID=" + RefID.ToString() + " Where RefID=" + randomno.ToString() + " ";

                con=new Connection();
                con.Connect();
                com = new SqlCommand();
                com.Connection=con.SQLCon;
                com.CommandText = sql;

                com.ExecuteNonQuery();

                return true;
            }
            catch(SqlException ex)
            {
                Message=ex.Message;
                return false;
            }
            finally
            {
                if(com!=null)
                {
                    com.Dispose();
                    com=null;
                    con.DisConnect();
                }
            }
        }
开发者ID:gregggdavis,项目名称:schedww2,代码行数:35,代码来源:clsContact.cs

示例14: UpdateData

        public bool UpdateData()
        {
            string sql="";
            SqlCommand com=null;
            Connection con=null;

            try
            {
                sql = "Update [Contact] Set ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected], ";
                sql += "[email protected] ";
                sql += "WHERE [email protected] ";

                con=new Connection();
                con.Connect();
                com = new SqlCommand();
                com.Connection=con.SQLCon;
                com.CommandText = sql;

                com.Parameters.Add(new SqlParameter("@ContactID", SqlDbType.Int));
                com.Parameters.Add(new SqlParameter("@LastName", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@LastNamePhonetic", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@LastNameRomaji", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@FirstNamePhonetic", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@FirstNameRomaji", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@NickName", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@CompanyName", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@CompanyNamePhonetic", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@CompanyNameRomaji", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@TitleForName", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@TitleForJob", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@Street1", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@Street2", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@Street3", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@City", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@State", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@PostalCode", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@Country", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@ContactType", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@BlockCode", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@Email1", SqlDbType.NVarChar));
                com.Parameters.Add(new SqlParameter("@Email2", SqlDbType.NVarChar));
//.........这里部分代码省略.........
开发者ID:gregggdavis,项目名称:schedww2,代码行数:101,代码来源:clsContact.cs

示例15: IsEventExists

        public bool IsEventExists(int evtid)
        {
            string strSql="";
            SqlCommand com=null;
            Connection con=null;
            try
            {
                strSql =  "Select Count(EventID) From [Event] " +
                    "WHERE EventID=" + evtid.ToString() + " ";

                con=new Connection();
                con.Connect();
                com = new SqlCommand();
                com.Connection=con.SQLCon;
                com.CommandText = strSql;

                object o = com.ExecuteScalar();
                if(Convert.ToInt32(o)>0)
                {
                    return true;
                }

                return false;
            }
            catch(SqlException ex)
            {
                Message=ex.Message;
                return false;
            }
            finally
            {
                if(com!=null)
                {
                    com.Dispose();
                    com=null;
                    con.DisConnect();
                }
            }
        }
开发者ID:gregggdavis,项目名称:schedww2,代码行数:39,代码来源:clsCourse.cs


注:本文中的Scheduler.BusinessLayer.Connection.Connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。