//public int UpdateRoomForSale(string code,int state) //{ // SqlParameter[] param = { new SqlParameter("@Code", SqlDbType.VarChar, 9),new SqlParameter("@State",SqlDbType.SmallInt) }; // param[0].Value = code; // param[1].Value = state; // int result = SqlHelp.ExecuteNonQuery("prc_UpdateRoomForSale", CommandType.StoredProcedure, param); // return result; //} public int InsertRoom(RoomModel[] room) { string[] commandText = new string[room.Length]; SqlParameter[][] paramArray = new SqlParameter[room.Length][]; for (int i = 0; i < room.Length; i++) { RoomModel items = room[i]; SqlParameter[] param = { new SqlParameter("@Code", SqlDbType.VarChar, 9), new SqlParameter("@RoomID", SqlDbType.VarChar, 6), new SqlParameter("@PaID", SqlDbType.VarChar, 3), new SqlParameter("@CellID", SqlDbType.Int), new SqlParameter("@SunnyID", SqlDbType.Int), new SqlParameter("@IndoorID", SqlDbType.Int), new SqlParameter("@RoomUseID", SqlDbType.Int), new SqlParameter("@RoomFormatID", SqlDbType.Int), new SqlParameter("@BuildArea", SqlDbType.Float), new SqlParameter("@UseArea", SqlDbType.Float) }; param[0].Value = items.Code; param[1].Value = items.RoomID; param[2].Value = items.PaID; param[3].Value = items.CellID; param[4].Value = items.SunnyID; param[5].Value = items.IndoorID; param[6].Value = items.RoomUseID; param[7].Value = items.RoomFormatID; param[8].Value = items.BuildArea; param[9].Value = items.UseArea; paramArray[i] = param; commandText[i] = "prc_InsertRoom"; } int result = SqlHelp.ExecuteNonQueryTransaction(commandText, CommandType.StoredProcedure, paramArray); return(result); }
public int InsertHomeHold(HomeHoldModel homeHold, UserModel user, string code, int state) { SqlParameter[] param = { new SqlParameter("@Code", SqlDbType.VarChar, 9), new SqlParameter("@Name", SqlDbType.VarChar, 20), new SqlParameter("@Tel", SqlDbType.VarChar, 13), new SqlParameter("@Contact", SqlDbType.VarChar, 50), new SqlParameter("@Mobile", SqlDbType.VarChar, 11), new SqlParameter("@Email", SqlDbType.VarChar, 40), new SqlParameter("@CardID", SqlDbType.VarChar, 19), new SqlParameter("@OwnerID", SqlDbType.VarChar, 20), new SqlParameter("@Unit", SqlDbType.VarChar, 20), new SqlParameter("@Memo", SqlDbType.Text) }; param[0].Value = homeHold.Code; param[1].Value = homeHold.UserName; param[2].Value = homeHold.Tel; param[3].Value = homeHold.Contact; param[4].Value = homeHold.Mobile; param[5].Value = homeHold.Email; param[6].Value = homeHold.CardID; param[7].Value = homeHold.OwnerID; param[8].Value = homeHold.Unit; param[9].Value = homeHold.Memo; SqlParameter[] param1 = { new SqlParameter("@UID", SqlDbType.VarChar, 20), new SqlParameter("@Password", SqlDbType.VarChar, 20), new SqlParameter("@UserType", SqlDbType.SmallInt), new SqlParameter("@SubID", SqlDbType.Int) }; param1[0].Value = user.UID; param1[1].Value = user.Password; param1[2].Value = user.UserType; param1[3].Value = user.SubID; SqlParameter[] param2 = { new SqlParameter("@Code", SqlDbType.VarChar, 9), new SqlParameter("@State", SqlDbType.Int) }; param2[0].Value = code; param2[1].Value = state; string[] commandText = { "prc_InsertHomeHold", "prc_InsertUser", "prc_UpdateRoomForSale" }; SqlParameter[][] paramArray = { param, param1, param2 }; int result = SqlHelp.ExecuteNonQueryTransaction(commandText, CommandType.StoredProcedure, paramArray); return(result); }
public int InsertEmployee(EmployeeModel employee, UserModel user) { SqlParameter[] param = { new SqlParameter("@Name", SqlDbType.VarChar, 20), new SqlParameter("@Sex", SqlDbType.SmallInt), new SqlParameter("@Arrage", SqlDbType.VarChar, 20), new SqlParameter("@Address", SqlDbType.VarChar, 30), new SqlParameter("@Tel", SqlDbType.VarChar, 12), new SqlParameter("@Mobile", SqlDbType.VarChar, 12), new SqlParameter("@CardID", SqlDbType.VarChar, 18), new SqlParameter("@PhotoPath", SqlDbType.VarChar, 255) }; param[0].Value = employee.EmlpoyeeName; param[1].Value = employee.Sex; param[2].Value = employee.Arrage; param[3].Value = employee.Address; param[4].Value = employee.Tel; param[5].Value = employee.Mobile; param[6].Value = employee.CardID; param[7].Value = employee.PhotoPath; SqlParameter[] param1 = { new SqlParameter("@UID", SqlDbType.VarChar, 20), new SqlParameter("@Password", SqlDbType.VarChar, 20), new SqlParameter("@UserType", SqlDbType.SmallInt), new SqlParameter("@SubID", SqlDbType.Int) }; param1[0].Value = user.UID; param1[1].Value = user.Password; param1[2].Value = user.UserType; param1[3].Value = user.SubID; string[] commandText = { "prc_InsertEmployee", "prc_InsertUser" }; SqlParameter[][] paramArray = { param, param1 }; int result = SqlHelp.ExecuteNonQueryTransaction(commandText, CommandType.StoredProcedure, paramArray); return(result); }
public int DeleteHomeHold(int id, string code, int state) { SqlParameter[] param = { new SqlParameter("@ID", SqlDbType.Int) }; SqlParameter[] param1 = { new SqlParameter("@Code", SqlDbType.VarChar, 9), new SqlParameter("@State", SqlDbType.Int) }; param[0].Value = id; param1[0].Value = code; param1[1].Value = state; SqlParameter[][] paramArray = { param, param1 }; string[] commandText = { "prc_DeleteHomeHold", "prc_UpdateRoomForSale" }; int result = SqlHelp.ExecuteNonQueryTransaction(commandText, CommandType.StoredProcedure, paramArray); return(result); }