public static void DeleteT_InvestigateByBuilding_name(string building_name) { string sql = "DELETE T_Investigates WHERE Building_name = @Building_name"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@building_name", building_name) }; DBHelper.ExecuteCommand(sql, para); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static void DeleteT_BaseInfoByConfig_id(int config_id) { string sql = "DELETE T_BaseInfo WHERE Config_id = @Config_id"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@config_id", config_id) }; DBHelper.ExecuteCommand(sql, para); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static void DeleteT_CheckupCorpByCorp_name(string corp_name) { string sql = "DELETE T_CheckupCorps WHERE Corp_name = @Corp_name"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@corp_name", corp_name) }; DBHelper.ExecuteCommand(sql, para); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static void DeleteT_RoleMenuRelationById(int id) { string sql = "DELETE T_RoleMenuRelations WHERE Id = @Id"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@Id", id) }; DBHelper.ExecuteCommand(sql, para); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static void DeleteT_RoleByRole_name(string role_name) { string sql = "DELETE T_Role WHERE Role_name = @Role_name"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@role_name", role_name) }; DBHelper.ExecuteCommand(sql, para); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static void DeleteT_DepartmentByDepart_name(string depart_name) { string sql = "DELETE T_Department WHERE Depart_name = @Depart_name"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@depart_name", depart_name) }; DBHelper.ExecuteCommand(sql, para); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static void DeleteT_MenuByMenu_url(string menu_url) { string sql = "DELETE T_Menu WHERE Menu_url = @Menu_url"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@menu_url", menu_url) }; DBHelper.ExecuteCommand(sql, para); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
public static void DeleteT_UserByUsername(string username) { string sql = "DELETE T_User WHERE Username = @Username"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@username", username) }; DBHelper.ExecuteCommand(sql, para); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
/// <summary> /// 删除信息 /// </summary> /// <param name="c_id"></param> /// <returns></returns> public bool delete(string tableName, List <String> ids) { int count = 0; try { string sql = "delete from " + tableName + " where C_ID in "; string ccid = "("; for (int i = 0; i < ids.Count; i++) { ccid += " '" + ids[i] + "'"; if (i < ids.Count - 1) { ccid += ","; } } ccid += " )"; sql += ccid; count = dbHelper.ExecuteCommand(sql); if (count > 0) { return(true); } else { return(false); } } catch (Exception ex) { Log.write(ex.Message + "\r\n" + ex.StackTrace); throw ex; } finally { dbHelper.getConnection().Close(); } }
public static bool MyDiaryDelete(MyDiary mydiary, out int Result) { SqlParameter[] sqlPare = new SqlParameter[] { new SqlParameter("@DiaryId", mydiary.DiaryId), new SqlParameter("@UserId", mydiary.UserId), new SqlParameter("@Result", SqlDbType.Int) }; sqlPare[2].Direction = ParameterDirection.Output; int count = DBHelper.ExecuteCommand("[dbo].[pro_MyDiaryDelete]", sqlPare); if (!(count > 0)) { Result = Convert.ToInt32(sqlPare[2].Value.ToString()); } else { Result = -1; } return(count > 0); }
public static void ModifyT_CheckupCorp(T_CheckupCorp t_CheckupCorp) { string sql = "UPDATE T_CheckupCorps " + "SET " + "id = @id, " + "corp_addr = @corp_addr, " + "leading_official = @leading_official, " + "contacts = @contacts, " + "contact_numbers = @contact_numbers, " + "remarks = @remarks, " + "status = @status " + "WHERE corp_name = @corp_name"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@corp_name", t_CheckupCorp.corp_name), new SqlParameter("@id", DBHelper.GetValueByWhetherNull(t_CheckupCorp.id)), new SqlParameter("@corp_addr", DBHelper.GetValueByWhetherNull(t_CheckupCorp.corp_addr)), new SqlParameter("@leading_official", DBHelper.GetValueByWhetherNull(t_CheckupCorp.leading_official)), new SqlParameter("@contacts", DBHelper.GetValueByWhetherNull(t_CheckupCorp.contacts)), new SqlParameter("@contact_numbers", DBHelper.GetValueByWhetherNull(t_CheckupCorp.contact_numbers)), new SqlParameter("@remarks", DBHelper.GetValueByWhetherNull(t_CheckupCorp.remarks)), new SqlParameter("@status", DBHelper.GetValueByWhetherNull(t_CheckupCorp.status)) }; DBHelper.ExecuteCommand(sql, para); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
/// <summary> /// 根据ID修改 ///</summary> public static int UpdateSudents(Sudents SudentsModel) { string sql = string.Format("UPDATE Sudents set SutCode=@SutCode,SutName=@SutName,ClassId=@ClassId,Native=@Native,Born=@Born,[National]=@National,Political=@Political,Sex=@Sex,Grade=@Grade,Contact=@Contact,Note=@Note,Pwd=@Pwd where SutId=@SutId"); SqlParameter[] para = { new SqlParameter("@SutCode", SqlDbType.NVarChar), new SqlParameter("@SutName", SqlDbType.NVarChar), new SqlParameter("@ClassId", SqlDbType.Int), new SqlParameter("@Native", SqlDbType.NVarChar), new SqlParameter("@Born", SqlDbType.DateTime), new SqlParameter("@National", SqlDbType.NVarChar), new SqlParameter("@Political", SqlDbType.NVarChar), new SqlParameter("@Sex", SqlDbType.NVarChar), new SqlParameter("@Grade", SqlDbType.Int), new SqlParameter("@Contact", SqlDbType.NVarChar), new SqlParameter("@Note", SqlDbType.NText), new SqlParameter("@Pwd", SqlDbType.NVarChar), new SqlParameter("@SutId", SqlDbType.Int) }; para[0].Value = SudentsModel.SutCode; para[1].Value = SudentsModel.SutName; para[2].Value = SudentsModel.ClassId; para[3].Value = SudentsModel.Native; para[4].Value = SudentsModel.Born; para[5].Value = SudentsModel.National; para[6].Value = SudentsModel.Political; para[7].Value = SudentsModel.Sex; para[8].Value = SudentsModel.Grade; para[9].Value = SudentsModel.Contact; para[10].Value = SudentsModel.Note; para[11].Value = SudentsModel.Pwd; para[12].Value = SudentsModel.SutId; return(DBHelper.ExecuteCommand(sql, para)); }
public void Save() { using (dbhFamilyMember = new DBHelper(ConnectionStrings.DefaultDBConnection)) { dbhFamilyMember.AddParameter("@MemberMasterID", this.MemberMasterID); dbhFamilyMember.AddParameter("@ID", this.ID); dbhFamilyMember.AddParameter("@FIRSTNAME", this.Firstname); dbhFamilyMember.AddParameter("@LASTNAME", this.Lastname); dbhFamilyMember.AddParameter("@SEX", this.Sex); dbhFamilyMember.AddParameter("@DOB", this.DOB); dbhFamilyMember.AddParameter("@RELATIONSHIP_ID", this.RelationshipID); dbhFamilyMember.AddParameter("@CurrentStatus", this.CurrentStatus); dbhFamilyMember.AddParameter("@LivingStatus", this.LivingStatus); dbhFamilyMember.AddParameter("@DateOfDeath", this.DateOfDeath); dbhFamilyMember.AddParameter("@CauseOfDeath", this.CauseOfDeath); dbhFamilyMember.AddParameter("@CURRENTUSERID", mCurrentUserID); dbhFamilyMember.ExecuteCommand("INSERTUPDATE_FAMILY_MEMBER"); } }
/// <summary> /// 添加 ///</summary> public static int AddCourse(Course CourseModel) { string sql = string.Format("insert into Course (CourseName,Note,TeacherId,Credits )values('{0}','{1}',{2},{3})", CourseModel.CourseName, CourseModel.Note, CourseModel.TeacherId, CourseModel.Credits); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 根据ID修改 ///</summary> public static int UpdateLive(Live LiveModel) { string sql = string.Format(" UPDATE Live set L_No='{0}',L_Name='{1}',L_IdCard='{2}',L_Tel='{3}',L_Time='{4}',L_OutTime='{5}',L_Deposit={6},R_Id={7},L_Pay={8},L_Total={9},L_State='{10}',U_Id={11} where L_Id={12} ", LiveModel.L_No, LiveModel.L_Name, LiveModel.L_IdCard, LiveModel.L_Tel, LiveModel.L_Time, LiveModel.L_OutTime, LiveModel.L_Deposit, LiveModel.R_Id, LiveModel.L_Pay, LiveModel.L_Total, LiveModel.L_State, LiveModel.U_Id, LiveModel.L_Id); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 添加 ///</summary> public static int AddLive(Live LiveModel) { string sql = string.Format("insert into Live (L_No,L_Name,L_IdCard,L_Tel,L_Time,L_OutTime,L_Deposit,R_Id,L_Pay,L_Total,L_State,U_Id )values('{0}','{1}','{2}','{3}','{4}','{5}',{6},{7},{8},{9},'{10}',{11})", LiveModel.L_No, LiveModel.L_Name, LiveModel.L_IdCard, LiveModel.L_Tel, LiveModel.L_Time, LiveModel.L_OutTime, LiveModel.L_Deposit, LiveModel.R_Id, LiveModel.L_Pay, LiveModel.L_Total, LiveModel.L_State, LiveModel.U_Id); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 根据ID修改 ///</summary> public static int UpdateClass(Class ClassModel) { string sql = string.Format(" UPDATE Class set ClassName='{0}',MajorId={1} where ClassId={2} ", ClassModel.ClassName, ClassModel.MajorId, ClassModel.ClassId); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 添加 ///</summary> public static int AddClass(Class ClassModel) { string sql = string.Format("insert into Class (ClassName,MajorId )values('{0}',{1})", ClassModel.ClassName, ClassModel.MajorId); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 添加 ///</summary> public static int AddUsers(Users UsersModel) { string sql = string.Format("insert into Users (U_Name,U_Pwd,U_RealName,U_Sex,U_Type )values('{0}','{1}','{2}','{3}','{4}')", UsersModel.U_Name, UsersModel.U_Pwd, UsersModel.U_RealName, UsersModel.U_Sex, UsersModel.U_Type); return(DBHelper.ExecuteCommand(sql)); }
public static void ModifyT_Investigate(T_Investigate t_Investigate) { string sql = "UPDATE T_Investigates " + "SET " + "id = @id, " + "building_id = @building_id, " + "building_owner = @building_owner, " + "building_user = @building_user, " + "start_date = @start_date, " + "finish_date = @finish_date, " + "design_corp = @design_corp, " + "construct_corp = @construct_corp, " + "total_area = @total_area, " + "floors = @floors, " + "struct_type = @struct_type, " + "building_purpose = @building_purpose, " + "contacts = @contacts, " + "contact_numbers = @contact_numbers, " + "problems = @problems, " + "checkup_suggestions = @checkup_suggestions, " + "rectifications = @rectifications, " + "remarks = @remarks, " + "create_user = @create_user, " + "create_datetime = @create_datetime, " + "update_user = @update_user, " + "update_time = @update_time, " + "investigate_category = @investigate_category " + "WHERE building_name = @building_name"; try { SqlParameter[] para = new SqlParameter[] { new SqlParameter("@building_name", t_Investigate.building_name), new SqlParameter("@id", DBHelper.GetValueByWhetherNull(t_Investigate.id)), new SqlParameter("@building_id", DBHelper.GetValueByWhetherNull(t_Investigate.building_id)), new SqlParameter("@building_owner", DBHelper.GetValueByWhetherNull(t_Investigate.building_owner)), new SqlParameter("@building_user", DBHelper.GetValueByWhetherNull(t_Investigate.building_user)), new SqlParameter("@start_date", DBHelper.GetValueByWhetherNull(t_Investigate.start_date)), new SqlParameter("@finish_date", DBHelper.GetValueByWhetherNull(t_Investigate.finish_date)), new SqlParameter("@design_corp", DBHelper.GetValueByWhetherNull(t_Investigate.design_corp)), new SqlParameter("@construct_corp", DBHelper.GetValueByWhetherNull(t_Investigate.construct_corp)), new SqlParameter("@total_area", DBHelper.GetValueByWhetherNull(t_Investigate.total_area)), new SqlParameter("@floors", DBHelper.GetValueByWhetherNull(t_Investigate.floors)), new SqlParameter("@struct_type", DBHelper.GetValueByWhetherNull(t_Investigate.struct_type)), new SqlParameter("@building_purpose", DBHelper.GetValueByWhetherNull(t_Investigate.building_purpose)), new SqlParameter("@contacts", DBHelper.GetValueByWhetherNull(t_Investigate.contacts)), new SqlParameter("@contact_numbers", DBHelper.GetValueByWhetherNull(t_Investigate.contact_numbers)), new SqlParameter("@problems", DBHelper.GetValueByWhetherNull(t_Investigate.problems)), new SqlParameter("@checkup_suggestions", DBHelper.GetValueByWhetherNull(t_Investigate.checkup_suggestions)), new SqlParameter("@rectifications", DBHelper.GetValueByWhetherNull(t_Investigate.rectifications)), new SqlParameter("@remarks", DBHelper.GetValueByWhetherNull(t_Investigate.remarks)), new SqlParameter("@create_user", DBHelper.GetValueByWhetherNull(t_Investigate.create_user)), new SqlParameter("@create_datetime", DBHelper.GetValueByWhetherNull(t_Investigate.create_datetime)), new SqlParameter("@update_user", DBHelper.GetValueByWhetherNull(t_Investigate.update_user)), new SqlParameter("@update_time", DBHelper.GetValueByWhetherNull(t_Investigate.update_time)), new SqlParameter("@investigate_category", DBHelper.GetValueByWhetherNull(t_Investigate.investigate_category)) }; DBHelper.ExecuteCommand(sql, para); } catch (Exception e) { Console.WriteLine(e.Message); throw e; } }
/// <summary> /// 根据主键删除 ///</summary> public static int DeleteOrders(int Id) { string sql = string.Format("delete from Orders where O_Id={0}", Id); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 根据ID修改 ///</summary> public static int UpdateUsers(Users UsersModel) { string sql = string.Format(" UPDATE Users set U_Name='{0}',U_Pwd='{1}',U_RealName='{2}',U_Sex='{3}',U_Type='{4}' where U_Id={5} ", UsersModel.U_Name, UsersModel.U_Pwd, UsersModel.U_RealName, UsersModel.U_Sex, UsersModel.U_Type, UsersModel.U_Id); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 根据ID修改 ///</summary> public static int UpdateRoom(Room RoomModel) { string sql = string.Format(" UPDATE Room set R_No='{0}',R_Tel='{1}',R_State='{2}',Rt_Id={3} where R_Id={4} ", RoomModel.R_No, RoomModel.R_Tel, RoomModel.R_State, RoomModel.Rt_Id, RoomModel.R_Id); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 根据ID修改 ///</summary> public static int UpdateAdmin(Admin AdminModel) { string sql = string.Format(" UPDATE Admin set AdminName='{0}',Pwd='{1}' where AdminId={2} ", AdminModel.AdminName, AdminModel.Pwd, AdminModel.AdminId); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 根据ID修改 ///</summary> public static int UpdateCourse(Course CourseModel) { string sql = string.Format(" UPDATE Course set CourseName='{0}',Note='{1}',TeacherId={2},Credits={3} where CourseId={4} ", CourseModel.CourseName, CourseModel.Note, CourseModel.TeacherId, CourseModel.Credits, CourseModel.CourseId); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 根据主键删除 ///</summary> public static int DeleteCourse(int Id) { string sql = string.Format("delete from Course where CourseId={0}", Id); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 根据主键删除 ///</summary> public static int DeleteSudents(int Id) { string sql = string.Format("delete from Sudents where SutId={0}", Id); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 添加 ///</summary> public static int AddRoom(Room RoomModel) { string sql = string.Format("insert into Room (R_No,R_Tel,R_State,Rt_Id )values('{0}','{1}','{2}',{3})", RoomModel.R_No, RoomModel.R_Tel, RoomModel.R_State, RoomModel.Rt_Id); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 添加 ///</summary> public static int AddOrders(Orders OrdersModel) { string sql = string.Format("insert into Orders (O_No,O_Name,O_Tel,O_Time,O_Budget,Rt_Id,U_Id,O_State )values('{0}','{1}','{2}','{3}','{4}',{5},{6},'{7}')", OrdersModel.O_No, OrdersModel.O_Name, OrdersModel.O_Tel, OrdersModel.O_Time, OrdersModel.O_Budget, OrdersModel.Rt_Id, OrdersModel.U_Id, OrdersModel.O_State); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 根据主键删除 ///</summary> public static int DeleteRoom(int Id) { string sql = string.Format("delete from Room where R_Id={0}", Id); return(DBHelper.ExecuteCommand(sql)); }
/// <summary> /// 根据ID修改 ///</summary> public static int UpdateOrders(Orders OrdersModel) { string sql = string.Format(" UPDATE Orders set O_No='{0}',O_Name='{1}',O_Tel='{2}',O_Time='{3}',O_Budget='{4}',Rt_Id={5},U_Id={6},O_State='{7}' where O_Id={8} ", OrdersModel.O_No, OrdersModel.O_Name, OrdersModel.O_Tel, OrdersModel.O_Time, OrdersModel.O_Budget, OrdersModel.Rt_Id, OrdersModel.U_Id, OrdersModel.O_State, OrdersModel.O_Id); return(DBHelper.ExecuteCommand(sql)); }