public void SaveResponsibleStaffInfo(ResponsibleStaffInfo responsibleStaffInfo, string clientID) { if (this.IsResponsibleStaffExisted(clientID, responsibleStaffInfo.StaffID)) { this.UpdateResponsibleStaff(responsibleStaffInfo); } else { this.InsertResponsibleStaff(responsibleStaffInfo); } }
public void UpdateResponsibleStaff(ResponsibleStaffInfo responsibleStaffInfo) { string query = "UPDATE [dbo].[ResponsibleStaffList] " + "SET " + "[StaffName] = @StaffName " + ",[ResponsibilityType] = @ResponsibilityType " + ",[LastModifiedUser] = @LastModifiedUser " + ",[LastModifiedDate] = @LastModifiedDate " + "WHERE ClientID = @ClientID and StaffID = @StaffID "; db.Execute(query, responsibleStaffInfo, transaction); }
public void InsertResponsibleStaff(ResponsibleStaffInfo responsibleStaffInfo) { string query = "INSERT INTO [dbo].[ResponsibleStaffList] " + "([ClientID] " + ",[StaffID] " + ",[StaffName] " + ",[ResponsibilityType] " + ",[CreateUser] " + ",[CreateDate] " + ",[LastModifiedUser] " + ",[LastModifiedDate] ) " + "VALUES " + "(@ClientID " + ",@StaffID " + ",@StaffName " + ",@ResponsibilityType " + ",@CreateUser " + ",@CreateDate " + ",@LastModifiedUser " + ",@LastModifiedDate) "; db.Execute(query, responsibleStaffInfo, transaction); }