本文整理汇总了C#中StaffDataBase类的典型用法代码示例。如果您正苦于以下问题:C# StaffDataBase类的具体用法?C# StaffDataBase怎么用?C# StaffDataBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StaffDataBase类属于命名空间,在下文中一共展示了StaffDataBase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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
示例2: 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
示例3: loginsuccess
public void loginsuccess(List<string> result)
{
_Staff_ID = result[_Index_ID];
_Staff_Name = result[_Index_Name];
_Staff_UnitID = result[_Index_Unit];
StaffDataBase myDataBase = new StaffDataBase();
_Staff_UnitName = myDataBase.getUnitName(_Staff_UnitID);
_Header_Info_innerString = getLoginInfoString();
}
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:9,代码来源:Controler.cs
示例4: 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
示例5: caseBTFunction
public void caseBTFunction()
{
StaffDataBase sDB = new StaffDataBase();
RolesStruct StaffAllRoles = sDB.getStaffRoles(HttpContext.Current.User.Identity.Name);
//_StaffhaveRoles[0] = StaffAllRoles.caseStu[0];//權限
char[] haveRolesitem = new char[4] { '0', '0', '0', '0' };
haveRolesitem = StaffAllRoles.caseBT[0].ToCharArray();
_StaffhaveRoles[0] = haveRolesitem[0].ToString();//刪除
_StaffhaveRoles[1] = haveRolesitem[1].ToString();//更新
_StaffhaveRoles[2] = haveRolesitem[2].ToString();//新增
_StaffhaveRoles[3] = haveRolesitem[3].ToString();//查詢
_StaffhaveRoles[4] = StaffAllRoles.caseBT[1];//跨區與否
}
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:14,代码来源:AdministrationDataBase.cs
示例6: Audiometry
public Audiometry()
{
//
// TODO: Add constructor logic here
//
StaffDataBase sDB = new StaffDataBase();
RolesStruct StaffAllRoles = sDB.getStaffRoles(HttpContext.Current.User.Identity.Name);
//_StaffhaveRoles[0] = StaffAllRoles.caseStu[0];//權限
char[] haveRolesitem = new char[4] { '0', '0', '0', '0' };
haveRolesitem = StaffAllRoles.hearing[0].ToCharArray();
_StaffhaveRoles[0] = haveRolesitem[0].ToString();//刪除
_StaffhaveRoles[1] = haveRolesitem[1].ToString();//更新
_StaffhaveRoles[2] = haveRolesitem[2].ToString();//新增
_StaffhaveRoles[3] = haveRolesitem[3].ToString();//查詢
_StaffhaveRoles[4] = StaffAllRoles.hearing[1];//跨區與否
}
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:17,代码来源:Audiometry.cs
示例7: SearchSingleTeachCondition
private string SearchSingleTeachCondition(SearchCaseISPRecord SearchStructure, int type)
{
string ConditionReturn = "";
string DateBase = "1900-01-01";
if (SearchStructure.txtstudentName != null)
{
ConditionReturn += " AND StudentName like (@StudentName) ";
}
if (SearchStructure.txtteacherName != null)
{
ConditionReturn += " AND TeacherName like (@TeacherName) ";
}
if (SearchStructure.txtConventionDatestart != null && SearchStructure.txtConventionDateend != null && SearchStructure.txtConventionDatestart != DateBase && SearchStructure.txtConventionDateend != DateBase)
{
ConditionReturn += " AND ( PlanDateStart BETWEEN (@ConventionDatestart) AND (@ConventionDaterend) or PlanDateEnd BETWEEN (@ConventionDatestart) AND (@ConventionDaterend) ) ";
}
StaffDataBase sDB = new StaffDataBase();
List<string> UserFile = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
caseBTFunction();
if (int.Parse(_StaffhaveRoles[4]) == 0 && UserFile[1].Length > 0)
{
ConditionReturn += " AND b.Unit =" + UserFile[2] + " ";
}
if (type == 0)
{
ConditionReturn += " AND b.CaseStatu2 =" + type + " ";
}
return ConditionReturn;
}
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:29,代码来源:AdministrationDataBase.cs
示例8: SearchClassNameCondition
private string SearchClassNameCondition(SearchClassName SearchStructure)
{
string ConditionReturn = "";
if (SearchStructure.txtstaffID != null)
{
ConditionReturn += " AND TeacherID=(@txtstaffID) ";
}
if (SearchStructure.txtstaffName != null)
{
ConditionReturn += " AND TeacherName like (@txtstaffName) ";
}
if (SearchStructure.txtClassID != null)
{
ConditionReturn += " AND ClassID=(@txtClassID) ";
}
if (SearchStructure.txtClassName != null)
{
ConditionReturn += " AND ClassName like (@txtClassName) ";
}
StaffDataBase sDB = new StaffDataBase();
List<string> UserFile = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
caseBTFunction();
if (int.Parse(_StaffhaveRoles[4]) == 0 && UserFile[1].Length > 0)
{
ConditionReturn += " AND a.Unit =" + UserFile[2] + " ";
}
return ConditionReturn;
}
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:29,代码来源:AdministrationDataBase.cs
示例9: SearchBookStatisticsConditionReturn
private string SearchBookStatisticsConditionReturn(SearchBookStatistics BookStatisticsData)
{
string ConditionReturn = "";
if (BookStatisticsData.txtbookStartDay != null && BookStatisticsData.txtbookEndDay != null)
{
ConditionReturn += " AND (SELECT CONVERT(varchar, BookManage.BorrowDate, 23)) BETWEEN CONVERT(varchar, GETDATE() - @txtbookEndDay, 23) AND CONVERT(varchar, GETDATE() - @txtbookStartDay, 23) ";
}
if (BookStatisticsData.txtbookDateStartDate != null && BookStatisticsData.txtbookDateEndDate != null)
{
ConditionReturn += " AND (SELECT CONVERT(varchar, BookManage.BorrowDate, 23)) BETWEEN @txtbookDateStartDate AND @txtbookDateEndDate ";
}
if (BookStatisticsData.txtrecordBookID != null)
{
ConditionReturn += " AND [email protected] ";
}
if (BookStatisticsData.txtrecordBookStartDate != null && BookStatisticsData.txtrecordBookEndDate != null)
{
ConditionReturn += " AND (SELECT CONVERT(varchar, BookManage.BorrowDate, 23)) BETWEEN @txtrecordBookStartDate AND @txtrecordBookEndDate ";
}
if (BookStatisticsData.txtrecordBorrowerType != null)
{
ConditionReturn += " AND [email protected] ";
}
if (BookStatisticsData.txtrecordBorrowerType == "1" && BookStatisticsData.txtrecordBorrowerName != null)
{
ConditionReturn += " AND StaffDatabase.StaffName like @txtrecordBorrowerName ";
}
else if (BookStatisticsData.txtrecordBorrowerType == "2" && BookStatisticsData.txtrecordBorrowerName != null)
{
ConditionReturn += " AND StudentDatabase.StudentName like @txtrecordBorrowerName ";
}
if (BookStatisticsData.txtrecordBorrowerStartDate != null && BookStatisticsData.txtrecordBorrowerEndDate != null)
{
ConditionReturn += " AND (SELECT CONVERT(varchar, BookManage.BorrowDate, 23)) BETWEEN @txtrecordBorrowerStartDate AND @txtrecordBorrowerEndDate ";
}
StaffDataBase sDB = new StaffDataBase();
List<string> UserFile = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
if (int.Parse(_StaffhaveRoles[4]) == 0 && UserFile[1].Length > 0)
{
ConditionReturn += " AND BookManage.Unit =" + UserFile[2] + " ";
}
return ConditionReturn;
}
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:46,代码来源:AdministrationDataBase.cs
示例10: SearchBookConditionReturn
private string SearchBookConditionReturn(SearchBook bookData, string bookDBName)
{
string ConditionReturn = "";
if (bookData.txtbookNumber != null)
{
ConditionReturn += " AND [email protected] ";
}
if (bookData.txtbookTitle != null)
{
ConditionReturn += " AND BookName like @txtbookTitle ";
}
if (bookData.txtbookClassification != null)
{
ConditionReturn += " AND [email protected] ";
}
if (bookData.txtbookAuthor != null)
{
ConditionReturn += " AND Author like @txtbookAuthor ";
}
if (bookData.txtbookPress != null)
{
ConditionReturn += " AND Press like @txtbookPress ";
}
StaffDataBase sDB = new StaffDataBase();
List<string> UserFile = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
if (int.Parse(_StaffhaveRoles[4]) == 0 && UserFile[1].Length > 0)
{
ConditionReturn += " AND " + bookDBName + ".Unit =" + UserFile[2] + " ";
}
return ConditionReturn;
}
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:31,代码来源:AdministrationDataBase.cs
示例11: setBookReturnDataBase
public List<CreateBookSystem> setBookReturnDataBase(CreateBookSystem bookSystemData)
{
List<CreateBookSystem> returnValue = new List<CreateBookSystem>();
DataBase Base = new DataBase();
using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
{
try
{
string[] checkBookData = getBookDataName(bookSystemData.bookReturnCode);
if (int.Parse(checkBookData[0]) > 0 && int.Parse(checkBookData[1]) == 2)
{
StaffDataBase sDB = new StaffDataBase();
List<string> CreateFileName = sDB.getStaffDataName(HttpContext.Current.User.Identity.Name);
Sqlconn.Open();
string sql = "SELECT ID,BorrowerIdentity FROM BookManage WHERE [email protected] AND Status=1 AND isDeleted=0";
SqlCommand cmd = new SqlCommand(sql, Sqlconn);
cmd.Parameters.Add("@Status", SqlDbType.TinyInt).Value = 2;
cmd.Parameters.Add("@bookID", SqlDbType.BigInt).Value = Chk.CheckStringtoIntFunction(checkBookData[2]);
SqlDataReader dr = cmd.ExecuteReader();
Int64 Column = 0;
string borrowerStatus = "0";
if (dr.Read())
{
Column = Int64.Parse(dr["ID"].ToString());
borrowerStatus = dr["BorrowerIdentity"].ToString();
}
dr.Close();
if (Column != 0)
{
sql = "UPDATE BookManage SET [email protected],ReturnDate=(getDate()) WHERE [email protected] AND Status=1 AND isDeleted=0";
cmd = new SqlCommand(sql, Sqlconn);
cmd.Parameters.Add("@ID", SqlDbType.BigInt).Value = Column;
cmd.Parameters.Add("@Status", SqlDbType.TinyInt).Value = 2;
string numberStr = cmd.ExecuteNonQuery().ToString();
if (numberStr != "0")
{
sql = "UPDATE BookDatabase SET [email protected] WHERE [email protected] AND isDeleted=0";
cmd = new SqlCommand(sql, Sqlconn);
cmd.Parameters.Add("@Status", SqlDbType.TinyInt).Value = 1;
cmd.Parameters.Add("@bookID", SqlDbType.BigInt).Value = Chk.CheckStringtoIntFunction(checkBookData[2]);
string numberStr2 = cmd.ExecuteNonQuery().ToString();
if (numberStr2 != "0")
{
if (borrowerStatus == "1")
{
sql = "SELECT BookManage.*, BookDatabase.BookCodeID, BookDatabase.BookName, StaffDatabase.StaffName AS BorrowerName FROM BookManage " +
"RIGHT JOIN StaffDatabase ON BookManage.BorrowerID=StaffDatabase.StaffID AND StaffDatabase.isDeleted=0 " +
"RIGHT JOIN BookDatabase ON BookManage.BookID=BookDatabase.BookID AND BookDatabase.isDeleted=0 " +
"WHERE BookManage.isDeleted=0 AND [email protected]";
}
else if (borrowerStatus == "2")
{
sql = "SELECT BookManage.*, BookDatabase.BookCodeID, BookDatabase.BookName, StudentDatabase.StudentName AS BorrowerName FROM BookManage " +
"RIGHT JOIN StudentDatabase ON BookManage.BorrowerID=StudentDatabase.StudentID AND StudentDatabase.isDeleted=0 " +
"RIGHT JOIN BookDatabase ON BookManage.BookID=BookDatabase.BookID AND BookDatabase.isDeleted=0 " +
"WHERE BookManage.isDeleted=0 AND [email protected]";
}
cmd = new SqlCommand(sql, Sqlconn);
cmd.Parameters.Add("@BID", SqlDbType.BigInt).Value = Column;
dr = cmd.ExecuteReader();
while (dr.Read())
{
CreateBookSystem addValue = new CreateBookSystem();
addValue.bID = Column.ToString();
addValue.borrowStatus = dr["Status"].ToString();
addValue.borrowerClassID = dr["ClassID"].ToString();
addValue.borrowerName = dr["BorrowerName"].ToString();
addValue.borrowerID = dr["BorrowerID"].ToString();
addValue.borrowerStatus = dr["BorrowerIdentity"].ToString();
addValue.bookCode = dr["BookCodeID"].ToString();
addValue.bookName = dr["BookName"].ToString();
addValue.borrowDate = DateTime.Parse(dr["BorrowDate"].ToString()).ToString("yyyy-MM-dd");
addValue.expireDate = DateTime.Parse(dr["MaturityDate"].ToString()).ToString("yyyy-MM-dd");
addValue.restoreDate = DateTime.Parse(dr["ReturnDate"].ToString()).ToString("yyyy-MM-dd");
addValue.checkNo = "1";
returnValue.Add(addValue);
}
dr.Close();
Sqlconn.Close();
}
}
}
Sqlconn.Close();
}
else if (int.Parse(checkBookData[1]) == 1)
{
CreateBookSystem addValue = new CreateBookSystem();
addValue.checkNo = "0";
addValue.errorMsg = "此本圖書已歸還";
returnValue.Add(addValue);
}
else if (int.Parse(checkBookData[0]) == 0)
{
CreateBookSystem addValue = new CreateBookSystem();
addValue.checkNo = checkBookData[0];
addValue.errorMsg = "查無此本圖書";
returnValue.Add(addValue);
}
else
//.........这里部分代码省略.........
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:101,代码来源:AdministrationDataBase.cs
示例12: 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
示例13: 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
示例14: ShowCaseStudy
public List<AchievementAssessmentLoad> ShowCaseStudy(int ID)
{
string strSql = "";
List<AchievementAssessmentLoad> returnvalue = new List<AchievementAssessmentLoad>();
AchievementAssessmentLoad temp = new AchievementAssessmentLoad();
CaseStudy sTemperatureData = new CaseStudy();
foreach (System.Reflection.FieldInfo fldInfo in sTemperatureData.GetType().GetFields())
{
switch (fldInfo.Name)
{
case "ID":
case "Unit":
case "WriteNameName":
case "WriteName1Name":
case "RecordedByName":
break;
case "WriteDate":
case "RecordedDateTime":
strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "convert(varchar, isnull(convert(date, a." + fldInfo.Name + ",1),'1912'), 111) as " + fldInfo.Name;
break;
default:
strSql += (string.IsNullOrEmpty(strSql) ? "" : ",") + "a." + fldInfo.Name;
break;
}
}
DataBase Base = new DataBase();
using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
{
try
{
StaffDataBase sDB = new StaffDataBase();
Sqlconn.Open();
string sql = "select b.studentname ,convert(varchar, isnull(convert(date, b.studentbirthday ,1),'1912'), 23) as studentbirthday , c.WriteNameName , d.WriteName1Name,e.RecordedByName , " + strSql + " from CaseStudy a ";
sql += " left join ( select staffid as cid , StaffName as WriteNameName from staffDatabase ) c on a.WriteName = c.cid ";
sql += " left join ( select staffid as did , StaffName as WriteName1Name from staffDatabase ) d on a.WriteName1 = d.did ";
sql += " left join ( select staffid as eid , StaffName as RecordedByName from staffDatabase ) e on a.RecordedBy = e.eid ";
sql += " left join studentDatabase b on a.studentid = b.id where [email protected] and isnull(a.isDeleted,0) = 0 ";
SqlCommand cmd = new SqlCommand(sql, Sqlconn);
cmd.Parameters.Add("@ID", SqlDbType.Int).Value = ID;
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
temp.IDname = "studentName";
temp.ThisValue = dr["studentName"].ToString();
returnvalue.Add(temp);
temp.IDname = "WriteNameName";
temp.ThisValue = dr["WriteNameName"].ToString();
returnvalue.Add(temp);
temp.IDname = "WriteName1Name";
temp.ThisValue = dr["WriteName1Name"].ToString();
returnvalue.Add(temp);
temp.IDname = "RecordedByName";
temp.ThisValue = dr["RecordedByName"].ToString();
returnvalue.Add(temp);
temp.IDname = "studentbirthday";
temp.ThisValue = dr["studentbirthday"].ToString();
returnvalue.Add(temp);
foreach (System.Reflection.FieldInfo fldInfo in sTemperatureData.GetType().GetFields())
{
switch (fldInfo.Name)
{
case "ID":
case "Unit":
case "WriteNameName":
case "WriteName1Name":
case "RecordedByName":
break;
case "WriteDate":
case "RecordedDateTime":
temp.IDname = fldInfo.Name;
temp.ThisValue = Convert.ToDateTime(dr[fldInfo.Name].ToString()).AddYears(-1911).ToShortDateString().Remove(0, 1);
returnvalue.Add(temp);
break;
default:
string namee = fldInfo.Name;
string namee2 = dr[fldInfo.Name].ToString();
temp.IDname = fldInfo.Name;
temp.ThisValue = dr[fldInfo.Name].ToString();
returnvalue.Add(temp);
break;
}
}
}
dr.Close();
Sqlconn.Close();
}
catch (Exception e)
{
string error = e.Message;
}
}
return returnvalue;
//.........这里部分代码省略.........
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:101,代码来源:AdministrationDataBase.cs
示例15: ShowStudent
//顯示學生姓名(有點多餘)
public List<SearchStudentResult> ShowStudent(int SID)
{
List<SearchStudentResult> returnvalue = new List<SearchStudentResult>();
SearchStudentResult temp = new SearchStudentResult();
DataBase Base = new DataBase();
using (SqlConnection Sqlconn = new SqlConnection(Base.GetConnString()))
{
try
{
StaffDataBase sDB = new StaffDataBase();
Sqlconn.Open();
string sql = "select StudentName from StudentDatabase where [email protected] ";
SqlCommand cmd = new SqlCommand(sql, Sqlconn);
cmd.Parameters.Add("@StudentID", SqlDbType.Int).Value = SID;
SqlDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
//temp.txtstudentSex = int.Parse(dr["StudentSex"].ToString());
temp.txtstudentName = dr["StudentName"].ToString();
//temp.txtstudentbirthday = DateTime.Parse(dr["StudentBirthday"].ToString());
returnvalue.Add(temp);
}
dr.Close();
Sqlconn.Close();
}
catch (Exception e)
{
}
}
return returnvalue;
}
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:35,代码来源:AdministrationDataBase.cs
示例16: createBookDataBase
public string[] createBookDataBase(CreateBook bookData)
{
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 BookDatabase (Unit, BookCodeID, BookName, CategoryID, Author, Press, PressDate, Remark, ArchivingDate, Status, " +
"CreateFileBy, CreateFileDate, UpFileBy, UpFileDate, isDeleted ,bookUseTo,bookComefrom ,bookGeter,bookScrapstatus) VALUES " +
"(@Unit, @BookCodeID, @BookName, @CategoryID, @Author, @Press, @PressDate, @Remark, @ArchivingDate, 1, " +
"@CreateFileBy, (getDate()), @UpFileBy, (getDate()), 0 , @bookUseTo,@bookComefrom ,@bookGeter,@bookScrapstatus)";
// bookUseTo,bookComefrom ,bookGeter,bookScrapstatus
SqlCommand cmd = new SqlCommand(sql, Sqlconn);
cmd.Parameters.Add("@Unit", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(CreateFileName[2]);
cmd.Parameters.Add("@BookCodeID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(bookData.bookNumber);
cmd.Parameters.Add("@BookName", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(bookData.bookTitle);
cmd.Parameters.Add("@CategoryID", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(bookData.bookClassification);
cmd.Parameters.Add("@Author", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(bookData.bookAuthor);
cmd.Parameters.Add("@Press", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(bookData.bookPress);
cmd.Parameters.Add("@PressDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(bookData.bookPressDate);
cmd.Parameters.Add("@Remark", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(bookData.bookRemark);
cmd.Parameters.Add("@ArchivingDate", SqlDbType.Date).Value = Chk.CheckStringtoDateFunction(bookData.bookFilingDate);
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("@bookUseTo", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(bookData.bookUseTo);
cmd.Parameters.Add("@bookComefrom", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(bookData.bookComefrom);
cmd.Parameters.Add("@bookGeter", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(bookData.bookGeter);
cmd.Parameters.Add("@bookScrapstatus", SqlDbType.Int).Value = Chk.CheckStringtoIntFunction(bookData.bookScrapstatus);
returnValue[0] = cmd.ExecuteNonQuery().ToString();
if (returnValue[0] != "0")
{
Int64 Column = 0;
sql = "select IDENT_CURRENT('BookDatabase') AS bID";
cmd = new SqlCommand(sql, Sqlconn);
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
Column = Int64.Parse(dr["bID"].ToString());
}
dr.Close();
if (Column != 0)
{
// sql = "SELECT Count(*) AS QCOUNT FROM BookDatabase WHERE CategoryID=(@CategoryID) and Unit = @Unit ";
sql = "SELECT top 1 CAST (SUBSTRING(BookCodeID,6,4 ) as int) AS QCOUNT FROM BookDatabase WHERE CategoryID=(@CategoryID) and Unit = @Unit order by BookCodeID desc ";
cmd = new SqlCommand(sql, Sqlconn);
cmd.Parameters.Add("@CategoryID", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(bookData.bookClassification);
cmd.Parameters.Add("@Unit", SqlDbType.TinyInt).Value = Chk.CheckStringtoIntFunction(CreateFileName[2]);
SqlDataReader dr2 = cmd.ExecuteReader();
string stuNumber = "1";
if (dr2.Read())
{
stuNumber = (Chk.CheckStringtoIntFunction(dr2["QCOUNT"].ToString()) + 1).ToString();//cmd.ExecuteScalar().ToString();
}
dr2.Close();
string stuIDName = CreateFileName[2] + Chk.CheckStringFunction(bookData.bookClassificationCode) + stuNumber.PadLeft(4, '0');
sql = "UPDATE BookDatabase SET BookCodeID=(@BookCodeID) WHERE BookID=(@BID) ";
cmd = new SqlCommand(sql, Sqlconn);
cmd.Parameters.Add("@BID", SqlDbType.BigInt).Value = Column;
cmd.Parameters.Add("@BookCodeID", SqlDbType.NVarChar).Value = Chk.CheckStringFunction(stuIDName);
returnValue[0] = cmd.ExecuteNonQuery().ToString();
}
}
Sqlconn.Close();
}
catch (Exception e)
{
returnValue[0] = "-1";
returnValue[1] = e.Message.ToString();
}
}
return returnValue;
}
开发者ID:lhuwho,项目名称:HearingImpaired_local,代码行数:82,代码来源:AdministrationDataBase.cs
示例17: ShowCaseIspRecord
public List<AchievementAssessmentLoad> ShowCaseIspRecord(int ID)
{
string strSql = "";
List<AchievementAssessmentLoad> returnvalue = new List<AchievementAssessmentLoad>();
AchievementAssessmentLoad temp = new AchievementAssessmentLoad();
CaseISPRecord sTemperatureData = new CaseISPRecord();
foreach (System.Reflection.FieldInfo fldInfo in sTemperatureData.GetType().GetFields())
{
switch (fldInfo.Name)
{
case "ID":
case "Unit":
|
请发表评论