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


C# DataBase.GetConnString方法代码示例

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


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

示例1: createSalaryValue

    public string[] createSalaryValue(string Value)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "";
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = "INSERT INTO PointValue (PointValue, CreateFileBy, CreateFileDate) " +
                    "VALUES(@PointValue, @CreateFileBy, (getDate()))";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@PointValue", SqlDbType.Decimal).Value = Chk.CheckStringtoDecimalFunction(Value);
                cmd.Parameters.Add("@CreateFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                returnValue[0] = cmd.ExecuteNonQuery().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message;
            }

        }
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:30,代码来源:ManageDataBase.cs

示例2: createAidsBrandList

    public string[] createAidsBrandList(CreateAidsBrand structValue)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "";
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = "INSERT INTO AidsBrandTable (Category, Brand, CreateFileBy, CreateFileDate, UpFileBy , UpFileDate) " +
                    "VALUES(@Category, @Brand, @CreateFileBy, getDate(), @UpFileBy, getDate() )";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@Category", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(structValue.brandType);
                cmd.Parameters.Add("@Brand", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(structValue.brandName);
                cmd.Parameters.Add("@CreateFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                returnValue[0] = cmd.ExecuteNonQuery().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message;
            }

        }
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:32,代码来源:ManageDataBase.cs

示例3: createExternalTeacherData

 public string[] createExternalTeacherData(CreateExternal StaffData)
 {
     string[] returnValue = new string[2];
     returnValue[0] = "0";
     returnValue[1] = "0";
     DataBase Base = new DataBase();
     using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
     {
         try
         {
             StaffDataBase sDB = new StaffDataBase();
             List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
             Sqlconn.Open();
             string sql = "INSERT INTO ExternalTeacherDatabase (Unit, TeachName, TeachIdentity, AddressZip1, AddressCity1, AddressOther1, AddressZip2, AddressCity2, AddressOther2, Phone, Phone2, Email,  CreateFileBy, CreateFileDate, UpFileBy, UpFileDate ) " +
                         "VALUES (@Unit, @TeachName, @TeachIdentity, @AddressZip1, @AddressCity1, @AddressOther1, @AddressZip2, @AddressCity2, @AddressOther2, @Phone, @Phone2, @Email, @CreateFileBy, getDate(), @UpFileBy, getDate())";
             SqlCommand cmd = new SqlCommand(sql, Sqlconn);
             cmd.Parameters.Add("@Unit", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(CreateFileName[2]);
             cmd.Parameters.Add("@TeachName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffName);
             cmd.Parameters.Add("@TeachIdentity", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffTWID);
             cmd.Parameters.Add("@AddressZip1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.censusAddressZip);
             cmd.Parameters.Add("@AddressCity1", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.censusCity);
             cmd.Parameters.Add("@AddressOther1", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.censusAddress);
             cmd.Parameters.Add("@AddressZip2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.addressZip);
             cmd.Parameters.Add("@AddressCity2", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(StaffData.addressCity);
             cmd.Parameters.Add("@AddressOther2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.address);
             cmd.Parameters.Add("@Phone", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Phone);
             cmd.Parameters.Add("@Phone2", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.Phone2);
             cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(StaffData.staffemail);
             cmd.Parameters.Add("@CreateFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
             cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
             returnValue[0] = cmd.ExecuteNonQuery().ToString();
             if (returnValue[0] != "0")
             {
                 sql = "select IDENT_CURRENT('ExternalTeacherDatabase') AS cID";
                 cmd = new SqlCommand(sql, Sqlconn);
                 SqlDataReader dr = cmd.ExecuteReader();
                 while (dr.Read())
                 {
                     returnValue[1] = dr["cID"].ToString();
                 }
                 dr.Close();
             }
             Sqlconn.Close();
         }
         catch (Exception e)
         {
             returnValue[0] = "-1";
             returnValue[1] = e.Message.ToString();
         }
     }
     return returnValue;
 }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:52,代码来源:SalaryManagement.cs

示例4: AddWorkRecordTime

    public void AddWorkRecordTime( string staffID,string Year, int Type, float hour, int type)
    {
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                Sqlconn.Open();
                string sql = " IF  EXISTS (SELECT 1 FROM YearVaction WHERE [email protected] and [email protected] ) ";
                sql += " update YearVaction set yearVaction = yearVaction ";
                if (Type == 13) {
                    sql += " , WorkAdd = WorkAdd + @WorkAdd ";
                }
                else if (Type == 12)
                {
                    sql += " , WorkMinus = WorkMinus + @WorkMinus ";
                }
                sql += " where [email protected] and [email protected] ";
                sql += " else ";
                sql += "INSERT INTO YearVaction (StaffID, Year, YearVaction, WorkAdd, WorkMinus ) " +
                         "VALUES (@StaffID, @Year, 0 ";
                if (Type == 13) {
                    sql += " ,  @WorkAdd ,0) ";

                }
                else if (Type == 12)
                {
                    sql += " ,  @WorkMinus ,0) ";
                }

                //sql += " insert into YearVacationLog (staffID , Type,Year , Changed,creatDate) values (@StaffID ,@Type,@Year , @WorkAdd,getdate())  ";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@StaffID", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(staffID);
                cmd.Parameters.Add("@Year", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(Year);
               // cmd.Parameters.Add("@Type", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(Type);
                cmd.Parameters.Add("@WorkAdd", SqlDbType.Float).Value = Chk.CheckFloatFunction(((hour/8) * type).ToString());
                cmd.Parameters.Add("@WorkMinus", SqlDbType.Float).Value = Chk.CheckFloatFunction(((hour / 8) * type).ToString());
               // returnValue[0] = cmd.ExecuteNonQuery().ToString();
                cmd.ExecuteNonQuery();
                Sqlconn.Close();
            }
            catch (Exception e)
            {

            }

        }
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:48,代码来源:StaffDataBase.cs

示例5: delBookData

 public string[] delBookData(Int64 bID)
 {
     string[] returnValue = new string[2];
     returnValue[0] = "0";
     returnValue[1] = "0";
     DataBase Base = new DataBase();
     using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
     {
         try
         {
             StaffDataBase sDB = new StaffDataBase();
             List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
             Sqlconn.Open();
             string sql = "UPDATE BookDatabase SET isDeleted=1, [email protected], UpFileDate=(getDate()) WHERE [email protected]";
             SqlCommand cmd = new SqlCommand(sql, Sqlconn);
             cmd.Parameters.Add("@bID", SqlDbType.BigInt).Value = bID;
             cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
             returnValue[0] = cmd.ExecuteNonQuery().ToString();
             Sqlconn.Close();
         }
         catch (Exception e)
         {
             returnValue[0] = "-1";
             returnValue[1] = e.Message.ToString();
         }
     }
     return returnValue;
 }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:28,代码来源:AdministrationDataBase.cs

示例6: CreatTeachServiceSupervisor

    public string[] CreatTeachServiceSupervisor(TeachServiceSupervisor sTemperatureData)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "0";
        string strSql = "";
        string strSqlPara = "";
        foreach (System.Reflection.FieldInfo fldInfo in sTemperatureData.GetType().GetFields())
        {
            switch (fldInfo.Name)
            {
                case "ID":
                case "Unit":
                case "RowNum":
                case "TeacherName":
                case "StudentName":
                case "txtstudentbirthday":
                case "checkNo":
                case "errorMsg":
                    break;
                case "isDeleted":
                    strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + fldInfo.Name;
                    strSqlPara += (string.IsNullOrEmpty(strSqlPara) ? "" : ",") + "0 ";
                    break;
                case "CreateFileDate":
                case "UpFileDate":
                    strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + fldInfo.Name;
                    strSqlPara += (string.IsNullOrEmpty(strSqlPara) ? "" : ",") + "getdate() ";
                    break;
                default:
                    strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + fldInfo.Name;
                    strSqlPara += (string.IsNullOrEmpty(strSqlPara) ? "@" : ",@") + fldInfo.Name;
                    break;
            }
        }

        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                string sql = " insert into  TeachServiceSupervisor ( " + strSql + " )values( " + strSqlPara + ")  select @@identity as ID ";

                Sqlconn.Open();
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                //cmd.Parameters.Add("@AcademicYear", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(sTemperatureData.AcademicYear.ToString());
                //cmd.Parameters.Add("@VDID", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(sTemperatureData.ID.ToString());
                foreach (System.Reflection.FieldInfo fldInfo in sTemperatureData.GetType().GetFields())
                {

                    switch (fldInfo.Name)
                    {
                        case "ID":
                        case "Unit":
                        case "RowNum":
                        case "TeacherName":
                        case "StudentName":
                        case "txtstudentbirthday":
                        case "checkNo":
                        case "errorMsg":
                            break;
                        case "CreateFileBy":
                        case "UpFileBy":
                            //cmd.Parameters.Add("@" + fldInfo.Name, fldInfo.GetValue(sTemperatureData));
                            cmd.Parameters.Add("@" + fldInfo.Name, SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                            break;
                        case "ClassDate":
                            if (fldInfo.GetValue(sTemperatureData) != null)
                            {
                                cmd.Parameters.Add("@" + fldInfo.Name, Convert.ToDateTime( fldInfo.GetValue(sTemperatureData).ToString()).AddYears(1911).ToShortDateString());
                            }
                            else
                            {
                                cmd.Parameters.Add("@" + fldInfo.Name, "");
                            }
                            break;
                        default:
                            if (fldInfo.GetValue(sTemperatureData) != null)
                            {
                                cmd.Parameters.Add("@" + fldInfo.Name, fldInfo.GetValue(sTemperatureData).ToString());
                            }
                            else
                            {
                                cmd.Parameters.Add("@" + fldInfo.Name, "");
                            }
                            break;
                    }
                }
                SqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    returnValue[0] = dr["ID"].ToString();
                }
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
//.........这里部分代码省略.........
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:101,代码来源:AdministrationDataBase.cs

示例7: createTeacherTemperatureData

    public string[] createTeacherTemperatureData(CreateTeacherSystem temperatureDataSystem)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "0";
        DateTime now = DateTime.Now;
        deleteStudentTemperatureData(temperatureDataSystem.txtpeopleID, now.Year.ToString(), now.Month.ToString(), now.Day.ToString());
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = "INSERT INTO TeacherTemperature ([TeacherID],[TeacherTemperature],[CheckContent],[CreateFileBy],[CreateFileDate],[UpFileBy],[UpFileDate] " +
                    " ) VALUES " +
                    "(@TeacherID, @TeacherTemperature, @CheckContent, @CreateFileBy, @CreateFileDate , @UpFileBy, (getDate()))";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@TeacherID", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(temperatureDataSystem.txtpeopleID);
                cmd.Parameters.Add("@TeacherTemperature", SqlDbType.Decimal).Value = Chk.CheckStringtoDecimalFunction(temperatureDataSystem.TeacherTemp);
                cmd.Parameters.Add("@CheckContent", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(temperatureDataSystem.CheckContent);
                cmd.Parameters.Add("@CreateFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                cmd.Parameters.Add("@UpFileBy", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                cmd.Parameters.Add("@CreateFileDate", SqlDbType.Date).Value = (string.IsNullOrEmpty(temperatureDataSystem.Year) ? Chk.CheckStringFunction(now.Year.ToString()) : Chk.CheckStringFunction(temperatureDataSystem.Year)) + "/" + (string.IsNullOrEmpty(temperatureDataSystem.Month) ? Chk.CheckStringFunction(now.Month.ToString()) : Chk.CheckStringFunction(temperatureDataSystem.Month)) + "/" + (string.IsNullOrEmpty(temperatureDataSystem.Day) ? Chk.CheckStringFunction(now.Day.ToString()) : Chk.CheckStringFunction(temperatureDataSystem.Day));

                returnValue[0] = cmd.ExecuteNonQuery().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message.ToString();
            }
        }
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:37,代码来源:AdministrationDataBase.cs

示例8: createHearLoss

    public string[] createHearLoss(UpdateHearLoss temperatureDataSystem, int SID)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "0";
        DateTime now = DateTime.Now;
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = " DECLARE @MasterID int " +
                " insert into Hearing_Loss_AnsMaster ( StudentID , LossDate , Tool,page) values ( @StudentID ,@LossDate, @Tool,@page) " +
                "  select @MasterID = (select @@identity) ";
                for (int i = 0; i < Chk.CheckStringFunction(temperatureDataSystem.anser).Split('|').Length; i++)
                {
                    sql += " insert into Hearing_Loss_AnsDetail (MasterID , Anser) values (@MasterID , @Anser" + i.ToString() + ") ";
                }

                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@StudentID", SqlDbType.Int).Value = SID;
                string date = temperatureDataSystem.Date;
                cmd.Parameters.Add("@LossDate", SqlDbType.NVarChar).Value = date;
                cmd.Parameters.Add("@Tool", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(temperatureDataSystem.tool);
                cmd.Parameters.Add("@page", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(temperatureDataSystem.page);
                for (int i = 0; i < Chk.CheckStringFunction(temperatureDataSystem.anser).Split('|').Length; i++)
                {
                    cmd.Parameters.Add("@Anser" + i.ToString(), SqlDbType.NVarChar).Value = Chk.CheckStringFunction(temperatureDataSystem.anser.Split('|').GetValue(i).ToString());
                }

                returnValue[0] = cmd.ExecuteNonQuery().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message.ToString();
            }
        }
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:44,代码来源:AdministrationDataBase.cs

示例9: UpdateVoiceDistance

    public string[] UpdateVoiceDistance(List<VoiceDistance> sTemperatureData)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "0";
        DataBase Base = new DataBase();
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                string sql = " Update VoiceDistance set AcademicYear = @AcademicYear ,AcademicTerm = @AcademicTerm where id = @VDID ";
                for (int i = 0; i < sTemperatureData.Count; i++)
                {
                    sql += " Update VoiceDistanceMaster set date = @" + i.ToString() + "date , remark [email protected]" + i.ToString() + "remark ,up1 = @" + i.ToString() + "up1,[email protected]" + i.ToString() + "up2,[email protected]" + i.ToString() + "up3 , up4 [email protected]" + i.ToString() + "up4 , up5 [email protected]" + i.ToString() + "up5 where VDid = @VDID and ListOrder [email protected]" + i.ToString() + "ListOrder ";
                    sql += " Update VoiceDistanceDetail set Question = @" + i.ToString() + "Question , A1 = @" + i.ToString() + "A1,[email protected]" + i.ToString() + "A2,[email protected]" + i.ToString() + "A3,[email protected]" + i.ToString() + "A4,A5 = @" + i.ToString() + "A5 where ID = @" + i.ToString() + "HidID";
                }

                Sqlconn.Open();
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@AcademicYear", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(sTemperatureData[0].AcademicYear.ToString());
                cmd.Parameters.Add("@AcademicTerm", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(sTemperatureData[0].AcademicTerm.ToString());
                cmd.Parameters.Add("@VDID", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(sTemperatureData[0].ID.ToString());
                for (int i = 0; i < sTemperatureData.Count; i++)
                {
                    cmd.Parameters.Add("@" + i.ToString() + "date", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(sTemperatureData[i].Date.AddYears(1911).AddDays(-1).ToShortDateString());
                    cmd.Parameters.Add("@" + i.ToString() + "remark", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(sTemperatureData[i].remark.ToString());
                    cmd.Parameters.Add("@" + i.ToString() + "ListOrder", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(sTemperatureData[i].ListOrder.ToString());
                    cmd.Parameters.Add("@" + i.ToString() + "Question", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(sTemperatureData[i].Question.ToString());
                    cmd.Parameters.Add("@" + i.ToString() + "HidID", SqlDbType.Int).Value = Chk.CheckStringtoInt64Function(sTemperatureData[i].HidID.ToString());
                    for (int up = 0; up < sTemperatureData[i].up.Split('|').Length; up++)
                    {
                        cmd.Parameters.Add("@" + i.ToString() + "up" + (up + 1).ToString(), SqlDbType.NVarChar).Value = Chk.CheckStringFunction(sTemperatureData[i].up.Split('|').GetValue(up).ToString());
                    }
                    for (int j = 0; j < sTemperatureData[i].Anser.Split('|').Length; j++)
                    {
                        cmd.Parameters.Add("@" + i.ToString() + "A" + (j + 1).ToString(), SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(sTemperatureData[i].Anser.Split('|').GetValue(j).ToString());
                    }
                }
                int dr = cmd.ExecuteNonQuery();
                if (dr > 0)
                {
                    returnValue[0] = sTemperatureData[0].ID.ToString();
                }
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message.ToString();
            }
        }
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:54,代码来源:AdministrationDataBase.cs

示例10: UpdateCaseStudy

    public List<CaseStudy> UpdateCaseStudy(CaseStudy sTemperatureData)
    {
        List<CaseStudy> returnValue = new List<CaseStudy>();
        CaseStudy temp = new CaseStudy();
        DataBase Base = new DataBase();
        string strSql = "";
        foreach (System.Reflection.FieldInfo fldInfo in sTemperatureData.GetType().GetFields())
        {

            switch (fldInfo.Name)
            {
                case "CreateFileBy":
                case "CreateFileDate":
                case "ID":
                case "Unit":
                case "WriteNameName":
                case "WriteName1Name":
                case "RecordedByName":
                    // strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + fldInfo.Name + " = " + fldInfo.GetValue(sTemperatureData);
                    break;
                //case "CreateFileDate":
                case "UpFileDate":
                    strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + fldInfo.Name + "=getdate()";
                    // strSqlPara += (string.IsNullOrEmpty(strSqlPara) ? "" : ",") + "getdate() ";
                    //cmd.Parameters.Add("@" + fldInfo.Name, SqlDbType.Date).Value = DateTime.Now.ToLongDateString();
                    break;
                default:
                    strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + fldInfo.Name + "[email protected]" + fldInfo.Name;
                    //strSqlPara += (string.IsNullOrEmpty(strSqlPara) ? "@" : ",@") + fldInfo.Name;
                    break;
            }
        }

        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                StaffDataBase sDB = new StaffDataBase();
                List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
                Sqlconn.Open();
                string sql = " update   CaseStudy set  " + strSql + " where [email protected] ";
                //sql += " select @@identity as id ";
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                foreach (System.Reflection.FieldInfo fldInfo in sTemperatureData.GetType().GetFields())
                {

                    switch (fldInfo.Name)
                    {
                        //case "ID":
                        case "CreateFileDate":
                        case "Unit":
                            // strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + fldInfo.Name + " = " + fldInfo.GetValue(sTemperatureData);
                            break;

                        case "UpFileBy":
                            //cmd.Parameters.Add("@" + fldInfo.Name, fldInfo.GetValue(sTemperatureData));
                            cmd.Parameters.Add("@" + fldInfo.Name, SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(CreateFileName[0]);
                            break;
                        default:
                            if (fldInfo.GetValue(sTemperatureData) != null)
                            {
                                cmd.Parameters.Add("@" + fldInfo.Name, fldInfo.GetValue(sTemperatureData).ToString());
                            }
                            else
                            {
                                cmd.Parameters.Add("@" + fldInfo.Name, "");
                            }
                            break;
                    }
                }
                cmd.ExecuteNonQuery();
                temp.ID = sTemperatureData.ID;
            }
            catch (Exception e)
            {
                string a = e.Message.ToString();
            }
            Sqlconn.Close();
        }
        returnValue.Add(temp);
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:82,代码来源:AdministrationDataBase.cs

示例11: SearchVoiceDistanceCount

    public string[] SearchVoiceDistanceCount(SearchStudent SearchStructure, int type)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "0";
        DataBase Base = new DataBase();
        string ConditionReturn = this.SearchVoiceDistanceCondition(SearchStructure, type);
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                Sqlconn.Open();
                string sql = "SELECT COUNT(*) AS QCOUNT FROM VoiceDistance a left join studentDatabase b on a.studentid = b.id   WHERE 1=1 " + ConditionReturn;
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@StudentID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.txtstudentID);
                cmd.Parameters.Add("@StudentName", SqlDbType.NVarChar).Value = "%" + Chk.CheckStringFunction(SearchStructure.txtstudentName) + "%";
                cmd.Parameters.Add("@StudentSex", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.txtstudentSex);

                cmd.Parameters.Add("@sBirthdayStart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtbirthdaystart);
                cmd.Parameters.Add("@sBirthdayEnd", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtbirthdayend);

                cmd.Parameters.Add("@AcademicYearstart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtAcademicYearstart);
                cmd.Parameters.Add("@AcademicYearend", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtAcademicYearend);

                returnValue[0] = cmd.ExecuteScalar().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message.ToString();
            }
        }
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:35,代码来源:AdministrationDataBase.cs

示例12: SearchVoiceDistance

    public List<VoiceDistance> SearchVoiceDistance(int indexpage, SearchStudent SearchStructure, int type)
    {
        List<VoiceDistance> returnValue = new List<VoiceDistance>();
        DataBase Base = new DataBase();
        string ConditionReturn = this.SearchVoiceDistanceCondition(SearchStructure, type);
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                Sqlconn.Open();
                string sql = " SELECT * from (select ROW_NUMBER() OVER (ORDER BY isnull( a.AcademicYear,'') DESC) as RowNum ";
                sql += " ,a.id, a.AcademicYear,a.AcademicTerm ,a.StudentAge,a.StudentMonth , b.StudentName , b.StudentBirthday ";
                sql += " FROM VoiceDistance a left join studentDatabase b on a.studentid = b.id  ";
                sql += " WHERE 1=1 " + ConditionReturn + ") AS NewTable ";

                sql += " where  RowNum >= (@indexpage-" + PageMinNumFunction() + ") AND RowNum <= (@indexpage) ";

                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@indexpage", SqlDbType.Int).Value = indexpage;
                cmd.Parameters.Add("@StudentID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.txtstudentID);
                cmd.Parameters.Add("@StudentName", SqlDbType.NVarChar).Value = "%" + Chk.CheckStringFunction(SearchStructure.txtstudentName) + "%";
                cmd.Parameters.Add("@StudentSex", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.txtstudentSex);
                cmd.Parameters.Add("@sBirthdayStart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtbirthdaystart);
                cmd.Parameters.Add("@sBirthdayEnd", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtbirthdayend);

                cmd.Parameters.Add("@AcademicYearstart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtAcademicYearstart);
                cmd.Parameters.Add("@AcademicYearend", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtAcademicYearend);

                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    VoiceDistance addValue = new VoiceDistance();
                    addValue.RowNum = dr["rownum"].ToString();
                    addValue.ID = dr["ID"].ToString();
                    addValue.StudentName = dr["StudentName"].ToString();
                    addValue.AcademicYear = dr["AcademicYear"].ToString();
                    addValue.AcademicTerm = dr["AcademicTerm"].ToString();
                    addValue.StudentAge = dr["StudentAge"].ToString();
                    addValue.StudentMonth = dr["StudentMonth"].ToString();
                    addValue.txtstudentbirthday = DateTime.Parse(dr["StudentBirthday"].ToString());
                    returnValue.Add(addValue);
                }
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                VoiceDistance addValue = new VoiceDistance();
                addValue.checkNo = "-1";
                addValue.errorMsg = e.Message.ToString();
                returnValue.Add(addValue);
            }
        }
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:54,代码来源:AdministrationDataBase.cs

示例13: searchUserDataCardNum

 public string[] searchUserDataCardNum(SearchUser userData)
 {
     string[] returnValue = new string[4];
     returnValue[0] = "0";
     returnValue[1] = "";
     returnValue[2] = "0"; //
     returnValue[3] = "";
     DataBase Base = new DataBase();
     using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
     {
         try
         {
             StaffDataBase sDB = new StaffDataBase();
             CaseDataBase cDB = new CaseDataBase();
             List<string> CreateFileName = sDB.getStaffDataNameCardNum(userData.txtpeopleID);
             if (CreateFileName[1].Length == 0)
             {
                 CreateFileName = cDB.getStudentDataName(userData.txtpeopleID);
                 if (CreateFileName[1].Length != 0)
                 {
                     CreateFileName[2] = "2";
                 }
                 else
                 {
                     CreateFileName[0] = "0";
                 }
             }
             else
             {
                 CreateFileName[2] = "1";
             }
             returnValue[0] = CreateFileName[0];
             returnValue[1] = CreateFileName[1];
             returnValue[2] = CreateFileName[2];
             returnValue[3] = CreateFileName[3];
         }
         catch (Exception e)
         {
             returnValue[0] = "-1";
             returnValue[1] = e.Message.ToString();
             returnValue[2] = "0";
         }
     }
     return returnValue;
 }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:45,代码来源:AdministrationDataBase.cs

示例14: SearchTeachServiceInspect

    public List<TeachServiceInspect> SearchTeachServiceInspect(int indexpage, SearchStudent SearchStructure, int type)
    {
        List<TeachServiceInspect> returnValue = new List<TeachServiceInspect>();
        DataBase Base = new DataBase();
        string ConditionReturn = this.SearchTeachServiceInspectCondition(SearchStructure, type);
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                Sqlconn.Open();
                string sql = " SELECT * from (select ROW_NUMBER() OVER (ORDER BY isnull( a.AcademicYear,'') DESC) as RowNum ";
                sql += " ,a.id, a.AcademicYear,  convert(varchar, isnull(convert(date,  a.InspectDate,1),'1912'), 111) as   InspectDate,a.ClassType , b.StudentName , b.StudentBirthday , c.TeacherName ,d.ClassIDName ";
                sql += " FROM TeachServiceInspect a left join studentDatabase b on a.studentid = b.id  ";
                sql += " left join (select staffid as cid , staffname as TeacherName from staffdatabase ) c on a.teacherid = c.cid ";
                sql += " left join (select ClassIDName , ClassID as did from ClassName ) d on a.ClassNameID = d.did ";
                sql += " WHERE 1=1 " + ConditionReturn + ") AS NewTable ";

                sql += " where  RowNum >= (@indexpage-" + PageMinNumFunction() + ") AND RowNum <= (@indexpage) ";

                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@indexpage", SqlDbType.Int).Value = indexpage;
                cmd.Parameters.Add("@StudentID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(SearchStructure.txtstudentID);
                cmd.Parameters.Add("@StudentName", SqlDbType.NVarChar).Value = "%" + Chk.CheckStringFunction(SearchStructure.txtstudentName) + "%";
                cmd.Parameters.Add("@StudentSex", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(SearchStructure.txtstudentSex);
                cmd.Parameters.Add("@sBirthdayStart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtbirthdaystart);
                cmd.Parameters.Add("@sBirthdayEnd", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtbirthdayend);

                cmd.Parameters.Add("@InspectDatestart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtendReasonDatestart);
                cmd.Parameters.Add("@InspectDateend", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtendReasonDateend);

                cmd.Parameters.Add("@AcademicYearstart", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(SearchStructure.txtAcademicYearstart);
                cmd.Parameters.Add("@AcademicYearend", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(SearchStructure.txtAcademicYearend);

                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    TeachServiceInspect addValue = new TeachServiceInspect();
                    addValue.RowNum = dr["rownum"].ToString();
                    addValue.ID = dr["ID"].ToString();
                    addValue.ClassType = dr["ClassType"].ToString();
                    addValue.InspectDate = dr["InspectDate"].ToString();
                    addValue.StudentName = dr["StudentName"].ToString();
                    addValue.TeacherName = dr["TeacherName"].ToString();
                    addValue.AcademicYear = dr["AcademicYear"].ToString();
                    addValue.ClassIDName = dr["ClassIDName"].ToString();
                    //if (dr["ClassType"].ToString() == 1)
                    //{
                    //    addValue.txtstudentbirthday = DateTime.Parse(dr["StudentBirthday"].ToString());
                    //}
                    returnValue.Add(addValue);
                }
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                TeachServiceInspect addValue = new TeachServiceInspect();
                addValue.checkNo = "-1";
                addValue.errorMsg = e.Message.ToString();
                returnValue.Add(addValue);
            }
        }
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:63,代码来源:AdministrationDataBase.cs

示例15: SearchSingleTeachCount

    public string[] SearchSingleTeachCount(SearchCaseISPRecord SearchStructure, int type)
    {
        string[] returnValue = new string[2];
        returnValue[0] = "0";
        returnValue[1] = "0";
        DataBase Base = new DataBase();
        string ConditionReturn = this.SearchSingleTeachCondition(SearchStructure, type);
        using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
        {
            try
            {
                Sqlconn.Open();
                string sql = "SELECT COUNT(*) AS QCOUNT FROM SingleClassShortTerm a left join studentDatabase b on a.studentid = b.id left join ( select staffid as cid , StaffName as TeacherName from staffDatabase ) c on a.teacherid = c.cid  WHERE isnull(a.isDeleted,0) = 0 " + ConditionReturn;
                SqlCommand cmd = new SqlCommand(sql, Sqlconn);
                cmd.Parameters.Add("@StudentName", SqlDbType.NVarChar).Value = "%" + Chk.CheckStringFunction(SearchStructure.txtstudentName) + "%";
                cmd.Parameters.Add("@TeacherName", SqlDbType.NVarChar).Value = "%" + Chk.CheckStringFunction(SearchStructure.txtteacherName) + "%";
                cmd.Parameters.Add("@ConventionDatestart", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtConventionDatestart);
                cmd.Parameters.Add("@ConventionDaterend", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(SearchStructure.txtConventionDateend);

                returnValue[0] = cmd.ExecuteScalar().ToString();
                Sqlconn.Close();
            }
            catch (Exception e)
            {
                returnValue[0] = "-1";
                returnValue[1] = e.Message.ToString();
            }
        }
        return returnValue;
    }
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:30,代码来源:AdministrationDataBase.cs


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