public int SaveLocationAllocation(LocationAllocations allocation) { con = new SqlConnection(cs.DBConn); con.Open(); string query = "INSERT INTO LocationUser(LocationId,UserId,AddedDate) VALUES(@d1,@d2,@d3)"; cmd = new SqlCommand(query, con); cmd.Parameters.AddWithValue("@d1", allocation.LocationId); cmd.Parameters.AddWithValue("@d2", allocation.LocationInChargeId); cmd.Parameters.AddWithValue("@d3", allocation.AddedDate); int affectedRows = cmd.ExecuteNonQuery(); con.Close(); return(affectedRows); }
private void SaveLocationForUser() { int lmg = 0; LocationAllocationManager amManager = new LocationAllocationManager(); LocationAllocations allocation = new LocationAllocations(); allocation.LocationId = Convert.ToInt32(locationId); allocation.LocationInChargeId = Convert.ToInt32(txtUserId.Text); allocation.AddedDate = DateTime.UtcNow.ToLocalTime(); lmg = amManager.SaveLocationAllocation(allocation); MessageBox.Show("Successfully Saved", "record", MessageBoxButtons.OK, MessageBoxIcon.Information); // SetUserByList(); // SetLocationByList(); Reset(); dataGridView2.Rows.Clear(); }
public int SaveLocationAllocation(LocationAllocations allocation) { return(agGateway.SaveLocationAllocation(allocation)); }