public List <DeliveryReceiptEmployeeInfo> GetDeliveryReceiptEmployeesByIds(SqlConnection connection, string ids) { List <DeliveryReceiptEmployeeInfo> ret = new List <DeliveryReceiptEmployeeInfo>(); using (var command = new SqlCommand(@"select DE.AutoID, DE.DeliveryReceiptID, DE.EmployeeID, DE.Role, E.Title, E.RoleName, E.Name, E.Generic , E.DepartmentID , E.UserID from (select * from tbl_DeliveryReceiptEmployee where DeliveryReceiptID in (" + ids + @")) DE left join tbl_Employee as E on E.EmployeeID = DE.EmployeeID ", connection)) { WriteLogExecutingCommand(command); using (var reader = command.ExecuteReader()) { while (reader.Read()) { var item = new DeliveryReceiptEmployeeInfo(); item.AutoID = GetDbReaderValue <int>(reader["AutoID"]); item.DeliveryReceiptID = GetDbReaderValue <int>(reader["DeliveryReceiptID"]); item.EmployeeID = GetDbReaderValue <int>(reader["EmployeeID"]); item.Role = GetDbReaderValue <int>(reader["Role"]); item.Title = GetDbReaderValue <string>(reader["Title"]); item.RoleName = GetDbReaderValue <string>(reader["RoleName"]); item.Name = GetDbReaderValue <string>(reader["Name"]); item.Generic = GetDbReaderValue <int>(reader["Generic"]); item.DepartmentID = GetDbReaderValue <string>(reader["DepartmentID"]); item.UserID = GetDbReaderValue <string>(reader["UserID"]); ret.Add(item); } } } return(ret); }
public void UpdateDeliveryReceiptItemUser(SqlConnection connection, DeliveryReceiptEmployeeInfo itemObj, string userID) { string strAddNewCode = "UPDATE tbl_DeliveryReceiptEmployee " + " SET EmployeeID = @EmployeeID, Role = @Role , UserU = @UserU " + " WHERE AutoID = @AutoID"; using (var command = new SqlCommand(strAddNewCode)) { AddSqlParameter(command, "@EmployeeID", itemObj.EmployeeID, System.Data.SqlDbType.Bit); AddSqlParameter(command, "@Role", itemObj.Role, System.Data.SqlDbType.Int); AddSqlParameter(command, "@UserU", userID, System.Data.SqlDbType.VarChar); AddSqlParameter(command, "@AutoID", itemObj.AutoID, System.Data.SqlDbType.Int); db.ExcuteScalar(connection, command); } }
public void CreateDeliveryReceiptItemUser(SqlConnection connection, DeliveryReceiptEmployeeInfo itemObj, string userID) { DateTime localDate = DateTime.Now; string strAddNewCode = "Insert into tbl_DeliveryReceiptEmployee " + " (EmployeeID, Role , DeliveryReceiptID )" + "VALUES (@EmployeeID, @Role, @DeliveryReceiptID )"; using (var command = new SqlCommand(strAddNewCode)) { AddSqlParameter(command, "@EmployeeID", itemObj.EmployeeID, System.Data.SqlDbType.Int); AddSqlParameter(command, "@Role", itemObj.Role, System.Data.SqlDbType.Int); AddSqlParameter(command, "@DeliveryReceiptID", itemObj.DeliveryReceiptID, System.Data.SqlDbType.Int); db.ExcuteScalar(connection, command); } }
public void InsertDeliveryReceiptEmployee(SqlConnection connection, int _DeliveryReceiptID, DeliveryReceiptEmployeeInfo item) { using (var command = new SqlCommand("Insert into [dbo].[tbl_DeliveryReceiptEmployee] ([DeliveryReceiptID], [EmployeeID], Role)" + "VALUES(@DeliveryReceiptID,@EmployeeID,Role)", connection)) { AddSqlParameter(command, "@DeliveryReceiptID", _DeliveryReceiptID, System.Data.SqlDbType.Int); AddSqlParameter(command, "@EmployeeID", item.EmployeeID, System.Data.SqlDbType.Int); AddSqlParameter(command, "@Role", item.Role, System.Data.SqlDbType.Int); WriteLogExecutingCommand(command); command.ExecuteScalar(); } }